Ejemplo n.º 1
0
    protected void btnImport_Click(object sender, ImageClickEventArgs e)
    {
        try
        {
            string orderString = hiddExpOrder.Value.Trim();//排序
            string order = "asc";//排序:降序
            string orderBy = (!string.IsNullOrEmpty(orderString)) ? orderString.Substring(0, orderString.Length - 2) : "linkmanname";//要排序的字段,如果为空,默认为"ID"
           
            if (orderString.EndsWith("_d"))
            {
                order = "desc";//排序:降序
            }
            string CompanyCD = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD;
            string ord = " ORDER BY " + orderBy + " " + order;

            LinkManModel LinkManM = new LinkManModel();
            string CustID = hiddCustID.Value;//客户ID
            LinkManM.LinkManName = txtLinkManName.Value.Trim();
            LinkManM.Handset = txtHandset.Value.Trim();
            LinkManM.Important = seleImportant.Value;
            LinkManM.LinkType = ddlLinkType.SelectedItem.Value == "0" ? 0 : Convert.ToInt32(ddlLinkType.SelectedItem.Value);
            string DateBegin = txtDateBegin.Value.Trim();
            string DateEnd = txtDateEnd.Value.Trim();
            LinkManM.WorkTel = txtWorkTel.Value.Trim();

            LinkManM.CompanyCD = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD;
            LinkManM.CanViewUser = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).EmployeeID.ToString();//当前用户ID

            DataTable dt = LinkManBus.ExportLinkManInfo(CustID, LinkManM, DateBegin, DateEnd, ord);

            OutputToExecl.ExportToTableFormat(this, dt,
                new string[] { "联系人姓名", "对应客户", "称谓", "联系人类型", "重要程度", "工作电话", "手机", "QQ", "生日"},
                new string[] { "linkmanname", "CustName", "Appellation", "TypeName", "Important", "WorkTel", "Handset", "QQ", "Birthday" },
                "联系人列表");
        }
        catch
        {
            ClientScript.RegisterStartupScript(this.GetType(), "Exp", "<script language=javascript>showPopup('../../../Images/Pic/Close.gif','../../../Images/Pic/note.gif','导出发生异常');</script>");
        }
    }
    protected void btn_excel_Click(object sender, EventArgs e)
    {
        string ErrorMsg = string.Empty;

        #region 上传文件包含验证
        /*获取公司的上传路径*/
        string FileUrl = XBase.Business.Office.SupplyChain.ProductInfoBus.GetCompanyUpFilePath(UserInfo.CompanyCD);



        /*验证该公司路径是否存在 不存在则创建*/
        DirectoryInfo dir = new DirectoryInfo(FileUrl);
        if (!dir.Exists)
        {
            try
            {
                dir.Create();
            }
            catch (Exception ex)
            {
                lblMsg.Text = ex.ToString();
                return;
            }
        }
        /*验证是否选择了文件*/
        if (string.IsNullOrEmpty(fileExportExcel.PostedFile.FileName))
        {
            lblMsg.Text = "请选择需要导入的Excel文件";
            return;
        }

        /*验证文件类型*/
        string FileExtension = fileExportExcel.PostedFile.FileName.Split('.')[1].ToUpper();
        if (FileExtension != "XLS" && FileExtension != "XLSX")
        {
            lblMsg.Text = "文件类型错误,请上传正确的Excel文件";
            return;
        }

        /*上传文件*/
        string FileName = Guid.NewGuid().ToString() + "." + FileExtension.ToLower();
        string FileNewUrl = FileUrl + "\\" + FileName;
        try
        {
            fileExportExcel.PostedFile.SaveAs(FileNewUrl);
        }
        catch (Exception ex)
        {
            lblMsg.Text = ex.ToString();
            return;
        }

        #endregion

        #region 将Excel转换为DataTable
        /*将Excel转换成DataTable*/
        System.Data.DataTable dt = ExcelToDataTable(FileNewUrl);

        /*验证Excel是否为空*/
        if (dt == null || dt.Rows.Count <= 0)
        {
            lblMsg.Text = "Excel文件为空,请重新上传Excel文件";
            try
            {
                //删除上传的Excel文件
                DelExcel(FileNewUrl);
            }
            catch (Exception ex)
            {
                lblMsg.Text = ex.ToString();
                return;
            }
            return;
        }

        //转换成功,删除上传的Excel文件、
        try
        {
            DelExcel(FileNewUrl);
        }
        catch (Exception ex)
        {
            lblMsg.Text = ex.ToString();
        }


        #endregion

        #region 重新设置列名
        int m = 0;
        dt.Columns[m++].ColumnName = "CustName";
        dt.Columns[m++].ColumnName = "ContactName";
        dt.Columns[m++].ColumnName = "Sex";
        dt.Columns[m++].ColumnName = "Important";
        dt.Columns[m++].ColumnName = "TypeName";
        dt.Columns[m++].ColumnName = "Age";
        dt.Columns[m++].ColumnName = "Operation";
        dt.Columns[m++].ColumnName = "Company";
        dt.Columns[m++].ColumnName = "Position";
        dt.Columns[m++].ColumnName = "Department";
        dt.Columns[m++].ColumnName = "WorkTel";
        dt.Columns[m++].ColumnName = "Handset";
        dt.Columns[m++].ColumnName = "Fax";
        dt.Columns[m++].ColumnName = "HomeTel";
        dt.Columns[m++].ColumnName = "MailAddress";
        #endregion

        #region 重新构造数据源
        //DataTable dtNew = new DataTable();
        //dtNew.Columns.Add(new DataColumn("custNo", typeof(string)));
        //dtNew.Columns.Add(new DataColumn("LinkType", typeof(string)));
        //dtNew.Columns.Add(new DataColumn("LinkManName", typeof(string)));
        //dtNew.Columns.Add(new DataColumn("Sex", typeof(string)));
        //dtNew.Columns.Add(new DataColumn("Important", typeof(string)));
        //dtNew.Columns.Add(new DataColumn("Age", typeof(string)));
        //dtNew.Columns.Add(new DataColumn("Operation", typeof(string)));
        //dtNew.Columns.Add(new DataColumn("Company", typeof(string)));
        //dtNew.Columns.Add(new DataColumn("Position", typeof(string)));
        //dtNew.Columns.Add(new DataColumn("Department", typeof(string)));
        //dtNew.Columns.Add(new DataColumn("WorkTel", typeof(string)));
        //dtNew.Columns.Add(new DataColumn("Fax", typeof(string)));
        //dtNew.Columns.Add(new DataColumn("Handset", typeof(string)));
        //dtNew.Columns.Add(new DataColumn("HomeTel", typeof(string)));
        //dtNew.Columns.Add(new DataColumn("MailAddress", typeof(string)));
        #endregion

        #region 数据验证,并重新构造实体列表
        List<XBase.Model.Office.CustManager.LinkManModel> modelList = new List<XBase.Model.Office.CustManager.LinkManModel>();
        int index = 2;
        foreach (DataRow row in dt.Rows)
        {
            #region 对应客户验证
            string custNo = string.Empty;
            if (string.IsNullOrEmpty(row["CustName"].ToString()))
                ErrorMsg += "对应客户不能为空。<br />";
            else
            {
                custNo = CustomContactImportBus.CustomExists(UserInfo.CompanyCD, row["CustName"].ToString());
                if (string.IsNullOrEmpty(custNo))
                    ErrorMsg += "所填写的客户在系统中不存在。<br />";
            }
            #endregion

            #region 验证联系人姓名
            if (string.IsNullOrEmpty(row["ContactName"].ToString()))
                ErrorMsg += "联系人姓名不能为空。<br />";
            #endregion

            #region 验证联系人类型
            string typeName = string.Empty;
            if (!string.IsNullOrEmpty(row["TypeName"].ToString()))
            {
                typeName = CustomContactImportBus.ContactExists(UserInfo.CompanyCD, row["TypeName"].ToString());
                if (string.IsNullOrEmpty(typeName))
                    ErrorMsg += "所填写的联系人类型在系统中不存在。<br />";
            }
            else
                typeName = "0";
            #endregion

            #region 客户重要程度
            string Important = "0";
            if (!string.IsNullOrEmpty(row["Important"].ToString()))
            {
                switch (row["Important"].ToString())
                {
                    case "": Important = "0"; break;
                    case "不重要": Important = "1"; break;
                    case "普通": Important = "2"; break;
                    case "重要": Important = "3"; break;
                    case "关键": Important = "4"; break;
                    default: ErrorMsg += "联系人重要程度不正确。<br />"; break;
                }
            }
            #endregion


            #region 性别
            string sex = string.Empty;
            if (string.IsNullOrEmpty(row["Sex"].ToString()))
            {
                ErrorMsg += "性别不能为空。<br />";
            }
            else
            {
                switch (row["Sex"].ToString())
                {
                    case "男": sex = "1"; break;
                    case "女": sex = "2"; break;
                    default: ErrorMsg += "性别只能为男或女。<br />"; break;
                }
            }
            #endregion

            #region 若无错误信息,则将该行数据添加至新的数据源,反之则保存错误信息
            if (string.IsNullOrEmpty(ErrorMsg))
            {
                XBase.Model.Office.CustManager.LinkManModel model = new XBase.Model.Office.CustManager.LinkManModel();
                model.CustNo = custNo;
                model.LinkType = Convert.ToInt32(typeName);
                model.LinkManName = row["ContactName"].ToString();
                model.Sex = sex;
                model.Important = Important;
                model.Age = row["Age"].ToString();
                model.Operation = row["Operation"].ToString();
                model.Company = row["Company"].ToString();
                model.Position = row["Position"].ToString();
                model.Department = row["Department"].ToString();
                model.WorkTel = row["WorkTel"].ToString();
                model.Fax = row["Fax"].ToString();
                model.Handset = row["Handset"].ToString();
                model.HomeTel = row["HomeTel"].ToString();
                model.MailAddress = row["MailAddress"].ToString();
                model.CreatedDate = DateTime.Now.ToString();
                model.Creator = UserInfo.EmployeeID.ToString();
                model.CanViewUser = UserInfo.EmployeeID.ToString() + ".";
                model.CompanyCD = UserInfo.CompanyCD;
                modelList.Add(model);
            }
            else
            {
                ErrorMsg = "第 " + index.ToString() + " 行中存在的错误:<br />" + ErrorMsg;
            }
            #endregion

            index++;
        }
        #endregion

        #region 添加数据
        if (string.IsNullOrEmpty(ErrorMsg))
        {
            try
            {
                bool res = CustomContactImportBus.ImportContact(modelList);
                if (res)
                    lblMsg.Text = "数据导入成功!";
                else
                    lblMsg.Text = "数据导入失败!";
            }
            catch (Exception ex)
            {
                lblMsg.Text = ex.ToString();
            }

        }
        else
        {
            lblMsg.Text = "数据导入失败,原因如下:<br />" + ErrorMsg;
        }

        #endregion


    }
