/// <summary> /// 新增、修改营销管理中心数据 /// </summary> public string UpXFBdate(CXT_Customer Model) { if (!CheckXFBExistLinkPhone(Model.Cust_LinkPhone, Model.Cust_IsBill)) { StringBuilder strSql = new StringBuilder(); strSql.Append("\r IF NOT EXISTS(SELECT * FROM XFB_Customer WHERE Cust_Code ='" + ValueHandler.GetStringValue(Model.Cust_Code) + "')"); strSql.Append("\r BEGIN "); strSql.Append("\r INSERT INTO XFB_Customer("); strSql.Append("Cust_Code,Cust_Name,Cust_OldName,Cust_NameKey,Cust_Phone,Cust_Linkman,Cust_LinkPhone,Cust_ProvinceCode,Cust_ProvinceName,Cust_CityCode,Cust_CityName,Cust_CountyCode,Cust_CountyName,Cust_Address,Cust_IsBill,Cust_BillMoney,Cust_BillNumber,Cust_Nature,Cust_KFVoice,Cust_Source,Cust_OpenDate,Cust_WH_Remark,Cust_WH_UserName,Cust_State,Cust_OperateTime,Cust_IsView "); strSql.Append(") SELECT "); strSql.Append(" Cust_Code = '" + GetCode() + "', "); strSql.Append(GetCXT_Customer(Model)); strSql.Append("\r END"); strSql.Append("\r ELSE"); strSql.Append("\r BEGIN "); strSql.Append("UPDATE XFB_Customer SET "); strSql.Append(GetCXT_Customer(Model)); strSql.Append(" WHERE Cust_Code ='" + ValueHandler.GetStringValue(Model.Cust_Code) + "'"); strSql.Append("\r END"); if (strSql.Length > 0) { return(UpdateData(strSql.ToString()).ToString().ToLower()); } else { throw new Exception("无数据操作!"); } } else { return("-1"); } }
public string UpXFBdate(object obj) { ArrayList arr = JSON.getPara(obj); CXT_Customer Model = new CXT_Customer(); Model.Cust_Code = ValueHandler.GetStringValue(arr[0]); Model.Cust_Name = ValueHandler.GetStringValue(arr[1]); Model.Cust_OldName = ValueHandler.GetStringValue(arr[2]); Model.Cust_NameKey = ValueHandler.GetStringValue(arr[3]); Model.Cust_Phone = ValueHandler.GetStringValue(arr[4]); Model.Cust_Linkman = ValueHandler.GetStringValue(arr[5]); Model.Cust_LinkPhone = ValueHandler.GetStringValue(arr[6]); Model.Cust_ProvinceCode = ValueHandler.GetStringValue(arr[7]); Model.Cust_ProvinceName = ValueHandler.GetStringValue(arr[8]); Model.Cust_CityCode = ValueHandler.GetStringValue(arr[9]); Model.Cust_CityName = ValueHandler.GetStringValue(arr[10]); Model.Cust_CountyCode = ValueHandler.GetStringValue(arr[11]); Model.Cust_CountyName = ValueHandler.GetStringValue(arr[12]); Model.Cust_Address = ValueHandler.GetStringValue(arr[13]); Model.Cust_IsBill = ValueHandler.GetStringValue(arr[14]); Model.Cust_BillMoney = ValueHandler.GetIntNumberValue(arr[15]); Model.Cust_BillNumber = ValueHandler.GetStringValue(arr[16]); Model.Cust_Nature = ValueHandler.GetStringValue(arr[17]); Model.Cust_KFVoice = ValueHandler.GetStringValue(arr[18]); Model.Cust_Source = ValueHandler.GetStringValue(arr[19]); Model.Cust_WH_Remark = ValueHandler.GetStringValue(arr[20]); Model.Cust_WH_UserName = ValueHandler.GetStringValue(BLL_User.User_Name); Model.Cust_State = ValueHandler.GetStringValue("待审"); Model.Cust_IsView = ValueHandler.GetIntNumberValue(arr[21]); Model.fromPage = ValueHandler.GetStringValue(arr[22]); string Data = dAL_CallCenterDts.UpXFBdate(Model); return(Data); }
/// <summary> /// 得到数据 /// </summary> public string GetCXT_Customer(CXT_Customer Model) { StringBuilder strSql = new StringBuilder(); strSql.Append("Cust_Name = '" + ValueHandler.GetStringValue(Model.Cust_Name) + "', "); strSql.Append("Cust_OldName = '" + ValueHandler.GetStringValue(Model.Cust_OldName) + "', "); strSql.Append("Cust_NameKey = '" + ValueHandler.GetStringValue(Model.Cust_NameKey) + "', "); strSql.Append("Cust_Phone = '" + ValueHandler.GetStringValue(Model.Cust_Phone) + "', "); strSql.Append("Cust_Linkman = '" + ValueHandler.GetStringValue(Model.Cust_Linkman) + "', "); strSql.Append("Cust_LinkPhone = '" + ValueHandler.GetStringValue(Model.Cust_LinkPhone) + "', "); strSql.Append("Cust_ProvinceCode = '" + ValueHandler.GetStringValue(Model.Cust_ProvinceCode) + "', "); strSql.Append("Cust_ProvinceName = '" + ValueHandler.GetStringValue(Model.Cust_ProvinceName) + "', "); strSql.Append("Cust_CityCode = '" + ValueHandler.GetStringValue(Model.Cust_CityCode) + "', "); strSql.Append("Cust_CityName = '" + ValueHandler.GetStringValue(Model.Cust_CityName) + "', "); strSql.Append("Cust_CountyCode = '" + ValueHandler.GetStringValue(Model.Cust_CountyCode) + "', "); strSql.Append("Cust_CountyName = '" + ValueHandler.GetStringValue(Model.Cust_CountyName) + "', "); strSql.Append("Cust_Address = '" + ValueHandler.GetStringValue(Model.Cust_Address) + "', "); strSql.Append("Cust_IsBill = '" + ValueHandler.GetStringValue(Model.Cust_IsBill) + "', "); strSql.Append("Cust_BillMoney = " + ValueHandler.GetIntNumberValue(Model.Cust_BillMoney) + ", "); strSql.Append("Cust_BillNumber = '" + ValueHandler.GetStringValue(Model.Cust_BillNumber) + "', "); strSql.Append("Cust_Nature = '" + ValueHandler.GetStringValue(Model.Cust_Nature) + "', "); strSql.Append("Cust_KFVoice = '" + ValueHandler.GetStringValue(Model.Cust_KFVoice) + "', "); strSql.Append("Cust_Source = '" + ValueHandler.GetStringValue(Model.Cust_Source) + "', "); strSql.Append("Cust_OpenDate = " + ValueHandler.GetMarkStringDateValue(Model.Cust_OpenDate) + ", "); strSql.Append("Cust_WH_Remark = '" + ValueHandler.GetStringValue(Model.Cust_WH_Remark) + "', "); strSql.Append("Cust_WH_UserName = '******', "); strSql.Append("Cust_State = '" + ValueHandler.GetStringValue(Model.Cust_State) + "', "); string NowTime = DateTime.Now.ToString(); strSql.Append("Cust_OperateTime = '" + NowTime + "', "); strSql.Append("Cust_IsView = " + ValueHandler.GetIntNumberValue(Model.Cust_IsView) + ""); return(strSql.ToString()); }
/// <summary> /// 判断是否存在加盟店联系电话 By zhaohu /// </summary> /// <param name="linkPhone">联系电话</param> /// <param name="Cust_IsBill">是否计费</param> /// <returns>bool值</returns> public string CheckExistLinkPhone(CXT_Customer model) { string msg = ""; string linkPhone = model.Cust_LinkPhone; string Cust_IsBill = model.Cust_IsBill; string fromPage = model.fromPage; string cusCode = model.Cust_Code; string sql = string.Format(@"SELECT * FROM CXT_Customer WHERE Cust_LinkPhone = '{0}' AND Cust_State NOT IN( '待审','退回') AND DataState = 0", linkPhone); if (fromPage == "CustomerReturns_A") { sql = string.Format(@"SELECT * FROM CXT_Customer WHERE Cust_Code!='{1}' and Cust_LinkPhone = '{0}' AND Cust_State NOT IN( '待审','退回') AND DataState = 0", linkPhone, cusCode); } DataTable dt = SearchData(sql); if (dt != null && dt.Rows.Count > 0) { if (Cust_IsBill == "是") { return("联系电话已经存在,请将是否计费<br/>改成否!"); } else { return(msg); } } else { return(msg); } }
/// <summary> /// 新增、修改营销管理中心数据 /// </summary> public string Update(CXT_Customer Model) { #region old //string msg = CheckExistLinkPhone(Model); //if (msg=="") //{ // StringBuilder strSql = new StringBuilder(); // strSql.Append("\r IF NOT EXISTS(SELECT * FROM CXT_Customer WHERE Cust_Code ='" + ValueHandler.GetStringValue(Model.Cust_Code) + "')"); // strSql.Append("\r BEGIN "); // strSql.Append("\r INSERT INTO CXT_Customer("); // strSql.Append("Cust_Code,Cust_Name,Cust_OldName,Cust_NameKey,Cust_Phone,Cust_Linkman,Cust_LinkPhone,Cust_ProvinceCode,Cust_ProvinceName,Cust_CityCode,Cust_CityName,Cust_CountyCode,Cust_CountyName,Cust_Address,Cust_IsBill,Cust_BillMoney,Cust_BillNumber,Cust_Nature,Cust_KFVoice,Cust_Source,Cust_OpenDate,Cust_WH_Remark,Cust_WH_UserName,Cust_State,Cust_OperateTime,Cust_IsView "); // strSql.Append(") SELECT "); // strSql.Append(" Cust_Code = '" + GetCode() + "', "); // strSql.Append(GetCXT_Customer(Model)); // strSql.Append("\r END"); // strSql.Append("\r ELSE"); // strSql.Append("\r BEGIN "); // strSql.Append("UPDATE CXT_Customer SET "); // strSql.Append(GetCXT_Customer(Model)); // strSql.Append(" WHERE Cust_Code ='" + ValueHandler.GetStringValue(Model.Cust_Code) + "'"); // strSql.Append("\r END"); // if (strSql.Length > 0) // { // return UpdateData(strSql.ToString()).ToString().ToLower(); // } // else // { // throw new Exception("无数据操作!"); // } //} //else //{ // return msg; //} #endregion string msg = ""; StringBuilder strSql = new StringBuilder(); strSql.Append("'" + ValueHandler.GetStringValue(Model.Cust_Code) + "', "); strSql.Append("'" + ValueHandler.GetStringValue(Model.Cust_Name) + "', "); strSql.Append("'" + ValueHandler.GetStringValue(Model.Cust_OldName) + "', "); strSql.Append("'" + ValueHandler.GetStringValue(Model.Cust_NameKey) + "', "); strSql.Append("'" + ValueHandler.GetStringValue(Model.Cust_Phone) + "', "); strSql.Append("'" + ValueHandler.GetStringValue(Model.Cust_Linkman) + "', "); strSql.Append("'" + ValueHandler.GetStringValue(Model.Cust_LinkPhone) + "', "); strSql.Append("'" + ValueHandler.GetStringValue(Model.Cust_ProvinceCode) + "', "); strSql.Append("'" + ValueHandler.GetStringValue(Model.Cust_ProvinceName) + "', "); strSql.Append("'" + ValueHandler.GetStringValue(Model.Cust_CityCode) + "', "); strSql.Append("'" + ValueHandler.GetStringValue(Model.Cust_CityName) + "', "); strSql.Append("'" + ValueHandler.GetStringValue(Model.Cust_CountyCode) + "', "); strSql.Append("'" + ValueHandler.GetStringValue(Model.Cust_CountyName) + "', "); strSql.Append("'" + ValueHandler.GetStringValue(Model.Cust_Address) + "', "); strSql.Append("'" + ValueHandler.GetStringValue(Model.Cust_IsBill) + "', "); strSql.Append("'" + ValueHandler.GetIntNumberValue(Model.Cust_BillMoney) + "', "); strSql.Append("'" + ValueHandler.GetStringValue(Model.Cust_BillNumber) + "', "); strSql.Append("'" + ValueHandler.GetStringValue(Model.Cust_Nature) + "', "); strSql.Append("'" + ValueHandler.GetStringValue(Model.Cust_KFVoice) + "', "); strSql.Append("'" + ValueHandler.GetStringValue(Model.Cust_Source) + "', "); strSql.Append("'" + ValueHandler.GetMarkStringDateValue(Model.Cust_OpenDate) + "', "); strSql.Append("'" + ValueHandler.GetStringValue(Model.Cust_WH_Remark) + "', "); strSql.Append("'" + ValueHandler.GetStringValue(Model.Cust_WH_UserName) + "', "); strSql.Append("'" + ValueHandler.GetStringValue(Model.Cust_State) + "', "); strSql.Append("'" + ValueHandler.GetIntNumberValue(Model.Cust_IsView) + "',"); strSql.Append("'" + ValueHandler.GetStringValue(Model.JoinMan) + "',"); strSql.Append("'" + ValueHandler.GetStringValue(Model.fromPage) + "',"); strSql.Append("'" + ValueHandler.GetIntNumberValue(Model.platForm) + "',"); strSql.Append("'" + ValueHandler.GetStringValue(Model.isCheck) + "',"); strSql.Append("'" + ValueHandler.GetStringValue(Model.Cust_BelongProvinceCode) + "',"); strSql.Append("'" + ValueHandler.GetStringValue(Model.Cust_BelongProvinceName) + "',"); strSql.Append("'" + ValueHandler.GetStringValue(Model.Cust_BelongCityCode) + "',"); strSql.Append("'" + ValueHandler.GetStringValue(Model.Cust_BelongCityName) + "'"); string sql = string.Format(@"exec [dbo].[SP_CustomerMaitain] {0}", strSql); try { DataTable dt = SearchData(sql); msg = dt.Rows[0][0].ToString(); } catch (Exception ex) { msg = ex.Message; } return(msg); }