| | |
| | | guid = Guid.Parse(dr["guid"].ToString()), |
| | | upGuid = dr["upGuid"].ToString().Length > 0 ? Guid.Parse(dr["upGuid"].ToString()) : null, |
| | | name = dr["name"].ToString(), |
| | | serialNumber = dr["serialNumber"].ToString(), |
| | | icon = dr["icon"].ToString(), |
| | | status = int.Parse(dr["status"].ToString()), |
| | | fromPath = dr["fromPath"].ToString(), |
| | | formPath = dr["formPath"].ToString(), |
| | | idx = int.Parse(dr["idx"].ToString()), |
| | | category = int.Parse(dr["category"].ToString()), |
| | | statusTxt = (dr["status"].ToString() == "1" ? "正常" : "禁用"), |
| | | categoryTxt = (dr["category"].ToString() == "1" ? "窗体类型" : "按钮类型"), |
| | | } |
| | | ); |
| | | } |
| | |
| | | public ReturnDto<int?> DeleteModel([FromBody] MenuAction model) |
| | | { |
| | | int rtnInt = (int)ReturnCode.Default; |
| | | int cont = 0; |
| | | try |
| | | { |
| | | //是否内置 |
| | | cont = int.Parse(DbHelperSQL.GetSingle("select count(1) from sys_MenuAction where guid='" + model.guid.ToString() + "' and [isSys]=1").ToString()); |
| | | if (cont > 0) |
| | | { |
| | | return ReturnDto<int>.QuickReturn(default(int?), ReturnCode.Exception, "删除失败,该条目为系统内置,不可删除!"); |
| | | } |
| | | cont = 0; |
| | | //是否有子菜单 |
| | | cont = int.Parse(DbHelperSQL.GetSingle("select count(1) from sys_MenuAction where upguid='" + model.guid.ToString() + "'").ToString()); |
| | | if (cont > 0) |
| | | { |
| | | return ReturnDto<int>.QuickReturn(default(int?), ReturnCode.Exception, "删除失败,该条目下面有子菜单,不可删除!"); |
| | | } |
| | | rtnInt = DbHelperSQL.ExecuteSql("delete from dbo.sys_MenuAction where guid='" + model.guid.ToString() + "'"); |
| | | } |
| | | catch (Exception ex) |
| | |
| | | [RequestMethod(RequestMethods.POST)] |
| | | public ReturnDto<int?> EditModel([FromBody] MenuAction model) |
| | | { |
| | | string dddd= model.guid.ToString(); |
| | | string dddd = model.guid.ToString(); |
| | | Guid? guid = model.guid; |
| | | Guid? upGuid = model.upGuid; |
| | | string name = model.name; |
| | | string serialNumber = model.serialNumber; |
| | | string icon = model.icon; |
| | | int status = model.status; |
| | | string fromPath = model.fromPath; |
| | | string formPath = model.formPath; |
| | | int category = model.category; |
| | | int idx = model.idx; |
| | | int? rtnInt = (int)ReturnCode.Default; |
| | |
| | | if (guid != null) |
| | | { |
| | | strSql.Append(" update dbo.sys_MenuAction"); |
| | | strSql.Append(" set upGuid=@upGuid,name=@name,serialNumber=@serialNumber,icon=@icon,status=@status,fromPath=@fromPath,category=@category,idx=@idx"); |
| | | strSql.Append(" set upGuid=@upGuid,name=@name,icon=@icon,status=@status,formPath=@formPath,category=@category,idx=@idx"); |
| | | strSql.Append(" where guid='" + guid + "'"); |
| | | } |
| | | else |
| | | { |
| | | guid = Guid.NewGuid(); |
| | | strSql.Append("insert into dbo.sys_MenuAction("); |
| | | strSql.Append(" guid,upGuid,name,serialNumber,icon,status,fromPath,category,idx)"); |
| | | strSql.Append(" guid,upGuid,name,icon,status,formPath,category,idx)"); |
| | | strSql.Append(" values ("); |
| | | strSql.Append("'" + guid + "',@upGuid,@name,@serialNumber,@icon,@status,@fromPath,@category,@idx)"); |
| | | strSql.Append("'" + guid + "',@upGuid,@name,@icon,@status,@formPath,@category,@idx)"); |
| | | } |
| | | SqlParameter[] parameters = { |
| | | new SqlParameter("@upGuid", upGuid), |
| | | new SqlParameter("@name", name), |
| | | new SqlParameter("@serialNumber",serialNumber), |
| | | new SqlParameter("@icon",icon), |
| | | new SqlParameter("@status",status), |
| | | new SqlParameter("@fromPath",fromPath), |
| | | new SqlParameter("@formPath",formPath), |
| | | new SqlParameter("@category",category), |
| | | new SqlParameter("@idx",idx), |
| | | }; |
| | |
| | | rtnInt = (int)ReturnCode.Exception; |
| | | } |
| | | if (rtnInt > 0) |
| | | return ReturnDto<int>.QuickReturn(rtnInt, ReturnCode.Success, "增加成功!"); |
| | | return ReturnDto<int>.QuickReturn(rtnInt, ReturnCode.Success, "操作成功!"); |
| | | else |
| | | return ReturnDto<int>.QuickReturn(rtnInt, ReturnCode.Exception, "增加失败,请重试!"); |
| | | } |
| | |
| | | /// <returns></returns> |
| | | [RequestMethod(RequestMethods.POST)] |
| | | [AllowAnonymous] |
| | | public ReturnDto<MenuAction> GetModel([FromBody] MenuAction model ) |
| | | public ReturnDto<MenuAction> GetModel([FromBody] MenuAction model) |
| | | { |
| | | MenuAction m = new MenuAction(); |
| | | System.Text.StringBuilder sbSql = new StringBuilder(); |
| | |
| | | m.guid = Guid.Parse(dr["guid"].ToString()); |
| | | m.upGuid = dr["upGuid"].ToString().Length > 0 ? Guid.Parse(dr["upGuid"].ToString()) : null; |
| | | m.name = dr["name"].ToString(); |
| | | m.serialNumber = dr["serialNumber"].ToString(); |
| | | m.icon = dr["icon"].ToString(); |
| | | m.status = int.Parse(dr["status"].ToString()); |
| | | m.fromPath = dr["fromPath"].ToString(); |
| | | m.formPath = dr["formPath"].ToString(); |
| | | m.idx = int.Parse(dr["idx"].ToString()); |
| | | m.category = int.Parse(dr["category"].ToString()); |
| | | return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Success, "读取成功!"); |