Ejemplo n.º 3
0
        /// <summary>
        /// 增加客户信息的方法
        /// </summary>
        /// <param name="CustModel">客户信息Model</param>
        /// <returns>bool值</returns>
        public static bool CustInfoAdd(CustInfoModel CustModel,LinkManModel LinkManM, Hashtable htExtAttr)
        {
            UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"];
            LogInfoModel logModel = new LogInfoModel(); //操作日志
            bool isSucc = false;//定义返回变量

            #region 设置操作日志内容
            //设置公司代码
            logModel.CompanyCD = userInfo.CompanyCD;
            //设置登陆用户ID
            logModel.UserID = userInfo.UserID;
            //设置模块ID 模块ID在ConstUtil中定义,以便维护
            logModel.ModuleID = ConstUtil.MODULE_ID_CUST_INFO_ADD;
            //操作单据编号 客户编号
            logModel.ObjectID = CustModel.CustNo;            
            //操作对象 操作的表信息
            logModel.ObjectName = ConstUtil.TABLE_NAME_CUST;
            //涉及关键元素 涉及其他业务、表关系
            logModel.Element = string.Empty;
            //备注 操作类型
            logModel.Remark = ConstUtil.LOG_PROCESS_INSERT;
            #endregion

            try
            {
                //if (CustModel.CustBig == "2")//会员客户时,添加到2个表中
                //{

                //}
                //else
                //{
                isSucc = CustInfoDBHelper.CustInfoAdd(CustModel,LinkManM, htExtAttr);
                //}
                
            }
            catch (System.Exception ex)
            {
                #region  操作失败时记录日志到文件
                //定义变量
                LogInfo logSys = new LogInfo();
                //设置日志类型 需要指定为系统日志
                logSys.Type = LogInfo.LogType.SYSTEM;
                //指定系统日志类型 出错信息
                logSys.SystemKind = LogInfo.SystemLogKind.SYSTEM_ERROR;
                //指定登陆用户信息
                logSys.UserInfo = userInfo;
                //设定模块ID
                logSys.ModuleID = ConstUtil.MODULE_ID_CUST_INFO_ADD;
                //描述
                logSys.Description = ex.ToString();
                //输出日志
                LogUtil.WriteLog(logSys);
                #endregion
            }

            if (isSucc)//操作成功
            {
                logModel.Remark += "成功";
            }
            else//操作失败
            {
                logModel.Remark += "失败";
            }

            //记录日志
            LogDBHelper.InsertLog(logModel);

            return isSucc;
        }
    protected void btn_excel_Click(object sender, EventArgs e)
    {
        string ErrorMsg = string.Empty;

        #region   文件包含验证
        /*获取公司的上传路径*/
        string FileUrl = XBase.Business.Office.SupplyChain.ProductInfoBus.GetCompanyUpFilePath(UserInfo.CompanyCD);



        /*验证该公司路径是否存在 不存在则创建*/
        DirectoryInfo dir = new DirectoryInfo(FileUrl);
        if (!dir.Exists)
        {
            try
            {
                dir.Create();
            }
            catch (Exception ex)
            {
                lblMsg.Text = ex.ToString();
                return;
            }
        }
        /*验证是否选择了文件*/
        if (string.IsNullOrEmpty(fileExportExcel.PostedFile.FileName))
        {
            lblMsg.Text = "请选择需要导入的Excel文件";
            return;
        }

        /*验证文件类型*/
        string FileExtension = fileExportExcel.PostedFile.FileName.Split('.')[1].ToUpper();
        if (FileExtension != "XLS" && FileExtension != "XLSX")
        {
            lblMsg.Text = "文件类型错误,请上传正确的Excel文件";
            return;
        }

        /*上传文件*/
        string FileName   = Guid.NewGuid().ToString() + "." + FileExtension.ToLower();
        string FileNewUrl = FileUrl + "\\" + FileName;
        try
        {
            fileExportExcel.PostedFile.SaveAs(FileNewUrl);
        }
        catch (Exception ex)
        {
            lblMsg.Text = ex.ToString();
            return;
        }

        #endregion

        #region 将Excel转换为DataTable
        /*将Excel转换成DataTable*/
        System.Data.DataTable dt = ExcelToDataTable(FileNewUrl);

        /*验证Excel是否为空*/
        if (dt == null || dt.Rows.Count <= 0)
        {
            lblMsg.Text = "Excel文件为空,请重新上传Excel文件";
            try
            {
                //删除上传的Excel文件
                DelExcel(FileNewUrl);
            }
            catch (Exception ex)
            {
                lblMsg.Text = ex.ToString();
                return;
            }
            return;
        }

        //转换成功,删除上传的Excel文件、
        try
        {
            DelExcel(FileNewUrl);
        }
        catch (Exception ex)
        {
            lblMsg.Text = ex.ToString();
        }


        #endregion

        #region 重新设置列名
        int m = 0;
        dt.Columns[m++].ColumnName = "CustName";
        dt.Columns[m++].ColumnName = "ContactName";
        dt.Columns[m++].ColumnName = "Sex";
        dt.Columns[m++].ColumnName = "Important";
        dt.Columns[m++].ColumnName = "TypeName";
        dt.Columns[m++].ColumnName = "Age";
        dt.Columns[m++].ColumnName = "Operation";
        dt.Columns[m++].ColumnName = "Company";
        dt.Columns[m++].ColumnName = "Position";
        dt.Columns[m++].ColumnName = "Department";
        dt.Columns[m++].ColumnName = "WorkTel";
        dt.Columns[m++].ColumnName = "Handset";
        dt.Columns[m++].ColumnName = "Fax";
        dt.Columns[m++].ColumnName = "HomeTel";
        dt.Columns[m++].ColumnName = "MailAddress";
        #endregion

        #region 重新构造数据源
        //DataTable dtNew = new DataTable();
        //dtNew.Columns.Add(new DataColumn("custNo", typeof(string)));
        //dtNew.Columns.Add(new DataColumn("LinkType", typeof(string)));
        //dtNew.Columns.Add(new DataColumn("LinkManName", typeof(string)));
        //dtNew.Columns.Add(new DataColumn("Sex", typeof(string)));
        //dtNew.Columns.Add(new DataColumn("Important", typeof(string)));
        //dtNew.Columns.Add(new DataColumn("Age", typeof(string)));
        //dtNew.Columns.Add(new DataColumn("Operation", typeof(string)));
        //dtNew.Columns.Add(new DataColumn("Company", typeof(string)));
        //dtNew.Columns.Add(new DataColumn("Position", typeof(string)));
        //dtNew.Columns.Add(new DataColumn("Department", typeof(string)));
        //dtNew.Columns.Add(new DataColumn("WorkTel", typeof(string)));
        //dtNew.Columns.Add(new DataColumn("Fax", typeof(string)));
        //dtNew.Columns.Add(new DataColumn("Handset", typeof(string)));
        //dtNew.Columns.Add(new DataColumn("HomeTel", typeof(string)));
        //dtNew.Columns.Add(new DataColumn("MailAddress", typeof(string)));
        #endregion

        #region 数据验证,并重新构造实体列表
        List <XBase.Model.Office.CustManager.LinkManModel> modelList = new List <XBase.Model.Office.CustManager.LinkManModel>();
        int index = 2;
        foreach (DataRow row in dt.Rows)
        {
            #region 对应客户验证
            string custNo = string.Empty;
            if (string.IsNullOrEmpty(row["CustName"].ToString()))
            {
                ErrorMsg += "对应客户不能为空。<br />";
            }
            else
            {
                custNo = CustomContactImportBus.CustomExists(UserInfo.CompanyCD, row["CustName"].ToString());
                if (string.IsNullOrEmpty(custNo))
                {
                    ErrorMsg += "所填写的客户在系统中不存在。<br />";
                }
            }
            #endregion

            #region 验证联系人姓名
            if (string.IsNullOrEmpty(row["ContactName"].ToString()))
            {
                ErrorMsg += "联系人姓名不能为空。<br />";
            }
            #endregion

            #region 验证联系人类型
            string typeName = string.Empty;
            if (!string.IsNullOrEmpty(row["TypeName"].ToString()))
            {
                typeName = CustomContactImportBus.ContactExists(UserInfo.CompanyCD, row["TypeName"].ToString());
                if (string.IsNullOrEmpty(typeName))
                {
                    ErrorMsg += "所填写的联系人类型在系统中不存在。<br />";
                }
            }
            else
            {
                typeName = "0";
            }
            #endregion

            #region 客户重要程度
            string Important = "0";
            if (!string.IsNullOrEmpty(row["Important"].ToString()))
            {
                switch (row["Important"].ToString())
                {
                case "": Important = "0"; break;

                case "不重要": Important = "1"; break;

                case "普通": Important = "2"; break;

                case "重要": Important = "3"; break;

                case "关键": Important = "4"; break;

                default: ErrorMsg += "联系人重要程度不正确。<br />"; break;
                }
            }
            #endregion


            #region 性别
            string sex = string.Empty;
            if (string.IsNullOrEmpty(row["Sex"].ToString()))
            {
                ErrorMsg += "性别不能为空。<br />";
            }
            else
            {
                switch (row["Sex"].ToString())
                {
                case "男": sex = "1"; break;

                case "女": sex = "2"; break;

                default: ErrorMsg += "性别只能为男或女。<br />"; break;
                }
            }
            #endregion

            #region 若无错误信息,则将该行数据添加至新的数据源,反之则保存错误信息
            if (string.IsNullOrEmpty(ErrorMsg))
            {
                XBase.Model.Office.CustManager.LinkManModel model = new XBase.Model.Office.CustManager.LinkManModel();
                model.CustNo      = custNo;
                model.LinkType    = Convert.ToInt32(typeName);
                model.LinkManName = row["ContactName"].ToString();
                model.Sex         = sex;
                model.Important   = Important;
                model.Age         = row["Age"].ToString();
                model.Operation   = row["Operation"].ToString();
                model.Company     = row["Company"].ToString();
                model.Position    = row["Position"].ToString();
                model.Department  = row["Department"].ToString();
                model.WorkTel     = row["WorkTel"].ToString();
                model.Fax         = row["Fax"].ToString();
                model.Handset     = row["Handset"].ToString();
                model.HomeTel     = row["HomeTel"].ToString();
                model.MailAddress = row["MailAddress"].ToString();
                model.CreatedDate = DateTime.Now.ToString();
                model.Creator     = UserInfo.EmployeeID.ToString();
                model.CanViewUser = UserInfo.EmployeeID.ToString() + ".";
                model.CompanyCD   = UserInfo.CompanyCD;
                modelList.Add(model);
            }
            else
            {
                ErrorMsg = "第 " + index.ToString() + " 行中存在的错误:<br />" + ErrorMsg;
            }
            #endregion

            index++;
        }
        #endregion

        #region 添加数据
        if (string.IsNullOrEmpty(ErrorMsg))
        {
            try
            {
                bool res = CustomContactImportBus.ImportContact(modelList);
                if (res)
                {
                    lblMsg.Text = "数据导入成功!";
                }
                else
                {
                    lblMsg.Text = "数据导入失败!";
                }
            }
            catch (Exception ex)
            {
                lblMsg.Text = ex.ToString();
            }
        }
        else
        {
            lblMsg.Text = "数据导入失败,原因如下:<br />" + ErrorMsg;
        }

        #endregion
    }
