/// <summary> /// 更新一条数据 /// </summary> public int Update(Entities.CC_MagazineReturn model) { SqlParameter[] parameters = { new SqlParameter("@RecID", SqlDbType.Int, 4), new SqlParameter("@CustID", SqlDbType.VarChar, 50), new SqlParameter("@ContactID", SqlDbType.Int, 4), new SqlParameter("@DMSMemberID", SqlDbType.VarChar, 50), new SqlParameter("@Title", SqlDbType.VarChar, 200), new SqlParameter("@Status", SqlDbType.Int, 4), new SqlParameter("@CMDID", SqlDbType.Int, 4), new SqlParameter("@CreateTime", SqlDbType.DateTime), new SqlParameter("@CreateUserID", SqlDbType.Int, 4) }; parameters[0].Value = model.RecID; parameters[1].Value = model.CustID; parameters[2].Value = model.ContactID; parameters[3].Value = model.DMSMemberID; parameters[4].Value = model.Title; parameters[5].Value = model.Status; parameters[6].Value = model.CMDID; parameters[7].Value = model.CreateTime; parameters[8].Value = model.CreateUserID; return(SqlHelper.ExecuteNonQuery(ConnectionStrings_CRM, CommandType.StoredProcedure, P_CC_MAGAZINERETURN_UPDATE, parameters)); }
/// <summary> /// 增加一条数据 /// </summary> public int Insert(Entities.CC_MagazineReturn model) { SqlParameter[] parameters = { new SqlParameter("@RecID", SqlDbType.Int, 4), new SqlParameter("@CustID", SqlDbType.VarChar, 50), new SqlParameter("@ContactID", SqlDbType.Int, 4), new SqlParameter("@DMSMemberID", SqlDbType.VarChar, 50), new SqlParameter("@Title", SqlDbType.VarChar, 200), new SqlParameter("@Status", SqlDbType.Int, 4), new SqlParameter("@CMDID", SqlDbType.Int, 4), new SqlParameter("@CreateUserID", SqlDbType.Int, 4) }; parameters[0].Direction = ParameterDirection.Output; parameters[1].Value = model.CustID; parameters[2].Value = model.ContactID; parameters[3].Value = model.DMSMemberID; parameters[4].Value = model.Title; parameters[5].Value = model.Status; parameters[6].Value = model.CMDID; parameters[7].Value = model.CreateUserID; SqlHelper.ExecuteNonQuery(ConnectionStrings_CRM, CommandType.StoredProcedure, P_CC_MAGAZINERETURN_INSERT, parameters); return((int)parameters[0].Value); }
private Entities.CC_MagazineReturn LoadSingleCC_MagazineReturn(DataRow row) { Entities.CC_MagazineReturn model = new Entities.CC_MagazineReturn(); if (row["RecID"].ToString() != "") { model.RecID = int.Parse(row["RecID"].ToString()); } model.CustID = row["CustID"].ToString(); if (row["ContactID"].ToString() != "") { model.ContactID = int.Parse(row["ContactID"].ToString()); } model.DMSMemberID = row["DMSMemberID"].ToString(); model.Title = row["Title"].ToString(); if (row["Status"].ToString() != "") { model.Status = int.Parse(row["Status"].ToString()); } if (row["CMDID"].ToString() != "") { model.CMDID = int.Parse(row["CMDID"].ToString()); } if (row["CreateTime"].ToString() != "") { model.CreateTime = DateTime.Parse(row["CreateTime"].ToString()); } if (row["CreateUserID"].ToString() != "") { model.CreateUserID = int.Parse(row["CreateUserID"].ToString()); } return(model); }
/// <summary> /// 合同和它的金额(数组:0-总金额 1-现有金额) /// </summary> //private Dictionary<string, decimal[]> contractMoney = new Dictionary<string, decimal[]>(); /// <summary> /// 校验 /// </summary> private bool Valid(int rowNum, IDataReader reader, List <MagezineInfoImportExceptionInfo> exceptionInfoList, Dictionary <Entities.CC_MagazineReturn, string> magezineInfoList) { bool currentSuccess = true; MagezineInfoImportExceptionInfo ex = new MagezineInfoImportExceptionInfo(); #region validate string custId = reader[0].ToString().Trim(); string memberCode = reader[2].ToString().Trim(); string contacter = reader[4].ToString().Trim();; int contractId = -1; string dmsMemberID = string.Empty; if (string.IsNullOrEmpty(custId) && string.IsNullOrEmpty(memberCode) && string.IsNullOrEmpty(contacter)) { return(currentSuccess);//此行为空行 } //判断UserID参数 int intval = 0; if (!int.TryParse(UserID, out intval)) { ex.Info.Append("用户ID参数不正确"); currentSuccess = false; } //客户信息验证 if (string.IsNullOrEmpty(custId)) { ex.Info.Append("第" + rowNum + "行此[客户ID]不可为空。"); currentSuccess = false; } else { BitAuto.YanFa.Crm2009.Entities.CustInfo custInfo = BitAuto.YanFa.Crm2009.BLL.CustInfo.Instance.GetCustInfo(custId); if (custInfo == null) { ex.Info.Append("第" + rowNum + "行此[客户ID]不存在。"); currentSuccess = false; } } //会员信息验证 if (string.IsNullOrEmpty(memberCode)) { ex.Info.Append("第" + rowNum + "行此[会员ID]不可为空。"); currentSuccess = false; } else { List <BitAuto.YanFa.Crm2009.Entities.DMSMember> dmsMembers = BitAuto.YanFa.Crm2009.BLL.DMSMember.Instance.GetDMSMemberByCustID(custId); if (dmsMembers == null) { ex.Info.Append("第" + rowNum + "行此[会员ID]不存在。"); currentSuccess = false; } else { bool isExist = false; foreach (BitAuto.YanFa.Crm2009.Entities.DMSMember dmsMember in dmsMembers) { if (dmsMember.MemberCode == memberCode.Trim()) { isExist = true; dmsMemberID = dmsMember.ID.ToString(); } } if (!isExist) { ex.Info.Append("第" + rowNum + "行此客户下不存在此[会员ID]。"); currentSuccess = false; } } } if (string.IsNullOrEmpty(contacter)) { ex.Info.Append("第" + rowNum + "行此[联系人]不可为空。"); currentSuccess = false; } else { contacter = contacter.Replace(',', ','); string[] contacterArry = contacter.Split(','); foreach (string cter in contacterArry) { BitAuto.YanFa.Crm2009.Entities.QueryContactInfo query = new BitAuto.YanFa.Crm2009.Entities.QueryContactInfo(); query.CustID = custId; query.CName = cter.Trim(); int totalCount = 0; DataTable dt = BitAuto.YanFa.Crm2009.BLL.ContactInfo.Instance.GetContactInfo(query, "", 1, 1, out totalCount); if (dt.Rows.Count <= 0) { ex.Info.Append("第" + rowNum + "行联系人<" + cter + ">不存在。"); currentSuccess = false; } else { contractId = int.Parse(dt.Rows[0]["ID"].ToString()); } } } if (string.IsNullOrEmpty(CooperationName)) { ex.Info.Append("合作名称不能为空"); currentSuccess = false; } else { Entities.QueryCC_MagazineReturn query = new Entities.QueryCC_MagazineReturn(); query.Title = "第" + cooperationName + "期"; query.Status = 0; query.DMSMemberID = dmsMemberID; int totalCount = 0; DataTable dt = BLL.CC_MagazineReturn.Instance.GetCC_MagazineReturn(query, "", 1, 1, out totalCount); if (dt.Rows.Count > 0) { ex.Info.Append("第" + rowNum + "行已经存在此期的会员"); currentSuccess = false; } } #endregion //如通过则插入数据 if (currentSuccess) { Entities.CC_MagazineReturn info = new Entities.CC_MagazineReturn(); info.ContactID = contractId; info.CreateTime = DateTime.Now; info.CreateUserID = int.Parse(UserID); info.CustID = custId; info.DMSMemberID = dmsMemberID; info.Title = "第" + cooperationName + "期"; info.Status = 0; magezineInfoList.Add(info, contacter); } else { exceptionInfoList.Add(ex); } return(currentSuccess); }
/// <summary> /// 增加一条数据 /// </summary> public int Insert(Entities.CC_MagazineReturn model) { return(Dal.CC_MagazineReturn.Instance.Insert(model)); }
/// <summary> /// 更新一条数据 /// </summary> public int Update(Entities.CC_MagazineReturn model) { return(Dal.CC_MagazineReturn.Instance.Update(model)); }