public ActionResult Login(SoftProjectAreaEntityDomain domain) { //LoginInfo ss = new SoftProject.CellModel.SoftProjectAreaEntity(); var resp = new MyResponseBase(); resp.Item = domain.Item; if (domain.Item.MobilePhone != null) { try { resp = domain.Login(); Session["LoginInfo"] = resp.Item; if (resp.Item.LoginCategoryID == 1) SoftProjectAreaEntityDomain.Sys_OperLogDetail_AddSave(1, 1, "登录", resp.Item.CompanyID, resp.Item.Sys_LoginInfoID, resp.Item.UserName, resp.Item.Sys_LoginInfoID, "登录"); else SoftProjectAreaEntityDomain.Sys_OperLogDetail_AddSave(2, 1, "登录", resp.Item.CompanyID, resp.Item.Sys_LoginInfoID, resp.Item.UserName, resp.Item.Sys_LoginInfoID, "登录"); return RedirectToAction("Index", "Home"); } catch (Exception e) { resp.Item.ErrorMessage = e.Message; return View(resp); } } return View(resp); }
/// <summary> /// 添加管理员 /// </summary> /// <returns></returns> public MyResponseBase Pre_User_AddAdminSave() { var resp = new MyResponseBase(); //查询企业类型为2的管理员角色 var Pre_RoleID = SoftProjectAreaEntityDomain.Pre_Roles.Where(p => p.LoginCategoryID == 2 && p.BAdmin == 1).FirstOrDefault().Pre_RoleID; if (Pre_RoleID == null) throw new Exception("企业管理员角色还不有添加"); //(1)验证 ValidateMobilePhoneAdd(); ExecuteDelegate(new Action<SoftProjectAreaEntityDomain>(p => { Pre_User_Domain(); Sys_HOperControl = null; Item.Pre_RoleID = Pre_RoleID; Item.UserCategoryID = 1; Item.UserStatuID = 1; Item.LoginCategoryID = 2; OperCode = "Pre_User.AddAdminSave"; Item.UserName = Item.PreCompanyName2; resp = Execute(); })); //(3)添加到缓存 Item.Pre_UserID = resp.Item.Pre_UserID; Pre_User_AddCache(); return resp; }
public MyResponseBase Design_ModularOrFunDomain_Add() { var resp = new MyResponseBase(); resp.Item = new SoftProjectAreaEntity { Design_ModularOrFunID = Item.Design_ModularOrFunID }; resp.FunNameEn = "Add"; return resp; }
public ActionResult CompMagerIndex() { MyResponseBase resp = new MyResponseBase(); var domain=new SoftProjectAreaEntityDomain(); resp = domain.Doc_Docment_Home(); return View(resp); }
/// <summary> /// 编辑保存 /// </summary> /// <returns></returns> public MyResponseBase C_Order_EditSave() { if (Item.C_OrderID == null) throw new Exception("顾客订单ID:不能为空"); #region 查询原订单金额 var sql = string.Format("SELECT * FROM C_Order WHERE C_OrderID={0}", Item.C_OrderID); var respOld = Query16(sql, 4); #endregion //编辑保存 var resp = new MyResponseBase(); Item.OrderAmount = Item.Items.Sum(p => p.CustomerSpecificationsPrice * p.Number); var OderAmountNew = Item.OrderAmount; ExecuteDelegate(new Action<SoftProjectAreaEntityDomain>(p => { resp = EditSaveNotTran(); C_OrderDetail_AddEditDelete(); //更新数据库:用户帐户余额 sql = string.Format("UPDATE Pre_User SET FundBalance=ISNULL(FundBalance,0)-{0}+{1} WHERE Pre_UserID={2}", OderAmountNew, respOld.Item.OrderAmount, respOld.Item.Pre_UserID); Query16(sql, 1); //更新缓存:用户账户余额 var userItem = SoftProjectAreaEntityDomain.Pre_UserRoleAll.Where(o => o.Pre_UserID == respOld.Item.Pre_UserID).FirstOrDefault(); var OrderAmount = (userItem.FundBalance != null ? userItem.FundBalance : 0) - OderAmountNew + respOld.Item.OrderAmount; userItem.FundBalance = OrderAmount; })); return resp; }
public MyResponseBase(MyResponseBase Item) { this.Obj = Item.Obj; this.DataSet = Item.DataSet; this.DataTable = Item.DataTable; this.LogMessage = Item.LogMessage; this.PageQueryBase = Item.PageQueryBase; this.RespAttachInfo = Item.RespAttachInfo; }
public ActionResult Dashboard(SoftProjectAreaEntityDomain domain) { if (domain.Item.Pre_CompanyID == null) throw new Exception("加盟商ID不能为空"); var resp = new MyResponseBase { Item=domain.Item}; ModularOrFunCode = "AuthorizationAreas.Pre_Company.Dashboard"; domain.Design_ModularOrFun = Design_ModularOrFun; return View("Dashboard", resp); }
/// <summary> /// 添加保存 /// </summary> /// <returns></returns> public MyResponseBase Fra_Store_Add() { var resp = new MyResponseBase(); var sbsql = new StringBuilder(); sbsql.AppendLine("SELECT TOP 1 * "); sbsql.AppendLine("FROM Fra_StoreTemplate"); sbsql.AppendLine("WHERE StoreTemplateStatuID=1"); sbsql.AppendLine("ORDER BY StoreTemplateSort DESC"); resp = Query16(sbsql.ToString(), 4); resp.Item.StoreContext = resp.Item.StoreTemplateContext; return resp; }
/// <summary> /// 编辑保存 /// </summary> /// <returns></returns> public MyResponseBase BC_Order_EditSave() { //编辑保存 var resp = new MyResponseBase(); Item.OrderAmount = Item.Items.Sum(p => p.BCSpecificationsPrice * p.Number); ExecuteDelegate(new Action<SoftProjectAreaEntityDomain>(p => { resp = EditSaveNotTran(); BC_OrderDetail_AddEditDelete(); })); return resp; }
public ActionResult IndexEdit(SoftProjectAreaEntityDomain domain) { var resp = new MyResponseBase(); ModularOrFunCode = "PartnerAreas.BC_OrderDetail.IndexEdit"; domain.Design_ModularOrFun = Design_ModularOrFun; if (domain.Item.BC_OrderID == null) { return View("IndexEdit", resp); } domain.Querys.Add(new Query { QuryType = 0, FieldName = "BC_OrderID___equal", Value = domain.Item.BC_OrderID.ToString() }); resp = domain.QueryIndex(); //return View(Design_ModularOrFun.MainView, resp); return View("IndexEdit", resp); }
/// <summary> /// 参数由配置文件完成 /// </summary> /// <returns></returns> public MyResponseBase C_Visit_AddSave() { var resp = new MyResponseBase(); resp = ExecuteDelegate(new Action<SoftProjectAreaEntityDomain>(p => { resp = AddSaveNotTran(); if (Item.NextVisitDate != null) { var sql = string.Format("Update Pre_User SET NextVisitDate='{0}' WHERE Pre_UserID={1}", Item.NextVisitDate.Format_yyyy_MM_dd(), Item.Pre_UserID); Query16(sql, 1); } })); return resp; }
///// <summary> ///// 主键不为空检查 ///// </summary> ///// <returns></returns> //public void Design_ModularOrFunDomainDetail_PKCheck() //{ // if (Item.Design_ModularOrFunDomainDetailID == null) // { // throw new Exception("案例管理主键不能为空!"); // } //} //public MyResponseBase Design_ModularOrFunDomainDetail_ByID() //{ // Design_ModularOrFunDomainDetail_PKCheck(); // var sql = string.Format(";SELECT * FROM [dbo].[Design_ModularOrFunDomainDetail] A WHERE Design_ModularOrFunDomainDetailID={0} ", Item.Design_ModularOrFunDomainDetailID); // var resp = Query16(sql, 4); // return resp; //} /// <summary> /// 根据页面ID查询页面字段 /// </summary> /// <returns></returns> public MyResponseBase Design_ModularOrFunDomainDetail_EditList() { MyResponseBase resp = new MyResponseBase(); //(1)根据页面ID查询页面字段 if (FunNameEn == "Add") { } else if (FunNameEn == "Edit") { string sql = string.Format("SELECT * FROM Design_ModularOrFunDomainDetail WHERE Design_ModularOrFunDomainID={0} Order By Serial", Item.Design_ModularOrFunDomainID); resp = Query16(sql, 2); ////(2)查询模块编码字段 //var ModularFields = Design_ModularField_GetModularPageOrQueryField(Item.Design_ModularOrFunID); //resp.Item.Design_ModularFields = ModularFields; } return resp; }
public ActionResult IndexDetail(SoftProjectAreaEntityDomain domain) { var resp = new MyResponseBase(); ModularOrFunCode = "ToolArea.T_ToolAttachment.IndexDetail"; domain.Design_ModularOrFun = Design_ModularOrFun; if (!string.IsNullOrEmpty(domain.Item.ToolAttRefPKTableGuid)) { domain.Querys.Add(new Query { QuryType = 0, FieldName = "RefPKTableGuid___equal", Value = domain.Item.ToolAttRefPKTableGuid }); resp = domain.QueryIndex(); } if (Request.IsAjaxRequest()) return View(Design_ModularOrFun.PartialView, resp); resp.ViewContextName = Design_ModularOrFun.PartialView; return View(Design_ModularOrFun.MainView, resp); }
/// <summary> /// 日志添加 /// </summary> /// <param name="LoginCategoryID">登录类型:1:公司,2:加盟商</param> /// <param name="LogCategoryID">日志类型:1:登录</param> /// <param name="LogCategoryName">日志类型名称:</param> /// <param name="Comp_CompanyID">公司ID:</param> /// <param name="LogPersonID">日志人员ID</param> /// <param name="LogPerson">日志人员</param> /// <param name="OperLogIdent">操作标识</param> /// <param name="OperName">操作名称</param> /// <param name="DetailDescription">描述</param> /// <returns></returns> public static MyResponseBase Sys_OperLogDetail_AddSave(int? LoginCategoryID, int?LogCategoryID,string LogCategoryName, int? Pre_CompanyID, int? LogPersonID, string LogPerson, int? OperLogIdent, string OperName, string DetailDescription="") { MyResponseBase resp = new MyResponseBase(); SoftProjectAreaEntityDomain operLogDetailDomain = new SoftProjectAreaEntityDomain { Item = new SoftProjectAreaEntity { LoginCategoryID=LoginCategoryID, LogCategoryID=LogCategoryID, LogCategoryName=LogCategoryName, Pre_CompanyID = Pre_CompanyID, LogPersonID=LogPersonID, LogPerson=LogPerson, OperLogIdent = OperLogIdent, OperName = OperName, OperDate=DateTime.Now, DetailDescription = DetailDescription, } }; using (var scope = new TransactionScope()) { try { operLogDetailDomain.Sys_OperLogDetail_Domain(); operLogDetailDomain.OperCode = "Sys_OperLogDetail.AddSave"; resp = operLogDetailDomain.Execute(); scope.Complete(); } catch (Exception ex) { throw new Exception( ex.Message); } finally { scope.Dispose(); } } return resp; }
public MyResponseBase Design_ModularOrFun_AddSave() { MyResponseBase resp = new MyResponseBase(); Design_ModularOrFun_Domain(); Item.Design_ModularOrFunParentID = 0; //Item.GroupModularOrFun = 2; Item.ParentPremID = 0; Item.PremSort = 0; Item.bValidModularOrFun = 1; Item.BMenu = 1; Item.BPrem = 1; Item.GroupModularOrFun = 2; Item.MenuPostion = 2; Item.LoginCategoryID = 1; Item.PremName = Item.ModularName; Item.bFieldsConfigDisp = 1; Item.PageFormEleTypeName = "Page01FormEleType"; Item.PageTitle = Item.ModularName; Item.PageType = 1; Item.QueryFormEleTypeName = "Query01"; Item.bPage = 1; Item.BCalCol = 0; Item.ModularOrFunCode = Item.AreasCode + "." + Item.ControllCode + ".Index"; //Item.ModularName = ""; Item.MenuName = "列表"; Item.BUrlNva = 1; Item.MainView = "NavPFrame"; Item.PartialView = "TableContext"; Item.ToolbarButtonAreaWidth = 3; Item.TableWidth = "100%"; Item.TabViewName = "V_" + Item.ControllCode; Item.DBOperTypeFun = 8; Item.PrimaryKey = Item.ControllCode + "ID"; var DBFieldVals = "AreasCode,ControllCode,PrimaryKey,Sort,Design_ModularOrFunParentID,ParentPremID,PremSort,bValidModularOrFun,BMenu,BPrem,PremName,GroupModularOrFun,MenuPostion,LoginCategoryID,"; DBFieldVals += "bFieldsConfigDisp,PageFormEleTypeName,SortCol,PageTitle,PageType,QueryFormEleTypeName,bPage,BCalCol,"; DBFieldVals += "ModularOrFunCode,ModularName,MenuName,BUrlNva,MainView,PartialView,ToolbarButtonAreaWidth,TableWidth,TabViewName,DBOperTypeFun"; //string DBFieldVals = "AreasCode,ControllCode,ModularName,PrimaryKey,Sort,Design_ModularOrFunParentID,bValidModularOrFun,BMenu,BPrem,GroupModularOrFun,MenuPostion,LoginCategoryID,PremName,bFieldsConfigDisp,PageFormEleTypeName,PageTitle,PageType,"; //DBFieldVals += "QueryFormEleTypeName,bPage,BCalCol,ModularOrFunCode,MenuName,BUrlNva,MainView,PartialView,ToolbarButtonAreaWidth,TableWidth,TabViewName,DBOperTypeFun"; resp = AddSave(DBFieldVals); ProjectCache.Design_ModularOrFuns_Clear(); return resp; }
/// <summary> /// 最后1个订单 /// </summary> /// <returns></returns> public MyResponseBase C_Recharge_AddSave() { if (Item.Pre_UserID == null) throw new Exception("ID不能为空"); //编辑保存 var resp = new MyResponseBase(); ExecuteDelegate(new Action<SoftProjectAreaEntityDomain>(p => { resp = AddSaveNotTran(); //添加数据库中:用户帐户余额 var sql = string.Format("UPDATE Pre_User SET FundBalance=ISNULL(FundBalance,0)+{0} WHERE Pre_UserID={1}", Item.Amount, Item.Pre_UserID); Query16(sql, 1); //更新缓存:用户账户余额 var userItem = SoftProjectAreaEntityDomain.Pre_UserRoleAll.Where(o => o.Pre_UserID == Item.Pre_UserID).FirstOrDefault(); userItem.FundBalance = (userItem.FundBalance == null ? 0 : userItem.FundBalance )+ Item.Amount; })); return resp; }
/// <summary> /// 编辑保存 /// </summary> /// <returns></returns> public MyResponseBase C_Order_AddSave() { var Pre_UserID = Item.Pre_UserID; //编辑保存 var resp = new MyResponseBase(); Item.OrderAmount = Item.Items.Sum(p => p.CustomerSpecificationsPrice * p.Number); var OrderAmount = Item.OrderAmount; ExecuteDelegate(new Action<SoftProjectAreaEntityDomain>(p => { resp = AddSaveNotTran(); C_OrderDetail_AddEditDelete(); //添加数据库中:用户帐户余额 var sql = string.Format("UPDATE Pre_User SET FundBalance=ISNULL(FundBalance,0)-{0} WHERE Pre_UserID={1}", OrderAmount, Pre_UserID); Query16(sql, 1); //更新缓存:用户账户余额 var userItem = SoftProjectAreaEntityDomain.Pre_UserRoleAll.Where(o => o.Pre_UserID == Pre_UserID).FirstOrDefault(); userItem.FundBalance = (userItem.FundBalance == null ? 0 : userItem.FundBalance) - OrderAmount; })); return resp; }
/// <summary> /// 添加保存,包含添加企业管理员信息 /// </summary> /// <returns></returns> public MyResponseBase Pre_Company_AddSave() { var resp = new MyResponseBase(); if (Item.Ba_AreaID1 != null) { Item.AreaName1 = SoftProjectAreaEntityDomain.Ba_Area_GetByAreaID(Item.Ba_AreaID1).AreaName; Item.AreaName = Item.AreaName1; } if (Item.Ba_AreaID2 != null) { Item.AreaName2 = SoftProjectAreaEntityDomain.Ba_Area_GetByAreaID(Item.Ba_AreaID2).AreaName; Item.AreaName += Item.AreaName2; } if (Item.Ba_AreaID3 != null) { Item.AreaName3 = SoftProjectAreaEntityDomain.Ba_Area_GetByAreaID(Item.Ba_AreaID3).AreaName; Item.AreaName += Item.AreaName3; } //经营项目:字符串 if (!string.IsNullOrEmpty(Item.OperatingItemIDs))// != null && Item.OperatingItemIDs.Count > 0) { Item.OperatingItemIDs = Item.OperatingItemIDs.Substring(0, Item.OperatingItemIDs.Length - 1); var arrs=Item.OperatingItemIDs.Split(','); var OperatingItemNames=""; foreach (var s in arrs) { OperatingItemNames += SoftProjectAreaEntityDomain.P_Categorys.Where(p => p.P_CategoryID.ToString() == s).FirstOrDefault().PCategoryName+","; } Item.OperatingItemName = OperatingItemNames.Substring(0,OperatingItemNames.Length-1); } resp = ExecuteDelegate(new Action<SoftProjectAreaEntityDomain>(p => { resp = AddSaveNotTran(); Item.Pre_CompanyID = resp.Item.Pre_CompanyID; Pre_User_AddAdminSave(); })); return resp; }
/// <summary> /// 最后1个订单 /// </summary> /// <returns></returns> public MyResponseBase C_Recharge_EditSave() { if (Item.C_RechargeID == null) throw new Exception("充值记录ID不能为空"); #region 查询原记录 var sql = string.Format("SELECT * FROM C_Recharge WHERE C_RechargeID={0}", Item.C_RechargeID); var respOld = Query16(sql, 4); #endregion var resp = new MyResponseBase(); ExecuteDelegate(new Action<SoftProjectAreaEntityDomain>(p => { resp = EditSaveNotTran(); //更新数据库:用户帐户余额 sql = string.Format("UPDATE Pre_User SET FundBalance=ISNULL(FundBalance,0)+{0}-{1} WHERE Pre_UserID={2}", Item.Amount,respOld.Item.Amount, respOld.Item.Pre_UserID); Query16(sql, 1); //更新缓存:用户账户余额 var userItem=SoftProjectAreaEntityDomain.Pre_UserRoleAll.Where(o => o.Pre_UserID == respOld.Item.Pre_UserID).FirstOrDefault(); userItem.FundBalance = (userItem.FundBalance!=null? userItem.FundBalance:0)+ Item.Amount - respOld.Item.Amount; })); return resp; }
public MyResponseBase Design_ModularOrFunDomain_AddSave() { var resp = new MyResponseBase(); Design_ModularOrFunDomain_Domain(); #region (2)修改功能模块字段 using (var scope = new TransactionScope()) { try { SoftProjectAreaEntity hOperControl = new SoftProjectAreaEntity { }; var DBFieldVals = ""; #region (1)添加功能模块 //Design_ModularOrFunDomain_PKCheck(); Design_ModularOrFunDomain_Domain(); DBFieldVals = "ModularOrFunDomainName,MethodName,MethodReturnTypeID,Sort,Design_ModularOrFunID"; resp = AddSave(DBFieldVals); #endregion Design_ModularOrFunDomainDetail_EditSave(); scope.Complete(); } catch (Exception ex) { throw new Exception(ex.Message); } finally { scope.Dispose(); } } #endregion return resp; }
/// <summary> /// 用户管理--显示修改修改密码页面 /// </summary> /// <param name="domain"></param> /// <returns></returns> public ActionResult ChangePass(SoftProjectAreaEntityDomain domain) { var resp = new MyResponseBase(); resp.FunNameEn = "Edit"; ModularOrFunCode = "AuthorizationAreas.Pre_User.ChangePass"; resp.ViewContextName = Design_ModularOrFun.PartialView; return View(Design_ModularOrFun.MainView, resp); }
//#region 持久化 public void Execute(MyResponseBase response) { SoftProjectAreaEntity moci = domain.Sys_HOperControl; Tuple<string, SqlParameter[]> vals = null; //MyResponseBase<CellT> response = new MyResponseBase<CellT>(); try { switch (moci.DBOperType) { case 1://Insert #region 插入 vals = SqlTool.BulidInsertParas(domain); var UID = SqlHelper.ExecuteScalar(ProviderHelper.ConnectionString, CommandType.Text, vals.Item1, vals.Item2); if (UID != null) { var type = domain.Item.GetType(); string tabName = type.Name; PropertyInfo propertyInfo = type.GetProperty(domain.PKField);//PKFields[0]); //domain.Item = new CellT(); propertyInfo.SetValue(domain.Item, Convert.ToInt32(UID), null); response.Item = domain.Item; } #endregion break; case 2://Update #region 更新 vals = SqlTool.BulidUpdateParas(domain); SqlHelper.ExecuteScalar(ProviderHelper.ConnectionString, CommandType.Text, vals.Item1, vals.Item2); response.Item = domain.Item; #endregion break; case 4://Delete vals = SqlTool.BulidDeleteParas(domain); response.Obj = SqlHelper.ExecuteNonQuery(ProviderHelper.ConnectionString, CommandType.Text, vals.Item1, vals.Item2); break; case 8://查询 #region 128 vals = SqlTool.BulidBaseSqlParas128(domain); var SelectSubType = domain.SelectSubType; if (SelectSubType == null) SelectSubType = moci.SelectSubType; var strCal = ""; if (domain.bCal==1)//计算 { strCal = SqlTool.AppendTotal(vals.Item1,domain.ModularOrFunCode); } else if((SelectSubType & 4)==4) { strCal = SqlTool.AppendCount(vals.Item1); } if (strCal.Length>0)//如果分页,则计算记录总数,或者合计 { //var sql = SqlTool.AppendCount(vals.Item1);// SqlTool.BulidSelectPageByTotalItemsParas<CellT>(domain); //vals = Tuple.Create<string, SqlParameter[]>(sql, vals.Item2); var xx = vals.Item2; Select(strCal, xx, 1, 4, response); #region 分页处理 /////////////////////// #region 获取总数值 var type = domain.Item.GetType(); PropertyInfo propertyInfo = type.GetProperty("TotalItems"); //domain.Item = new CellT(); var TotalItems=propertyInfo.GetValue(response.Item);//.SetValue(domain.Item, Convert.ToInt32(UID), null); /////////////////////// response.PageQueryBase = domain.PageQueryBase; response.PageQueryBase.TotalItems = (int)TotalItems; if (response.PageQueryBase.TotalPages < response.PageQueryBase.PageIndex) response.PageQueryBase.PageIndex = response.PageQueryBase.TotalPages; #endregion response.ItemTotal = response.Item; #endregion } #region SelectType说明 //--如果为1:select * from t1000--不分页、不排序 //-- 2: --不分页、排序 //--如果为4:select * from tp1000--分页--一定要排序 //--如果为8:select * from tcal1000--计算 //--如果为9:不分页+不排序、计算 //-- select * from t1000 //-- select * from tcal1000 //--如果为10:不分页、排序、计算 //--如果为14:分页+计算 //-- select * from tp1000 //-- union all //-- select * from tcal1000 #endregion var strsql128 = vals.Item1; #region 追加排序、分页语句 if ((SelectSubType & 2) == 2)//排序,TO1000 { strsql128 = SqlTool.AppendOrder(strsql128, domain.PageQueryBase); } if ((SelectSubType & 4) == 4)//分页TP1000 { strsql128 = SqlTool.AppendPage(strsql128, domain.PageQueryBase); } #endregion #region 根据功能拼接 最后语句 //select * from T1000 var paramleng = vals.Item2.Count(); //SqlParameter[] paras =new SqlParameter[paramleng]{};// List<SqlParameter>(); var sqlparams = new List<SqlParameter>(); //sqlparams=vals.Item2.AsEnumerable().ToList();//.CopyTo(sqlparams, 0L); //var paras = sqlparams.ToArray(); //vals.Item2 =new SqlParameter(); for (var i = 0; i < vals.Item2.Count(); i++) { sqlparams.Add(new SqlParameter(vals.Item2[i].ParameterName,vals.Item2[i].Value)); } var paras = sqlparams.ToArray(); if (SelectSubType == 1)//不排序+不分页 { strsql128 += "\n SELECT * FROM T1000"; vals = Tuple.Create<string, SqlParameter[]>(strsql128, paras); } else if (SelectSubType == 2)//排序+不分页 { strsql128 += "\n SELECT * FROM TO1000"; vals = Tuple.Create<string, SqlParameter[]>(strsql128, paras); } else if (SelectSubType == 6)//分页(包含排序) { strsql128 += "SELECT * FROM TP1000"; vals = Tuple.Create<string, SqlParameter[]>(strsql128, paras); } else { strsql128 += "SELECT * FROM T1000"; vals = Tuple.Create<string, SqlParameter[]>(strsql128, paras); } //else if (moci.SelectSubType == 8)//计算 //{ // strsql128 += "\n SELECT * FROM TCal1000"; // vals = Tuple.Create<string, SqlParameter[]>(strsql128, vals.Item2); //} //else if (moci.SelectSubType == 9)//不排序+不分页+计算(1+8) //{ // strsql128 += "\n SELECT * FROM TCal1000 \n UNION ALL \n SELECT * FROM T1000"; // vals = Tuple.Create<string, SqlParameter[]>(strsql128, vals.Item2); //} //else if (moci.SelectSubType == 10)//排序+不分页计算(2+8) //{ // strsql128 += "\n SELECT * FROM TCal1000 \n UNION ALL \n SELECT * FROM TO1000 "; // vals = Tuple.Create<string, SqlParameter[]>(strsql128, vals.Item2); //} //else if (moci.SelectSubType == 14)//分页(包含排序)+计算(6+8) //{ // strsql128 += "\n SELECT * FROM TCal1000 \n UNION ALL \n SELECT * FROM TP1000"; // vals = Tuple.Create<string, SqlParameter[]>(strsql128, vals.Item2); //} #endregion Select(vals.Item1, vals.Item2, 1, (int)moci.DBSelectResultType, response); #endregion break; case 16: vals = SqlTool.BulidSqlItemsParas16(domain); Select(vals.Item1, vals.Item2, 1, (int)moci.DBSelectResultType, response); break; } } catch (Exception ex) { var validationInfo = new ValidationInfo(null) { FieldName = "", Title = domain.Sys_HOperControl.OperName, Message = string.Format("{0}:{1}", domain.Sys_HOperControl.OperName + "操作失败", ex.Message) }; var TupleSql = vals; throw new Exception(string.Format("{0}:{1}", domain.Sys_HOperControl.OperName + "操作失败", ex.Message)); } }
/// <summary> /// 用户角色--编辑列表 /// </summary> /// <returns></returns> public MyResponseBase Pre_RolePremSet_EditList() { MyResponseBase resp = new MyResponseBase(); //(1)根据页面ID查询页面字段 if (FunNameEn == "Add") { #region Sys_HOperControl = null; StringBuilder sbsql = new StringBuilder(); sbsql.AppendLine(" SELECT Design_ModularOrFunID Sys_PremSetID,PremName PremSetName,ParentPremID PremSetParentID,PremSort OrderNum,LoginCategoryID,DataRightDropDown,0 bCheckSelect "); sbsql.AppendLine(" FROM Design_ModularOrFun"); sbsql.AppendLine(string.Format(" WHERE BPrem=1 AND (LoginCategoryID&{0})={0}",Item.LoginCategoryID)); //sbsql.AppendLine(")"); resp = Query16(sbsql.ToString(), 2); resp.FunNameEn = "Add"; #endregion } else if (FunNameEn == "Edit") { #region 查询 Sys_HOperControl = null; //OperCode = "Pre_RolePremSet.PremSetAllByRoleID"; //resp = Execute(); StringBuilder sbsql = new StringBuilder(); sbsql.AppendLine(";WITH T0 AS"); sbsql.AppendLine("("); sbsql.AppendLine(" SELECT Design_ModularOrFunID Sys_PremSetID,PremName PremSetName,ParentPremID PremSetParentID,Sort OrderNum,LoginCategoryID,DataRightDropDown"); sbsql.AppendLine(" FROM Design_ModularOrFun"); sbsql.AppendLine(string.Format(" WHERE BPrem=1 AND (LoginCategoryID&{0})={0}", Item.LoginCategoryID)); //sbsql.AppendLine(" WHERE BPrem=1 AND (LoginCategoryID&1)=1"); sbsql.AppendLine(")"); sbsql.AppendLine("SELECT A.*,Pre_RolePremSetID,CASE WHEN B.Sys_PremSetID IS NULL THEN 0 ELSE 1 END AS bCheckSelect"); sbsql.AppendLine("FROM T0 A"); sbsql.AppendLine("LEFT JOIN Pre_RolePremSet B ON B.Sys_PremSetID=A.Sys_PremSetID"); sbsql.AppendLine("AND Pre_RoleID=" + Item.Pre_RoleID); resp = Query16(sbsql.ToString()); resp.FunNameEn = "Edit"; #endregion } else if (FunNameEn == "Detail") { //Sys_HOperControl = null; //OperCode = "Pre_RolePremSet.PremSetAllByRoleID"; //resp = Execute(); StringBuilder sbsql = new StringBuilder(); sbsql.AppendLine(";WITH T0 AS"); sbsql.AppendLine("("); sbsql.AppendLine(" SELECT Design_ModularOrFunID Sys_PremSetID,PremName PremSetName,ParentPremID PremSetParentID,PremSort OrderNum,LoginCategoryID,DataRightDropDown"); sbsql.AppendLine(" FROM Design_ModularOrFun"); //sbsql.AppendLine(" WHERE BPrem=1 AND (LoginCategoryID&1)=1"); sbsql.AppendLine(string.Format(" WHERE BPrem=1 AND (LoginCategoryID&{0})={0}", Item.LoginCategoryID)); //sbsql.AppendLine(" WHERE BPrem=1 AND (LoginCategoryID&1)=1"); sbsql.AppendLine(")"); sbsql.AppendLine("SELECT A.*,Pre_RolePremSetID,CASE WHEN B.Sys_PremSetID IS NULL THEN 0 ELSE 1 END AS bCheckSelect"); sbsql.AppendLine("FROM T0 A"); sbsql.AppendLine("LEFT JOIN Pre_RolePremSet B ON B.Sys_PremSetID=A.Sys_PremSetID"); sbsql.AppendLine("AND Pre_RoleID=" + Item.Pre_RoleID); resp = Query16(sbsql.ToString()); resp.FunNameEn = "Detail"; } return resp; }
/// <summary> /// Row /// </summary> /// <returns></returns> public MyResponseBase Design_ModularOrFunDomain_AddSaveMethod() { MyResponseBase resp = new MyResponseBase(); var Design_ModularOrFunID = Item.Design_ModularOrFunID; var Design_ModularOrFun = Design_ModularOrFun_GetByID().Item; //Design_ModularOrFunID StringBuilder sbentity = new StringBuilder(); if (Item.DomainTypeTemp == 1) { #region 构造函数 sbentity.AppendLine(string.Format("PKFields = new List<string> {{ \"{0}ID\" }};", Design_ModularOrFun.ControllCode)); sbentity.AppendLine(string.Format("TableName = \"{0}\";", Design_ModularOrFun.ControllCode)); //sbentity.AppendLine(string.Format("return resp;")); //主表 Item = new SoftProjectAreaEntity { ModularOrFunDomainName = "构造函数", MethodName = "Domain", MethodReturnTypeID = 1, Design_ModularOrFunID = Design_ModularOrFunID, Sort = 1, }; //var resp = Design_ModularOrFunDomain_AddSave(); //明细表 //Item = resp.Item; //StringBuilder sbsql = new StringBuilder(); Item.Items.Add(new SoftProjectAreaEntity { ModularOrFunDomainDetailName = "构造函数", //Design_ModularOrFunDomainID = resp.Item.Design_ModularOrFunDomainID, DomainType = 1, ParamName = sbentity.ToString(), DBOperCode = "", Serial = 1, }); Design_ModularOrFunDomain_AddSave(); //Design_ModularOrFunDomainDetail_EditSave(); #endregion } else if (Item.DomainTypeTemp == 2) { //new TextValue{Text="主键不为空检查",Value="2"}, #region 主键不能为空 //var MethodName = "PKCheck"; //sbentity.AppendLine(string.Format(" public void {0}_{1}()", Design_ModularOrFun.ControllCode, MethodName)); //sbentity.AppendLine(string.Format(" {{")); sbentity.AppendLine(string.Format(" if (Item.{0}ID == null)", Design_ModularOrFun.ControllCode)); sbentity.AppendLine(string.Format(" {{")); sbentity.AppendLine(string.Format(" throw new Exception(\"{0}主键不能为空!\");", Design_ModularOrFun.ModularName)); sbentity.AppendLine(string.Format(" }}")); //sbentity.AppendLine(string.Format(" }")); //sbentity.AppendLine(string.Format(" return resp;")); Item = new SoftProjectAreaEntity { ModularOrFunDomainName = "主键不为空检查", MethodName = "PKCheck", MethodReturnTypeID = 1, Design_ModularOrFunID = Design_ModularOrFunID, Sort = 6, }; // resp = Design_ModularOrFunDomain_AddSave(); //明细表 //Item = resp.Item; Item.Items.Add(new SoftProjectAreaEntity { ModularOrFunDomainDetailName = "主键不为空检查", Design_ModularOrFunDomainID = resp.Item.Design_ModularOrFunDomainID, DomainType = 2, ParamName = sbentity.ToString(), DBOperCode = "", Serial = 1, }); Design_ModularOrFunDomain_AddSave(); #endregion } //new TextValue{Text="根据主键查询-显示",Value="13"}, //new TextValue{Text="根据主键查询-编辑",Value="14"}, else if (Item.DomainTypeTemp == 13) { #region 根据主键查询--显示 sbentity.AppendLine(string.Format("{0}_PKCheck();", Design_ModularOrFun.ControllCode)); sbentity.AppendLine(string.Format("OperCode = \"{0}.ByID\";", Design_ModularOrFun.ControllCode)); sbentity.AppendLine(string.Format("resp = Execute();")); sbentity.AppendLine(string.Format("return resp;")); //主表 Item = new SoftProjectAreaEntity { ModularOrFunDomainName = "根据主键查询--显示", MethodName = "ByID", MethodReturnTypeID = 2,// "MyResponseBase", Design_ModularOrFunID = Design_ModularOrFunID, Sort = 11, }; //resp = Design_ModularOrFunDomain_AddSave(); //明细表 //Item = resp.Item; Item.Items.Add(new SoftProjectAreaEntity { ModularOrFunDomainDetailName = "根据主键查询--显示", Design_ModularOrFunDomainID = resp.Item.Design_ModularOrFunDomainID, DomainType = 13, ParamName = sbentity.ToString(), DBOperCode = Design_ModularOrFun.ControllCode + ".ByID", Serial = 1, }); //Design_ModularOrFunDomainDetail_EditSave(); Design_ModularOrFunDomain_AddSave(); #endregion } else if (Item.DomainTypeTemp == 14) { #region 根据主键查询--编辑 sbentity.AppendLine(string.Format("{0}_PKCheck();", Design_ModularOrFun.ControllCode)); sbentity.AppendLine(string.Format("var sql = string.Format(\";SELECT * FROM [dbo].[{0}] A WHERE {0}ID={{0}} \", Item.{0}ID);", Design_ModularOrFun.ControllCode)); sbentity.AppendLine(string.Format("var resp = Query16(sql, 4);")); sbentity.AppendLine(string.Format("return resp;")); //主表 Item = new SoftProjectAreaEntity { ModularOrFunDomainName = "根据主键查询--编辑", MethodName = "ByIDEdit", MethodReturnTypeID = 2,// "MyResponseBase", Design_ModularOrFunID = Design_ModularOrFunID, Sort = 11, }; //resp = Design_ModularOrFunDomain_AddSave(); //明细表 //Item = resp.Item; Item.Items.Add(new SoftProjectAreaEntity { ModularOrFunDomainDetailName = "根据主键查询--编辑", Design_ModularOrFunDomainID = resp.Item.Design_ModularOrFunDomainID, DomainType = 14, ParamName = sbentity.ToString(), DBOperCode = "", Serial = 1, }); //Design_ModularOrFunDomainDetail_EditSave(); Design_ModularOrFunDomain_AddSave(); #endregion } //new TextValue{Text="列表查询",Value="11"}, //new TextValue{Text="列表查询--初始条件",Value="12"}, else if (Item.DomainTypeTemp == 11) { #region 列表查询 //主表 sbentity.AppendLine(string.Format("var resp = new MyResponseBase();")); sbentity.AppendLine(string.Format("")); sbentity.AppendLine(string.Format("if (PageQueryBase.RankInfo == null || PageQueryBase.RankInfo.Length == 0)")); sbentity.AppendLine(string.Format("{{")); sbentity.AppendLine(string.Format(" PageQueryBase.RankInfo = \"UpdateDate|0\";")); sbentity.AppendLine(string.Format("}}")); sbentity.AppendLine(string.Format("")); //sbentity.AppendLine(string.Format("if (!Querys.QueryDicts.ContainsKey(\"{0}ID___equal\"))", Design_ModularOrFun.ControllCode)); //sbentity.AppendLine(string.Format("{{")); //sbentity.AppendLine(string.Format(" Querys.Add(new Query { QuryType = 0, FieldName = \"{0}ID___equal\", Value = \"\" });", Design_ModularOrFun.ControllCode)); //sbentity.AppendLine(string.Format("}}")); //sbentity.AppendLine(string.Format("")); sbentity.AppendLine(string.Format("//SoftProjectAreaEntity hOperControl = new SoftProjectAreaEntity")); sbentity.AppendLine(string.Format("//{{")); sbentity.AppendLine(string.Format("// DBTSql =string.Format(\";WITH T1000 AS (SELECT * FROM [dbo].[{0}] A WHERE 1=1 sqlplaceholder )", Design_ModularOrFun.ControllCode)); sbentity.AppendLine(string.Format("// DBOperType = 8,//排序分页")); sbentity.AppendLine(string.Format("// SelectSubType = SelectType,")); sbentity.AppendLine(string.Format("// DBSelectResultType = 2,")); sbentity.AppendLine(string.Format("// EqualQueryParam = \"\"")); sbentity.AppendLine(string.Format("//}};")); sbentity.AppendLine(string.Format("//Sys_HOperControl = hOperControl;")); sbentity.AppendLine(string.Format("")); sbentity.AppendLine(string.Format("OperCode = \"{0}.Index\";", Design_ModularOrFun.ControllCode)); sbentity.AppendLine(string.Format("resp = Execute();")); sbentity.AppendLine(string.Format("")); sbentity.AppendLine(string.Format("resp.Querys = Querys;")); sbentity.AppendLine(string.Format("resp.Item = Item;")); sbentity.AppendLine(string.Format("return resp;")); Item = new SoftProjectAreaEntity { ModularOrFunDomainName = string.Format("列表查询"), MethodName = "Index", MethodReturnTypeID = 2,// "MyResponseBase", Design_ModularOrFunID = Design_ModularOrFunID, Sort = 11, }; //resp = Design_ModularOrFunDomain_AddSave(); //明细表 //Item = resp.Item; Item.Items.Add(new SoftProjectAreaEntity { ModularOrFunDomainDetailName = string.Format("列表查询"), Design_ModularOrFunDomainID = resp.Item.Design_ModularOrFunDomainID, DomainType = 11, ParamName = sbentity.ToString(), DBOperCode = Design_ModularOrFun.ControllCode + ".Index", Serial = 1, }); //Design_ModularOrFunDomainDetail_EditSave(); Design_ModularOrFunDomain_AddSave(); #endregion } else if (Item.DomainTypeTemp == 12) { #region 列表查询-带初值 //主表 sbentity.AppendLine(string.Format("var resp = new MyResponseBase();")); sbentity.AppendLine(string.Format("")); sbentity.AppendLine(string.Format("if (PageQueryBase.RankInfo == null || PageQueryBase.RankInfo.Length == 0)")); sbentity.AppendLine(string.Format("{{")); sbentity.AppendLine(string.Format(" PageQueryBase.RankInfo = \"UpdateDate|0\";")); sbentity.AppendLine(string.Format("}}")); sbentity.AppendLine(string.Format("")); sbentity.AppendLine(string.Format("if (!Querys.QueryDicts.ContainsKey(\"{0}ID___equal\"))", Design_ModularOrFun.ControllCode)); sbentity.AppendLine(string.Format("{{")); sbentity.AppendLine(string.Format(" Querys.Add(new Query {{ QuryType = 0, FieldName = \"{0}ID___equal\", Value = \"\" }});", Design_ModularOrFun.ControllCode)); sbentity.AppendLine(string.Format("}}")); sbentity.AppendLine(string.Format("")); sbentity.AppendLine(string.Format("//SoftProjectAreaEntity hOperControl = new SoftProjectAreaEntity")); sbentity.AppendLine(string.Format("//{{")); sbentity.AppendLine(string.Format("// DBTSql =string.Format(\";WITH T1000 AS (SELECT * FROM [dbo].[{0}] A WHERE 1=1 sqlplaceholder )", Design_ModularOrFun.ControllCode)); sbentity.AppendLine(string.Format("// DBOperType = 8,//排序分页")); sbentity.AppendLine(string.Format("// SelectSubType = SelectType,")); sbentity.AppendLine(string.Format("// DBSelectResultType = 2,")); sbentity.AppendLine(string.Format("// EqualQueryParam = \"\"")); sbentity.AppendLine(string.Format("//}};")); sbentity.AppendLine(string.Format("//Sys_HOperControl = hOperControl;")); sbentity.AppendLine(string.Format("")); sbentity.AppendLine(string.Format("OperCode = \"{0}.Index\";", Design_ModularOrFun.ControllCode)); sbentity.AppendLine(string.Format("resp = Execute();")); sbentity.AppendLine(string.Format("")); sbentity.AppendLine(string.Format("resp.Querys = Querys;")); sbentity.AppendLine(string.Format("resp.Item = Item;")); sbentity.AppendLine(string.Format("return resp;")); Item = new SoftProjectAreaEntity { ModularOrFunDomainName = string.Format("列表查询"), MethodName = "Index", MethodReturnTypeID = 2,// "MyResponseBase", Design_ModularOrFunID = Design_ModularOrFunID, Sort = 11, }; //resp = Design_ModularOrFunDomain_AddSave(); //明细表 //Item = resp.Item; Item.Items.Add(new SoftProjectAreaEntity { ModularOrFunDomainDetailName = string.Format("列表查询"), Design_ModularOrFunDomainID = resp.Item.Design_ModularOrFunDomainID, DomainType = 12, ParamName = sbentity.ToString(), DBOperCode = Design_ModularOrFun.ControllCode + ".Index", Serial = 1, }); //Design_ModularOrFunDomainDetail_EditSave(); Design_ModularOrFunDomain_AddSave(); #endregion } #region 添加查询 ////主表 //Item = new SoftProjectAreaEntity //{ // ModularOrFunDomainDetailName = string.Format("添加查询--根据{0}初始化", FKFieldss.NameCn), // MethodName = "Add", // Design_ModularOrFunID = Design_ModularOrFunID, // Sort = 31, //}; //resp = Design_ModularOrFunDomain_Add(); ////明细表 //Item = resp.Item; //Item.Items.Add(new SoftProjectAreaEntity //{ // ModularOrFunDomainDetailName = string.Format("添加查询--根据{0}初始化", FKFieldss.NameCn), // Design_ModularOrFunDomainID = resp.Item.Design_ModularOrFunDomainID, // DomainType = 22, // ParamName = FKFieldss.name, // DBOperCode = "", // Serial = 1, //}); //Design_ModularOrFunDomainDetail_EditSave(); #endregion //new TextValue{Text="添加保存--事务",Value="23"}, //new TextValue{Text="编辑保存--事务",Value="26"}, else if (Item.DomainTypeTemp == 23) { #region 添加保存 sbentity.AppendLine(string.Format("var resp = new MyResponseBase();")); sbentity.AppendLine(string.Format("#region (2)添加")); sbentity.AppendLine(string.Format("using (var scope = new TransactionScope())")); sbentity.AppendLine(string.Format("{{")); sbentity.AppendLine(string.Format(" try")); sbentity.AppendLine(string.Format(" {{")); sbentity.AppendLine(string.Format(" {0}_Domain();", Design_ModularOrFun.ControllCode)); sbentity.AppendLine(string.Format(" //string DBFieldVals = \"添加的字段\";")); sbentity.AppendLine(string.Format(" //resp = AddSave(DBFieldVals);")); sbentity.AppendLine(string.Format(" OperCode = \"{0}.AddSave\";", Design_ModularOrFun.ControllCode)); sbentity.AppendLine(string.Format(" resp = Execute();")); sbentity.AppendLine(string.Format(" scope.Complete();")); sbentity.AppendLine(string.Format(" }}")); sbentity.AppendLine(string.Format(" catch (Exception ex)")); sbentity.AppendLine(string.Format(" {{")); sbentity.AppendLine(string.Format(" throw new Exception(ex.Message);")); sbentity.AppendLine(string.Format(" }}")); sbentity.AppendLine(string.Format(" finally")); sbentity.AppendLine(string.Format(" {{")); sbentity.AppendLine(string.Format(" scope.Dispose();")); sbentity.AppendLine(string.Format(" }}")); sbentity.AppendLine(string.Format("}}")); sbentity.AppendLine(string.Format("#endregion")); sbentity.AppendLine(string.Format("return resp;")); //主表 Item = new SoftProjectAreaEntity { ModularOrFunDomainName = string.Format("添加保存"), MethodName = "AddSave", MethodReturnTypeID = 2,// "MyResponseBase", Design_ModularOrFunID = Design_ModularOrFunID, Sort = 31, }; //resp = Design_ModularOrFunDomain_AddSave(); //明细表 //Item = resp.Item; Item.Items.Add(new SoftProjectAreaEntity { ModularOrFunDomainDetailName = string.Format("添加保存"), Design_ModularOrFunDomainID = resp.Item.Design_ModularOrFunDomainID, DomainType = 23, ParamName = sbentity.ToString(), DBOperCode = Design_ModularOrFun.ControllCode + ".AddSave", Serial = 1, }); //Design_ModularOrFunDomainDetail_EditSave(); Design_ModularOrFunDomain_AddSave(); #endregion } else if (Item.DomainTypeTemp == 26) { #region 编辑保存 sbentity.AppendLine(string.Format("var resp = new MyResponseBase();")); sbentity.AppendLine(string.Format("{0}_PKCheck();", Design_ModularOrFun.ControllCode)); sbentity.AppendLine(string.Format("")); sbentity.AppendLine(string.Format("#region (2)编辑")); sbentity.AppendLine(string.Format("using (var scope = new TransactionScope())")); sbentity.AppendLine(string.Format("{{")); sbentity.AppendLine(string.Format(" try")); sbentity.AppendLine(string.Format(" {{")); sbentity.AppendLine(string.Format(" {0}_Domain();", Design_ModularOrFun.ControllCode)); sbentity.AppendLine(string.Format(" //string DBFieldVals = \"编辑的字段\";")); sbentity.AppendLine(string.Format(" //resp = EditSave(DBFieldVals);")); sbentity.AppendLine(string.Format(" OperCode = \"{0}.EditSave\";", Design_ModularOrFun.ControllCode)); sbentity.AppendLine(string.Format(" resp = Execute();")); sbentity.AppendLine(string.Format(" scope.Complete();")); sbentity.AppendLine(string.Format(" }}")); sbentity.AppendLine(string.Format(" catch (Exception ex)")); sbentity.AppendLine(string.Format(" {{")); sbentity.AppendLine(string.Format(" throw new Exception(ex.Message);")); sbentity.AppendLine(string.Format(" }}")); sbentity.AppendLine(string.Format(" finally")); sbentity.AppendLine(string.Format(" {{")); sbentity.AppendLine(string.Format(" scope.Dispose();")); sbentity.AppendLine(string.Format(" }}")); sbentity.AppendLine(string.Format("}}")); sbentity.AppendLine(string.Format("#endregion")); sbentity.AppendLine(string.Format("return resp;")); //主表 Item = new SoftProjectAreaEntity { ModularOrFunDomainName = string.Format("编辑保存"), MethodName = "EditSave", MethodReturnTypeID = 2, Design_ModularOrFunID = Design_ModularOrFunID, Sort = 31, }; //resp = Design_ModularOrFunDomain_AddSave(); //明细表 //Item = resp.Item; Item.Items.Add(new SoftProjectAreaEntity { ModularOrFunDomainDetailName = string.Format("编辑保存"), Design_ModularOrFunDomainID = resp.Item.Design_ModularOrFunDomainID, DomainType = 26, ParamName = sbentity.ToString(), DBOperCode = Design_ModularOrFun.ControllCode + ".EditSave", Serial = 1, }); //Design_ModularOrFunDomainDetail_EditSave(); Design_ModularOrFunDomain_AddSave(); #endregion } //resp = Design_ModularOrFunDomain_AddSave(); else if (Item.DomainTypeTemp == 51) { #region Add、Edit、Delete Item = new SoftProjectAreaEntity { ModularOrFunDomainName = string.Format("添加、编辑、删除"), MethodName = "AddEditDelete", MethodReturnTypeID = 2,// "MyResponseBase", Design_ModularOrFunID = Design_ModularOrFunID, Sort = 31, }; #region 启动事务 sbentity = new StringBuilder(); sbentity.AppendLine("using (var scope = new TransactionScope())"); sbentity.AppendLine("{"); sbentity.AppendLine(" try"); sbentity.AppendLine(" {"); Item.Items.Add(new SoftProjectAreaEntity { ModularOrFunDomainDetailName = string.Format("启动事务及try"), Design_ModularOrFunDomainID = resp.Item.Design_ModularOrFunDomainID, DomainType = 71, ParamName = sbentity.ToString(), DBOperCode = "", Serial = 1, }); #endregion #region 查询原始值 sbentity = new StringBuilder(); sbentity.AppendLine(string.Format("var OldItems = {0}_GetByXXX();", Design_ModularOrFun.ControllCode)); Item.Items.Add(new SoftProjectAreaEntity { ModularOrFunDomainDetailName = string.Format("根据{0}ID查询原始值", Design_ModularOrFun.ModularName), Design_ModularOrFunDomainID = resp.Item.Design_ModularOrFunDomainID, DomainType = 101, ParamName = sbentity.ToString(), DBOperCode = "", Serial = 1, }); #endregion #region 数据整理 sbentity = new StringBuilder(); //sbentity.AppendLine("var OldItems = Pre_UserRole_GetByUserID();"); sbentity.AppendLine("Item.Items.ForEach(p => p.XXXXID = Item.XXXXID);"); sbentity.AppendLine(string.Format("var deleteIDsEnum = (from p in OldItems select p.{0}ID).Except(from o in Item.Items select o.{0}ID);", Design_ModularOrFun.ControllCode)); sbentity.AppendLine(string.Format("var updateItems = Item.Items.Where(p => p.{0}ID != null);", Design_ModularOrFun.ControllCode)); sbentity.AppendLine(string.Format("var addItems = Item.Items.Where(p => p.{0}ID == null);", Design_ModularOrFun.ControllCode)); Item.Items.Add(new SoftProjectAreaEntity { ModularOrFunDomainDetailName = string.Format("数据整理"), Design_ModularOrFunDomainID = resp.Item.Design_ModularOrFunDomainID, DomainType = 101, ParamName = sbentity.ToString(), DBOperCode = "", Serial = 1, }); #endregion #region 删除 sbentity = new StringBuilder(); //sbentity.AppendLine("var OldItems = Pre_UserRole_GetByUserID();"); sbentity.AppendLine(string.Format("if (deleteIDsEnum.Count() > 0)")); sbentity.AppendLine(string.Format("{{")); sbentity.AppendLine(string.Format(" var deleteIDs = string.Join(\",\", deleteIDsEnum);")); sbentity.AppendLine(string.Format(" var sql = string.Format(\"DELETE [dbo].[{0}] WHERE {0}ID IN({{0}})\", deleteIDs);", Design_ModularOrFun.ControllCode)); sbentity.AppendLine(string.Format(" var resptemp = Query16(sql, 1);")); sbentity.AppendLine(string.Format("}}")); Item.Items.Add(new SoftProjectAreaEntity { ModularOrFunDomainDetailName = string.Format("删除"), Design_ModularOrFunDomainID = resp.Item.Design_ModularOrFunDomainID, DomainType = 101, ParamName = sbentity.ToString(), DBOperCode = "", Serial = 1, }); #endregion #region 更新 sbentity = new StringBuilder(); //sbentity.AppendLine("var OldItems = Pre_UserRole_GetByUserID();"); sbentity.AppendLine(string.Format("if (updateItems.Count() > 0)")); sbentity.AppendLine(string.Format("{{")); sbentity.AppendLine(string.Format(" SoftProjectAreaEntityDomain domain = new SoftProjectAreaEntityDomain {{ Items = updateItems.ToList() }};")); sbentity.AppendLine(string.Format(" domain.{0}_Domain();", Design_ModularOrFun.ControllCode)); sbentity.AppendLine(string.Format(" var operCode = \"{0}.EditSave\";", Design_ModularOrFun.ControllCode)); sbentity.AppendLine(string.Format(" domain.ExecuteEnums(operCode);")); sbentity.AppendLine(string.Format("}}")); Item.Items.Add(new SoftProjectAreaEntity { ModularOrFunDomainDetailName = string.Format("更新"), Design_ModularOrFunDomainID = resp.Item.Design_ModularOrFunDomainID, DomainType = 101, ParamName = sbentity.ToString(), DBOperCode = "", Serial = 1, }); #endregion #region 添加 sbentity = new StringBuilder(); //sbentity.AppendLine("var OldItems = Pre_UserRole_GetByUserID();"); sbentity.AppendLine(string.Format("if (addItems.Count() > 0)")); sbentity.AppendLine(string.Format("{{")); sbentity.AppendLine(string.Format(" SoftProjectAreaEntityDomain domain = new SoftProjectAreaEntityDomain {{ Items = addItems.ToList() }};")); sbentity.AppendLine(string.Format(" domain.{0}_Domain();", Design_ModularOrFun.ControllCode)); sbentity.AppendLine(string.Format(" var operCode = \"{0}.AddSave\";", Design_ModularOrFun.ControllCode)); sbentity.AppendLine(string.Format(" domain.ExecuteEnums(operCode);")); sbentity.AppendLine(string.Format("}}")); Item.Items.Add(new SoftProjectAreaEntity { ModularOrFunDomainDetailName = string.Format("添加"), Design_ModularOrFunDomainID = resp.Item.Design_ModularOrFunDomainID, DomainType = 101, ParamName = sbentity.ToString(), DBOperCode = "", Serial = 1, }); #endregion #region 提交事务 sbentity = new StringBuilder(); sbentity.AppendLine("scope.Complete();"); Item.Items.Add(new SoftProjectAreaEntity { ModularOrFunDomainDetailName = "提交事务", Design_ModularOrFunDomainID = resp.Item.Design_ModularOrFunDomainID, DomainType = 73, ParamName = sbentity.ToString(), DBOperCode = "", Serial = 1, }); #endregion #region 结束事务及try sbentity = new StringBuilder(); sbentity.AppendLine(" }"); sbentity.AppendLine(" catch (Exception ex)"); sbentity.AppendLine(" {"); sbentity.AppendLine(" throw new Exception(ex.Message);"); sbentity.AppendLine(" }"); sbentity.AppendLine(" finally"); sbentity.AppendLine(" {"); sbentity.AppendLine(" scope.Dispose();"); sbentity.AppendLine(" }"); sbentity.AppendLine("}"); sbentity.AppendLine(string.Format("return resp;")); Item.Items.Add(new SoftProjectAreaEntity { ModularOrFunDomainDetailName = "结束事务及try", Design_ModularOrFunDomainID = resp.Item.Design_ModularOrFunDomainID, DomainType = 72, ParamName = sbentity.ToString(), DBOperCode = "", Serial = 1, }); #endregion Design_ModularOrFunDomain_AddSave(); #endregion } else if (Item.DomainTypeTemp == 53) { #region 结束事务及try模板 Item = new SoftProjectAreaEntity { ModularOrFunDomainName = string.Format("结束事务及try模板"), MethodName = "", MethodReturnTypeID = 2,// "MyResponseBase", Design_ModularOrFunID = Design_ModularOrFunID, Sort = 31, }; #region 启动事务 sbentity = new StringBuilder(); sbentity.AppendLine("using (var scope = new TransactionScope())"); sbentity.AppendLine("{"); sbentity.AppendLine(" try"); sbentity.AppendLine(" {"); Item.Items.Add(new SoftProjectAreaEntity { ModularOrFunDomainDetailName = string.Format("启动事务及try"), Design_ModularOrFunDomainID = resp.Item.Design_ModularOrFunDomainID, DomainType = 71, ParamName = sbentity.ToString(), DBOperCode = "", Serial = 1, }); #endregion #region 执行操作 sbentity = new StringBuilder(); Item.Items.Add(new SoftProjectAreaEntity { ModularOrFunDomainDetailName = "执行操作", Design_ModularOrFunDomainID = resp.Item.Design_ModularOrFunDomainID, DomainType = 101, ParamName = "", DBOperCode = "", Serial = 1, }); #endregion #region 提交事务 sbentity = new StringBuilder(); sbentity.AppendLine("scope.Complete();"); Item.Items.Add(new SoftProjectAreaEntity { ModularOrFunDomainDetailName = "提交事务", Design_ModularOrFunDomainID = resp.Item.Design_ModularOrFunDomainID, DomainType = 73, ParamName = sbentity.ToString(), DBOperCode = "", Serial = 1, }); #endregion #region 结束事务及try sbentity = new StringBuilder(); sbentity.AppendLine(" }"); sbentity.AppendLine(" catch (Exception ex)"); sbentity.AppendLine(" {"); sbentity.AppendLine(" throw new Exception(ex.Message);"); sbentity.AppendLine(" }"); sbentity.AppendLine(" finally"); sbentity.AppendLine(" {"); sbentity.AppendLine(" scope.Dispose();"); sbentity.AppendLine(" }"); sbentity.AppendLine("}"); sbentity.AppendLine(string.Format("return resp;")); Item.Items.Add(new SoftProjectAreaEntity { ModularOrFunDomainDetailName = "结束事务及try", Design_ModularOrFunDomainID = resp.Item.Design_ModularOrFunDomainID, DomainType = 72, ParamName = sbentity.ToString(), DBOperCode = "", Serial = 1, }); #endregion Design_ModularOrFunDomain_AddSave(); #endregion } return resp; }
public MyResponseBase Design_ModularOrFunDomainDetail_EditSave() { MyResponseBase resp = new MyResponseBase(); Design_ModularOrFunDomainDetail_Domain(); #region (2)修改顾客 using (var scope = new TransactionScope()) { try { #region (3)根据功能模块ID查询所有字段 var Design_ModularOrFunDomainDetails = Design_ModularOrFunDomainDetail_GetByModularOrFunDomainID(); #endregion #region (2)模块字段--数据整理 //Item.Design_Design_ModularOrFunDomainDetails.ForEach(p => //{ p.Design_ModularPageID = Item.Design_ModularPageID; }); Item.Items.ForEach(p => p.Design_ModularOrFunDomainID = Item.Design_ModularOrFunDomainID); var deleteIDsEnum = (from p in Design_ModularOrFunDomainDetails select p.Design_ModularOrFunDomainDetailID).Except(from o in Item.Items select o.Design_ModularOrFunDomainDetailID); var updateItems = Item.Items.Where(p => p.Design_ModularOrFunDomainDetailID != null); var addItems = Item.Items.Where(p => p.Design_ModularOrFunDomainDetailID == null); #endregion MyResponseBase resptemp = new MyResponseBase(); #region (4)删除元素:执行删除,通过In进行删除 //需要写专门语句?delete xxx where ID IN(XXX) if (deleteIDsEnum.Count() > 0) { var deleteIDs = string.Join(",", deleteIDsEnum);//deleteForecastIDsEnum.ToArray() var sql = string.Format("DELETE [dbo].[Design_ModularOrFunDomainDetail] WHERE Design_ModularOrFunDomainDetailID IN({0})", deleteIDs); resptemp = Query16(sql, 1); } #endregion var DBFieldVals = ""; #region (5)更新模块字段 if (updateItems.Count() > 0) { SoftProjectAreaEntityDomain domain = new SoftProjectAreaEntityDomain { Items = updateItems.ToList() }; domain.Design_ModularOrFunDomainDetail_Domain(); DBFieldVals = "ModularOrFunDomainDetailName,Design_ModularOrFunDomainID,DomainType,DBOperCode,Serial,ParamName"; domain.EditSaves(DBFieldVals); } #endregion #region (6)添加 if (addItems.Count() > 0) { SoftProjectAreaEntityDomain domain = new SoftProjectAreaEntityDomain { Items = addItems.ToList() }; domain.Design_ModularOrFunDomainDetail_Domain(); DBFieldVals = "ModularOrFunDomainDetailName,Design_ModularOrFunDomainID,DomainType,DBOperCode,Serial,ParamName"; domain.AddSaves(DBFieldVals); } #endregion scope.Complete(); } catch (Exception ex) { throw new Exception(ex.Message); } finally { scope.Dispose(); } } #endregion return resp; }
public void Select(string TSql, SqlParameter[] paras, int commandType, int DBSelectResultType, MyResponseBase response) { if (DBSelectResultType == 1)//标量查询 { response.Obj = SqlHelper.ExecuteScalar(ProviderHelper.ConnectionString, CommandType.Text, TSql, paras); } else if (DBSelectResultType == 2)//集合 { List<SoftProjectAreaEntity> CellTs = SelectCells(CommandType.Text, TSql, paras); response.Items = CellTs; } else if (DBSelectResultType == 4)//单个对象 { List<SoftProjectAreaEntity> CellTs = SelectCells(CommandType.Text, TSql, paras); if (CellTs.Count > 0) response.Item = CellTs.FirstOrDefault(); else response.Item = new SoftProjectAreaEntity(); } else { DataTable dt = SqlHelper.ExecuteDataTable(ProviderHelper.ConnectionString, CommandType.Text, TSql, paras); response.DataTable = dt; } }
public ActionResult IndexImageHandout(SoftProjectAreaEntityDomain domain) { ModularOrFunCode = "MarketingAreas.M_MarketingAttachment.IndexImage"; domain.Design_ModularOrFun = Design_ModularOrFun; var resp = new MyResponseBase(); if (!string.IsNullOrEmpty(domain.Item.HandoutFileNameGuid)) { domain.Querys.Add(new Query { QuryType = 0, FieldName = "RefPKTableGuid___equal", Value = domain.Item.HandoutFileNameGuid }); resp = domain.QueryIndex(); } if (Request.IsAjaxRequest()) return View(Design_ModularOrFun.PartialView, resp); resp.ViewContextName = Design_ModularOrFun.PartialView; return View(Design_ModularOrFun.MainView, resp); }
public void Set(MyResponseBase Item) { this.Item = Item.Item; this.Items.AddRange(Item.Items); this.RespAttachInfo.Merg(Item.RespAttachInfo); }
public MyResponseBase Design_ModularOrFunRefBtn_Rows() { MyResponseBase resp = new MyResponseBase(); string sql = string.Format("SELECT B.ModularName,A.* FROM Design_ModularOrFunBtn A "); sql += " JOIN Design_ModularOrFun B ON A.Design_ModularOrFunID=B.Design_ModularOrFunID"; sql += string.Format(" WHERE Design_ModularOrFunBtnID IN({0}) ", Item.Design_ModularOrFunBtnIDs); resp = Query16(sql, 2); ////(2)查询模块编码字段 //var ModularFields = Design_ModularField_GetModularPageOrQueryField(Item.Design_ModularOrFunID); //resp.Item.Design_ModularFields = ModularFields; return resp; }
/// <summary> /// 编辑保存,包含更新企业管理员信息 /// </summary> /// <returns></returns> public MyResponseBase Pre_Company_EditSave() { var resp = new MyResponseBase(); #region 数据处理 if (Item.Ba_AreaID1 != null) { Item.AreaName1 = SoftProjectAreaEntityDomain.Ba_Area_GetByAreaID(Item.Ba_AreaID1).AreaName; Item.AreaName = Item.AreaName1; } if (Item.Ba_AreaID2 != null) { Item.AreaName2 = SoftProjectAreaEntityDomain.Ba_Area_GetByAreaID(Item.Ba_AreaID2).AreaName; Item.AreaName += Item.AreaName2; } if (Item.Ba_AreaID3 != null) { Item.AreaName3 = SoftProjectAreaEntityDomain.Ba_Area_GetByAreaID(Item.Ba_AreaID3).AreaName; Item.AreaName += Item.AreaName3; } //经营项目:字符串 if (!string.IsNullOrEmpty(Item.OperatingItemIDs))// != null && Item.OperatingItemIDs.Count > 0) { Item.OperatingItemIDs = Item.OperatingItemIDs.Substring(0, Item.OperatingItemIDs.Length - 1); var arrs = Item.OperatingItemIDs.Split(','); var OperatingItemNames = ""; foreach (var s in arrs) { OperatingItemNames += SoftProjectAreaEntityDomain.P_Categorys.Where(p => p.P_CategoryID.ToString() == s).FirstOrDefault().PCategoryName + ","; } Item.OperatingItemName = OperatingItemNames.Substring(0, OperatingItemNames.Length - 1); } #endregion //更新加盟商零售价格表的商品为有效值 var sqlProductPrice = ProjectCache.Sys_HOperControls.Where(p => p.OperCode == "Pre_Company.Fra_ProductPriceByUpdateBValidate").FirstOrDefault().DBTSql; sqlProductPrice = string.Format(sqlProductPrice, Item.Pre_CompanyID, Item.OperatingItemIDs); //更新加盟商的合作商价格表的商品为有效值 var sqlPartnerProductPrice = ProjectCache.Sys_HOperControls.Where(p => p.OperCode == "Pre_Company.BC_PartnerProductPriceByUpdateBValidate").FirstOrDefault().DBTSql; sqlPartnerProductPrice = string.Format(sqlPartnerProductPrice, Item.Pre_CompanyID, Item.OperatingItemIDs); resp = ExecuteDelegate(new Action<SoftProjectAreaEntityDomain>(p => { resp = EditSaveNotTran(); Pre_User_EditAdminSave(); Query16(sqlProductPrice, 1);//更新加盟商零售价格表中,商品有效性。 Query16(sqlPartnerProductPrice, 1);//更新加盟商的合作商价格表中,商品有效性。 })); return resp; }
public MyResponseBase Design_ModularOrFun_EditSave() { MyResponseBase resp = new MyResponseBase(); //(1)检查主键ID Design_ModularOrFun_PKCheck(); Design_ModularOrFun_Domain(); Item.PrimaryKey = Item.ControllCode + "ID"; string DBFieldVals = "AreasCode,ControllCode,ModularName,PrimaryKey,Sort";//,ModularOrFunCode,ModularName,Design_ModularOrFunParentID,GroupModularOrFun,Design_ModularPageID,ActionPath,PrimaryKey,SearchMethod,BMenu,MenuName,MenuParentID"; resp = EditSave(DBFieldVals); ProjectCache.Design_ModularOrFuns_Clear(); return resp; }