Ejemplo n.º 5
0
        /// <summary>
        /// 同时添加客户信息及联系人列表信息的方法
        /// </summary>
        /// <param name="CustInfoModel">客户信息Model</param>
        /// <param name="LinkManlist">联系人列表信息流</param>
        /// <returns>bool值</returns>
        public static bool AddCustAndLinkMan(CustInfoModel CustInfoModel, string LinkManlist)
        {
            try
            {
                #region 拼写添加客户信息SQL语句
                StringBuilder sql = new StringBuilder();
                sql.AppendLine("INSERT INTO officedba.CustInfo");
                sql.AppendLine("(CompanyCD");
                sql.AppendLine(",CustType");
                sql.AppendLine(",CustClass ");
                sql.AppendLine(",CustNo ");
                sql.AppendLine(",CustName ");
                sql.AppendLine(",CustNam ");
                sql.AppendLine(",CustShort ");
                sql.AppendLine(",CreditGrade ");
                sql.AppendLine(",Manager ");
                sql.AppendLine(",AreaID ");
                sql.AppendLine(",CustNote ");
                sql.AppendLine(",LinkCycle ");
                sql.AppendLine(",HotIs ");
                sql.AppendLine(",HotHow ");
                sql.AppendLine(",HotType ");
                sql.AppendLine(",MeritGrade ");
                sql.AppendLine(",RelaGrade ");
                sql.AppendLine(",Relation ");
                sql.AppendLine(",CompanyType ");
                sql.AppendLine(",StaffCount ");
                sql.AppendLine(",Source ");
                sql.AppendLine(",Phase ");
                sql.AppendLine(",CustSupe ");
                sql.AppendLine(",Trade ");
                sql.AppendLine(",SetupDate ");
                sql.AppendLine(",ArtiPerson ");
                sql.AppendLine(",SetupMoney ");
                sql.AppendLine(",SetupAddress ");
                sql.AppendLine(",CapitalScale ");
                sql.AppendLine(",SaleroomY ");
                sql.AppendLine(",ProfitY ");
                sql.AppendLine(",TaxCD ");
                sql.AppendLine(",BusiNumber ");
                sql.AppendLine(",IsTax ");
                sql.AppendLine(",SellMode ");
                sql.AppendLine(",SellArea ");
                sql.AppendLine(",CountryID ");
                sql.AppendLine(",Province ");
                sql.AppendLine(",City ");
                sql.AppendLine(",Tel ");
                sql.AppendLine(",ContactName ");
                sql.AppendLine(",Mobile ");
                sql.AppendLine(",ReceiveAddress ");
                sql.AppendLine(",WebSite ");
                sql.AppendLine(",Post ");
                sql.AppendLine(",email ");
                sql.AppendLine(",Fax ");
                sql.AppendLine(",OnLine ");
                sql.AppendLine(",TakeType ");
                sql.AppendLine(",CarryType ");
                sql.AppendLine(",BusiType ");
                sql.AppendLine(",BillType ");
                sql.AppendLine(",PayType ");
                sql.AppendLine(",MoneyType ");
                sql.AppendLine(",CurrencyType ");
                sql.AppendLine(",CreditManage ");
                sql.AppendLine(",MaxCredit ");
                sql.AppendLine(",MaxCreditDate ");
                //sql.AppendLine(",UpdateCredit ");
                sql.AppendLine(",UsedStatus ");
                sql.AppendLine(",Creator ");
                sql.AppendLine(",CreatedDate ");
                sql.AppendLine(",OpenBank ");
                sql.AppendLine(",AccountMan ");
                sql.AppendLine(",AccountNum ");
                sql.AppendLine(",Remark) ");
                sql.AppendLine(" values ");
                sql.AppendLine("(@CompanyCD");
                sql.AppendLine(",@CustType");
                sql.AppendLine(",@CustClass ");
                sql.AppendLine(",@CustNo ");
                sql.AppendLine(",@CustName ");
                sql.AppendLine(",@CustNam ");
                sql.AppendLine(",@CustShort ");
                sql.AppendLine(",@CreditGrade ");
                sql.AppendLine(",@Manager ");
                sql.AppendLine(",@AreaID ");
                sql.AppendLine(",@CustNote ");
                sql.AppendLine(",@LinkCycle ");
                sql.AppendLine(",@HotIs ");
                sql.AppendLine(",@HotHow ");
                sql.AppendLine(",@HotType ");
                sql.AppendLine(",@MeritGrade ");
                sql.AppendLine(",@RelaGrade ");
                sql.AppendLine(",@Relation ");
                sql.AppendLine(",@CompanyType ");
                sql.AppendLine(",@StaffCount ");
                sql.AppendLine(",@Source ");
                sql.AppendLine(",@Phase ");
                sql.AppendLine(",@CustSupe ");
                sql.AppendLine(",@Trade ");
                sql.AppendLine(",@SetupDate ");
                sql.AppendLine(",@ArtiPerson ");
                sql.AppendLine(",@SetupMoney ");
                sql.AppendLine(",@SetupAddress ");
                sql.AppendLine(",@CapitalScale ");
                sql.AppendLine(",@SaleroomY ");
                sql.AppendLine(",@ProfitY ");
                sql.AppendLine(",@TaxCD ");
                sql.AppendLine(",@BusiNumber ");
                sql.AppendLine(",@IsTax ");
                sql.AppendLine(",@SellMode ");
                sql.AppendLine(",@SellArea ");
                sql.AppendLine(",@CountryID ");
                sql.AppendLine(",@Province ");
                sql.AppendLine(",@City ");
                sql.AppendLine(",@Tel ");
                sql.AppendLine(",@ContactName ");
                sql.AppendLine(",@Mobile ");
                sql.AppendLine(",@ReceiveAddress ");
                sql.AppendLine(",@WebSite ");
                sql.AppendLine(",@Post ");
                sql.AppendLine(",@email ");
                sql.AppendLine(",@Fax ");
                sql.AppendLine(",@OnLine ");
                sql.AppendLine(",@TakeType ");
                sql.AppendLine(",@CarryType ");
                sql.AppendLine(",@BusiType ");
                sql.AppendLine(",@BillType ");
                sql.AppendLine(",@PayType ");
                sql.AppendLine(",@MoneyType ");
                sql.AppendLine(",@CurrencyType ");
                sql.AppendLine(",@CreditManage ");
                sql.AppendLine(",@MaxCredit ");
                sql.AppendLine(",@MaxCreditDate ");
                //sql.AppendLine(",@UpdateCredit ");
                sql.AppendLine(",@UsedStatus ");
                sql.AppendLine(",@Creator ");
                sql.AppendLine(",@CreatedDate ");
                sql.AppendLine(",@OpenBank ");
                sql.AppendLine(",@AccountMan ");
                sql.AppendLine(",@AccountNum ");
                sql.AppendLine(",@Remark) ");
                #endregion

                #region 设置添加客户信息参数
                SqlParameter[] param = new SqlParameter[65];
                param[0] = SqlHelper.GetParameter("@CompanyCD", CustInfoModel.CompanyCD);
                param[1] = SqlHelper.GetParameter("@CustType", CustInfoModel.CustType);
                param[2] = SqlHelper.GetParameter("@CustClass", CustInfoModel.CustClass);
                param[3] = SqlHelper.GetParameter("@CustNo", CustInfoModel.CustNo);
                param[4] = SqlHelper.GetParameter("@CustName", CustInfoModel.CustName);
                param[5] = SqlHelper.GetParameter("@CustNam", CustInfoModel.CustNam);
                param[6] = SqlHelper.GetParameter("@CustShort", CustInfoModel.CustShort);
                param[7] = SqlHelper.GetParameter("@CreditGrade", CustInfoModel.CreditGrade);
                param[8] = SqlHelper.GetParameter("@Manager", CustInfoModel.Seller);
                param[9] = SqlHelper.GetParameter("@AreaID", CustInfoModel.AreaID);
                param[10] = SqlHelper.GetParameter("@CustNote", CustInfoModel.CustNote);
                param[11] = SqlHelper.GetParameter("@LinkCycle", CustInfoModel.LinkCycle);
                param[12] = SqlHelper.GetParameter("@HotIs", CustInfoModel.HotIs);
                param[13] = SqlHelper.GetParameter("@HotHow", CustInfoModel.HotHow);
                param[14] = SqlHelper.GetParameter("@HotType", CustInfoModel.HotType);
                param[15] = SqlHelper.GetParameter("@MeritGrade", CustInfoModel.MeritGrade);
                param[16] = SqlHelper.GetParameter("@RelaGrade", CustInfoModel.RelaGrade);
                param[17] = SqlHelper.GetParameter("@Relation", CustInfoModel.Relation);
                param[18] = SqlHelper.GetParameter("@CompanyType", CustInfoModel.CompanyType);
                param[19] = SqlHelper.GetParameter("@StaffCount", CustInfoModel.StaffCount);
                param[20] = SqlHelper.GetParameter("@Source", CustInfoModel.Source);
                param[21] = SqlHelper.GetParameter("@Phase", CustInfoModel.Phase);
                param[22] = SqlHelper.GetParameter("@CustSupe", CustInfoModel.CustSupe);
                param[23] = SqlHelper.GetParameter("@Trade", CustInfoModel.Trade);
                param[24] = SqlHelper.GetParameter("@SetupDate", CustInfoModel.SetupDate == null
                                       ? SqlDateTime.Null
                                       : SqlDateTime.Parse(CustInfoModel.SetupDate.ToString()));
                param[25] = SqlHelper.GetParameter("@ArtiPerson", CustInfoModel.ArtiPerson);
                param[26] = SqlHelper.GetParameter("@SetupMoney", CustInfoModel.SetupMoney);
                param[27] = SqlHelper.GetParameter("@SetupAddress", CustInfoModel.SetupAddress);
                param[28] = SqlHelper.GetParameter("@CapitalScale", CustInfoModel.CapitalScale);
                param[29] = SqlHelper.GetParameter("@SaleroomY", CustInfoModel.SaleroomY);
                param[30] = SqlHelper.GetParameter("@ProfitY", CustInfoModel.ProfitY);
                param[31] = SqlHelper.GetParameter("@TaxCD", CustInfoModel.TaxCD);
                param[32] = SqlHelper.GetParameter("@BusiNumber", CustInfoModel.BusiNumber);
                param[33] = SqlHelper.GetParameter("@IsTax", CustInfoModel.IsTax);
                param[34] = SqlHelper.GetParameter("@SellMode", CustInfoModel.SellMode);
                param[35] = SqlHelper.GetParameter("@SellArea", CustInfoModel.SellArea);
                param[36] = SqlHelper.GetParameter("@CountryID", CustInfoModel.CountryID);
                param[37] = SqlHelper.GetParameter("@Province", CustInfoModel.Province);
                param[38] = SqlHelper.GetParameter("@City", CustInfoModel.City);
                param[39] = SqlHelper.GetParameter("@Tel", CustInfoModel.Tel);
                param[40] = SqlHelper.GetParameter("@ContactName", CustInfoModel.ContactName);
                param[41] = SqlHelper.GetParameter("@Mobile", CustInfoModel.Mobile);
                param[42] = SqlHelper.GetParameter("@ReceiveAddress", CustInfoModel.ReceiveAddress);
                param[43] = SqlHelper.GetParameter("@WebSite", CustInfoModel.WebSite);
                param[44] = SqlHelper.GetParameter("@Post", CustInfoModel.Post);
                param[45] = SqlHelper.GetParameter("@email", CustInfoModel.email);
                param[46] = SqlHelper.GetParameter("@Fax", CustInfoModel.Fax);
                param[47] = SqlHelper.GetParameter("@OnLine", CustInfoModel.OnLine);
                param[48] = SqlHelper.GetParameter("@TakeType", CustInfoModel.TakeType);
                param[49] = SqlHelper.GetParameter("@CarryType", CustInfoModel.CarryType);
                param[50] = SqlHelper.GetParameter("@BusiType", CustInfoModel.BusiType);
                param[51] = SqlHelper.GetParameter("@BillType", CustInfoModel.BillType);
                param[52] = SqlHelper.GetParameter("@PayType", CustInfoModel.PayType);
                param[53] = SqlHelper.GetParameter("@MoneyType", CustInfoModel.MoneyType);

                param[54] = SqlHelper.GetParameter("@CurrencyType", CustInfoModel.CurrencyType);
                param[55] = SqlHelper.GetParameter("@CreditManage", CustInfoModel.CreditManage);
                param[56] = SqlHelper.GetParameter("@MaxCredit", CustInfoModel.MaxCredit);
                param[57] = SqlHelper.GetParameter("@MaxCreditDate", CustInfoModel.MaxCreditDate);
                param[58] = SqlHelper.GetParameter("@UsedStatus", CustInfoModel.UsedStatus);
                param[59] = SqlHelper.GetParameter("@Creator", CustInfoModel.Creator);
                param[60] = SqlHelper.GetParameter("@CreatedDate", CustInfoModel.CreatedDate == null
                                                       ? SqlDateTime.Null
                                                       : SqlDateTime.Parse(CustInfoModel.CreatedDate.ToString()));
                param[61] = SqlHelper.GetParameter("@OpenBank", CustInfoModel.OpenBank);
                param[62] = SqlHelper.GetParameter("@AccountMan", CustInfoModel.AccountMan);
                param[63] = SqlHelper.GetParameter("@AccountNum", CustInfoModel.AccountNum);
                param[64] = SqlHelper.GetParameter("@Remark", CustInfoModel.Remark);
                #endregion

                LinkManModel LinkManM = new LinkManModel();
                string[] strlinkman = LinkManlist.Split('|'); //把联系人列表流分隔成数组
                SqlCommand[] comms = new SqlCommand[strlinkman.Length]; //申明cmd数组

                SqlCommand cmdcust = new SqlCommand(sql.ToString());  //未执行的客户信息添加命令
                cmdcust.Parameters.AddRange(param);
                comms[0] = cmdcust; //把未执行的客户信息添加命令给cmd数组第一项                

                string recorditems = "";
                string[] linkmanfield = null;

                for (int i = 1; i < strlinkman.Length; i++) //循环数组
                {
                    recorditems = strlinkman[i].ToString();//取到每一条记录:[序号,联系人姓名,手机,工作电话,职位,负责业务]
                    linkmanfield = recorditems.Split(','); //把每条记录分隔到字段

                    string fieldxh = linkmanfield[0].ToString();//序号
                    string fieldname = linkmanfield[1].ToString();//联系人姓名
                    string fieldhandset = linkmanfield[2].ToString();//手机
                    string fieldworktel = linkmanfield[3].ToString();//工作电话
                    string fieldposition = linkmanfield[4].ToString();//职务
                    string fieldoperation = linkmanfield[5].ToString();//负责业务

                    LinkManM.CompanyCD = CustInfoModel.CompanyCD; //联系人信息赋予一个LinkManM(联系人Model对象实例)
                    LinkManM.CustNo = CustInfoModel.CustNo;
                    LinkManM.LinkManName = fieldname;
                    LinkManM.Handset = fieldhandset;
                    LinkManM.WorkTel = fieldworktel;
                    LinkManM.Position = fieldposition;
                    LinkManM.Operation = fieldoperation;
                    LinkManM.ModifiedDate = DateTime.Now;
                    LinkManM.ModifiedUserID = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).UserID;//Session读取当前用户ID

                    #region 拼写添加联系人信息sql语句
                    StringBuilder sqllinkman = new StringBuilder();
                    sqllinkman.AppendLine("INSERT INTO officedba.CustLinkMan");
                    sqllinkman.AppendLine("(CompanyCD");
                    sqllinkman.AppendLine(",CustNo     ");
                    sqllinkman.AppendLine(",LinkManName");
                    sqllinkman.AppendLine(",Position   ");
                    sqllinkman.AppendLine(",Operation  ");
                    sqllinkman.AppendLine(",WorkTel    ");
                    sqllinkman.AppendLine(",Handset    ");
                    sqllinkman.AppendLine(",ModifiedDate");
                    sqllinkman.AppendLine(",ModifiedUserID)");
                    sqllinkman.AppendLine(" values ");
                    sqllinkman.AppendLine("(@CompanyCD");
                    sqllinkman.AppendLine(",@CustNo     ");
                    sqllinkman.AppendLine(",@LinkManName");
                    sqllinkman.AppendLine(",@Position   ");
                    sqllinkman.AppendLine(",@Operation  ");
                    sqllinkman.AppendLine(",@WorkTel    ");
                    sqllinkman.AppendLine(",@Handset    ");
                    sqllinkman.AppendLine(",@ModifiedDate");
                    sqllinkman.AppendLine(",@ModifiedUserID)");
                    #endregion

                    #region 设置参数
                    SqlParameter[] paramlinkman = new SqlParameter[9];
                    paramlinkman[0] = SqlHelper.GetParameter("@CompanyCD", CustInfoModel.CompanyCD);
                    paramlinkman[1] = SqlHelper.GetParameter("@CustNo", CustInfoModel.CustNo);
                    paramlinkman[2] = SqlHelper.GetParameter("@LinkManName", LinkManM.LinkManName);
                    paramlinkman[3] = SqlHelper.GetParameter("@Position", LinkManM.Position);
                    paramlinkman[4] = SqlHelper.GetParameter("@Operation", LinkManM.Operation);
                    paramlinkman[5] = SqlHelper.GetParameter("@WorkTel", LinkManM.WorkTel);
                    paramlinkman[6] = SqlHelper.GetParameter("@Handset", LinkManM.Handset);
                    paramlinkman[7] = SqlHelper.GetParameter("@ModifiedDate", LinkManM.ModifiedDate);
                    paramlinkman[8] = SqlHelper.GetParameter("@ModifiedUserID", LinkManM.ModifiedUserID);
                    #endregion

                    SqlCommand cmdlinkman = new SqlCommand(sqllinkman.ToString());  //未执行的联系人信息添加命令
                    cmdlinkman.Parameters.AddRange(paramlinkman);
                    comms[i] = cmdlinkman; //把未执行的联系人信息添加命令给cmd数组
                }

                //执行
                SqlHelper.ExecuteTransForList(comms);
                return SqlHelper.Result.OprateCount > 0 ? true : false;
            }
            catch
            {
                return false;
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 添加客户信息的方法
        /// </summary>
        /// <param name="CustInfoModel">客户信息</param>
        /// <returns>bool值</returns>
        public static bool CustInfoAdd(CustInfoModel CustInfoModel,LinkManModel LinkManM, Hashtable htExtAttr)
        {
            try
            {
                #region 拼写SQL语句
                StringBuilder sql = new StringBuilder();
                sql.AppendLine("INSERT INTO officedba.CustInfo");
                sql.AppendLine("(CompanyCD");
                sql.AppendLine(",CustTypeManage");
                sql.AppendLine(",CustTypeSell");
                sql.AppendLine(",CustTypeTime");
                sql.AppendLine(",CustType");
                sql.AppendLine(",CustClass ");
                sql.AppendLine(",CustNo ");
                sql.AppendLine(",CustName ");
                sql.AppendLine(",CustNam ");
                sql.AppendLine(",CustShort ");
                sql.AppendLine(",CreditGrade ");
                sql.AppendLine(",Manager ");
                sql.AppendLine(",AreaID ");
                sql.AppendLine(",CustNote ");
                sql.AppendLine(",LinkCycle ");
                sql.AppendLine(",HotIs ");
                sql.AppendLine(",HotHow ");
                sql.AppendLine(",MeritGrade ");
                sql.AppendLine(",RelaGrade ");
                sql.AppendLine(",Relation ");
                sql.AppendLine(",CompanyType ");
                sql.AppendLine(",StaffCount ");
                sql.AppendLine(",Source ");
                sql.AppendLine(",Phase ");
                sql.AppendLine(",CustSupe ");
                sql.AppendLine(",Trade ");
                sql.AppendLine(",SetupDate ");
                sql.AppendLine(",ArtiPerson ");
                sql.AppendLine(",SetupMoney ");
                sql.AppendLine(",SetupAddress ");
                sql.AppendLine(",CapitalScale ");
                sql.AppendLine(",SaleroomY ");
                sql.AppendLine(",ProfitY ");
                sql.AppendLine(",TaxCD ");
                sql.AppendLine(",BusiNumber ");
                sql.AppendLine(",IsTax ");
                sql.AppendLine(",SellMode ");
                sql.AppendLine(",SellArea ");
                sql.AppendLine(",CountryID ");
                sql.AppendLine(",Province ");
                sql.AppendLine(",City ");
                sql.AppendLine(",Tel ");
                sql.AppendLine(",ContactName ");
                sql.AppendLine(",Mobile ");
                sql.AppendLine(",ReceiveAddress ");
                sql.AppendLine(",WebSite ");
                sql.AppendLine(",Post ");
                sql.AppendLine(",email ");
                sql.AppendLine(",Fax ");
                sql.AppendLine(",OnLine ");
                sql.AppendLine(",TakeType ");
                sql.AppendLine(",CarryType ");
                sql.AppendLine(",BusiType ");
                sql.AppendLine(",BillType ");
                sql.AppendLine(",PayType ");
                sql.AppendLine(",MoneyType ");
                sql.AppendLine(",CurrencyType ");
                sql.AppendLine(",CreditManage ");
                sql.AppendLine(",MaxCredit ");
                sql.AppendLine(",MaxCreditDate ");
                sql.AppendLine(",UsedStatus ");

                sql.AppendLine(",CanViewUser ");
                sql.AppendLine(",CanViewUserName ");

                sql.AppendLine(",Creator ");
                sql.AppendLine(",CreatedDate ");
                sql.AppendLine(",FirstBuyDate ");
                sql.AppendLine(",OpenBank ");
                sql.AppendLine(",AccountMan ");
                sql.AppendLine(",AccountNum ");
                sql.AppendLine(",ModifiedUserID ");
                sql.AppendLine(",CompanyValues ");
                sql.AppendLine(",CatchWord ");
                sql.AppendLine(",ManageValues ");
                sql.AppendLine(",Potential ");
                sql.AppendLine(",Problem ");
                sql.AppendLine(",Advantages ");
                sql.AppendLine(",TradePosition ");
                sql.AppendLine(",Competition ");
                sql.AppendLine(",Collaborator ");
                sql.AppendLine(",ManagePlan ");
                sql.AppendLine(",Collaborate ");
                sql.AppendLine(",CustBig ");
                sql.AppendLine(",CustNum ");
                sql.AppendLine(",Remark) ");
                sql.AppendLine(" values ");
                sql.AppendLine("(@CompanyCD");
                sql.AppendLine(",@CustTypeManage");
                sql.AppendLine(",@CustTypeSell");
                sql.AppendLine(",@CustTypeTime");
                sql.AppendLine(",@CustType");
                sql.AppendLine(",@CustClass ");
                sql.AppendLine(",@CustNo ");
                sql.AppendLine(",@CustName ");
                sql.AppendLine(",@CustNam ");
                sql.AppendLine(",@CustShort ");
                sql.AppendLine(",@CreditGrade ");
                sql.AppendLine(",@Manager ");
                sql.AppendLine(",@AreaID ");
                sql.AppendLine(",@CustNote ");
                sql.AppendLine(",@LinkCycle ");
                sql.AppendLine(",@HotIs ");
                sql.AppendLine(",@HotHow ");
                sql.AppendLine(",@MeritGrade ");
                sql.AppendLine(",@RelaGrade ");
                sql.AppendLine(",@Relation ");
                sql.AppendLine(",@CompanyType ");
                sql.AppendLine(",@StaffCount ");
                sql.AppendLine(",@Source ");
                sql.AppendLine(",@Phase ");
                sql.AppendLine(",@CustSupe ");
                sql.AppendLine(",@Trade ");
                sql.AppendLine(",@SetupDate ");
                sql.AppendLine(",@ArtiPerson ");
                sql.AppendLine(",@SetupMoney ");
                sql.AppendLine(",@SetupAddress ");
                sql.AppendLine(",@CapitalScale ");
                sql.AppendLine(",@SaleroomY ");
                sql.AppendLine(",@ProfitY ");
                sql.AppendLine(",@TaxCD ");
                sql.AppendLine(",@BusiNumber ");
                sql.AppendLine(",@IsTax ");
                sql.AppendLine(",@SellMode ");
                sql.AppendLine(",@SellArea ");
                sql.AppendLine(",@CountryID ");
                sql.AppendLine(",@Province ");
                sql.AppendLine(",@City ");
                sql.AppendLine(",@Tel ");
                sql.AppendLine(",@ContactName ");
                sql.AppendLine(",@Mobile ");
                sql.AppendLine(",@ReceiveAddress ");
                sql.AppendLine(",@WebSite ");
                sql.AppendLine(",@Post ");
                sql.AppendLine(",@email ");
                sql.AppendLine(",@Fax ");
                sql.AppendLine(",@OnLine ");
                sql.AppendLine(",@TakeType ");
                sql.AppendLine(",@CarryType ");
                sql.AppendLine(",@BusiType ");
                sql.AppendLine(",@BillType ");
                sql.AppendLine(",@PayType ");
                sql.AppendLine(",@MoneyType ");
                sql.AppendLine(",@CurrencyType ");
                sql.AppendLine(",@CreditManage ");
                sql.AppendLine(",@MaxCredit ");
                sql.AppendLine(",@MaxCreditDate ");
                sql.AppendLine(",@UsedStatus ");

                sql.AppendLine(",@CanViewUser ");
                sql.AppendLine(",@CanViewUserName ");

                sql.AppendLine(",@Creator ");
                sql.AppendLine(",@CreatedDate ");
                sql.AppendLine(",@FirstBuyDate ");
                sql.AppendLine(",@OpenBank ");
                sql.AppendLine(",@AccountMan ");
                sql.AppendLine(",@AccountNum ");
                sql.AppendLine(",@ModifiedUserID ");

                sql.AppendLine(",@CompanyValues ");
                sql.AppendLine(",@CatchWord ");
                sql.AppendLine(",@ManageValues ");
                sql.AppendLine(",@Potential ");
                sql.AppendLine(",@Problem ");
                sql.AppendLine(",@Advantages ");
                sql.AppendLine(",@TradePosition ");
                sql.AppendLine(",@Competition ");
                sql.AppendLine(",@Collaborator ");
                sql.AppendLine(",@ManagePlan ");
                sql.AppendLine(",@Collaborate ");
                sql.AppendLine(",@CustBig ");
                sql.AppendLine(",@CustNum ");
                sql.AppendLine(",@Remark) ");
                #endregion

                #region 设置参数
                SqlCommand mycomm = new SqlCommand();
                mycomm.Parameters.Add(SqlHelper.GetParameter("@CompanyCD", CustInfoModel.CompanyCD));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@CustType", CustInfoModel.CustType));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@CustClass", CustInfoModel.CustClass));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@CustNo", CustInfoModel.CustNo));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@CustName", CustInfoModel.CustName));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@CustNam", CustInfoModel.CustNam));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@CustShort", CustInfoModel.CustShort));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@CreditGrade", CustInfoModel.CreditGrade));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@Manager", CustInfoModel.Seller));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@AreaID", CustInfoModel.AreaID));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@CustNote", CustInfoModel.CustNote));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@LinkCycle", CustInfoModel.LinkCycle));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@HotIs", CustInfoModel.HotIs));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@HotHow", CustInfoModel.HotHow));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@MeritGrade", CustInfoModel.MeritGrade));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@RelaGrade", CustInfoModel.RelaGrade));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@Relation", CustInfoModel.Relation));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@CompanyType", CustInfoModel.CompanyType));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@StaffCount", CustInfoModel.StaffCount));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@Source", CustInfoModel.Source));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@Phase", CustInfoModel.Phase));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@CustSupe", CustInfoModel.CustSupe));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@Trade", CustInfoModel.Trade));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@SetupDate", CustInfoModel.SetupDate == null
                                        ? SqlDateTime.Null
                                        : SqlDateTime.Parse(CustInfoModel.SetupDate.ToString())));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@ArtiPerson", CustInfoModel.ArtiPerson));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@SetupMoney", CustInfoModel.SetupMoney));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@SetupAddress", CustInfoModel.SetupAddress));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@CapitalScale", CustInfoModel.CapitalScale));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@SaleroomY", CustInfoModel.SaleroomY));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@ProfitY", CustInfoModel.ProfitY));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@TaxCD", CustInfoModel.TaxCD));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@BusiNumber", CustInfoModel.BusiNumber));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@IsTax", CustInfoModel.IsTax));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@SellMode", CustInfoModel.SellMode));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@SellArea", CustInfoModel.SellArea));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@CountryID", CustInfoModel.CountryID));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@Province", CustInfoModel.Province));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@City", CustInfoModel.City));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@Tel", CustInfoModel.Tel));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@ContactName", CustInfoModel.ContactName));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@Mobile", CustInfoModel.Mobile));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@ReceiveAddress", CustInfoModel.ReceiveAddress));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@WebSite", CustInfoModel.WebSite));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@Post", CustInfoModel.Post));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@email", CustInfoModel.email));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@Fax", CustInfoModel.Fax));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@OnLine", CustInfoModel.OnLine));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@TakeType", CustInfoModel.TakeType));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@CarryType", CustInfoModel.CarryType));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@BusiType", CustInfoModel.BusiType));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@BillType", CustInfoModel.BillType));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@PayType", CustInfoModel.PayType));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@MoneyType", CustInfoModel.MoneyType));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@CurrencyType", CustInfoModel.CurrencyType));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@CreditManage", CustInfoModel.CreditManage));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@MaxCredit", CustInfoModel.MaxCredit));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@MaxCreditDate", CustInfoModel.MaxCreditDate));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@UsedStatus", CustInfoModel.UsedStatus));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@Creator", CustInfoModel.Creator));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@CreatedDate", CustInfoModel.CreatedDate == null
                                                       ? SqlDateTime.Null
                                                       : SqlDateTime.Parse(CustInfoModel.CreatedDate.ToString())));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@OpenBank", CustInfoModel.OpenBank));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@AccountMan", CustInfoModel.AccountMan));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@AccountNum", CustInfoModel.AccountNum));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@CustBig", CustInfoModel.CustBig));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@CustNum", CustInfoModel.CustNum));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@Remark", CustInfoModel.Remark));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@CustTypeManage", CustInfoModel.CustTypeManage));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@CustTypeSell", CustInfoModel.CustTypeSell));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@CustTypeTime", CustInfoModel.CustTypeTime));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@FirstBuyDate", CustInfoModel.FirstBuyDate == null
                                                       ? SqlDateTime.Null
                                                       : SqlDateTime.Parse(CustInfoModel.FirstBuyDate.ToString())));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@ModifiedUserID", CustInfoModel.ModifiedUserID));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@CanViewUser", CustInfoModel.CanViewUser));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@CanViewUserName", CustInfoModel.CanViewUserName));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@CompanyValues", CustInfoModel.CompanyValues));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@CatchWord", CustInfoModel.CatchWord));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@ManageValues", CustInfoModel.ManageValues));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@Potential", CustInfoModel.Potential));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@Problem", CustInfoModel.Problem));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@Advantages", CustInfoModel.Advantages));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@TradePosition", CustInfoModel.TradePosition));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@Competition", CustInfoModel.Competition));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@Collaborator", CustInfoModel.Collaborator));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@ManagePlan", CustInfoModel.ManagePlan));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@Collaborate", CustInfoModel.Collaborate));
                mycomm.CommandText = sql.ToString();
                #endregion

                ArrayList lstCmd = new ArrayList();
                SqlCommand cmd = new SqlCommand();
                GetExtAttrCmd(CustInfoModel, htExtAttr, cmd);

                lstCmd.Add(mycomm);//基本信息
                if (htExtAttr != null)//扩展信息
                    lstCmd.Add(cmd);


                if (CustInfoModel.CustBig == "2")//当选择会员客户时,插入信息到联系人表
                {
                    SqlCommand cmdLinkMan = new SqlCommand();
                    StringBuilder sqlLinkMan = new StringBuilder();
                    sqlLinkMan.AppendLine(" insert into officedba.CustLinkMan ");
                    sqlLinkMan.AppendLine(" ( CompanyCD,CustNo,LinkManName,Sex,LinkType,PaperNum,Birthday,WorkTel,Handset,Fax,Position, ");
                    sqlLinkMan.AppendLine("   Important, ");
                    sqlLinkMan.AppendLine("   Age,Post,MailAddress,HomeTown,NationalID,CultureLevel,Professional,IncomeYear,FuoodDrink, ");
                    sqlLinkMan.AppendLine("   LoveMusic,LoveColor,LoveSmoke,LoveDrink,LoveTea,LoveBook,LoveSport,LoveClothes,Cosmetic, ");
                    sqlLinkMan.AppendLine("   Nature,Appearance,AdoutBody,AboutFamily,Car,CanViewUser,CanViewUserName,Creator,CreatedDate ) values ");
                    sqlLinkMan.AppendLine(" ( @CompanyCD,@CustNo,@LinkManName,@Sex,@LinkType,@PaperNum,@Birthday,@WorkTel,@Handset,@Fax,@Position, ");
                    sqlLinkMan.AppendLine("    '0',");
                    sqlLinkMan.AppendLine("   @Age,@Post,@MailAddress,@HomeTown,@NationalID,@CultureLevel,@Professional,@IncomeYear,@FuoodDrink, ");
                    sqlLinkMan.AppendLine("   @LoveMusic,@LoveColor,@LoveSmoke,@LoveDrink,@LoveTea,@LoveBook,@LoveSport,@LoveClothes,@Cosmetic, ");
                    sqlLinkMan.AppendLine("   @Nature,@Appearance,@AdoutBody,@AboutFamily,@Car,@CanViewUser,@CanViewUserName,@Creator,@CreatedDate ) ");

                    #region 设置联系人参数
                    SqlCommand commLinkMan = new SqlCommand();
                    commLinkMan.Parameters.Add(SqlHelper.GetParameter("@CompanyCD", CustInfoModel.CompanyCD));
                    commLinkMan.Parameters.Add(SqlHelper.GetParameter("@CustNo", CustInfoModel.CustNo));
                    commLinkMan.Parameters.Add(SqlHelper.GetParameter("@LinkManName", CustInfoModel.CustName));
                    commLinkMan.Parameters.Add(SqlHelper.GetParameter("@Sex", LinkManM.Sex));
                    commLinkMan.Parameters.Add(SqlHelper.GetParameter("@LinkType", LinkManM.LinkType));
                    commLinkMan.Parameters.Add(SqlHelper.GetParameter("@PaperNum", LinkManM.PaperNum));
                    commLinkMan.Parameters.Add(SqlHelper.GetParameter("@Birthday", LinkManM.Birthday == null ? SqlDateTime.Null : SqlDateTime.Parse(LinkManM.Birthday.ToString())));
                    commLinkMan.Parameters.Add(SqlHelper.GetParameter("@WorkTel", LinkManM.WorkTel));
                    commLinkMan.Parameters.Add(SqlHelper.GetParameter("@Handset", LinkManM.Handset));
                    commLinkMan.Parameters.Add(SqlHelper.GetParameter("@Fax", LinkManM.Fax));
                    commLinkMan.Parameters.Add(SqlHelper.GetParameter("@Position", LinkManM.Position));
                    commLinkMan.Parameters.Add(SqlHelper.GetParameter("@Age", LinkManM.Age));
                    commLinkMan.Parameters.Add(SqlHelper.GetParameter("@Post", LinkManM.Post));
                    commLinkMan.Parameters.Add(SqlHelper.GetParameter("@MailAddress", LinkManM.MailAddress));
                    commLinkMan.Parameters.Add(SqlHelper.GetParameter("@HomeTown", LinkManM.HomeTown));
                    commLinkMan.Parameters.Add(SqlHelper.GetParameter("@NationalID", LinkManM.NationalID));
                    commLinkMan.Parameters.Add(SqlHelper.GetParameter("@CultureLevel", LinkManM.CultureLevel));
                    commLinkMan.Parameters.Add(SqlHelper.GetParameter("@Professional", LinkManM.Professional));
                    commLinkMan.Parameters.Add(SqlHelper.GetParameter("@IncomeYear", LinkManM.IncomeYear));
                    commLinkMan.Parameters.Add(SqlHelper.GetParameter("@FuoodDrink", LinkManM.FuoodDrink));
                    commLinkMan.Parameters.Add(SqlHelper.GetParameter("@LoveMusic", LinkManM.LoveMusic));
                    commLinkMan.Parameters.Add(SqlHelper.GetParameter("@LoveColor", LinkManM.LoveColor));
                    commLinkMan.Parameters.Add(SqlHelper.GetParameter("@LoveSmoke", LinkManM.LoveSmoke));
                    commLinkMan.Parameters.Add(SqlHelper.GetParameter("@LoveDrink", LinkManM.LoveDrink));
                    commLinkMan.Parameters.Add(SqlHelper.GetParameter("@LoveTea", LinkManM.LoveTea));
                    commLinkMan.Parameters.Add(SqlHelper.GetParameter("@LoveBook", LinkManM.LoveBook));
                    commLinkMan.Parameters.Add(SqlHelper.GetParameter("@LoveSport", LinkManM.LoveSport));
                    commLinkMan.Parameters.Add(SqlHelper.GetParameter("@LoveClothes", LinkManM.LoveClothes));
                    commLinkMan.Parameters.Add(SqlHelper.GetParameter("@Cosmetic", LinkManM.Cosmetic));
                    commLinkMan.Parameters.Add(SqlHelper.GetParameter("@Nature", LinkManM.Nature));
                    commLinkMan.Parameters.Add(SqlHelper.GetParameter("@Appearance", LinkManM.Appearance));
                    commLinkMan.Parameters.Add(SqlHelper.GetParameter("@AdoutBody", LinkManM.AdoutBody));
                    commLinkMan.Parameters.Add(SqlHelper.GetParameter("@AboutFamily", LinkManM.AboutFamily));
                    commLinkMan.Parameters.Add(SqlHelper.GetParameter("@Car", LinkManM.Car));
                    commLinkMan.Parameters.Add(SqlHelper.GetParameter("@CanViewUser", CustInfoModel.CanViewUser));
                    commLinkMan.Parameters.Add(SqlHelper.GetParameter("@CanViewUserName", CustInfoModel.CanViewUserName));
                    commLinkMan.Parameters.Add(SqlHelper.GetParameter("@Creator", CustInfoModel.Creator));
                    commLinkMan.Parameters.Add(SqlHelper.GetParameter("@CreatedDate", CustInfoModel.CreatedDate == null
                                                       ? SqlDateTime.Null
                                                       : SqlDateTime.Parse(CustInfoModel.CreatedDate.ToString())));
                    commLinkMan.CommandText = sqlLinkMan.ToString();

                    #endregion

                    lstCmd.Add(commLinkMan);

                }

                //执行登陆操作
                bool isSucc = SqlHelper.ExecuteTransWithArrayList(lstCmd);

                return isSucc;
            }
            catch
            {
                return false;
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 同时修改客户信息及联系人列表信息的方法
        /// </summary>
        /// <param name="CustInfoModel">客户信息Model</param>
        /// <param name="LinkManlist">联系人列表信息流</param>
        /// <returns>bool值</returns>
        public static bool UpdateCustAndLinkMan(CustInfoModel CustInfoModel, string LinkManlist)
        {
            try
            {
                #region 拼写修改客户信息SQL语句
                StringBuilder sqlcust = new StringBuilder();
                sqlcust.AppendLine("UPDATE officedba.CustInfo set ");
                sqlcust.AppendLine("CompanyCD=           @CompanyCD, ");
                sqlcust.AppendLine("CustType=            @CustType, ");
                sqlcust.AppendLine("CustClass =          @CustClass , ");
                //sqlcust.AppendLine("CustNo =             @CustNo , ");        
                sqlcust.AppendLine("CustName =           @CustName , ");
                sqlcust.AppendLine("CustNam =            @CustNam , ");
                sqlcust.AppendLine("CustShort =          @CustShort , ");
                sqlcust.AppendLine("CreditGrade =        @CreditGrade , ");
                sqlcust.AppendLine("Manager =            @Manager , ");
                sqlcust.AppendLine("AreaID =             @AreaID , ");
                sqlcust.AppendLine("CustNote =           @CustNote , ");
                sqlcust.AppendLine("LinkCycle =          @LinkCycle , ");
                sqlcust.AppendLine("HotIs =              @HotIs , ");
                sqlcust.AppendLine("HotHow =             @HotHow , ");
                sqlcust.AppendLine("HotType =            @HotType , ");
                sqlcust.AppendLine("MeritGrade =         @MeritGrade , ");
                sqlcust.AppendLine("RelaGrade =          @RelaGrade , ");
                sqlcust.AppendLine("Relation =           @Relation , ");
                sqlcust.AppendLine("CompanyType =        @CompanyType , ");
                sqlcust.AppendLine("StaffCount =         @StaffCount , ");
                sqlcust.AppendLine("Source =             @Source , ");
                sqlcust.AppendLine("Phase =              @Phase , ");
                sqlcust.AppendLine("CustSupe =           @CustSupe , ");
                sqlcust.AppendLine("Trade =              @Trade , ");
                sqlcust.AppendLine("SetupDate =          @SetupDate , ");
                sqlcust.AppendLine("ArtiPerson =         @ArtiPerson , ");
                sqlcust.AppendLine("SetupMoney =         @SetupMoney , ");
                sqlcust.AppendLine("SetupAddress =       @SetupAddress , ");
                sqlcust.AppendLine("CapitalScale =       @CapitalScale , ");
                sqlcust.AppendLine("SaleroomY =          @SaleroomY , ");
                sqlcust.AppendLine("ProfitY =            @ProfitY , ");
                sqlcust.AppendLine("TaxCD =              @TaxCD , ");
                sqlcust.AppendLine("BusiNumber =         @BusiNumber , ");
                sqlcust.AppendLine("IsTax =              @IsTax , ");
                sqlcust.AppendLine("SellMode =           @SellMode , ");
                sqlcust.AppendLine("SellArea =           @SellArea , ");
                sqlcust.AppendLine("CountryID =          @CountryID , ");
                sqlcust.AppendLine("Province =           @Province , ");
                sqlcust.AppendLine("City =               @City , ");
                sqlcust.AppendLine("Tel =                @Tel , ");
                sqlcust.AppendLine("ContactName =        @ContactName , ");
                sqlcust.AppendLine("Mobile =             @Mobile , ");
                sqlcust.AppendLine("ReceiveAddress =     @ReceiveAddress , ");
                sqlcust.AppendLine("WebSite =            @WebSite , ");
                sqlcust.AppendLine("Post =               @Post , ");
                sqlcust.AppendLine("email =              @email , ");
                sqlcust.AppendLine("Fax =                @Fax , ");
                sqlcust.AppendLine("OnLine =             @OnLine , ");
                sqlcust.AppendLine("TakeType =           @TakeType , ");
                sqlcust.AppendLine("CarryType =          @CarryType , ");
                sqlcust.AppendLine("BusiType =           @BusiType , ");
                sqlcust.AppendLine("BillType =           @BillType , ");
                sqlcust.AppendLine("PayType =            @PayType , ");
                sqlcust.AppendLine("MoneyType =          @MoneyType , ");
                sqlcust.AppendLine("CurrencyType =       @CurrencyType , ");
                sqlcust.AppendLine("CreditManage =       @CreditManage , ");
                sqlcust.AppendLine("MaxCredit =          @MaxCredit , ");
                sqlcust.AppendLine("MaxCreditDate =      @MaxCreditDate , ");
                //sqlcust.AppendLine("UpdateCredit =       @UpdateCredit , ");
                sqlcust.AppendLine("UsedStatus =         @UsedStatus , ");
                sqlcust.AppendLine("Creator =            @Creator , ");
                sqlcust.AppendLine("CreatedDate =        @CreatedDate , ");
                sqlcust.AppendLine("OpenBank =        @OpenBank , ");
                sqlcust.AppendLine("AccountMan =        @AccountMan , ");
                sqlcust.AppendLine("AccountNum =        @AccountNum , ");
                sqlcust.AppendLine("Remark =            @Remark, ");
                sqlcust.AppendLine("CustBig =            @CustBig, ");
                sqlcust.AppendLine("CustNum =            @CustNum, ");
                sqlcust.AppendLine("ModifiedDate =       @ModifiedDate, ");
                sqlcust.AppendLine("ModifiedUserID =     @ModifiedUserID ");
                sqlcust.AppendLine(" WHERE ");
                sqlcust.AppendLine("CustNo = @CustNo ");
                #endregion

                #region 设置修改客户信息参数
                SqlParameter[] param = new SqlParameter[69];
                param[0] = SqlHelper.GetParameter("@CompanyCD", CustInfoModel.CompanyCD);
                param[1] = SqlHelper.GetParameter("@CustType", CustInfoModel.CustType);
                param[2] = SqlHelper.GetParameter("@CustClass", CustInfoModel.CustClass);
                param[3] = SqlHelper.GetParameter("@CustNo", CustInfoModel.CustNo);
                param[4] = SqlHelper.GetParameter("@CustName", CustInfoModel.CustName);
                param[5] = SqlHelper.GetParameter("@CustNam", CustInfoModel.CustNam);
                param[6] = SqlHelper.GetParameter("@CustShort", CustInfoModel.CustShort);
                param[7] = SqlHelper.GetParameter("@CreditGrade", CustInfoModel.CreditGrade);
                param[8] = SqlHelper.GetParameter("@Manager", CustInfoModel.Seller);
                param[9] = SqlHelper.GetParameter("@AreaID", CustInfoModel.AreaID);
                param[10] = SqlHelper.GetParameter("@CustNote", CustInfoModel.CustNote);
                param[11] = SqlHelper.GetParameter("@LinkCycle", CustInfoModel.LinkCycle);
                param[12] = SqlHelper.GetParameter("@HotIs", CustInfoModel.HotIs);
                param[13] = SqlHelper.GetParameter("@HotHow", CustInfoModel.HotHow);
                param[14] = SqlHelper.GetParameter("@HotType", CustInfoModel.HotType);
                param[15] = SqlHelper.GetParameter("@MeritGrade", CustInfoModel.MeritGrade);
                param[16] = SqlHelper.GetParameter("@RelaGrade", CustInfoModel.RelaGrade);
                param[17] = SqlHelper.GetParameter("@Relation", CustInfoModel.Relation);
                param[18] = SqlHelper.GetParameter("@CompanyType", CustInfoModel.CompanyType);
                param[19] = SqlHelper.GetParameter("@StaffCount", CustInfoModel.StaffCount);
                param[20] = SqlHelper.GetParameter("@Source", CustInfoModel.Source);
                param[21] = SqlHelper.GetParameter("@Phase", CustInfoModel.Phase);
                param[22] = SqlHelper.GetParameter("@CustSupe", CustInfoModel.CustSupe);
                param[23] = SqlHelper.GetParameter("@Trade", CustInfoModel.Trade);
                param[24] = SqlHelper.GetParameter("@SetupDate", CustInfoModel.SetupDate == null
                                        ? SqlDateTime.Null
                                        : SqlDateTime.Parse(CustInfoModel.SetupDate.ToString()));
                param[25] = SqlHelper.GetParameter("@ArtiPerson", CustInfoModel.ArtiPerson);
                param[26] = SqlHelper.GetParameter("@SetupMoney", CustInfoModel.SetupMoney);
                param[27] = SqlHelper.GetParameter("@SetupAddress", CustInfoModel.SetupAddress);
                param[28] = SqlHelper.GetParameter("@CapitalScale", CustInfoModel.CapitalScale);
                param[29] = SqlHelper.GetParameter("@SaleroomY", CustInfoModel.SaleroomY);
                param[30] = SqlHelper.GetParameter("@ProfitY", CustInfoModel.ProfitY);
                param[31] = SqlHelper.GetParameter("@TaxCD", CustInfoModel.TaxCD);
                param[32] = SqlHelper.GetParameter("@BusiNumber", CustInfoModel.BusiNumber);
                param[33] = SqlHelper.GetParameter("@IsTax", CustInfoModel.IsTax);
                param[34] = SqlHelper.GetParameter("@SellMode", CustInfoModel.SellMode);
                param[35] = SqlHelper.GetParameter("@SellArea", CustInfoModel.SellArea);
                param[36] = SqlHelper.GetParameter("@CountryID", CustInfoModel.CountryID);
                param[37] = SqlHelper.GetParameter("@Province", CustInfoModel.Province);
                param[38] = SqlHelper.GetParameter("@City", CustInfoModel.City);
                param[39] = SqlHelper.GetParameter("@Tel", CustInfoModel.Tel);
                param[40] = SqlHelper.GetParameter("@ContactName", CustInfoModel.ContactName);
                param[41] = SqlHelper.GetParameter("@Mobile", CustInfoModel.Mobile);
                param[42] = SqlHelper.GetParameter("@ReceiveAddress", CustInfoModel.ReceiveAddress);
                param[43] = SqlHelper.GetParameter("@WebSite", CustInfoModel.WebSite);
                param[44] = SqlHelper.GetParameter("@Post", CustInfoModel.Post);
                param[45] = SqlHelper.GetParameter("@email", CustInfoModel.email);
                param[46] = SqlHelper.GetParameter("@Fax", CustInfoModel.Fax);
                param[47] = SqlHelper.GetParameter("@OnLine", CustInfoModel.OnLine);
                param[48] = SqlHelper.GetParameter("@TakeType", CustInfoModel.TakeType);
                param[49] = SqlHelper.GetParameter("@CarryType", CustInfoModel.CarryType);
                param[50] = SqlHelper.GetParameter("@BusiType", CustInfoModel.BusiType);
                param[51] = SqlHelper.GetParameter("@BillType", CustInfoModel.BillType);
                param[52] = SqlHelper.GetParameter("@PayType", CustInfoModel.PayType);
                param[53] = SqlHelper.GetParameter("@MoneyType", CustInfoModel.MoneyType);
                param[54] = SqlHelper.GetParameter("@CurrencyType", CustInfoModel.CurrencyType);
                param[55] = SqlHelper.GetParameter("@CreditManage", CustInfoModel.CreditManage);
                param[56] = SqlHelper.GetParameter("@MaxCredit", CustInfoModel.MaxCredit);
                param[57] = SqlHelper.GetParameter("@MaxCreditDate", CustInfoModel.MaxCreditDate);
                param[58] = SqlHelper.GetParameter("@UsedStatus", CustInfoModel.UsedStatus);
                param[59] = SqlHelper.GetParameter("@Creator", CustInfoModel.Creator);
                param[60] = SqlHelper.GetParameter("@CreatedDate", CustInfoModel.CreatedDate == null
                                                       ? SqlDateTime.Null
                                                       : SqlDateTime.Parse(CustInfoModel.CreatedDate.ToString()));
                param[61] = SqlHelper.GetParameter("@OpenBank", CustInfoModel.OpenBank);
                param[62] = SqlHelper.GetParameter("@AccountMan", CustInfoModel.AccountMan);
                param[63] = SqlHelper.GetParameter("@AccountNum", CustInfoModel.AccountNum);
                param[64] = SqlHelper.GetParameter("@Remark", CustInfoModel.Remark);
                param[65] = SqlHelper.GetParameter("@ModifiedDate", DateTime.Now);
                param[66] = SqlHelper.GetParameter("@ModifiedUserID", ((UserInfoUtil)SessionUtil.Session["UserInfo"]).UserID);
                param[67] = SqlHelper.GetParameter("@CustBig", CustInfoModel.CustBig);
                param[68] = SqlHelper.GetParameter("@CustNum", CustInfoModel.CustNum);
                #endregion

                LinkManModel LinkManM = new LinkManModel();
                string[] strlinkman = LinkManlist.Split('|'); //把联系人列表流分隔成数组
                SqlCommand[] comms = new SqlCommand[strlinkman.Length + 1]; ; //申明cmd数组

                SqlCommand cmdcust = new SqlCommand(sqlcust.ToString());  //未执行的客户信息修改命令
                cmdcust.Parameters.AddRange(param);
                comms[0] = cmdcust; //把未执行的客户信息修改命令给cmd数组第一项

                //如果联系人信息不为空,执行删除及从表修改
                if (LinkManlist != "")
                {
                    //对于从表联系人信息先删除再添加
                    SqlCommand cmdlinkmandelete = new SqlCommand("delete officedba.CustLinkMan where CustNo = '" + CustInfoModel.CustNo + "'");
                    comms[1] = cmdlinkmandelete;
                    string recorditems = "";
                    string[] linkmanfield = null;

                    for (int i = 1; i < strlinkman.Length; i++) //循环数组
                    {
                        recorditems = strlinkman[i].ToString();//取到每一条记录:[序号,联系人姓名,手机,工作电话,职位,负责业务]
                        linkmanfield = recorditems.Split(','); //把每条记录分隔到字段

                        string fieldxh = linkmanfield[0].ToString();//序号
                        string fieldname = linkmanfield[1].ToString();//联系人姓名
                        string fieldhandset = linkmanfield[2].ToString();//手机
                        string fieldworktel = linkmanfield[3].ToString();//工作电话
                        string fieldposition = linkmanfield[4].ToString();//职务
                        string fieldoperation = linkmanfield[5].ToString();//负责业务

                        LinkManM.CompanyCD = CustInfoModel.CompanyCD; //联系人信息赋予一个LinkManM(联系人Model对象实例)
                        LinkManM.CustNo = CustInfoModel.CustNo;
                        LinkManM.LinkManName = fieldname;
                        LinkManM.Handset = fieldhandset;
                        LinkManM.WorkTel = fieldworktel;
                        LinkManM.Position = fieldposition;
                        LinkManM.Operation = fieldoperation;
                        LinkManM.ModifiedDate = DateTime.Now;
                        LinkManM.ModifiedUserID = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).UserID;//Session读取

                        #region 拼写添加联系人信息sql语句
                        StringBuilder sqllinkman = new StringBuilder();
                        sqllinkman.AppendLine("INSERT INTO officedba.CustLinkMan");
                        sqllinkman.AppendLine("(CompanyCD");
                        sqllinkman.AppendLine(",CustNo     ");
                        sqllinkman.AppendLine(",LinkManName");
                        sqllinkman.AppendLine(",Position   ");
                        sqllinkman.AppendLine(",Operation  ");
                        sqllinkman.AppendLine(",WorkTel    ");
                        sqllinkman.AppendLine(",Handset    ");
                        sqllinkman.AppendLine(",ModifiedDate");
                        sqllinkman.AppendLine(",ModifiedUserID)");
                        sqllinkman.AppendLine(" values ");
                        sqllinkman.AppendLine("(@CompanyCD");
                        sqllinkman.AppendLine(",@CustNo     ");
                        sqllinkman.AppendLine(",@LinkManName");
                        sqllinkman.AppendLine(",@Position   ");
                        sqllinkman.AppendLine(",@Operation  ");
                        sqllinkman.AppendLine(",@WorkTel    ");
                        sqllinkman.AppendLine(",@Handset    ");
                        sqllinkman.AppendLine(",@ModifiedDate");
                        sqllinkman.AppendLine(",@ModifiedUserID)");

                        SqlParameter[] paramlinkman = new SqlParameter[9];
                        paramlinkman[0] = SqlHelper.GetParameter("@CompanyCD", CustInfoModel.CompanyCD);
                        paramlinkman[1] = SqlHelper.GetParameter("@CustNo", CustInfoModel.CustNo);
                        paramlinkman[2] = SqlHelper.GetParameter("@LinkManName", LinkManM.LinkManName);
                        paramlinkman[3] = SqlHelper.GetParameter("@Position", LinkManM.Position);
                        paramlinkman[4] = SqlHelper.GetParameter("@Operation", LinkManM.Operation);
                        paramlinkman[5] = SqlHelper.GetParameter("@WorkTel", LinkManM.WorkTel);
                        paramlinkman[6] = SqlHelper.GetParameter("@Handset", LinkManM.Handset);
                        paramlinkman[7] = SqlHelper.GetParameter("@ModifiedDate", LinkManM.ModifiedDate);
                        paramlinkman[8] = SqlHelper.GetParameter("@ModifiedUserID", LinkManM.ModifiedUserID);
                        #endregion

                        SqlCommand cmdlinkman = new SqlCommand(sqllinkman.ToString());  //未执行的联系人信息添加命令
                        cmdlinkman.Parameters.AddRange(paramlinkman);
                        comms[i + 1] = cmdlinkman; //把未执行的联系人信息添加命令给cmd数组
                    }
                }
                //执行
                SqlHelper.ExecuteTransForList(comms);
                return SqlHelper.Result.OprateCount > 0 ? true : false;
            }
            catch 
            {
                return false;
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 根据客户编号修改客户信息的方法
        /// </summary>
        /// <param name="CustInfoModel">客户信息Model</param>
        /// <returns>bool值</returns>
        public static bool UpdateCustInfo(CustInfoModel CustInfoModel, LinkManModel LinkManM, Hashtable htExtAttr)
        {
            try
            {
                #region 拼写修改客户信息SQL语句
                StringBuilder sqlcust = new StringBuilder();
                sqlcust.AppendLine("UPDATE officedba.CustInfo set ");
                //sqlcust.AppendLine("CompanyCD=           @CompanyCD, ");
                sqlcust.AppendLine("CustTypeManage =           @CustTypeManage, ");
                sqlcust.AppendLine("CustTypeSell =           @CustTypeSell, ");
                sqlcust.AppendLine("CustTypeTime =           @CustTypeTime, ");
                sqlcust.AppendLine("CustType=            @CustType, ");
                sqlcust.AppendLine("CustClass =          @CustClass , ");
                sqlcust.AppendLine("CustName =           @CustName , ");
                sqlcust.AppendLine("CustNam =            @CustNam , ");
                sqlcust.AppendLine("CustShort =          @CustShort , ");
                sqlcust.AppendLine("CreditGrade =        @CreditGrade , ");
                sqlcust.AppendLine("Manager =            @Manager , ");
                sqlcust.AppendLine("AreaID =             @AreaID , ");
                sqlcust.AppendLine("CustNote =           @CustNote , ");
                sqlcust.AppendLine("LinkCycle =          @LinkCycle , ");
                sqlcust.AppendLine("HotIs =              @HotIs , ");
                sqlcust.AppendLine("HotHow =             @HotHow , ");
                sqlcust.AppendLine("MeritGrade =         @MeritGrade , ");
                sqlcust.AppendLine("RelaGrade =          @RelaGrade , ");
                sqlcust.AppendLine("Relation =           @Relation , ");
                sqlcust.AppendLine("CompanyType =        @CompanyType , ");
                sqlcust.AppendLine("StaffCount =         @StaffCount , ");
                sqlcust.AppendLine("Source =             @Source , ");
                sqlcust.AppendLine("Phase =              @Phase , ");
                sqlcust.AppendLine("CustSupe =           @CustSupe , ");
                sqlcust.AppendLine("Trade =              @Trade , ");
                sqlcust.AppendLine("SetupDate =          @SetupDate , ");
                sqlcust.AppendLine("ArtiPerson =         @ArtiPerson , ");
                sqlcust.AppendLine("SetupMoney =         @SetupMoney , ");
                sqlcust.AppendLine("SetupAddress =       @SetupAddress , ");
                sqlcust.AppendLine("CapitalScale =       @CapitalScale , ");
                sqlcust.AppendLine("SaleroomY =          @SaleroomY , ");
                sqlcust.AppendLine("ProfitY =            @ProfitY , ");
                sqlcust.AppendLine("TaxCD =              @TaxCD , ");
                sqlcust.AppendLine("BusiNumber =         @BusiNumber , ");
                sqlcust.AppendLine("IsTax =              @IsTax , ");
                sqlcust.AppendLine("SellMode =           @SellMode , ");
                sqlcust.AppendLine("SellArea =           @SellArea , ");
                sqlcust.AppendLine("CountryID =          @CountryID , ");
                sqlcust.AppendLine("Province =           @Province , ");
                sqlcust.AppendLine("City =               @City , ");
                sqlcust.AppendLine("Tel =                @Tel , ");
                sqlcust.AppendLine("ContactName =        @ContactName , ");
                sqlcust.AppendLine("Mobile =             @Mobile , ");
                sqlcust.AppendLine("ReceiveAddress =     @ReceiveAddress , ");
                sqlcust.AppendLine("WebSite =            @WebSite , ");
                sqlcust.AppendLine("Post =               @Post , ");
                sqlcust.AppendLine("email =              @email , ");
                sqlcust.AppendLine("Fax =                @Fax , ");
                sqlcust.AppendLine("OnLine =             @OnLine , ");
                sqlcust.AppendLine("TakeType =           @TakeType , ");
                sqlcust.AppendLine("CarryType =          @CarryType , ");
                sqlcust.AppendLine("BusiType =           @BusiType , ");
                sqlcust.AppendLine("BillType =           @BillType , ");
                sqlcust.AppendLine("PayType =            @PayType , ");
                sqlcust.AppendLine("MoneyType =          @MoneyType , ");
                sqlcust.AppendLine("CurrencyType =       @CurrencyType , ");
                sqlcust.AppendLine("CreditManage =       @CreditManage , ");
                sqlcust.AppendLine("MaxCredit =          @MaxCredit , ");
                sqlcust.AppendLine("MaxCreditDate =      @MaxCreditDate , ");
                sqlcust.AppendLine("UsedStatus =         @UsedStatus , ");
                sqlcust.AppendLine("CanViewUser =         @CanViewUser , ");
                sqlcust.AppendLine("CanViewUserName =         @CanViewUserName , ");
                sqlcust.AppendLine("FirstBuyDate =         @FirstBuyDate , ");
                sqlcust.AppendLine("CreatedDate =        @CreatedDate , ");
                sqlcust.AppendLine("OpenBank =             @OpenBank, ");
                sqlcust.AppendLine("AccountMan =             @AccountMan, ");
                sqlcust.AppendLine("AccountNum =             @AccountNum, ");
                sqlcust.AppendLine("CustBig =            @CustBig, ");
                sqlcust.AppendLine("CustNum =            @CustNum, ");
                sqlcust.AppendLine("Remark =             @Remark, ");
                sqlcust.AppendLine("ModifiedDate =       @ModifiedDate, ");
                sqlcust.AppendLine("CompanyValues =      @CompanyValues , ");
                sqlcust.AppendLine("CatchWord =         @CatchWord , ");
                sqlcust.AppendLine("ManageValues =         @ManageValues , ");
                sqlcust.AppendLine("Potential =         @Potential , ");
                sqlcust.AppendLine("Problem =         @Problem , ");
                sqlcust.AppendLine("Advantages =        @Advantages , ");
                sqlcust.AppendLine("TradePosition =             @TradePosition, ");
                sqlcust.AppendLine("Competition =             @Competition, ");
                sqlcust.AppendLine("Collaborator =             @Collaborator, ");
                sqlcust.AppendLine("ManagePlan =             @ManagePlan, ");
                sqlcust.AppendLine("Collaborate =       @Collaborate, ");
                sqlcust.AppendLine("ModifiedUserID =     @ModifiedUserID ");
                sqlcust.AppendLine(" WHERE ");
                sqlcust.AppendLine("CustNo = @CustNo and CompanyCD = @CompanyCD");
                #endregion

                #region 设置修改客户信息参数
                SqlCommand mycomm = new SqlCommand();
                mycomm.Parameters.Add(SqlHelper.GetParameter("@CompanyCD", CustInfoModel.CompanyCD));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@CustType", CustInfoModel.CustType));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@CustClass", CustInfoModel.CustClass));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@CustNo", CustInfoModel.CustNo));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@CustName", CustInfoModel.CustName));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@CustNam", CustInfoModel.CustNam));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@CustShort", CustInfoModel.CustShort));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@CreditGrade", CustInfoModel.CreditGrade));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@Manager", CustInfoModel.Seller));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@AreaID", CustInfoModel.AreaID));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@CustNote", CustInfoModel.CustNote));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@LinkCycle", CustInfoModel.LinkCycle));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@HotIs", CustInfoModel.HotIs));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@HotHow", CustInfoModel.HotHow));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@MeritGrade", CustInfoModel.MeritGrade));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@RelaGrade", CustInfoModel.RelaGrade));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@Relation", CustInfoModel.Relation));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@CompanyType", CustInfoModel.CompanyType));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@StaffCount", CustInfoModel.StaffCount));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@Source", CustInfoModel.Source));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@Phase", CustInfoModel.Phase));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@CustSupe", CustInfoModel.CustSupe));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@Trade", CustInfoModel.Trade));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@SetupDate", CustInfoModel.SetupDate == null
                                        ? SqlDateTime.Null
                                        : SqlDateTime.Parse(CustInfoModel.SetupDate.ToString())));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@ArtiPerson", CustInfoModel.ArtiPerson));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@SetupMoney", CustInfoModel.SetupMoney));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@SetupAddress", CustInfoModel.SetupAddress));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@CapitalScale", CustInfoModel.CapitalScale));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@SaleroomY", CustInfoModel.SaleroomY));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@ProfitY", CustInfoModel.ProfitY));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@TaxCD", CustInfoModel.TaxCD));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@BusiNumber", CustInfoModel.BusiNumber));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@IsTax", CustInfoModel.IsTax));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@SellMode", CustInfoModel.SellMode));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@SellArea", CustInfoModel.SellArea));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@CountryID", CustInfoModel.CountryID));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@Province", CustInfoModel.Province));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@City", CustInfoModel.City));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@Tel", CustInfoModel.Tel));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@ContactName", CustInfoModel.ContactName));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@Mobile", CustInfoModel.Mobile));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@ReceiveAddress", CustInfoModel.ReceiveAddress));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@WebSite", CustInfoModel.WebSite));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@Post", CustInfoModel.Post));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@email", CustInfoModel.email));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@Fax", CustInfoModel.Fax));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@OnLine", CustInfoModel.OnLine));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@TakeType", CustInfoModel.TakeType));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@CarryType", CustInfoModel.CarryType));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@BusiType", CustInfoModel.BusiType));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@BillType", CustInfoModel.BillType));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@PayType", CustInfoModel.PayType));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@MoneyType", CustInfoModel.MoneyType));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@CurrencyType", CustInfoModel.CurrencyType));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@CreditManage", CustInfoModel.CreditManage));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@MaxCredit", CustInfoModel.MaxCredit));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@MaxCreditDate", CustInfoModel.MaxCreditDate));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@UsedStatus", CustInfoModel.UsedStatus));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@Creator", CustInfoModel.Creator));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@CreatedDate", CustInfoModel.CreatedDate == null
                                                       ? SqlDateTime.Null
                                                       : SqlDateTime.Parse(CustInfoModel.CreatedDate.ToString())));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@OpenBank", CustInfoModel.OpenBank));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@AccountMan", CustInfoModel.AccountMan));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@AccountNum", CustInfoModel.AccountNum));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@CustBig", CustInfoModel.CustBig));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@CustNum", CustInfoModel.CustNum));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@Remark", CustInfoModel.Remark));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@CustTypeManage", CustInfoModel.CustTypeManage));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@CustTypeSell", CustInfoModel.CustTypeSell));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@CustTypeTime", CustInfoModel.CustTypeTime));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@FirstBuyDate", CustInfoModel.FirstBuyDate == null
                                                       ? SqlDateTime.Null
                                                       : SqlDateTime.Parse(CustInfoModel.FirstBuyDate.ToString())));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@ModifiedDate", DateTime.Now));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@ModifiedUserID", ((UserInfoUtil)SessionUtil.Session["UserInfo"]).UserID));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@CanViewUser", CustInfoModel.CanViewUser));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@CanViewUserName", CustInfoModel.CanViewUserName));

                mycomm.Parameters.Add(SqlHelper.GetParameter("@CompanyValues", CustInfoModel.CompanyValues));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@CatchWord", CustInfoModel.CatchWord));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@ManageValues", CustInfoModel.ManageValues));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@Potential", CustInfoModel.Potential));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@Problem", CustInfoModel.Problem));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@Advantages", CustInfoModel.Advantages));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@TradePosition", CustInfoModel.TradePosition));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@Competition", CustInfoModel.Competition));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@Collaborator", CustInfoModel.Collaborator));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@ManagePlan", CustInfoModel.ManagePlan));
                mycomm.Parameters.Add(SqlHelper.GetParameter("@Collaborate", CustInfoModel.Collaborate));
                mycomm.CommandText = sqlcust.ToString();
                #endregion

                ArrayList lstCmd = new ArrayList();
                SqlCommand cmd = new SqlCommand();
                GetExtAttrCmd(CustInfoModel, htExtAttr, cmd);

                lstCmd.Add(mycomm);//修改客户基本信息
                if (htExtAttr != null)
                    lstCmd.Add(cmd);//修改客户扩展信息

                if (CustInfoModel.CustBig == "2")//当选择会员客户时,修改信息到联系人表
                {
                    SqlCommand cmdLinkMan = new SqlCommand();
                    StringBuilder sqlLinkMan = new StringBuilder();
                    sqlLinkMan.AppendLine(" update officedba.CustLinkMan ");
                    sqlLinkMan.AppendLine(" set LinkManName=@LinkManName,Sex=@Sex,LinkType=@LinkType,PaperNum=@PaperNum,");
                    sqlLinkMan.AppendLine(" Birthday=@Birthday,WorkTel=@WorkTel,Handset=@Handset,Fax=@Fax,Position=@Position, ");
                    sqlLinkMan.AppendLine("   Age= @Age,Post=@Post,MailAddress=@MailAddress,HomeTown=@HomeTown,NationalID=@NationalID,CultureLevel=@CultureLevel,");
                    sqlLinkMan.AppendLine(" Professional=@Professional,IncomeYear=@IncomeYear,FuoodDrink=@FuoodDrink, ");
                    sqlLinkMan.AppendLine("   LoveMusic=@LoveMusic,LoveColor=@LoveColor,LoveSmoke=@LoveSmoke,LoveDrink=@LoveDrink,LoveTea=@LoveTea,");
                    sqlLinkMan.AppendLine(" LoveBook=@LoveBook,LoveSport=@LoveSport,LoveClothes=@LoveClothes,Cosmetic=@Cosmetic, ");
                    sqlLinkMan.AppendLine("   Nature=@Nature,Appearance=@Appearance,AdoutBody=@AdoutBody,AboutFamily=@AboutFamily,Car=@Car,");
                    sqlLinkMan.AppendLine(" CanViewUser=@CanViewUser,CanViewUserName=@CanViewUserName ");                    
                    sqlLinkMan.AppendLine(" WHERE ");
                    sqlLinkMan.AppendLine(" CustNo = @CustNo and CompanyCD = @CompanyCD ");
                    sqlLinkMan.AppendLine(" and id=(select min(c.id)id from officedba.CustLinkMan c ");
                    sqlLinkMan.AppendLine(" 			where c.CompanyCD = @CompanyCD and c.custno = @CustNo ) ");

                    #region 设置联系人参数
                    SqlCommand commLinkMan = new SqlCommand();
                    commLinkMan.Parameters.Add(SqlHelper.GetParameter("@CompanyCD", CustInfoModel.CompanyCD));
                    commLinkMan.Parameters.Add(SqlHelper.GetParameter("@CustNo", CustInfoModel.CustNo));
                    commLinkMan.Parameters.Add(SqlHelper.GetParameter("@LinkManName", CustInfoModel.CustName));
                    commLinkMan.Parameters.Add(SqlHelper.GetParameter("@Sex", LinkManM.Sex));
                    commLinkMan.Parameters.Add(SqlHelper.GetParameter("@LinkType", LinkManM.LinkType));
                    commLinkMan.Parameters.Add(SqlHelper.GetParameter("@PaperNum", LinkManM.PaperNum));
                    commLinkMan.Parameters.Add(SqlHelper.GetParameter("@Birthday", LinkManM.Birthday == null ? SqlDateTime.Null : SqlDateTime.Parse(LinkManM.Birthday.ToString())));
                    commLinkMan.Parameters.Add(SqlHelper.GetParameter("@WorkTel", LinkManM.WorkTel));
                    commLinkMan.Parameters.Add(SqlHelper.GetParameter("@Handset", LinkManM.Handset));
                    commLinkMan.Parameters.Add(SqlHelper.GetParameter("@Fax", LinkManM.Fax));
                    commLinkMan.Parameters.Add(SqlHelper.GetParameter("@Position", LinkManM.Position));
                    commLinkMan.Parameters.Add(SqlHelper.GetParameter("@Age", LinkManM.Age));
                    commLinkMan.Parameters.Add(SqlHelper.GetParameter("@Post", LinkManM.Post));
                    commLinkMan.Parameters.Add(SqlHelper.GetParameter("@MailAddress", LinkManM.MailAddress));
                    commLinkMan.Parameters.Add(SqlHelper.GetParameter("@HomeTown", LinkManM.HomeTown));
                    commLinkMan.Parameters.Add(SqlHelper.GetParameter("@NationalID", LinkManM.NationalID));
                    commLinkMan.Parameters.Add(SqlHelper.GetParameter("@CultureLevel", LinkManM.CultureLevel));
                    commLinkMan.Parameters.Add(SqlHelper.GetParameter("@Professional", LinkManM.Professional));
                    commLinkMan.Parameters.Add(SqlHelper.GetParameter("@IncomeYear", LinkManM.IncomeYear));
                    commLinkMan.Parameters.Add(SqlHelper.GetParameter("@FuoodDrink", LinkManM.FuoodDrink));
                    commLinkMan.Parameters.Add(SqlHelper.GetParameter("@LoveMusic", LinkManM.LoveMusic));
                    commLinkMan.Parameters.Add(SqlHelper.GetParameter("@LoveColor", LinkManM.LoveColor));
                    commLinkMan.Parameters.Add(SqlHelper.GetParameter("@LoveSmoke", LinkManM.LoveSmoke));
                    commLinkMan.Parameters.Add(SqlHelper.GetParameter("@LoveDrink", LinkManM.LoveDrink));
                    commLinkMan.Parameters.Add(SqlHelper.GetParameter("@LoveTea", LinkManM.LoveTea));
                    commLinkMan.Parameters.Add(SqlHelper.GetParameter("@LoveBook", LinkManM.LoveBook));
                    commLinkMan.Parameters.Add(SqlHelper.GetParameter("@LoveSport", LinkManM.LoveSport));
                    commLinkMan.Parameters.Add(SqlHelper.GetParameter("@LoveClothes", LinkManM.LoveClothes));
                    commLinkMan.Parameters.Add(SqlHelper.GetParameter("@Cosmetic", LinkManM.Cosmetic));
                    commLinkMan.Parameters.Add(SqlHelper.GetParameter("@Nature", LinkManM.Nature));
                    commLinkMan.Parameters.Add(SqlHelper.GetParameter("@Appearance", LinkManM.Appearance));
                    commLinkMan.Parameters.Add(SqlHelper.GetParameter("@AdoutBody", LinkManM.AdoutBody));
                    commLinkMan.Parameters.Add(SqlHelper.GetParameter("@AboutFamily", LinkManM.AboutFamily));
                    commLinkMan.Parameters.Add(SqlHelper.GetParameter("@Car", LinkManM.Car));
                    commLinkMan.Parameters.Add(SqlHelper.GetParameter("@CanViewUser", CustInfoModel.CanViewUser));
                    commLinkMan.Parameters.Add(SqlHelper.GetParameter("@CanViewUserName", CustInfoModel.CanViewUserName));
                    commLinkMan.CommandText = sqlLinkMan.ToString();

                    #endregion

                    lstCmd.Add(commLinkMan);

                }

                //执行登陆操作
                bool isSucc = SqlHelper.ExecuteTransWithArrayList(lstCmd);

                return isSucc;
            }
            catch
            {
                return false;
            }
        }
