/// <summary> /// 修改个人会员信息,返回1成功 /// </summary> /// <param name="info">个人会员信息业务实体</param> /// <returns></returns> public int Update(EyouSoft.Model.CrmStructure.MCrmPersonalInfo info) { if (info == null || string.IsNullOrEmpty(info.CompanyId) || string.IsNullOrEmpty(info.OperatorId)) { return(0); } if (string.IsNullOrEmpty(info.Name)) { return(-1); } if (string.IsNullOrEmpty(info.CrmId)) { return(-2); } int dalRetCode = dal.Update(info); if (dalRetCode == 1) { SysStructure.BSysLogHandle.Insert("修改个人会员信息,会员编号:" + info.CrmId + ",会员姓名:" + info.Name + "。"); return(1); } return(dalRetCode); }
/// <summary> /// 获取个人会员信息业务实体 /// </summary> /// <param name="crmId">个人会员编号</param> /// <returns></returns> public EyouSoft.Model.CrmStructure.MCrmPersonalInfo GetInfo(string crmId) { EyouSoft.Model.CrmStructure.MCrmPersonalInfo info = null; DbCommand cmd = _db.GetSqlStringCommand(SQL_SELECT_GetInfo); _db.AddInParameter(cmd, "CrmId", DbType.AnsiStringFixedLength, crmId); using (IDataReader rdr = DbHelper.ExecuteReader(cmd, _db)) { if (rdr.Read()) { info = new EyouSoft.Model.CrmStructure.MCrmPersonalInfo(); if (!rdr.IsDBNull(rdr.GetOrdinal("Birthday"))) { info.Birthday = rdr.GetDateTime(rdr.GetOrdinal("Birthday")); } info.BriefCode = rdr["BrevityCode"].ToString(); info.CityId = rdr.GetInt32(rdr.GetOrdinal("CityId")); info.CompanyId = rdr.GetString(rdr.GetOrdinal("CompanyId")); info.CountryId = rdr.GetInt32(rdr.GetOrdinal("CountryId")); info.CrmId = crmId; info.DanWei = rdr["WorkUnit"].ToString(); info.DanWeiAddress = rdr["UnitAddress"].ToString(); info.DistrictId = rdr.GetInt32(rdr.GetOrdinal("CountyId")); info.Email = rdr["Email"].ToString(); info.Gender = (EyouSoft.Model.EnumType.GovStructure.Gender)rdr.GetByte(rdr.GetOrdinal("Gender")); info.HomeAddress = rdr["HomeAddress"].ToString(); info.HuiFei = rdr.GetDecimal(rdr.GetOrdinal("MemberDues")); info.IdCardCode = rdr["IdNumber"].ToString(); info.IsTiXing = rdr.GetString(rdr.GetOrdinal("IsRemind")) == "1"; info.JiFen = rdr.GetDecimal(rdr.GetOrdinal("AvailableIntegral")); if (!rdr.IsDBNull(rdr.GetOrdinal("JoinTime"))) { info.JoinTime = rdr.GetDateTime(rdr.GetOrdinal("JoinTime")); } info.JoinType = rdr["ApplicationType"].ToString(); info.MemberCardCode = rdr["MemberCardNumber"].ToString(); info.MemberStatus = (EyouSoft.Model.EnumType.CrmStructure.CrmMemberState)rdr.GetByte(rdr.GetOrdinal("MemberState")); info.MemberTypeId = rdr.GetInt32(rdr.GetOrdinal("MemberType")); info.Mobile = rdr["MobilePhone"].ToString(); info.Name = rdr["Name"].ToString(); info.National = rdr["National"].ToString(); info.OperatorId = rdr.GetString(rdr.GetOrdinal("OperatorId")); info.ProvinceId = rdr.GetInt32(rdr.GetOrdinal("ProvinceId")); info.QQ = rdr["QQ"].ToString(); info.Remark = rdr["Remark"].ToString(); info.Telephone = rdr["ContactPhone"].ToString(); info.ZipCode = rdr["ZipCode"].ToString(); info.SellerId = rdr["SellerId"].ToString(); info.SellerName = rdr["SellerName"].ToString(); } } return(info); }
/// <summary> /// 保存按钮点击事件执行方法 /// </summary> void Save() { EyouSoft.Model.CrmStructure.MCrmPersonalInfo info = new EyouSoft.Model.CrmStructure.MCrmPersonalInfo(); #region get form value if (IsEdit) { info.CrmId = Utils.GetQueryStringValue("crmid"); } info.Birthday = Utils.GetDateTimeNullable(Utils.GetFormValue(txtBirthday.UniqueID)); info.BriefCode = Utils.GetFormValue(txtBrevityCode.UniqueID); info.CityId = Utils.GetInt(Utils.GetFormValue(ddlCity.UniqueID)); info.CompanyId = CurrentUserCompanyID; info.CountryId = Utils.GetInt(Utils.GetFormValue(ddlCountry.UniqueID)); info.DanWei = Utils.GetFormValue(txtWorkUnit.UniqueID); info.DanWeiAddress = Utils.GetFormValue(txtUnitAddress.UniqueID); info.DistrictId = Utils.GetInt(Utils.GetFormValue(ddlCounty.UniqueID)); info.Email = Utils.GetFormValue(txtEMail.UniqueID); info.Gender = Utils.GetEnumValue <EyouSoft.Model.EnumType.GovStructure.Gender>(Utils.GetFormValue(ddlGender.UniqueID), EyouSoft.Model.EnumType.GovStructure.Gender.男); info.HomeAddress = Utils.GetFormValue(txtHomeAddress.UniqueID); info.HuiFei = Utils.GetDecimal(Utils.GetFormValue(txtMemberDues.UniqueID)); info.IdCardCode = Utils.GetFormValue(txtIdNumber.UniqueID); info.IsTiXing = Utils.GetFormValue(this.chbIsRemind.UniqueID) == "on"; info.JoinTime = Utils.GetDateTimeNullable(Utils.GetFormValue(txtJoinTime.UniqueID)); info.JoinType = Utils.GetFormValue(txtApplicationType.UniqueID); info.MemberCardCode = Utils.GetFormValue(txtMemberCardNumber.UniqueID); info.MemberStatus = Utils.GetEnumValue <EyouSoft.Model.EnumType.CrmStructure.CrmMemberState>(Utils.GetFormValue(ddlMemberState.UniqueID), EyouSoft.Model.EnumType.CrmStructure.CrmMemberState.普通); info.MemberTypeId = Utils.GetInt(Utils.GetFormValue(ddlMemberType.UniqueID)); info.Mobile = Utils.GetFormValue(txtMobilePhone.UniqueID); info.Name = Utils.GetFormValue(txtName.UniqueID); info.National = Utils.GetFormValue(txtNational.UniqueID); info.OperatorId = SiteUserInfo.UserId; info.ProvinceId = Utils.GetInt(Utils.GetFormValue(ddlProvince.UniqueID)); info.QQ = Utils.GetFormValue(txtQQ.UniqueID); info.Remark = Utils.GetFormValue(txtRemark.UniqueID); info.Telephone = Utils.GetFormValue(txtContactPhone.UniqueID); info.ZipCode = Utils.GetFormValue(txtZipCode.UniqueID); info.SellerId = Utils.GetFormValue(Seller1.SellsIDClient); #endregion //validate form int retcode = 0; if (IsAdd) { retcode = new EyouSoft.BLL.CrmStructure.BCrmMember().Insert(info); } if (IsEdit) { retcode = new EyouSoft.BLL.CrmStructure.BCrmMember().Update(info); } AjaxResponse(UtilsCommons.AjaxReturnJson(retcode == 1 ? "1" : "0")); }
/// <summary> /// 写入个人会员信息,返回1成功 /// </summary> /// <param name="info">个人会员信息业务实体</param> /// <returns></returns> public int Insert(EyouSoft.Model.CrmStructure.MCrmPersonalInfo info) { DbCommand cmd = _db.GetStoredProcCommand("proc_Crm_InsertPersonal"); _db.AddOutParameter(cmd, "RetCode", DbType.Int32, 4); _db.AddInParameter(cmd, "CrmId", DbType.AnsiStringFixedLength, info.CrmId); _db.AddInParameter(cmd, "CompanyId", DbType.AnsiStringFixedLength, info.CompanyId); _db.AddInParameter(cmd, "CountryId", DbType.Int32, info.CountryId); _db.AddInParameter(cmd, "ProvinceId", DbType.Int32, info.ProvinceId); _db.AddInParameter(cmd, "CityId", DbType.Int32, info.CityId); _db.AddInParameter(cmd, "DistrictId", DbType.Int32, info.DistrictId); _db.AddInParameter(cmd, "Name", DbType.String, info.Name); _db.AddInParameter(cmd, "BriefCode", DbType.String, info.BriefCode); _db.AddInParameter(cmd, "Gender", DbType.Byte, info.Gender); _db.AddInParameter(cmd, "IdCardCode", DbType.String, info.IdCardCode); if (info.Birthday.HasValue) { _db.AddInParameter(cmd, "Birthday", DbType.DateTime, info.Birthday.Value); } else { _db.AddInParameter(cmd, "Birthday", DbType.DateTime, DBNull.Value); } _db.AddInParameter(cmd, "National", DbType.String, info.National); _db.AddInParameter(cmd, "Telephone", DbType.String, info.Telephone); _db.AddInParameter(cmd, "Mobile", DbType.String, info.Mobile); _db.AddInParameter(cmd, "QQ", DbType.String, info.QQ); _db.AddInParameter(cmd, "Email", DbType.String, info.Email); _db.AddInParameter(cmd, "HomeAddress", DbType.String, info.HomeAddress); _db.AddInParameter(cmd, "ZipCode", DbType.String, info.ZipCode); _db.AddInParameter(cmd, "DanWei", DbType.String, info.DanWei); _db.AddInParameter(cmd, "DanWeiAddress", DbType.String, info.DanWeiAddress); _db.AddInParameter(cmd, "MemberTypeId", DbType.Int32, info.MemberTypeId); _db.AddInParameter(cmd, "MemberCardCode", DbType.String, info.MemberCardCode); _db.AddInParameter(cmd, "MemberStatus", DbType.Byte, info.MemberStatus); if (info.JoinTime.HasValue) { _db.AddInParameter(cmd, "JoinTime", DbType.DateTime, info.JoinTime.Value); } else { _db.AddInParameter(cmd, "JoinTime", DbType.DateTime, DBNull.Value); } _db.AddInParameter(cmd, "JoinType", DbType.String, info.JoinType); _db.AddInParameter(cmd, "HuiFei", DbType.Decimal, info.HuiFei); _db.AddInParameter(cmd, "Remark", DbType.String, info.Remark); _db.AddInParameter(cmd, "IsTiXing", DbType.AnsiStringFixedLength, info.IsTiXing ? "1" : "0"); _db.AddInParameter(cmd, "OperatorId", DbType.AnsiStringFixedLength, info.OperatorId); _db.AddInParameter(cmd, "CrmType", DbType.Byte, info.CrmType); _db.AddInParameter(cmd, "LxrId", DbType.AnsiStringFixedLength, Guid.NewGuid().ToString()); _db.AddInParameter(cmd, "LxrType", DbType.Byte, EyouSoft.Model.EnumType.ComStructure.LxrType.客户单位); _db.AddInParameter(cmd, "SellerId", DbType.AnsiStringFixedLength, info.SellerId); int sqlExceptionCode = 0; try { DbHelper.RunProcedure(cmd, _db); } catch (System.Data.SqlClient.SqlException e) { sqlExceptionCode = 0 - e.Number; } if (sqlExceptionCode < 0) { return(sqlExceptionCode); } else { return(Convert.ToInt32(_db.GetParameterValue(cmd, "RetCode"))); } }