/// <summary>
        /// 保存
        /// </summary>
        void UCPersonnelAddOrEdit_SaveEvent(object sender, EventArgs e)
        {
            string msg = string.Empty;
            bool bln = Validator(ref msg);
            if (!bln)
            {
                return;
            }

            string newGuid = string.Empty;
            string currUser_id = "";

            string keyName = string.Empty;
            string keyValue = string.Empty;
            string opName = "新增人员信息";
            Dictionary<string, string> dicFileds = new Dictionary<string, string>();

            dicFileds.Add("user_name", txtuser_name.Caption.Trim());//人员姓名
            //账号
            if (cbois_operator.SelectedValue.ToString() == DataSources.EnumYesNo.Yes.ToString("d"))
            {
                dicFileds.Add("land_name", txtland_name.Caption.Trim());
            }
            else
            {
                dicFileds.Add("land_name", "");
            }

            dicFileds.Add("user_phone", txtuser_phone.Caption.Trim());//手机
            dicFileds.Add("user_telephone", txtuser_telephone.Caption.Trim());//固话    
            dicFileds.Add("org_id", txcorg_name.Tag.ToString().Trim());//组织id 
            dicFileds.Add("sex", cbosex.SelectedValue.ToString());//性别
            dicFileds.Add("user_fax", txtuser_fax.Caption.Trim());//传真 
            dicFileds.Add("is_operator", cbois_operator.SelectedValue.ToString());//是否操作员 
            dicFileds.Add("idcard_type", cboidcard_type.SelectedValue.ToString());//证件类型 
            dicFileds.Add("user_email", txtuser_email.Caption.Trim());//邮箱 
            dicFileds.Add("idcard_num", txtidcard_num.Caption.Trim());//证件号码 
            dicFileds.Add("user_address", txtuser_address.Caption.Trim());//联系地址
            dicFileds.Add("remark", txtremark.Caption.Trim());//备注 
            //密码
            if (cbois_operator.SelectedValue.ToString() == DataSources.EnumYesNo.Yes.ToString("d"))
            {
                dicFileds.Add("password", txtPassWord.Caption.Trim());
            }
            else
            {
                dicFileds.Add("password", "");//密码
            }

            dicFileds.Add("nation", cbonation.SelectedValue.ToString());//民族 
            dicFileds.Add("graduate_institutions", txtgraduate_institutions.Caption.Trim());//毕业学校 
            dicFileds.Add("technical_expertise", txttechnical_expertise.Caption.Trim());//技术特长 
            dicFileds.Add("user_height", txtuser_height.Caption.Trim());//身高 
            dicFileds.Add("native_place", txtnative_place.Caption.Trim());//籍贯 
            dicFileds.Add("specialty", txtspecialty.Caption.Trim());//专业
            dicFileds.Add("entry_date", Common.LocalDateTimeToUtcLong(dtpentry_date.Value).ToString());//  入职日期 
            dicFileds.Add("user_weight", txtuser_weight.Caption.Trim());//体重 
            dicFileds.Add("register_address", txtregister_address.Caption.Trim());//户籍所在地 
            dicFileds.Add("graduate_date", Common.LocalDateTimeToUtcLong(dtpgraduate_date.Value).ToString());// 毕业时间 
            dicFileds.Add("wage", txtwage.Caption.Trim());// 工资 
            dicFileds.Add("birthday", Common.LocalDateTimeToUtcLong(dtpbirthday.Value).ToString());// 出生日期  
            dicFileds.Add("education", cboeducation.SelectedValue.ToString());//学历
            dicFileds.Add("position", cboposition.SelectedValue.ToString());//岗位
            dicFileds.Add("political_status", txtpolitical_status.Caption.Trim());//政治面貌
            dicFileds.Add("level", cbolevel.SelectedValue.ToString());//级别



            dicFileds.Add("health", cbojkzk.SelectedValue.ToString());//健康状况

            string nowUtcTicks = Common.LocalDateTimeToUtcLong(HXCPcClient.GlobalStaticObj.CurrentDateTime).ToString();
            dicFileds.Add("update_by", HXCPcClient.GlobalStaticObj.UserID);
            dicFileds.Add("update_time", nowUtcTicks);

            string crmId = string.Empty;

            if (wStatus == WindowStatus.Add || wStatus == WindowStatus.Copy)
            {
                dicFileds.Add("user_code", CommonUtility.GetNewNo(SYSModel.DataSources.EnumProjectType.User));//人员编码               

                newGuid = Guid.NewGuid().ToString();
                currUser_id = newGuid;
                dicFileds.Add("user_id", newGuid);//新ID                   
                dicFileds.Add("create_by", HXCPcClient.GlobalStaticObj.UserID);
                dicFileds.Add("create_time", nowUtcTicks);
                dicFileds.Add("enable_flag", SYSModel.DataSources.EnumEnableFlag.USING.ToString("d"));//1为未删除状态
                dicFileds.Add("status", SYSModel.DataSources.EnumStatus.Start.ToString("d"));//启用
                dicFileds.Add("data_sources", Convert.ToInt16(SYSModel.DataSources.EnumDataSources.SELFBUILD).ToString());//来源 自建
            }
            else if (wStatus == WindowStatus.Edit)
            {
                keyName = "user_id";
                keyValue = id;
                currUser_id = id;
                newGuid = id;
                crmId = dr["cont_crm_guid"].ToString();
                opName = "更新人员管理";
            }
            bln = DBHelper.Submit_AddOrEdit(opName, "sys_user", keyName, keyValue, dicFileds);

            string photo = string.Empty;
            if (picuser.Tag != null)
            {
                photo = Guid.NewGuid().ToString() + Path.GetExtension(picuser.Tag.ToString());
                if (!FileOperation.UploadFile(picuser.Tag.ToString(), photo))
                {
                    return;
                }
            }

            List<SQLObj> listSql = new List<SQLObj>();
            listSql = AddPhoto(listSql, currUser_id, photo);
            ucAttr.TableName = "sys_user";
            ucAttr.TableNameKeyValue = currUser_id;
            listSql.AddRange(ucAttr.AttachmentSql);
            DBHelper.BatchExeSQLMultiByTrans(opName, listSql);
            if (bln)
            {
                if (wStatus == WindowStatus.Add || wStatus == WindowStatus.Edit)
                {
                    var cont = new tb_contacts_ex
                           {
                               cont_id = CommonCtrl.IsNullToString(newGuid),//id
                               cont_name = CommonCtrl.IsNullToString(this.txtuser_name.Caption.Trim()),//name
                               cont_post = CommonCtrl.IsNullToString(""),//post
                               cont_phone = CommonCtrl.IsNullToString(this.txtuser_phone.Caption.Trim()),
                               nation = CommonCtrl.IsNullToString(this.cbonation.SelectedValue.ToString()),
                               parent_customer = CommonCtrl.IsNullToString(""),
                               sex = UpSex(),
                               status = CommonCtrl.IsNullToString(SYSModel.DataSources.EnumStatus.Start.ToString("d")),
                               cont_post_remark = CommonCtrl.IsNullToString(""),
                               cont_crm_guid = CommonCtrl.IsNullToString(crmId),
                               contact_type = "02"
                           };
                    Update.BeginInvoke("上传服务站工作人员", SYSModel.EnumWebServFunName.UpLoadCcontact, cont, null, null);

                    //DBHelper.WebServHandlerByFun("上传服务站工作人员", SYSModel.EnumWebServFunName.UpLoadCcontact, cont);
                }

                if (this.RefreshDataStart != null)
                {
                    this.RefreshDataStart();
                }

                LocalCache._Update(CacheList.User);

                MessageBoxEx.Show("保存成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.None);

                deleteMenuByTag(this.Tag.ToString(), this.parentName);
            }
            else
            {
                MessageBoxEx.Show("保存失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
        /// <summary>
        /// 删除时上传工作人员信息
        /// </summary>
        /// <param name="deleteUser">要删除的人员信息</param>
        void UploadUserData()
        {

            var cont = new tb_contacts_ex();
            cont.cont_id = CommonCtrl.IsNullToString(dr["user_id"]);//id
            cont.cont_name = CommonCtrl.IsNullToString(dr["user_name"].ToString());//name
            cont.cont_post = CommonCtrl.IsNullToString(dr["post"].ToString());//post 
            cont.cont_phone = CommonCtrl.IsNullToString(dr["user_phone"].ToString());//phone
            cont.nation = LocalCache.GetDictNameById(dr["nation"].ToString());
            cont.parent_customer = CommonCtrl.IsNullToString("");
            cont.sex = UpSex(dr["sex"].ToString());//sex
            //cont.status = CommonCtrl.IsNullToString(SYSModel.DataSources.EnumStatus.Start.ToString("d"));//status
            cont.status = "1";//status
            cont.cont_post_remark = CommonCtrl.IsNullToString("");
            cont.cont_crm_guid = CommonCtrl.IsNullToString(dr["cont_crm_guid"].ToString());//crmguid
            cont.contact_type = "02";
            DBHelper.WebServHandlerByFun("删除服务站工作人员", SYSModel.EnumWebServFunName.UpLoadCcontact, cont);

        }
 /// <summary> 联系人创建更新
 /// </summary>
 /// <param name="contactModel">联系人实体</param>
 /// <returns>返回错误信息,如果不为空,则操作失败</returns>
 public static string UpLoadCcontact(tb_contacts_ex tempContactModel)
 {
     //如果没有接入码或者sap代码,则不调用接口
     if (string.IsNullOrEmpty(GlobalStaticObj_YT.ClientID) ||
         string.IsNullOrEmpty(GlobalStaticObj_YT.SAPCode))
     {
         return "";
     }
     //tempContactModel = new tb_contacts_ex();
     //tempContactModel.cont_crm_guid = Guid.NewGuid().ToString();
     //tempContactModel.cont_crm_guid = "64258b13-0b55-e411-b917-005056ad01ea";
     //tempContactModel.cont_name = "张三";
     //tempContactModel.cont_phone = "13525566532";
     //tempContactModel.sex = "1";
     //tempContactModel.cont_post = "100000017";
     //tempContactModel.status = "1";
     //tempContactModel.nation = "100000000";
     //tempContactModel.parent_customer = "KH0000154987";
     //tempContactModel.contact_type = "1";
     //tempContactModel.cont_post_remark = "";
     string requestType = string.IsNullOrEmpty(tempContactModel.cont_crm_guid) ? "CREATE" : "UPDATE";
     string docType = string.Empty;
     SUContact.contact contactServModel = new SUContact.contact();
     contactServModel.crmcont_guid = tempContactModel.cont_crm_guid;
     contactServModel.cont_name = tempContactModel.cont_name;
     contactServModel.sex = tempContactModel.sex;
     contactServModel.cont_post = "";//联系人职务传空
     //转成宇通编码
     contactServModel.nation = WebServUtil.GetYTDicCode("nation", tempContactModel.nation);
     //根据parent_customer去客户表查找客户编码
     contactServModel.parent_customer = tempContactModel.parent_customer;
     contactServModel.cont_phone = tempContactModel.cont_phone;
     contactServModel.cont_post_remark = tempContactModel.cont_post_remark;
     contactServModel.status = tempContactModel.status;
     if (!string.IsNullOrEmpty(tempContactModel.contact_type))
     {
         docType = Convert.ToInt32(tempContactModel.contact_type).ToString("00");
         contactServModel.doc_type = docType;
     }
     else
     {
         contactServModel.doc_type = "";
     }
     //网点人员的上级客户为服务站
     if (docType == "02")
     {
         contactServModel.parent_customer = GlobalStaticObj_YT.SAPCode;
     }
     //Utility.Log.Log.writeLineToLog("【联系人创建更新】\r\n" + Newtonsoft.Json.JsonConvert.SerializeObject(contactServModel), "接口");
     GlobalStaticObj_Server.YTInterfaceLogService.WriteLog("联系人创建更新", Newtonsoft.Json.JsonConvert.SerializeObject(contactServModel));
     ServicePointManager.ServerCertificateValidationCallback = WebServUtil.ValidateServerCertificate;
     SUContact.clientInfo clientInfo = new SUContact.clientInfo();
     clientInfo.clientID = GlobalStaticObj_YT.ClientID;
     clientInfo.serviceID = "contactSU";
     SUContact.contactSUPortTypeService serv = new SUContact.contactSUPortTypeService();
     string stationCode = Secret.Encrypt3DES_UTF8(GlobalStaticObj_YT.SAPCode, GlobalStaticObj_YT.KeySecurity_YT);
     string dateStr = Secret.Encrypt3DES_UTF8(GlobalStaticObj_Server.Instance.CurrentDateTime.ToString("yyyy-MM-dd HH:mm:ss"), GlobalStaticObj_YT.KeySecurity_YT);
     requestType = Secret.Encrypt3DES_UTF8(requestType, GlobalStaticObj_YT.KeySecurity_YT);
     clientInfo = WebServUtil.EncModel<SUContact.clientInfo>(clientInfo);
     contactServModel = WebServUtil.EncModel<SUContact.contact>(contactServModel);
     //contactServModel.cont_phone = WebServUtil.GetDesFieldValue(contactServModel.cont_phone);//解密
     DateTime dtStart = GlobalStaticObj_Server.Instance.CurrentDateTime;//开始时间
     SUContact.Result result = new SUContact.Result();
     string message = string.Empty;//错误消息
     try
     {
         result = serv.contactSU(stationCode, dateStr, requestType, contactServModel, clientInfo);
     }
     catch (InvalidOperationException ioe)
     {
         //Utility.Log.Log.writeLineToLog(ioe, "联系人");
         GlobalStaticObj_Server.YTInterfaceLogService.WriteLog("联系人创建更新", ioe);
         message = ioe.Message;
     }
     catch (TimeoutException te)
     {
         //Utility.Log.Log.writeLineToLog(te, "联系人");
         GlobalStaticObj_Server.YTInterfaceLogService.WriteLog("联系人创建更新", te);
         message = te.Message;
     }
     string state = Secret.Decrypt3DES_UTF8(result.state, GlobalStaticObj_YT.KeySecurity_YT);
     if (state == "F")
     {
         string errMsg = Secret.Decrypt3DES_UTF8(result.errorMsg, GlobalStaticObj_YT.KeySecurity_YT);
         //Utility.Log.Log.writeLineToLog("【联系人创建更新】\r\n" + errMsg, "接口");
         GlobalStaticObj_Server.YTInterfaceLogService.WriteLog("联系人创建更新", errMsg);
         return "宇通接口错误:" + errMsg;
     }
     else
     {
         if (!string.IsNullOrEmpty(tempContactModel.cont_crm_guid))
         {
             return "";
         }
         string contact_guid = Secret.Decrypt3DES_UTF8(result.contact_guid, GlobalStaticObj_YT.KeySecurity_YT);
         //Utility.Log.Log.writeLineToLog("【联系人创建更新】返回\r\n" + contact_guid, "接口");
         GlobalStaticObj_Server.YTInterfaceLogService.WriteLog("联系人创建更新返回", contact_guid);
         List<SysSQLString> listSql = new List<SysSQLString>();
         SysSQLString updateSql = new SysSQLString();
         updateSql.cmdType = CommandType.Text;
         updateSql.Param = new Dictionary<string, string>();
         switch (docType)
         {
             case "01":
                 updateSql.Param.Add("cont_crm_guid", contact_guid);
                 updateSql.Param.Add("cont_id", tempContactModel.cont_id);
                 updateSql.sqlString = "update tb_contacts set cont_crm_guid=@cont_crm_guid where cont_id=@cont_id";
                 break;
             case "02":
                 updateSql.Param.Add("cont_crm_guid", contact_guid);
                 updateSql.Param.Add("user_id", tempContactModel.cont_id);
                 updateSql.sqlString = "update sys_user set cont_crm_guid=@cont_crm_guid where user_id=@user_id";
                 break;
         }
         listSql.Add(updateSql);
         bool flag = DBHelper.BatchExeSQLStrMultiByTransNoLogNoBackup("更新联系人:宇通cont_crm_guid", GlobalStaticObj_Server.Instance.MainAccCode, listSql);
         DateTime dtEnd = GlobalStaticObj_Server.Instance.CurrentDateTime;//结束时间
         if (flag)
         {
             WebServUtil.WriteInterficeSyncLog(DataSources.EnumInterfaceType.Contact, DataSources.EnumExternalSys.YTCRM, DataSources.EnumSyncDirection.UpLoad, "tb_contacts", dtStart, dtEnd, 1, message);
         }
         return flag ? "" : "DB错误:更新联系人失败:宇通cont_crm_guid";
     }
 }
        /// <summary>
        /// 删除时上传工作人员信息
        /// </summary>
        /// <param name="deleteUser">要删除的人员信息</param>
        void UploadUserData(List<string> DeleteUser)
        {
            DataTable dtuserinfo = dgvUser.DataSource as DataTable;
            if (dtuserinfo != null)
            {
                Parallel.ForEach(DeleteUser, userid =>
                {
                    DataRow[] druserinf = dtuserinfo.Select("user_id='" + userid + "'");
                    if (druserinf != null && druserinf.Length > 0)
                    {
                        var cont = new tb_contacts_ex();
                        cont.cont_id = userid;//id
                        cont.cont_name = CommonCtrl.IsNullToString(druserinf[0]["user_name"].ToString());//name
                        cont.cont_post = CommonCtrl.IsNullToString(druserinf[0]["post"].ToString());//post 
                        cont.cont_phone = CommonCtrl.IsNullToString(druserinf[0]["user_phone"].ToString());//phone
                        cont.nation = LocalCache.GetDictNameById(druserinf[0]["nation"].ToString());
                        cont.parent_customer = CommonCtrl.IsNullToString("");
                        cont.sex = UpSex(druserinf[0]["sex"].ToString());//sex
                        //cont.status = CommonCtrl.IsNullToString(SYSModel.DataSources.EnumStatus.Start.ToString("d"));//status
                        cont.status = "1";//status
                        cont.cont_post_remark = CommonCtrl.IsNullToString("");
                        cont.cont_crm_guid = CommonCtrl.IsNullToString(druserinf[0]["cont_crm_guid"].ToString());//crmguid
                        cont.contact_type = "02";
                        DBHelper.WebServHandlerByFun("删除服务站工作人员", SYSModel.EnumWebServFunName.UpLoadCcontact, cont);
                    }
                });

                //foreach (string userid in DeleteUser)
                //{
                //    DataRow[] druserinf = dtuserinfo.Select("user_id='" + userid + "'");
                //    if (druserinf != null && druserinf.Length > 0)
                //    {
                //        var cont = new tb_contacts_ex();
                //        cont.cont_id = userid;//id
                //        cont.cont_name = CommonCtrl.IsNullToString(druserinf[0]["user_name"].ToString());//name
                //        cont.cont_post = CommonCtrl.IsNullToString(druserinf[0]["post"].ToString());//post 
                //        cont.cont_phone = CommonCtrl.IsNullToString(druserinf[0]["user_phone"].ToString());//phone
                //        cont.nation = LocalCache.GetDictNameById(druserinf[0]["nation"].ToString());
                //        cont.parent_customer = CommonCtrl.IsNullToString("");
                //        cont.sex = UpSex(druserinf[0]["sex"].ToString());//sex
                //        //cont.status = CommonCtrl.IsNullToString(SYSModel.DataSources.EnumStatus.Start.ToString("d"));//status
                //        cont.status = "1";//status
                //        cont.cont_post_remark = CommonCtrl.IsNullToString("");
                //        cont.cont_crm_guid = CommonCtrl.IsNullToString(druserinf[0]["cont_crm_guid"].ToString());//crmguid
                //        cont.contact_type = "02";
                //        DBHelper.WebServHandlerByFun("删除服务站工作人员", SYSModel.EnumWebServFunName.UpLoadCcontact, cont);
                //    }
                //}
            }
        }
        void UCCustomerAddOrEdit_SaveEvent(object sender, EventArgs e)  //数据保存
        {
            try
            {
                if (!CheckControlValue()) return;
                var sysSqlStrList = new List<SysSQLString>();
                
                var custSql = BuildCustomerSqlString();
                sysSqlStrList.Add(custSql.Item1);
                sysSqlStrList.AddRange(BuildContactRelation(custSql.Item2));
                sysSqlStrList.AddRange(BuildVehicleRelation(custSql.Item2));
                sysSqlStrList.AddRange(BuildVipMemberSqlString(custSql.Item2));

                //ucAttr.GetAttachmentSql(sysSqlStrList);   //保存附件时失败...目前保留此代码
                var opName = wStatus == WindowStatus.Edit ? "更新客户档案" : "新增客户档案";
                var result = DBHelper.BatchExeSQLStringMultiByTrans(opName, sysSqlStrList);
                if (result)
                {
                    var customer = new tb_customer();
                    customer.cust_id = custSql.Item1.Param["cust_id"];
                    customer.cust_code = custSql.Item1.Param["cust_code"];
                    customer.cust_name = custSql.Item1.Param["cust_name"];
                    customer.cust_short_name = custSql.Item1.Param["cust_short_name"];
                    customer.cust_quick_code = custSql.Item1.Param["cust_quick_code"];
                    customer.cust_type = custSql.Item1.Param["cust_type"];
                    customer.legal_person = custSql.Item1.Param["legal_person"];
                    customer.enterprise_nature = custSql.Item1.Param["enterprise_nature"];
                    customer.cust_tel = custSql.Item1.Param["cust_tel"];
                    customer.cust_fax = custSql.Item1.Param["cust_fax"];
                    customer.cust_email = custSql.Item1.Param["cust_email"];
                    customer.cust_phone = custSql.Item1.Param["cust_phone"];
                    customer.cust_website = custSql.Item1.Param["cust_website"];
                    customer.province = custSql.Item1.Param["province"];
                    customer.city = custSql.Item1.Param["city"];
                    customer.county = custSql.Item1.Param["county"];
                    customer.cust_address = custSql.Item1.Param["cust_address"];
                    customer.zip_code = custSql.Item1.Param["zip_code"];
                    customer.tax_num = custSql.Item1.Param["tax_num"];
                    customer.indepen_legalperson = custSql.Item1.Param["indepen_legalperson"];
                    customer.credit_rating = custSql.Item1.Param["credit_rating"];
                    customer.credit_line = Convert.ToInt32(custSql.Item1.Param["credit_line"]);
                    customer.credit_account_period = Convert.ToInt32(custSql.Item1.Param["credit_account_period"]);
                    customer.price_type = custSql.Item1.Param["price_type"];
                    customer.billing_name = custSql.Item1.Param["billing_name"];
                    customer.billing_address = custSql.Item1.Param["billing_address"];
                    customer.billing_account = custSql.Item1.Param["billing_account"];
                    customer.open_bank = custSql.Item1.Param["open_bank"];
                    customer.bank_account = custSql.Item1.Param["bank_account"];
                    customer.bank_account_person = custSql.Item1.Param["bank_account_person"];
                    customer.cust_remark = custSql.Item1.Param["cust_remark"];
                    customer.is_member = custSql.Item1.Param["is_member"];
                    customer.member_number = custSql.Item1.Param["member_number"];
                    customer.member_class = custSql.Item1.Param["member_class"];
                    if(rdbis_member_y.Checked) customer.member_period_validity = Convert.ToInt64(custSql.Item1.Param["member_period_validity"]);
                    customer.status = custSql.Item1.Param["status"];
                    customer.enable_flag = custSql.Item1.Param["enable_flag"];
                    customer.data_source = custSql.Item1.Param["data_source"];
                    customer.cust_crm_guid = custSql.Item1.Param["cust_crm_guid"];

                    customer.accessories_discount = 0;
                    customer.workhours_discount = 0;
                    customer.country = custSql.Item1.Param["country"];
                    customer.indepen_legalperson = custSql.Item1.Param["indepen_legalperson"];
                    customer.market_segment = custSql.Item1.Param["market_segment"];
                    customer.institution_code = custSql.Item1.Param["institution_code"];
                    customer.com_constitution = custSql.Item1.Param["com_constitution"];
                    customer.registered_capital = custSql.Item1.Param["registered_capital"];
                    customer.vehicle_structure = custSql.Item1.Param["vehicle_structure"];
                    customer.agency = custSql.Item1.Param["agency"];
                    customer.sap_code = custSql.Item1.Param["sap_code"];
                    customer.business_scope = custSql.Item1.Param["business_scope"];
                    customer.ent_qualification = custSql.Item1.Param["ent_qualification"];

                    
                    if (wStatus == WindowStatus.Edit)
                    {
                        customer.update_by = custSql.Item1.Param["update_by"];
                        customer.update_time = Convert.ToInt64(custSql.Item1.Param["update_time"]);
                    }
                    else
                    {
                        customer.create_time = Convert.ToInt64(custSql.Item1.Param["create_time"]);
                        customer.create_by = custSql.Item1.Param["create_by"];
                    }
                    var flag = DBHelper.WebServHandler(opName, EnumWebServFunName.UpLoadCustomer, customer);
                    if (String.IsNullOrEmpty(flag))
                    {
                        var contactSql = BuildContactRelation(custSql.Item2).ToArray();
                        foreach (var sysSqlString in contactSql)
                        {
                            if (!sysSqlString.Param.ContainsKey("cont_id")) continue;
                            var contId = sysSqlString.Param["cont_id"];
                            var dt1 = DBHelper.GetTable("获取客户CRMID", "tb_customer","*", String.Format("cust_id = '{0}'", customer.cust_id), "", "");
                            var dt = DBHelper.GetTable("根据客户档案获取联系信息", "v_contacts", string.Format("*,{0} phone", EncryptByDB.GetDesFieldValue("cont_phone")), " cont_id = '" + contId + "'", "", "");
                            if (dt.DefaultView != null && dt.DefaultView.Count > 0)
                            {
                                var cont = new tb_contacts_ex
                                {
                                    cont_id = CommonCtrl.IsNullToString(dt.DefaultView[0]["cont_id"]),
                                    cont_name = CommonCtrl.IsNullToString(dt.DefaultView[0]["cont_name"]),
                                    cont_post = CommonCtrl.IsNullToString(dt.DefaultView[0]["cont_post_name"]),
                                    cont_phone = CommonCtrl.IsNullToString(dt.DefaultView[0]["phone"]),
                                    nation = CommonCtrl.IsNullToString(dt.DefaultView[0]["nation_name"]),
                                    parent_customer = CommonCtrl.IsNullToString(dt1.DefaultView[0]["cust_crm_guid"]),
                                    sex = CommonCtrl.IsNullToString(dt.DefaultView[0]["sex"]),
                                    status = CommonCtrl.IsNullToString(dt.DefaultView[0]["status"]),
                                    cont_post_remark = CommonCtrl.IsNullToString(dt.DefaultView[0]["post_remark"]),
                                    cont_crm_guid = CommonCtrl.IsNullToString(dt.DefaultView[0]["cont_crm_guid"]),
                                    contact_type = "01" //标识类型为联系人
                                };
                                var flag4Cont = DBHelper.WebServHandler(opName, EnumWebServFunName.UpLoadCcontact, cont);
                                if (String.IsNullOrEmpty(flag4Cont))
                                {
                                    //do something
                                }
                            }
                            
                        }
                        
                    }
                    MessageBoxEx.Show("保存成功!", "保存");
                    UCCustomerManager.BindPageData();
                    deleteMenuByTag(Tag.ToString(), UCCustomerManager.Name);
                }
                else
                {
                    MessageBoxEx.Show("保存失败!", "保存");
                }
            }
            catch (Exception ex)
            {
                MessageBoxEx.Show("保存失败!" + ex.Message, "提示");
            }

        }