Ejemplo n.º 9
0
        /// <summary>
        /// 导出联系人列表
        /// </summary>
        /// <param name="CustNam"></param>
        /// <param name="LinkManM"></param>
        /// <param name="BeginDate"></param>
        /// <param name="EndDate"></param>
        /// <param name="ord"></param>
        /// <returns></returns>
        public static DataTable ExportLinkManInfo(string CustNam, LinkManModel LinkManM, string BeginDate, string EndDate, string ord)
        {
            try
            {
                string sql = "select " +
                                   "link.id,isnull(cust.id,'-1') custid,isnull(link.linkmanname,'') linkmanname,isnull(link.Appellation,'') Appellation," +
                                   "(case link.Important when '1' then '不重要' when '2' then '普通' when '3' then '重要' when '4' then '关键' else '' end) Important," +
                                   "isnull(cust.CustName,'') CustName,isnull(link.WorkTel,'') WorkTel,isnull(link.Handset,'') Handset," +
                                   "isnull(link.QQ,'') QQ,isnull(cp.TypeName,'') TypeName,Convert(varchar(100),link.Birthday,23) Birthday " +
                              " from " +
                                  " officedba.custlinkman link" +
                                  " left join officedba.custinfo cust on cust.custno = link.custno " +
                                  " left join officedba.CodePublicType cp on cp.id = link.LinkType " +
                              " where link.companycd = '" + LinkManM.CompanyCD + "'" +
                              " and (link.CanViewUser like '%" + "," + LinkManM.CanViewUser + "," + "%' or '" + LinkManM.CanViewUser + "' = link.Creator or link.CanViewUser = '******')";

                if (CustNam != "")
                    sql += " and cust.id = '" + CustNam + "'";
                if (LinkManM.LinkManName != "")
                    sql += " and LinkManName like '%" + LinkManM.LinkManName + "%'";
                if (LinkManM.Handset != "")
                    sql += " and Handset like '%" + LinkManM.Handset + "%'";
                if (LinkManM.WorkTel != "")
                    sql += " and WorkTel like '%" + LinkManM.WorkTel + "%'";
                if (LinkManM.Important != "0")
                    sql += " and Important = '" + LinkManM.Important + "'";
                if (LinkManM.LinkType != 0)
                    sql += " and link.LinkType = '" + LinkManM.LinkType + "'";
                if (BeginDate.ToString() != "")
                    sql += " and link.Birthday >= '" + BeginDate.ToString() + "'";//sql += " and (link.Birthday >= '" + BeginDate.ToString() + "' or link.Birthday is null)";
                if (EndDate.ToString() != "")
                    sql += " and link.Birthday <= '" + EndDate.ToString() + "'";//sql += " and (link.Birthday <= '" + EndDate.ToString() + "' or link.Birthday is null)";

                return SqlHelper.ExecuteSql(sql);
            }
            catch (Exception ex)
            {
                string sss = ex.Message;
                return null;
            }
        }
