protected void LoadPrintInfo() { PrintParameterSettingModel model = new PrintParameterSettingModel(); model.CompanyCD = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD; model.BillTypeFlag = int.Parse(ConstUtil.BILL_TYPEFLAG_SUBSTORAGE); model.PrintTypeFlag = ConstUtil.PRINTBILL_TYPEFLAG_SUBSTORAGECUST; SubSellCustInfoModel modelCust = new SubSellCustInfoModel(); modelCust.CompanyCD = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD; modelCust.ID = this.intCustID.ToString(); #region 1.初始化 取基本信息及明细信息的字段以及对应的标题 /*此处需注意在模板设置表里的字段和取基本信息的字段是否一致*/ string[,] aBase = { { "客户名称", "CustName"}, { "客户联系电话", "CustTel"}, { "客户手机号", "CustMobile"}, { "客户地址", "CustAddr"}, }; #endregion #region 2.所设的打印模板设置 DataTable dbPrint = XBase.Business.Common.PrintParameterSettingBus.GetPrintParameterSettingInfo(model); DataTable dtCust = SubSellOrderBus.GetOneData(this.intCustID); string strBaseFields = ""; if (dbPrint.Rows.Count > 0) { #region 设置过打印模板设置时 直接取出表里设置的值 isSeted.Value = "1"; strBaseFields = dbPrint.Rows[0]["BaseFields"].ToString(); #endregion } else { #region 未设置过打印模板设置 默认显示所有的 isSeted.Value = "0"; /*未设置过打印模板设置时,默认显示的字段 基本信息字段*/ for (int m = 0; m < aBase.Length / 2; m++) { strBaseFields = strBaseFields + aBase[m, 1] + "|"; } #endregion /*两种都可以*/ } #endregion #region 3.输出主表信息 if (!string.IsNullOrEmpty(strBaseFields)) { tableBase.InnerHtml = WritePrintPageTable("客户", strBaseFields.TrimEnd('|'), "", aBase, aBase, dtCust, dtCust, true); } #endregion }
protected void btnImport_Click(object sender, ImageClickEventArgs e) { string companyCD = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD; SubSellCustInfoModel model = new SubSellCustInfoModel(); model.CompanyCD = companyCD; model.DeptID = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).DeptID.ToString(); DataRow dt1 = SubStorageDBHelper.GetSubDeptFromDeptID(((UserInfoUtil)SessionUtil.Session["UserInfo"]).DeptID.ToString()); if (dt1 != null) { model.DeptID = dt1["ID"].ToString(); } model.CustName = hiddenOrderCustName.Value; model.CustTel = hiddenOrderCustTel.Value; model.CustMobile = hiddenOrderCustMobile.Value; model.CustAddr = hiddenOrderCustAddr.Value; int TotalCount = 0; string myOrder = " ID asc"; if (this.hiddenOrder.Value != "0") { string[] myOrder1 = this.hiddenOrder.Value.Split('_'); if (myOrder1[1] == "a") { myOrder = myOrder1[0] + " asc "; } else { myOrder = myOrder1[0] + " desc "; } } DataTable dt = SubSellOrderBus.GetAllCustInfo(model,"out",1,1,myOrder, ref TotalCount); //导出标题 string headerTitle = "客户名称|客户电话|客户手机号|客户地址"; string[] header = headerTitle.Split('|'); //导出标题所对应的列字段名称 string columnFiled = "CustName|CustTel|CustMobile|CustAddr"; string[] field = columnFiled.Split('|'); XBase.Common.OutputToExecl.ExportToTable(this.Page, dt, header, field, "分店客户列表"); }
public static SqlCommand InsertSubSellCustInfo(SubSellCustInfoModel SubSellCustInfoM) { SqlCommand comm = new SqlCommand(); StringBuilder sql = new StringBuilder(); sql.AppendLine("INSERT INTO officedba.SubSellCustInfo "); sql.AppendLine(" (CompanyCD "); sql.AppendLine(" ,DeptID "); sql.AppendLine(" ,CustName "); sql.AppendLine(" ,CustTel "); sql.AppendLine(" ,CustMobile "); sql.AppendLine(" ,CustAddr "); sql.AppendLine(" ,Creator "); sql.AppendLine(" ,CreateDate) "); sql.AppendLine(" VALUES "); sql.AppendLine(" (@CompanyCD "); sql.AppendLine(" ,@DeptID "); sql.AppendLine(" ,@CustName "); sql.AppendLine(" ,@CustTel "); sql.AppendLine(" ,@CustMobile "); sql.AppendLine(" ,@CustAddr "); sql.AppendLine(" ,@Creator "); sql.AppendLine(" ,getdate()) "); comm.Parameters.Add(SqlHelper.GetParameterFromString("@CompanyCD", SubSellCustInfoM.CompanyCD)); comm.Parameters.Add(SqlHelper.GetParameterFromString("@DeptID", SubSellCustInfoM.DeptID)); comm.Parameters.Add(SqlHelper.GetParameterFromString("@CustName", SubSellCustInfoM.CustName)); comm.Parameters.Add(SqlHelper.GetParameterFromString("@CustTel", SubSellCustInfoM.CustTel)); comm.Parameters.Add(SqlHelper.GetParameterFromString("@CustMobile", SubSellCustInfoM.CustMobile)); comm.Parameters.Add(SqlHelper.GetParameterFromString("@CustAddr", SubSellCustInfoM.CustAddr)); comm.Parameters.Add(SqlHelper.GetParameterFromString("@Creator", ((UserInfoUtil)SessionUtil.Session["UserInfo"]).EmployeeID.ToString())); return comm; }
public static SqlCommand GetCustInfo(SubSellCustInfoModel SubSellCustInfoM) { SqlCommand comm = new SqlCommand(); #region SQL文 StringBuilder sql = new StringBuilder(); sql.AppendLine("SELECT ID "); sql.AppendLine(" ,CompanyCD "); sql.AppendLine(" ,DeptID "); sql.AppendLine(" ,isnull(CustName ,'') AS CustName "); sql.AppendLine(" ,isnull(CustTel ,'') AS CustTel "); sql.AppendLine(" ,isnull(CustMobile ,'') AS CustMobile "); sql.AppendLine(" ,isnull(CustAddr ,'') AS CustAddr "); sql.AppendLine(" ,isnull(Creator ,'') AS Creator "); sql.AppendLine(" ,isnull(CreateDate,'') AS CreateDate "); sql.AppendLine(" FROM officedba.SubSellCustInfo "); sql.AppendLine(" WHERE CompanyCD=@CompanyCD "); sql.AppendLine(" AND DeptID=@DeptID "); comm.Parameters.Add(SqlHelper.GetParameterFromString("@CompanyCD", ((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD)); comm.Parameters.Add(SqlHelper.GetParameterFromString("@DeptID", SubSellCustInfoM.DeptID)); if (SubSellCustInfoM.CustName != "") { sql.AppendLine(" AND CustName like @CustName"); comm.Parameters.Add(SqlHelper.GetParameterFromString("@CustName", "%" + SubSellCustInfoM.CustName + "%")); } if (SubSellCustInfoM.CustTel != "") { sql.AppendLine(" AND CustTel like @CustTel"); comm.Parameters.Add(SqlHelper.GetParameterFromString("@CustTel", "%" + SubSellCustInfoM.CustTel + "%")); } if (SubSellCustInfoM.CustMobile != "") { sql.AppendLine(" AND CustMobile like @CustMobile"); comm.Parameters.Add(SqlHelper.GetParameterFromString("@CustMobile", "%" + SubSellCustInfoM.CustMobile + "%")); } if (SubSellCustInfoM.CustAddr != "") { sql.AppendLine(" AND CustAddr like @CustAddr"); comm.Parameters.Add(SqlHelper.GetParameterFromString("@CustAddr", "%" + SubSellCustInfoM.CustAddr + "%")); } #endregion comm.CommandText = sql.ToString(); return comm; }
//确认时如果客户不存在于零售客户表中,则插入该条客户记录 public static SqlCommand InsertCustInfo(SubSellCustInfoModel SubSellCustInfoM) { SqlCommand comm = new SqlCommand(); #region SQL文 StringBuilder sql = new StringBuilder(); sql.AppendLine("INSERT INTO officedba.SubSellCustInfo "); sql.AppendLine(" (CompanyCD "); sql.AppendLine(" ,DeptID "); sql.AppendLine(" ,CustName "); sql.AppendLine(" ,CustTel "); sql.AppendLine(" ,CustMobile "); sql.AppendLine(" ,CustAddr "); sql.AppendLine(" ,Creator "); sql.AppendLine(" ,CreateDate) "); sql.AppendLine(" VALUES "); sql.AppendLine(" (@CompanyCD "); sql.AppendLine(" ,@DeptID "); sql.AppendLine(" ,@CustName "); sql.AppendLine(" ,@CustTel "); sql.AppendLine(" ,@CustMobile "); sql.AppendLine(" ,@CustAddr "); sql.AppendLine(" ,@Creator "); sql.AppendLine(" ,getdate()) "); #endregion #region 传参 comm.Parameters.Add(SqlHelper.GetParameterFromString("@CompanyCD", SubSellCustInfoM.CompanyCD)); comm.Parameters.Add(SqlHelper.GetParameterFromString("@DeptID", SubSellCustInfoM.DeptID)); comm.Parameters.Add(SqlHelper.GetParameterFromString("@CustName", SubSellCustInfoM.CustName)); comm.Parameters.Add(SqlHelper.GetParameterFromString("@CustTel", SubSellCustInfoM.CustTel)); comm.Parameters.Add(SqlHelper.GetParameterFromString("@CustMobile", SubSellCustInfoM.CustMobile)); comm.Parameters.Add(SqlHelper.GetParameterFromString("@CustAddr", SubSellCustInfoM.CustAddr)); comm.Parameters.Add(SqlHelper.GetParameterFromString("@Creator", SubSellCustInfoM.Creator)); #endregion comm.CommandText = sql.ToString(); return comm; }
public static bool UpdateCust(SubSellCustInfoModel model) { StringBuilder sql = new StringBuilder(); SqlCommand comm = new SqlCommand(); sql.AppendLine("UPDATE [officedba].[SubSellCustInfo] "); sql.AppendLine(" SET [CustName] = @CustName "); comm.Parameters.Add(SqlHelper.GetParameter("@CustName", model.CustName)); if (!string.IsNullOrEmpty(model.CustTel)) { sql.AppendLine(" ,[CustTel] = @CustTel "); comm.Parameters.Add(SqlHelper.GetParameter("@CustTel", model.CustTel)); } if (!string.IsNullOrEmpty(model.CustMobile)) { sql.AppendLine(" ,[CustMobile] = @CustMobile "); comm.Parameters.Add(SqlHelper.GetParameter("@CustMobile", model.CustMobile)); } if (!string.IsNullOrEmpty(model.CustAddr)) { sql.AppendLine(" ,[CustAddr] = @CustAddr "); comm.Parameters.Add(SqlHelper.GetParameter("@CustAddr", model.CustAddr)); } sql.AppendLine(" where ID=@ID "); comm.Parameters.Add(SqlHelper.GetParameter("@ID", model.ID)); comm.CommandText = sql.ToString(); return SqlHelper.ExecuteTransWithCommand(comm); }
/// <summary> /// 检索客户 /// </summary> /// <param name="model"></param> /// <returns></returns> public static DataTable GetAllCust(SubSellCustInfoModel model, string Method, int pageIndex, int pageSize, string OrderBy, ref int TotalCount) { StringBuilder sql = new StringBuilder(); SqlCommand comm = new SqlCommand(); sql.AppendLine("SELECT [ID] "); sql.AppendLine(" ,isnull(CustName,'') as CustName "); sql.AppendLine(" ,isnull(CustTel,'') as CustTel "); sql.AppendLine(" ,isnull(CustMobile,'') as CustMobile "); sql.AppendLine(" ,isnull(CustAddr,'') as CustAddr "); sql.AppendLine(" FROM [officedba].[SubSellCustInfo] "); sql.AppendLine(" where CompanyCD=@CompanyCD "); sql.AppendLine(" and DeptID=@DeptID "); if (!string.IsNullOrEmpty(model.CustName)) { sql.AppendLine(" and CustName like @CustName "); comm.Parameters.Add(SqlHelper.GetParameter("@CustName", "%" + model.CustName + "%")); } if (!string.IsNullOrEmpty(model.CustTel)) { sql.AppendLine(" and CustTel like @CustTel "); comm.Parameters.Add(SqlHelper.GetParameter("@CustTel", "%" + model.CustTel + "%")); } if (!string.IsNullOrEmpty(model.CustMobile)) { sql.AppendLine(" and CustMobile like @CustMobile "); comm.Parameters.Add(SqlHelper.GetParameter("@CustMobile", "%" + model.CustMobile + "%")); } if (!string.IsNullOrEmpty(model.CustAddr)) { sql.AppendLine(" and CustAddr like @CustAddr "); comm.Parameters.Add(SqlHelper.GetParameter("@CustAddr", "%" + model.CustAddr + "%")); } comm.Parameters.Add(SqlHelper.GetParameter("@DeptID", model.DeptID)); comm.Parameters.Add(SqlHelper.GetParameter("@CompanyCD", model.CompanyCD)); if (Method == "out") { sql.AppendLine(" order by " + OrderBy + ""); } comm.CommandText = sql.ToString(); DataTable dt = new DataTable(); if (Method == "out") { dt = SqlHelper.ExecuteSearch(comm); } else { dt = SqlHelper.PagerWithCommand(comm, pageIndex, pageSize, OrderBy, ref TotalCount); } return dt; }
public static bool SubStorageCustAdd(SubSellCustInfoModel model) { StringBuilder sql = new StringBuilder(); SqlCommand comm = new SqlCommand(); sql.AppendLine("INSERT INTO [officedba].[SubSellCustInfo] "); sql.AppendLine(" ([CompanyCD] "); sql.AppendLine(" ,[DeptID] "); sql.AppendLine(" ,[CustName] "); sql.AppendLine(" ,[CustTel] "); sql.AppendLine(" ,[CustMobile] "); sql.AppendLine(" ,[CustAddr] "); sql.AppendLine(" ,[Creator] "); sql.AppendLine(" ,[CreateDate]) "); sql.AppendLine(" VALUES "); sql.AppendLine(" (@CompanyCD "); sql.AppendLine(" ,@DeptID "); sql.AppendLine(" ,@CustName "); sql.AppendLine(" ,@CustTel "); sql.AppendLine(" ,@CustMobile "); sql.AppendLine(" ,@CustAddr "); sql.AppendLine(" ,@Creator "); sql.AppendLine(" ,@CreateDate) "); comm.Parameters.Add(SqlHelper.GetParameter("@CompanyCD", model.CompanyCD)); comm.Parameters.Add(SqlHelper.GetParameter("@DeptID", model.DeptID)); comm.Parameters.Add(SqlHelper.GetParameter("@CustName", model.CustName)); comm.Parameters.Add(SqlHelper.GetParameter("@CustTel", model.CustTel)); comm.Parameters.Add(SqlHelper.GetParameter("@CustMobile", model.CustMobile)); comm.Parameters.Add(SqlHelper.GetParameter("@CustAddr", model.CustAddr)); comm.Parameters.Add(SqlHelper.GetParameter("@Creator", model.Creator)); comm.Parameters.Add(SqlHelper.GetParameter("@CreateDate", model.CreateDate)); comm.CommandText = sql.ToString(); if (SqlHelper.ExecuteTransWithCommand(comm)) { return true; } else { return false; } }
public static bool UpdateCust(SubSellCustInfoModel model) { return SubSellOrderDBHelper.UpdateCust(model); }
/// <summary> /// 检索客户 /// </summary> /// <param name="model"></param> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <param name="OrderBy"></param> /// <param name="TotalCount"></param> /// <returns></returns> public static DataTable GetAllCustInfo(SubSellCustInfoModel model, string Method, int pageIndex, int pageSize, string OrderBy, ref int TotalCount) { return SubSellOrderDBHelper.GetAllCust(model, Method, pageIndex, pageSize, OrderBy, ref TotalCount); }
/// <summary> /// 添加分店客户 /// </summary> /// <param name="model"></param> /// <returns></returns> public static bool SubStorageCustAdd(SubSellCustInfoModel model) { UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"]; try { bool result = false; LogInfoModel logModel = InitLogInfo(model.CustName); logModel.Element = ConstUtil.LOG_PROCESS_INSERT; result = SubSellOrderDBHelper.SubStorageCustAdd(model); if (!result) { logModel.Remark = ConstUtil.LOG_PROCESS_FAILED; } else { logModel.Remark = ConstUtil.LOG_PROCESS_SUCCESS; model.ID = IDIdentityUtil.GetIDIdentity("officedba.SubSellCustInfo").ToString(); } LogDBHelper.InsertLog(logModel); return result; } catch (Exception ex) { WriteSystemLog(userInfo, ex); return false; } }
public static DataTable GetCustInfo(SubSellCustInfoModel SubSellCustInfoM) { try { SqlCommand comm = SubSellOrderDBHelper.GetCustInfo(SubSellCustInfoM); return SqlHelper.ExecuteSearch(comm); } catch (Exception ex) { throw ex; } }
//需要插入客户 public static bool ConfirmSubSellOrder(string ID, string No, SubSellCustInfoModel SubSellCustInfoM) { ArrayList lstConfirm = new ArrayList(); //单据确认人,确认时间,单据状态,业务状态 SqlCommand Confirm = SubSellOrderDBHelper.ConfirmSubSellOrder(ID); lstConfirm.Add(Confirm); //新增客户信息 SqlCommand AddCust = SubSellOrderDBHelper.InsertCustInfo(SubSellCustInfoM); lstConfirm.Add(AddCust); //获取登陆用户信息 UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"]; //定义返回变量 bool isSucc = false; /* * 定义日志内容变量 * 增删改相关的日志,需要输出操作日志,该类型日志插入到数据库 * 其他的 如出现异常时,需要输出系统日志,该类型日志保存到日志文件 */ //执行插入操作 try { isSucc = SqlHelper.ExecuteTransWithArrayList(lstConfirm); } catch (Exception ex) { //输出日志 WriteSystemLog(userInfo, ex); } //定义变量 string remark; //成功时 if (isSucc) { //设置操作成功标识 remark = ConstUtil.LOG_PROCESS_SUCCESS; } else { //设置操作成功标识 remark = ConstUtil.LOG_PROCESS_FAILED; } LogInfoModel logModel = InitLogInfo(No); //涉及关键元素 这个需要根据每个页面具体设置,本页面暂时设置为空 logModel.Element = ConstUtil.LOG_PROCESS_CONFIRM; //设置操作成功标识 logModel.Remark = remark; //登陆日志 LogDBHelper.InsertLog(logModel); return isSucc; }