public CustomerAttributeGroupInfoModel GetCustomerGroupFromDatabase(string group_id) { CustomerAttributeGroupInfoModel model = null; string sql = @" SELECT * FROM customer_attribute_group_info WHERE group_id = $group_id$ "; ParameterCollection pc = new ParameterCollection(); pc.Add("group_id", group_id); DataTable dt = ExecuteDataTable(sql, pc); if (dt != null && dt.Rows.Count > 0) { model = new CustomerAttributeGroupInfoModel(); ModelConvertFrom(model, dt, 0); } return(model); }
/// <summary> /// 从数据库中获取分组信息。 /// </summary> /// <returns></returns> public Dictionary <string, CustomerAttributeGroupInfoModel> GetGroupInfoListFromDatabse() { Dictionary <string, CustomerAttributeGroupInfoModel> dict = null; string sql = @" SELECT * FROM customer_attribute_group_info "; DataTable dt = ExecuteDataTable(sql); if (dt != null && dt.Rows.Count > 0) { dict = new Dictionary <string, CustomerAttributeGroupInfoModel>(); CustomerAttributeGroupInfoModel model = null; for (int i = 0; i < dt.Rows.Count; i++) { model = new CustomerAttributeGroupInfoModel(); model.GroupId = dt.Rows[i]["group_id"].ToString(); model.GroupName = dt.Rows[i]["group_name"].ToString(); model.Status = Convert.ToInt32(dt.Rows[i]["status"]); dict.Add(model.GroupId, model); } } return(dict); }
/// <summary> /// 删除 /// </summary> /// <param name="pc">pc</param> /// <returns>影响的记录行数</returns> public int DeleteMultiple(ParameterCollection pc) { int ret = 0; CustomerAttributeGroupInfoModel customerattributegroupinfo = new CustomerAttributeGroupInfoModel(); ret = DbUtil.Current.DeleteMultiple(customerattributegroupinfo, pc); return(ret); }
/// <summary> /// 更新 /// </summary> /// <param name="customerattributegroupinfo">实体</param> /// <param name="pc">pc</param> /// <returns>影响的记录行数</returns> public int UpdateMultiple(CustomerAttributeGroupInfoModel customerattributegroupinfo, ParameterCollection pc) { int ret = 0; customerattributegroupinfo.ModifiedBy = SessionUtil.Current.UserId; customerattributegroupinfo.ModifiedOn = DateTime.Now; ret = DbUtil.Current.UpdateMultiple(customerattributegroupinfo, pc); return(ret); }
/// <summary> /// 更新 /// </summary> /// <param name="customerattributegroupinfo">实体</param> /// <returns>影响的记录行数</returns> public int Update(CustomerAttributeGroupInfoModel customerattributegroupinfo) { int ret = 0; customerattributegroupinfo.ModifiedBy = SessionUtil.Current.UserId; customerattributegroupinfo.ModifiedOn = DateTime.Now; ret = DbUtil.Current.Update(customerattributegroupinfo); return(ret); }
/// <summary> /// 删除 /// </summary> /// <param name="groupid"></param> /// <param name="groupid"></param> /// <returns>影响的记录行数</returns> public int Delete(string groupid) { int ret = 0; CustomerAttributeGroupInfoModel customerattributegroupinfo = new CustomerAttributeGroupInfoModel(); customerattributegroupinfo.GroupId = groupid; customerattributegroupinfo.GroupId = groupid; ret = DbUtil.Current.Delete(customerattributegroupinfo); return(ret); }
/// <summary> /// 根据条件获取实体集合 /// </summary> /// <param name="pc">pc</param> /// <param name="obc">obc</param> /// <returns>实体</returns> public List <CustomerAttributeGroupInfoModel> RetrieveMultiple(ParameterCollection pc, OrderByCollection obc) { List <CustomerAttributeGroupInfoModel> customerattributegroupinfos = new List <CustomerAttributeGroupInfoModel>(); CustomerAttributeGroupInfoModel customerattributegroupinfo = new CustomerAttributeGroupInfoModel(); DataTable dt = DbUtil.Current.RetrieveMultiple(customerattributegroupinfo, pc, obc); for (int i = 0; i < dt.Rows.Count; i++) { customerattributegroupinfo = new CustomerAttributeGroupInfoModel(); customerattributegroupinfo.ConvertFrom(dt, i); customerattributegroupinfos.Add(customerattributegroupinfo); } return(customerattributegroupinfos); }
public bool UpdateGroupInfo(CustomerAttributeGroupInfoModel model, out string message) { bool result = false; message = "操作失败,请与管理员联系"; model.Tabname = "customer_info_" + CharacterUtil.ConvertToPinyin(model.GroupName); Dictionary <string, CustomerAttributeGroupInfoModel> dict = GetCustomeGroupInfoList(true); CustomerAttributeGroupInfoModel oldInfo = dict[model.GroupId]; try { BeginTransaction(); if (oldInfo.GroupName != model.GroupName) { string NewsTableName = "customer_info_" + CharacterUtil.ConvertToPinyin(model.GroupName); string TableName = "customer_info_" + CharacterUtil.ConvertToPinyin(oldInfo.GroupName); string renSQL = DTableUtil.GetRenameTableSQL(TableName, NewsTableName); ExecuteNonQuery(renSQL); } if (Update(model) == 1) { GetGroupInfoById(model.GroupId, true); message = "成功更新客户分组属性"; result = true; CommitTransaction(); } else { RollbackTransaction(); message = "更新产客户分组属性失败,请与管理员联系"; result = false; } } catch (Exception ex) { RollbackTransaction(); LogUtil.Error("更新客户分组属性异常", ex); throw ex; } return(result); }
// 在此添加你的代码.... public bool UpdateCustomerAttribute(CustomerExtAttributesModel attInfo, out string message, string oldName) { bool result = false; message = "操作失败,请与管理员联系"; CustomerExtAttributesModel model = GetCustomerAttributeById(attInfo.ExtAttributeId, true); Dictionary <string, CustomerAttributeGroupInfoModel> dict = CustomerAttributeGroupInfoService.Instance.GetCustomeGroupInfoList(true); CustomerAttributeGroupInfoModel oldInfo = dict[model.GroupId]; try { BeginTransaction(); if (attInfo.AttributeName != oldName) { string TableName = "customer_info_" + CharacterUtil.ConvertToPinyin(oldInfo.GroupName); string renameFieldSQL = DTableUtil.GetRenameFieldSQL(TableName, oldName, attInfo.AttributeName); ExecuteNonQuery(renameFieldSQL); } if (Update(attInfo) == 1) { GetCustomerAttributeList(attInfo.ExtAttributeId, true); message = "成功更新客户属性"; result = true; CommitTransaction(); } else { RollbackTransaction(); message = "更新产客户属性失败,请与管理员联系"; result = false; } } catch (Exception ex) { RollbackTransaction(); LogUtil.Error("更新客户属性异常", ex); throw ex; } return(result); }
/// <summary> /// 根据主键获取实体 /// </summary> /// <param name="groupid"></param> /// <param name="groupid"></param> /// <returns>实体</returns> public CustomerAttributeGroupInfoModel Retrieve(string groupid) { CustomerAttributeGroupInfoModel customerattributegroupinfo = new CustomerAttributeGroupInfoModel(); customerattributegroupinfo.GroupId = groupid; customerattributegroupinfo.GroupId = groupid; DataTable dt = DbUtil.Current.Retrieve(customerattributegroupinfo); if (dt.Rows.Count < 1) { return(null); } customerattributegroupinfo.ConvertFrom(dt); return(customerattributegroupinfo); }
/// <summary> /// 根据ID获取领域模型。 /// </summary> /// <param name="userId"></param> /// <param name="clear"></param> /// <returns></returns> public CustomerAttributeGroupInfoModel GetGroupInfoById(string Id, bool clear) { string cacheKey = CacheKey.GetKeyDefine(CacheKey.CUSTOMER_GroupInfo_DICT, Id); CustomerAttributeGroupInfoModel result = CacheUtil.Get <CustomerAttributeGroupInfoModel>(cacheKey); if (result == null || clear) { CustomerAttributeGroupInfoModel basicInfo = GetCustomerGroupFromDatabase(Id); if (basicInfo != null) { result = new CustomerAttributeGroupInfoModel(); result = basicInfo; CacheUtil.Set(cacheKey, result); } } return(result); }
// 在此添加你的代码... /// <summary> /// 根据ID删除客户分组属性信息。 /// </summary> /// <param name="departmentId"></param> /// <param name="message"></param> /// <returns></returns> public bool DeleteGroupInfoById(string groupid, out string message) { message = "操作失败,请与管理员联系"; bool result = false; Dictionary <string, CustomerAttributeGroupInfoModel> dict = GetCustomeGroupInfoList(true); CustomerAttributeGroupInfoModel oldInfo = dict[groupid]; string TableName = "customer_info_" + CharacterUtil.ConvertToPinyin(oldInfo.GroupName); string deleteCustomerAttributesSQL = "DELETE FROM customer_ext_attributes WHERE group_id = $groupid$;"; ParameterCollection pc = new ParameterCollection(); pc.Add("groupid", groupid); try { BeginTransaction(); if (Delete(groupid) > 0) { ExecuteNonQuery(deleteCustomerAttributesSQL, pc); string dropTableSQL = DTableUtil.GetDropTableSQL(TableName); ExecuteNonQuery(dropTableSQL); CommitTransaction(); result = true; message = "成功删除客户属性信息"; GetCustomeGroupInfoList(true); } else { RollbackTransaction(); } } catch (Exception ex) { RollbackTransaction(); LogUtil.Error("删除删除客户属性信息异常", ex); throw ex; } return(result); }
/// <summary> /// 根据ID删除客户属性信息。 /// </summary> /// <param name="departmentId"></param> /// <param name="message"></param> /// <returns></returns> public bool DeleteCustomerAttributeById(string extattributeid, out string message) { message = "操作失败,请与管理员联系"; bool result = false; CustomerExtAttributesModel model = GetCustomerAttributeById(extattributeid, true); Dictionary <string, CustomerAttributeGroupInfoModel> dict = CustomerAttributeGroupInfoService.Instance.GetCustomeGroupInfoList(true); CustomerAttributeGroupInfoModel oldInfo = dict[model.GroupId]; try { BeginTransaction(); string TableName = "customer_info_" + CharacterUtil.ConvertToPinyin(oldInfo.GroupName); string deleteFieldSQL = DTableUtil.GetDeleteFieldSQL(TableName, model.AttributeName); ExecuteNonQuery(deleteFieldSQL); if (Delete(extattributeid) > 0) { CommitTransaction(); result = true; message = "成功删除客户属性信息"; GetCustomerAttributeList(extattributeid, true); } else { RollbackTransaction(); } } catch (Exception ex) { RollbackTransaction(); LogUtil.Error("删除删除客户属性信息异常", ex); throw ex; } return(result); }
public bool CreateGroupInfo(CustomerAttributeGroupInfoModel model, out string message) { bool result = false; message = "操作失败,请与管理员联系"; model.GroupId = GetGuid(); model.Tabname = "customer_info_" + CharacterUtil.ConvertToPinyin(model.GroupName); if (CheckExistGroupname(model.GroupName)) { message = string.Format("操作失败,已经存在名为【{0}】属性名称", model.GroupName); return(false); } string TableName = "customer_info_" + CharacterUtil.ConvertToPinyin(model.GroupName); #region 创建表字段 List <FieldInfo> fieldList = new List <FieldInfo>(); FieldInfo field = new FieldInfo(); field.FieldName = "customer_id"; field.FieldType = "varchar"; field.MinLength = 50; field.MaxLength = 50; field.IsNull = false; field.IsPrimaryKey = true; fieldList.Add(field); field = new FieldInfo(); field.FieldName = "created_on"; field.FieldType = "datetime"; field.IsNull = false; field.IsPrimaryKey = false; fieldList.Add(field); field = new FieldInfo(); field.FieldName = "created_by"; field.FieldType = "varchar"; field.MinLength = 50; field.MaxLength = 50; field.IsNull = false; field.IsPrimaryKey = false; fieldList.Add(field); field = new FieldInfo(); field.FieldName = "modified_on"; field.FieldType = "datetime"; field.IsNull = true; field.IsPrimaryKey = false; fieldList.Add(field); field = new FieldInfo(); field.FieldName = "modified_by"; field.FieldType = "varchar"; field.MinLength = 50; field.MaxLength = 50; field.IsNull = true; field.IsPrimaryKey = false; fieldList.Add(field); field = new FieldInfo(); field.FieldName = "status_code"; field.FieldType = "int"; field.IsNull = true; fieldList.Add(field); string createTableSql = DTableUtil.GetCreateTableSQL(TableName, fieldList); #endregion try { BeginTransaction(); ExecuteNonQuery(createTableSql); if (Create(model) == 1) { message = "成功创建分组属性"; result = true; GetGroupInfoById(model.GroupId, true); CommitTransaction(); } else { RollbackTransaction(); result = false; message = "创建客户分组属性失败,请与管理员联系"; } } catch (Exception ex) { RollbackTransaction(); LogUtil.Error("创建客户分组属性异常", ex); throw ex; } return(result); }
public bool ImportCustomerBasicInfo(DataTable customerTable, out string importLogs, out string message) { message = "操作失败,请与管理员联系"; importLogs = ""; bool result = false; if (customerTable == null && customerTable.Rows.Count == 0) { message = "客户信息表为空,请检查Excel文件是否正确"; importLogs = message; return(false); } #region 验证表头 List <CustomerAttributeGroupInfoModel> attGrouList = new List <CustomerAttributeGroupInfoModel>(); CustomerExtAttributesModel attributeInfo = null; for (int i = 0; i < customerTable.Rows.Count; i++) { for (int j = 0; j < customerTable.Columns.Count; j++) { attributeInfo = CustomerExtAttributesInfoService.Instance.GetCustomerExtAttributeInfoModelByAttributeName(customerTable.Columns[j].ColumnName, true); if (attributeInfo == null) { message = string.Format("【{0}】列不存在数据库中", customerTable.Columns[j].ColumnName); return(false); } switch (attributeInfo.FieldType) { case "string": break; case "text": break; case "custom": List <string> customList = attributeInfo.CustomValue.Split(',').ToList(); if (customList != null && customList.Contains(customerTable.Rows[i][j].ToString()) == false) { message = string.Format("因为Excel第【{0}】行第【{0}】列的值不存在于属性名为A的自定义值列表中", customerTable.Rows[i], customerTable.Columns[j]); return(false); } break; case "decimal": if (Framework.Utilities.CharacterUtil.isNumber(customerTable.Rows[i][j].ToString()) == false) { message = string.Format("因为Excel第【{0}】行第【{0}】列的值不为数值", customerTable.Rows[i], customerTable.Columns[j]); return(false); } break; default: break; } } } #endregion CustomerAttributeGroupInfoModel attGroupInfo = CustomerAttributeGroupInfoService.Instance.GetGroupInfoById(attributeInfo.GroupId, false); if (attGroupInfo == null) { message = "操作失败,请与管理员联系"; return(false); } attGrouList.Add(attGroupInfo); List <string> insertSQLList = new List <string>(); foreach (CustomerAttributeGroupInfoModel groupInfo in attGrouList) { StringBuilder insertSQLBuilder = new StringBuilder(); insertSQLBuilder.AppendFormat("INSERT INTO {0} (customer_id, created_on, created_by, status_code,", groupInfo.Tabname); for (int k = 0; k < customerTable.Columns.Count; k++) { attributeInfo = CustomerExtAttributesInfoService.Instance.GetCustomerExtAttributeInfoModelByAttributeName(customerTable.Columns[k].ColumnName, true); if (attributeInfo.GroupId == groupInfo.GroupId) { insertSQLBuilder.AppendFormat("[{0}],", attributeInfo.AttributeName); } } insertSQLBuilder.Length = insertSQLBuilder.Length - 1; insertSQLBuilder.Append(" ) VALUES ( $customer_id$, GETDATE(), $created_by$, 0, "); for (int k = 0; k < customerTable.Columns.Count; k++) { attributeInfo = CustomerExtAttributesInfoService.Instance.GetCustomerExtAttributeInfoModelByAttributeName(customerTable.Columns[k].ColumnName, true); if (attributeInfo.GroupId == groupInfo.GroupId) { insertSQLBuilder.AppendFormat("${0}$,", CharacterUtil.ConvertToPinyin(attributeInfo.AttributeName)); } } insertSQLBuilder.Length = insertSQLBuilder.Length - 1; insertSQLBuilder.Append(" )"); insertSQLList.Add(insertSQLBuilder.ToString()); } try { ParameterCollection pc = new ParameterCollection(); CustomerBasicInfoModel basicInfo = null; BeginTransaction(); for (int i = 0; i < customerTable.Rows.Count; i++) { #region 插入客户基本信息表数据 basicInfo = new CustomerBasicInfoModel(); basicInfo.CustomerId = GetGuid(); basicInfo.MobilePhone = customerTable.Rows[i]["手机号码"].ToString(); basicInfo.HomePhone = customerTable.Rows[i]["电话号码"].ToString(); basicInfo.OtherPhone = customerTable.Rows[i]["其他号码"].ToString(); basicInfo.Sex = (customerTable.Rows[i]["性别"].ToString() == "男") ? 0 : 1; if (!string.IsNullOrEmpty(customerTable.Rows[i]["手机价位"].ToString())) { basicInfo.MobilePhonePrice = CustomDataInfoService.Instance.GetCustomDataDomainModelByName("手机价位", false).GetCustomDataValueDomainByDataValue(customerTable.Rows[i]["手机价位"].ToString()).ValueId; } else { basicInfo.MobilePhonePrice = CustomDataInfoService.Instance.GetCustomDataDomainModelByName("手机价位", false).GetCustomDataValueDomainByDataValue("未知").ValueId; } basicInfo.Level = CustomDataInfoService.Instance.GetCustomDataDomainModelByName("客户等级", false).GetCustomDataValueDomainByDataValue(customerTable.Rows[i]["客户等级"].ToString()).ValueId; if (!string.IsNullOrEmpty(customerTable.Rows[i]["运营商"].ToString())) { basicInfo.Carriers = CustomDataInfoService.Instance.GetCustomDataDomainModelByName("运营商", false).GetCustomDataValueDomainByDataValue(customerTable.Rows[i]["运营商"].ToString()).ValueId; } else { basicInfo.Carriers = CustomDataInfoService.Instance.GetCustomDataDomainModelByName("运营商", false).GetCustomDataValueDomainByDataValue("未知").ValueId; } basicInfo.UsingPhoneType = customerTable.Rows[i]["手机型号"].ToString(); basicInfo.CommunicationConsumer = CustomDataInfoService.Instance.GetCustomDataDomainModelByName("通讯消费", false).GetCustomDataValueDomainByDataValue(customerTable.Rows[i]["通讯消费"].ToString()).ValueId; basicInfo.PreferredPhoneBrand = CustomDataInfoService.Instance.GetCustomDataDomainModelByName("优选品牌", false).GetCustomDataValueDomainByDataValue(customerTable.Rows[i]["优选品牌"].ToString()).ValueId; basicInfo.UsingPhoneBrand = CustomDataInfoService.Instance.GetCustomDataDomainModelByName("优选品牌", false).GetCustomDataValueDomainByDataValue(customerTable.Rows[i]["在用品牌"].ToString()).ValueId; basicInfo.UsingSmartphone = (customerTable.Rows[i]["是否智能机"].ToString() == "是") ? 0 : 1; basicInfo.SalesFrom = CustomDataInfoService.Instance.GetCustomDataDomainModelByName("客户来源", false).GetCustomDataValueDomainByDataValue(customerTable.Rows[i]["客户来源"].ToString()).ValueId; basicInfo.CustomerCode = "C" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + i; PhoneLocationInfoModel loc = PhoneLocationInfoService.Instance.GetLocationInfo(basicInfo.MobilePhone, false); basicInfo.CustomerId = GetGuid(); if (loc != null) { basicInfo.ChinaId = loc.ChinaId; basicInfo.ComeFrom = loc.City; } else { basicInfo.ComeFrom = ""; } if (!string.IsNullOrEmpty(basicInfo.MobilePhone)) { if (CheckExistPhoneNumber(basicInfo.MobilePhone)) { continue; } } if (!string.IsNullOrEmpty(basicInfo.HomePhone)) { if (CheckExistPhoneNumber(basicInfo.HomePhone)) { continue; } } if (!string.IsNullOrEmpty(basicInfo.OtherPhone)) { if (CheckExistPhoneNumber(basicInfo.OtherPhone)) { continue; } } #endregion pc.Clear(); pc.Add("customer_id", basicInfo.CustomerId); pc.Add("created_by", SessionUtil.Current.UserId); for (int k = 0; k < customerTable.Columns.Count; k++) { pc.Add(CharacterUtil.ConvertToPinyin(customerTable.Columns[k].ColumnName), customerTable.Rows[i][k].ToString()); } if (CustomerBasicInfoService.Instance.Create(basicInfo) > 0) { foreach (string sql in insertSQLList) { if (DbUtil.Current.IData.ExecuteNonQuery(sql, pc) != 1) { RollbackTransaction(); message = ""; return(false); } } #region 判断插入customer_phone_info表 if (!string.IsNullOrEmpty(basicInfo.MobilePhone)) { if (!CustomerPhoneInfoService.Instance.CreateCustomerPhoneInfo(basicInfo.MobilePhone, basicInfo.CustomerId, out message)) { RollbackTransaction(); return(false); } } if (!string.IsNullOrEmpty(basicInfo.HomePhone)) { if (!CustomerPhoneInfoService.Instance.CreateCustomerPhoneInfo(basicInfo.HomePhone, basicInfo.CustomerId, out message)) { RollbackTransaction(); return(false); } } if (!string.IsNullOrEmpty(basicInfo.OtherPhone)) { if (!CustomerPhoneInfoService.Instance.CreateCustomerPhoneInfo(basicInfo.OtherPhone, basicInfo.CustomerId, out message)) { RollbackTransaction(); return(false); } } #endregion CustomerInfoService.Instance.GetCustomerDomainModelById(basicInfo.CustomerId, true); } } CommitTransaction(); message = "成功添加客户信息"; result = true; } catch (Exception ex) { RollbackTransaction(); LogUtil.Error("导入客户信息异常", ex); throw ex; } return(result); }
public bool CreateCustomerAttribute(CustomerExtAttributesModel attInfo, out string message) { bool result = false; message = "操作失败,请与管理员联系"; CustomerAttributeGroupInfoModel GroupInfoModel = null; GroupInfoModel = CustomerAttributeGroupInfoService.Instance.GetCustomerGroupFromDatabase(attInfo.GroupId); if (attInfo.FieldType.ToLower() == "string") { if (attInfo.FieldMinLength <= 1 || attInfo.FieldMaxLength <= 1 || attInfo.FieldMaxLength <= attInfo.FieldMinLength) { message = "属性字段长度有误,请检查输入"; return(false); } } if (CheckExistAttributename(attInfo.AttributeName)) { message = string.Format("操作失败,已经存在名为【{0}】属性名称", attInfo.AttributeName); return(false); } Dictionary <string, CustomerAttributeGroupInfoModel> dict = CustomerAttributeGroupInfoService.Instance.GetCustomeGroupInfoList(false); attInfo.SortOrder = (dict == null) ? 1 : dict.Count + 1; string TableName = "customer_info_" + CharacterUtil.ConvertToPinyin(GroupInfoModel.GroupName); #region 添加属性 attInfo.ExtAttributeId = Guid.NewGuid().ToString(); attInfo.SortOrder = (dict == null) ? 1 : dict.Count + 1; attInfo.NodeId = "0"; attInfo.ParnetId = "0"; FieldInfo fieldInfo = new FieldInfo(); fieldInfo.FieldName = attInfo.AttributeName; if (attInfo.FieldType == "string" || attInfo.FieldType == "custom") { fieldInfo.FieldType = "varchar"; fieldInfo.MinLength = Convert.ToInt32(attInfo.FieldMinLength); fieldInfo.MaxLength = Convert.ToInt32(attInfo.FieldMaxLength); } else { fieldInfo.FieldType = attInfo.FieldType; fieldInfo.MinLength = Convert.ToInt32(attInfo.FieldMinLength); fieldInfo.MaxLength = Convert.ToInt32(attInfo.FieldMaxLength); } if (fieldInfo.MinLength < 0 && fieldInfo.FieldType == "varchar") { fieldInfo.MinLength = 50; } if (fieldInfo.MaxLength < 0 && fieldInfo.FieldType == "varchar") { fieldInfo.MaxLength = 50; } if (attInfo.FieldType == "text") { fieldInfo.FieldType = "varchar"; fieldInfo.MaxLength = -1; } fieldInfo.DefaultValue = attInfo.DefaultValue; fieldInfo.Description = attInfo.Description; string addFieldSQL = DTableUtil.GetAddFieldSQL(TableName, fieldInfo); #endregion try { BeginTransaction(); if (Create(attInfo) == 1) { ExecuteNonQuery(addFieldSQL); message = "成功创建客户属性"; result = true; GetCustomerAttributeList(attInfo.ExtAttributeId, true); CommitTransaction(); } else { RollbackTransaction(); result = false; message = "创建客户属性失败,请与管理员联系"; } } catch (Exception ex) { RollbackTransaction(); LogUtil.Error("创建客户属性异常", ex); throw ex; } return(result); }