Ejemplo n.º 10
0
        /// <summary>
        /// 添加客户联系人的方法
        /// </summary>
        /// <param name="LinkManModel">联系人信息</param>
        /// <returns>bool值</returns>
        public static int LinkManAdd(LinkManModel LinkManModel)
        {
            try
            {
                #region 拼写SQL语句
                StringBuilder sql = new StringBuilder();
                sql.AppendLine("INSERT INTO officedba.CustLinkMan");
                sql.AppendLine("(CompanyCD");
                sql.AppendLine(",CustNo     ");
                sql.AppendLine(",LinkManName");
                sql.AppendLine(",Sex        ");
                sql.AppendLine(",Important  ");
                sql.AppendLine(",Company    ");
                sql.AppendLine(",Appellation");
                sql.AppendLine(",Department ");
                sql.AppendLine(",Position   ");
                sql.AppendLine(",Operation  ");
                sql.AppendLine(",WorkTel    ");
                sql.AppendLine(",Fax        ");
                sql.AppendLine(",Handset    ");
                sql.AppendLine(",MailAddress");
                sql.AppendLine(",HomeTel    ");
                sql.AppendLine(",MSN        ");
                sql.AppendLine(",QQ         ");
                sql.AppendLine(",Post       ");
                sql.AppendLine(",HomeAddress");
                sql.AppendLine(",Remark     ");
                sql.AppendLine(",Age        ");
                sql.AppendLine(",Likes      ");
                sql.AppendLine(",LinkType   ");
                sql.AppendLine(",Birthday   ");
                sql.AppendLine(",PaperType  ");
                sql.AppendLine(",PaperNum   ");
                sql.AppendLine(",Photo");
                sql.AppendLine(",Creator     ");
                sql.AppendLine(",CreatedDate     ");
                sql.AppendLine(",CanViewUser     ");
                sql.AppendLine(",CanViewUserName     ");
                sql.AppendLine(",ModifiedDate");

                sql.AppendLine(",HomeTown");
                if (!string.IsNullOrEmpty(LinkManModel.NationalID))
                {
                    sql.AppendLine(",NationalID");
                }
                sql.AppendLine(",Birthcity");
                if (!string.IsNullOrEmpty(LinkManModel.CultureLevel))
                {
                    sql.AppendLine(",CultureLevel");
                }
                if (!string.IsNullOrEmpty(LinkManModel.Professional))
                {
                    sql.AppendLine(",Professional");
                }
                sql.AppendLine(",GraduateSchool");
                sql.AppendLine(",IncomeYear");
                sql.AppendLine(",FuoodDrink");
                sql.AppendLine(",LoveMusic");
                sql.AppendLine(",LoveColor");
                sql.AppendLine(",LoveSmoke");
                sql.AppendLine(",LoveDrink");
                sql.AppendLine(",LoveTea");
                sql.AppendLine(",LoveBook");
                sql.AppendLine(",LoveSport");
                sql.AppendLine(",LoveClothes");
                sql.AppendLine(",Cosmetic");
                sql.AppendLine(",Nature");
                sql.AppendLine(",Appearance");
                sql.AppendLine(",AdoutBody");
                sql.AppendLine(",AboutFamily");
                sql.AppendLine(",Car");
                sql.AppendLine(",LiveHouse");
                sql.AppendLine(",ProfessionalDes");

                sql.AppendLine(",ModifiedUserID)");
                sql.AppendLine(" values ");
                sql.AppendLine("(@CompanyCD");
                sql.AppendLine(",@CustNo     ");
                sql.AppendLine(",@LinkManName");
                sql.AppendLine(",@Sex        ");
                sql.AppendLine(",@Important  ");
                sql.AppendLine(",@Company    ");
                sql.AppendLine(",@Appellation");
                sql.AppendLine(",@Department ");
                sql.AppendLine(",@Position   ");
                sql.AppendLine(",@Operation  ");
                sql.AppendLine(",@WorkTel    ");
                sql.AppendLine(",@Fax        ");
                sql.AppendLine(",@Handset    ");
                sql.AppendLine(",@MailAddress");
                sql.AppendLine(",@HomeTel    ");
                sql.AppendLine(",@MSN        ");
                sql.AppendLine(",@QQ         ");
                sql.AppendLine(",@Post       ");
                sql.AppendLine(",@HomeAddress");
                sql.AppendLine(",@Remark     ");
                sql.AppendLine(",@Age        ");
                sql.AppendLine(",@Likes      ");
                sql.AppendLine(",@LinkType   ");
                sql.AppendLine(",@Birthday   ");
                sql.AppendLine(",@PaperType  ");
                sql.AppendLine(",@PaperNum   ");
                sql.AppendLine(",@Photo");
                sql.AppendLine(",@Creator     ");
                sql.AppendLine(",@CreatedDate     ");
                sql.AppendLine(",@CanViewUser     ");
                sql.AppendLine(",@CanViewUserName     ");
                sql.AppendLine(",@ModifiedDate");
                sql.AppendLine(",@HomeTown");
                if (!string.IsNullOrEmpty(LinkManModel.NationalID))
                {
                    sql.AppendLine(",@NationalID");
                }
                sql.AppendLine(",@Birthcity");
                if (!string.IsNullOrEmpty(LinkManModel.CultureLevel))
                {
                    sql.AppendLine(",@CultureLevel");
                }
                if (!string.IsNullOrEmpty(LinkManModel.Professional))
                {
                    sql.AppendLine(",@Professional");
                }
                sql.AppendLine(",@GraduateSchool");
                sql.AppendLine(",@IncomeYear");
                sql.AppendLine(",@FuoodDrink");
                sql.AppendLine(",@LoveMusic");
                sql.AppendLine(",@LoveColor");
                sql.AppendLine(",@LoveSmoke");
                sql.AppendLine(",@LoveDrink");
                sql.AppendLine(",@LoveTea");
                sql.AppendLine(",@LoveBook");
                sql.AppendLine(",@LoveSport");
                sql.AppendLine(",@LoveClothes");
                sql.AppendLine(",@Cosmetic");
                sql.AppendLine(",@Nature");
                sql.AppendLine(",@Appearance");
                sql.AppendLine(",@AdoutBody");
                sql.AppendLine(",@AboutFamily");
                sql.AppendLine(",@Car");
                sql.AppendLine(",@LiveHouse");
                sql.AppendLine(",@ProfessionalDes");
                sql.AppendLine(",@ModifiedUserID)");

                #endregion

                #region 设置参数
                SqlParameter[] param = new SqlParameter[58];
                param[0] = SqlHelper.GetParameter("@CompanyCD", LinkManModel.CompanyCD);
                param[1] = SqlHelper.GetParameter("@CustNo", LinkManModel.CustNo);
                param[2] = SqlHelper.GetParameter("@LinkManName", LinkManModel.LinkManName);
                param[3] = SqlHelper.GetParameter("@Sex", LinkManModel.Sex);
                param[4] = SqlHelper.GetParameter("@Important", LinkManModel.Important);
                param[5] = SqlHelper.GetParameter("@Company", LinkManModel.Company);
                param[6] = SqlHelper.GetParameter("@Appellation", LinkManModel.Appellation);
                param[7] = SqlHelper.GetParameter("@Department", LinkManModel.Department);
                param[8] = SqlHelper.GetParameter("@Position", LinkManModel.Position);
                param[9] = SqlHelper.GetParameter("@Operation", LinkManModel.Operation);
                param[10] = SqlHelper.GetParameter("@WorkTel", LinkManModel.WorkTel);
                param[11] = SqlHelper.GetParameter("@Fax", LinkManModel.Fax);
                param[12] = SqlHelper.GetParameter("@Handset", LinkManModel.Handset);
                param[13] = SqlHelper.GetParameter("@MailAddress", LinkManModel.MailAddress);
                param[14] = SqlHelper.GetParameter("@HomeTel", LinkManModel.HomeTel);
                param[15] = SqlHelper.GetParameter("@MSN", LinkManModel.MSN);
                param[16] = SqlHelper.GetParameter("@QQ", LinkManModel.QQ);
                param[17] = SqlHelper.GetParameter("@Post", LinkManModel.Post);
                param[18] = SqlHelper.GetParameter("@HomeAddress", LinkManModel.HomeAddress);
                param[19] = SqlHelper.GetParameter("@Remark", LinkManModel.Remark);
                param[20] = SqlHelper.GetParameter("@Age", LinkManModel.Age);
                param[21] = SqlHelper.GetParameter("@Likes", LinkManModel.Likes);
                param[22] = SqlHelper.GetParameter("@LinkType", LinkManModel.LinkType);
                param[23] = SqlHelper.GetParameter("@Birthday", LinkManModel.Birthday == null
                                       ? SqlDateTime.Null
                                       : SqlDateTime.Parse(LinkManModel.Birthday.ToString()));
                param[24] = SqlHelper.GetParameter("@PaperType", LinkManModel.PaperType);
                param[25] = SqlHelper.GetParameter("@PaperNum", LinkManModel.PaperNum);
                param[26] = SqlHelper.GetParameter("@Photo", LinkManModel.Photo);
                param[27] = SqlHelper.GetParameter("@ModifiedDate", LinkManModel.ModifiedDate);
                param[28] = SqlHelper.GetParameter("@ModifiedUserID", LinkManModel.ModifiedUserID);
                param[29] = SqlHelper.GetParameter("@CanViewUser", LinkManModel.CanViewUser);
                param[30] = SqlHelper.GetParameter("@CanViewUserName", LinkManModel.CanViewUserName);
                param[31] = SqlHelper.GetParameter("@Creator", LinkManModel.Creator);
                param[32] = SqlHelper.GetParameter("@CreatedDate", LinkManModel.CreatedDate);
                param[33] = SqlHelper.GetParameter("@HomeTown", LinkManModel.HomeTown);
                param[34] = SqlHelper.GetParameter("@NationalID", LinkManModel.NationalID == null ? SqlInt32.Null : int.Parse(LinkManModel.NationalID));
                param[35] = SqlHelper.GetParameter("@Birthcity", LinkManModel.birthcity);
                param[36] = SqlHelper.GetParameter("@CultureLevel", LinkManModel.CultureLevel == null ? SqlInt32.Null : int.Parse(LinkManModel.CultureLevel));
                param[37] = SqlHelper.GetParameter("@Professional", LinkManModel.Professional == null ? SqlInt32.Null : int.Parse(LinkManModel.Professional));
                param[38] = SqlHelper.GetParameter("@GraduateSchool", LinkManModel.GraduateSchool);
                param[39] = SqlHelper.GetParameter("@IncomeYear", LinkManModel.IncomeYear);
                param[40] = SqlHelper.GetParameter("@FuoodDrink", LinkManModel.FuoodDrink);
                param[41] = SqlHelper.GetParameter("@LoveMusic", LinkManModel.LoveMusic);

                param[42] = SqlHelper.GetParameter("@LoveColor", LinkManModel.LoveColor);
                param[43] = SqlHelper.GetParameter("@LoveSmoke", LinkManModel.LoveSmoke);
                param[44] = SqlHelper.GetParameter("@LoveDrink", LinkManModel.LoveDrink);
                param[45] = SqlHelper.GetParameter("@LoveTea", LinkManModel.LoveTea);

                param[46] = SqlHelper.GetParameter("@LoveBook", LinkManModel.LoveBook);
                param[47] = SqlHelper.GetParameter("@LoveSport", LinkManModel.LoveSport);
                param[48] = SqlHelper.GetParameter("@LoveClothes", LinkManModel.LoveClothes);
                param[49] = SqlHelper.GetParameter("@Cosmetic", LinkManModel.Cosmetic);

                param[50] = SqlHelper.GetParameter("@Nature", LinkManModel.Nature);
                param[51] = SqlHelper.GetParameter("@Appearance", LinkManModel.Appearance);
                param[52] = SqlHelper.GetParameter("@AdoutBody", LinkManModel.AdoutBody);
                param[53] = SqlHelper.GetParameter("@AboutFamily", LinkManModel.AboutFamily);
                param[54] = SqlHelper.GetParameter("@Car", LinkManModel.Car);
                param[55] = SqlHelper.GetParameter("@LiveHouse", LinkManModel.LiveHouse);
                param[56] = SqlHelper.GetParameter("@ProfessionalDes", LinkManModel.ProfessionalDes);

                #endregion

                SqlParameter paramid = new SqlParameter("@id", SqlDbType.Int);
                paramid.Direction = ParameterDirection.Output;
                param[57] = paramid;

                //创建命令
                SqlCommand comm = new SqlCommand();
                SqlHelper.ExecuteTransStoredProcedure("officedba.insertCustLinkMan", comm, param);
                int contantid = Convert.ToInt32(comm.Parameters["@id"].Value);

                return contantid;
            }
            catch (Exception ex)
            {
                string sss = ex.Message;
                return 0;
            }
        }
Ejemplo n.º 11
0
        /// <summary>
        /// 根据客户编号修改联系人信息的方法
        /// </summary>
        /// <param name="LinkManM">联系人信息Model</param>
        /// <param name="CustNo">联系人对应客户编号</param>
        /// <returns>bool值</returns>
        public static bool UpdateLinkMan(LinkManModel LinkManM)
        {
            try
            {
                #region 拼写修改联系人信息SQL语句
                StringBuilder sqllink = new StringBuilder();
                sqllink.AppendLine("UPDATE officedba.CustLinkMan set ");
                sqllink.AppendLine("CompanyCD = @CompanyCD, ");
                sqllink.AppendLine("LinkManName = @LinkManName, ");
                sqllink.AppendLine("Sex = @Sex, ");
                sqllink.AppendLine("Important = @Important, ");
                sqllink.AppendLine("Company = @Company, ");
                sqllink.AppendLine("Appellation = @Appellation, ");
                sqllink.AppendLine("Department = @Department, ");
                sqllink.AppendLine("Position = @Position, ");
                sqllink.AppendLine("Operation = @Operation, ");
                sqllink.AppendLine("WorkTel = @WorkTel, ");
                sqllink.AppendLine("Fax = @Fax, ");
                sqllink.AppendLine("Handset = @Handset, ");
                sqllink.AppendLine("MailAddress = @MailAddress, ");
                sqllink.AppendLine("HomeTel = @HomeTel, ");
                sqllink.AppendLine("MSN = @MSN, ");
                sqllink.AppendLine("QQ = @QQ, ");
                sqllink.AppendLine("Post = @Post, ");
                sqllink.AppendLine("HomeAddress = @HomeAddress, ");
                sqllink.AppendLine("Remark = @Remark, ");
                sqllink.AppendLine("Age = @Age, ");
                sqllink.AppendLine("Likes = @Likes, ");
                sqllink.AppendLine("LinkType = @LinkType, ");
                sqllink.AppendLine("Birthday =@Birthday,");
                sqllink.AppendLine("PaperType = @PaperType, ");
                sqllink.AppendLine("PaperNum = @PaperNum, ");
                sqllink.AppendLine("Photo = @Photo, ");
                sqllink.AppendLine("CanViewUser = @CanViewUser, ");
                sqllink.AppendLine("CanViewUserName = @CanViewUserName, ");
                sqllink.AppendLine("ModifiedDate = @ModifiedDate, ");


                sqllink.AppendLine("HomeTown=@HomeTown,");
                if (!string.IsNullOrEmpty(LinkManM.NationalID))
                {
                    sqllink.AppendLine("NationalID=@NationalID,");
                }
                sqllink.AppendLine("Birthcity=@Birthcity,");
                if (!string.IsNullOrEmpty(LinkManM.CultureLevel))
                {
                    sqllink.AppendLine("CultureLevel=@CultureLevel,");
                }
                if (!string.IsNullOrEmpty(LinkManM.Professional))
                {
                    sqllink.AppendLine("Professional=@Professional,");
                }
                sqllink.AppendLine("GraduateSchool=@GraduateSchool,");
                sqllink.AppendLine("IncomeYear=@IncomeYear,");
                sqllink.AppendLine("FuoodDrink=@FuoodDrink,");
                sqllink.AppendLine("LoveMusic=@LoveMusic,");
                sqllink.AppendLine("LoveColor=@LoveColor,");
                sqllink.AppendLine("LoveSmoke=@LoveSmoke,");
                sqllink.AppendLine("LoveDrink=@LoveDrink,");
                sqllink.AppendLine("LoveTea=@LoveTea,");
                sqllink.AppendLine("LoveBook=@LoveBook,");
                sqllink.AppendLine("LoveSport=@LoveSport,");
                sqllink.AppendLine("LoveClothes=@LoveClothes,");
                sqllink.AppendLine("Cosmetic=@Cosmetic,");
                sqllink.AppendLine("Nature=@Nature,");
                sqllink.AppendLine("Appearance=@Appearance,");
                sqllink.AppendLine("AdoutBody=@AdoutBody,");
                sqllink.AppendLine("AboutFamily=@AboutFamily,");
                sqllink.AppendLine("Car=@Car,");
                sqllink.AppendLine("LiveHouse=@LiveHouse,");
                sqllink.AppendLine(" ProfessionalDes=@ProfessionalDes ");

                sqllink.AppendLine(" WHERE ");
                sqllink.AppendLine("ID = @ID ");
                sqllink.AppendLine("and CompanyCD = @CompanyCD ");
                #endregion

                #region 设置修改联系人信息参数
                SqlParameter[] param = new SqlParameter[55];
                param[0] = SqlHelper.GetParameter("@CompanyCD", LinkManM.CompanyCD);
                param[1] = SqlHelper.GetParameter("@ID", LinkManM.ID);
                param[2] = SqlHelper.GetParameter("@LinkManName", LinkManM.LinkManName);
                param[3] = SqlHelper.GetParameter("@Sex", LinkManM.Sex);
                param[4] = SqlHelper.GetParameter("@Important", LinkManM.Important);
                param[5] = SqlHelper.GetParameter("@Company", LinkManM.Company);
                param[6] = SqlHelper.GetParameter("@Appellation", LinkManM.Appellation);
                param[7] = SqlHelper.GetParameter("@Department", LinkManM.Department);
                param[8] = SqlHelper.GetParameter("@Position", LinkManM.Position);
                param[9] = SqlHelper.GetParameter("@Operation", LinkManM.Operation);
                param[10] = SqlHelper.GetParameter("@WorkTel", LinkManM.WorkTel);
                param[11] = SqlHelper.GetParameter("@Fax", LinkManM.Fax);
                param[12] = SqlHelper.GetParameter("@Handset", LinkManM.Handset);
                param[13] = SqlHelper.GetParameter("@MailAddress", LinkManM.MailAddress);
                param[14] = SqlHelper.GetParameter("@HomeTel", LinkManM.HomeTel);
                param[15] = SqlHelper.GetParameter("@MSN", LinkManM.MSN);
                param[16] = SqlHelper.GetParameter("@QQ", LinkManM.QQ);
                param[17] = SqlHelper.GetParameter("@Post", LinkManM.Post);
                param[18] = SqlHelper.GetParameter("@HomeAddress", LinkManM.HomeAddress);
                param[19] = SqlHelper.GetParameter("@Remark", LinkManM.Remark);
                param[20] = SqlHelper.GetParameter("@Age", LinkManM.Age);
                param[21] = SqlHelper.GetParameter("@Likes", LinkManM.Likes);
                param[22] = SqlHelper.GetParameter("@LinkType", LinkManM.LinkType);
                param[23] = SqlHelper.GetParameter("@Birthday", LinkManM.Birthday == null ? SqlDateTime.Null : SqlDateTime.Parse(LinkManM.Birthday.ToString()));
                //param[23] = SqlHelper.GetParameter("@Birthday", LinkManM.Birthday = DateTime.Now);
                param[24] = SqlHelper.GetParameter("@PaperType", LinkManM.PaperType);
                param[25] = SqlHelper.GetParameter("@PaperNum", LinkManM.PaperNum);
                param[26] = SqlHelper.GetParameter("@Photo", LinkManM.Photo);
                param[27] = SqlHelper.GetParameter("@ModifiedDate", LinkManM.ModifiedDate);
                param[28] = SqlHelper.GetParameter("@ModifiedUserID", LinkManM.ModifiedUserID);
                param[29] = SqlHelper.GetParameter("@CanViewUser", LinkManM.CanViewUser);
                param[30] = SqlHelper.GetParameter("@CanViewUserName", LinkManM.CanViewUserName);

                param[31] = SqlHelper.GetParameter("@HomeTown", LinkManM.HomeTown);

                param[32] = SqlHelper.GetParameter("@NationalID", LinkManM.NationalID == null ? SqlInt32.Null : int.Parse(LinkManM.NationalID));

                param[33] = SqlHelper.GetParameter("@Birthcity", LinkManM.birthcity == "" ? "" : LinkManM.birthcity);

                param[34] = SqlHelper.GetParameter("@CultureLevel", LinkManM.CultureLevel == null ? SqlInt32.Null : int.Parse(LinkManM.CultureLevel));

                param[35] = SqlHelper.GetParameter("@Professional", LinkManM.Professional == null ? SqlInt32.Null : int.Parse(LinkManM.Professional));

                param[36] = SqlHelper.GetParameter("@GraduateSchool", LinkManM.GraduateSchool);
                param[37] = SqlHelper.GetParameter("@IncomeYear", LinkManM.IncomeYear);
                param[38] = SqlHelper.GetParameter("@FuoodDrink", LinkManM.FuoodDrink);
                param[39] = SqlHelper.GetParameter("@LoveMusic", LinkManM.LoveMusic);

                param[40] = SqlHelper.GetParameter("@LoveColor", LinkManM.LoveColor);
                param[41] = SqlHelper.GetParameter("@LoveSmoke", LinkManM.LoveSmoke);
                param[42] = SqlHelper.GetParameter("@LoveDrink", LinkManM.LoveDrink);
                param[43] = SqlHelper.GetParameter("@LoveTea", LinkManM.LoveTea);

                param[44] = SqlHelper.GetParameter("@LoveBook", LinkManM.LoveBook);
                param[45] = SqlHelper.GetParameter("@LoveSport", LinkManM.LoveSport);
                param[46] = SqlHelper.GetParameter("@LoveClothes", LinkManM.LoveClothes);
                param[47] = SqlHelper.GetParameter("@Cosmetic", LinkManM.Cosmetic);

                param[48] = SqlHelper.GetParameter("@Nature", LinkManM.Nature);
                param[49] = SqlHelper.GetParameter("@Appearance", LinkManM.Appearance);
                param[50] = SqlHelper.GetParameter("@AdoutBody", LinkManM.AdoutBody);
                param[51] = SqlHelper.GetParameter("@AboutFamily", LinkManM.AboutFamily);
                param[52] = SqlHelper.GetParameter("@Car", LinkManM.Car);
                param[53] = SqlHelper.GetParameter("@LiveHouse", LinkManM.LiveHouse);
                param[54] = SqlHelper.GetParameter("@ProfessionalDes", LinkManM.ProfessionalDes);
                #endregion

                SqlHelper.ExecuteTransSql(sqllink.ToString(), param);
                return SqlHelper.Result.OprateCount > 0 ? true : false;

            }
            catch 
            {
                return false;
            }
        }
Ejemplo n.º 12
0
 /// <summary>
 /// 导出联系人列表
 /// </summary>
 /// <param name="CustNam"></param>
 /// <param name="LinkManM"></param>
 /// <param name="BeginDate"></param>
 /// <param name="EndDate"></param>
 /// <param name="ord"></param>
 /// <returns></returns>
  public static DataTable ExportLinkManInfo(string CustNam, LinkManModel LinkManM, string BeginDate, string EndDate, string ord)
  {
      return LinkManDBHelper.ExportLinkManInfo(CustNam, LinkManM, BeginDate, EndDate, ord);
  }
Ejemplo n.º 13
0
        /// <summary>
        /// 增加客户联系人的方法
        /// </summary>
        /// <param name="CustModel">客户联系人Model</param>
        /// <returns>bool值</returns>
        public static int LinkManAdd(LinkManModel LinkManModel)
        {
            UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"];
            LogInfoModel logModel = new LogInfoModel(); //操作日志
            int isSucc = 0;//定义返回变量

            #region 设置操作日志内容
            //设置公司代码
            logModel.CompanyCD = userInfo.CompanyCD;
            //设置登陆用户ID
            logModel.UserID = userInfo.UserID;
            //设置模块ID 模块ID在ConstUtil中定义,以便维护
            logModel.ModuleID = ConstUtil.MODULE_ID_CUST_LINK_ADD;
            //操作单据编号  联系人姓名
            logModel.ObjectID = LinkManModel.LinkManName;
            //操作对象 操作的表信息
            logModel.ObjectName = ConstUtil.TABLE_NAME_LISIMAN;
            //涉及关键元素 涉及其他业务、表关系
            logModel.Element = string.Empty;
            //备注 操作类型
            logModel.Remark = ConstUtil.LOG_PROCESS_INSERT;
            #endregion

            try
            {
                isSucc = LinkManDBHelper.LinkManAdd(LinkManModel);
            }
            catch (System.Exception ex)
            {
                #region  操作失败时记录日志到文件
                //定义变量
                LogInfo logSys = new LogInfo();
                //设置日志类型 需要指定为系统日志
                logSys.Type = LogInfo.LogType.SYSTEM;
                //指定系统日志类型 出错信息
                logSys.SystemKind = LogInfo.SystemLogKind.SYSTEM_ERROR;
                //指定登陆用户信息
                logSys.UserInfo = userInfo;
                //设定模块ID
                logSys.ModuleID = ConstUtil.MODULE_ID_CUST_LINK_ADD;
                //描述
                logSys.Description = ex.ToString();
                //输出日志
                LogUtil.WriteLog(logSys);
                #endregion
            }

            if (isSucc >0 )//操作成功
            {
                logModel.Remark += "成功";
            }
            else//操作失败
            {
                logModel.Remark += "失败";
            }

            //记录日志
            LogDBHelper.InsertLog(logModel);

            return isSucc;
        }
Ejemplo n.º 14
0
   /// <summary>
   /// 根据查询条件获取联系人列表信息的方法
  /// </summary>
   /// <param name="LinkManM">查询条件</param>
   /// <param name="Manager">登陆人</param>
   /// <returns>联系人列表结果集</returns>
  public static DataTable GetLinkManInfoBycondition(string CustNam, LinkManModel LinkManM, string BeginDate, string EndDate, int pageIndex, int pageCount, string ord, ref int TotalCount)
   {
      try
      {
          return LinkManDBHelper.GetLinkManInfoBycondition(CustNam, LinkManM,BeginDate,EndDate, pageIndex, pageCount, ord, ref TotalCount);
      }
      catch 
      {
          return null;
      }
 }