protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Entities.ProjectTask_Cust_Contact c = BLL.ProjectTask_Cust_Contact.Instance.GetContactInfo(this.ContactID); this.txtAddress.Value = c.Address; this.txtBirthday.Value = c.Birthday; this.txtContactDepartment.Value = c.DepartMent; this.txtContactDuty.Value = c.Title; this.txtContactEmali.Value = c.Email; this.txtContactFax.Value = c.Fax; this.txtContactModel.Value = c.Phone; this.txtContactName.Value = c.CName; this.txtContactRemark.Value = c.Remarks; this.txtContactTele.Value = c.OfficeTel; this.txtMSN.Value = c.MSN; this.txtOfficeTypeCode.Value = c.OfficeTypeCode.ToString(); this.txtZipCode.Value = c.ZipCode; if (c.Sex == "1 ") { this.radioBoy.Checked = true; } else { this.radioGirl.Checked = true; } //this.PID = c.PID.ToString(); CC_Contact_Helper.BindParentContactToSelectEle(this.SelectPID, c.PTID, c.ID); this.SelectPID.SelectedIndex = this.SelectPID.Items.IndexOf(this.SelectPID.Items.FindByValue(c.PID.ToString())); } }
internal void AddContact() { Entities.ProjectTaskInfo task = BLL.ProjectTaskInfo.Instance.GetProjectTaskInfo(this.TID); if (task == null) { throw new Exception("无法得到相应任务"); } //int i = -1; Entities.ProjectTask_Cust_Contact c = new Entities.ProjectTask_Cust_Contact(); c.PTID = task.PTID; //c.OriginalContactID = int _PID = -2; if (int.TryParse(this.ContactPID, out _PID)) { } c.PID = _PID; c.CName = this.CName; c.EName = this.EName; c.Sex = this.Sex; if (this.CustType != "20010") { c.DepartMent = this.DepartMent; } c.OfficeTypeCode = int.Parse(this.OfficeTypeCode.Trim()); c.Title = this.Title; c.OfficeTel = this.OfficeTel; c.Phone = this.Phone; c.Email = this.Email; c.Fax = this.Fax; c.Remarks = this.Reamrk; c.Address = this.Address; c.ZipCode = this.ZipCode; c.MSN = this.MSN; c.Birthday = this.Birthday; c.CreateTime = DateTime.Now; c.ModifyTime = DateTime.Now; c.CreateUserID = BLL.Util.GetLoginUserID(); c.Status = 0; c.Hobby = this.Hobby; c.Responsible = this.Responsible; try { int contactID = BLL.ProjectTask_Cust_Contact.Instance.InsertContact(c); if (contactID > 0) { //负责会员处理(按顺序执行) YesSelectMemberHandle(contactID); NotSelectMemberHandle(contactID); YesSelectMainHandle(contactID); NotSelectMainHandle(contactID); } } catch (Exception ex) { } }
/// <summary> /// 更新一条数据 /// </summary> public int Update(Entities.ProjectTask_Cust_Contact model) { SqlParameter[] parameters = { new SqlParameter("@ID", SqlDbType.Int, 4), new SqlParameter("@PID", SqlDbType.Int, 4), new SqlParameter("@CName", SqlDbType.VarChar, 50), new SqlParameter("@EName", SqlDbType.VarChar, 50), new SqlParameter("@Sex", SqlDbType.Char, 2), new SqlParameter("@DepartMent", SqlDbType.VarChar, 100), new SqlParameter("@OfficeTypeCode", SqlDbType.Int, 4), new SqlParameter("@Title", SqlDbType.VarChar, 100), new SqlParameter("@OfficeTel", SqlDbType.VarChar, 500), new SqlParameter("@Phone", SqlDbType.VarChar, 100), new SqlParameter("@Email", SqlDbType.VarChar, 100), new SqlParameter("@Fax", SqlDbType.VarChar, 50), new SqlParameter("@Remarks", SqlDbType.VarChar, 1000), new SqlParameter("@Address", SqlDbType.VarChar, 500), new SqlParameter("@ZipCode", SqlDbType.VarChar, 50), new SqlParameter("@MSN", SqlDbType.VarChar, 50), new SqlParameter("@Birthday", SqlDbType.VarChar, 50), new SqlParameter("@Status", SqlDbType.Int, 4), new SqlParameter("@CreateUserID", SqlDbType.Int, 4), new SqlParameter("@CreateTime", SqlDbType.DateTime), new SqlParameter("@ModifyUserID", SqlDbType.Int, 4), new SqlParameter("@ModifyTime", SqlDbType.DateTime), new SqlParameter("@Hobby", SqlDbType.VarChar, 500), new SqlParameter("@Responsible", SqlDbType.VarChar, 500) }; parameters[0].Value = model.ID; parameters[1].Value = model.PID; parameters[2].Value = model.CName; parameters[3].Value = model.EName; parameters[4].Value = model.Sex; parameters[5].Value = model.DepartMent; parameters[6].Value = model.OfficeTypeCode; parameters[7].Value = model.Title; parameters[8].Value = model.OfficeTel; parameters[9].Value = model.Phone; parameters[10].Value = model.Email; parameters[11].Value = model.Fax; parameters[12].Value = model.Remarks; parameters[13].Value = model.Address; parameters[14].Value = model.ZipCode; parameters[15].Value = model.MSN; parameters[16].Value = model.Birthday; parameters[17].Value = model.Status; parameters[18].Value = model.CreateUserID; parameters[19].Value = model.CreateTime; parameters[20].Value = model.ModifyUserID; parameters[21].Value = model.ModifyTime; parameters[22].Value = model.Hobby; parameters[23].Value = model.Responsible; return(SqlHelper.ExecuteNonQuery(CONNECTIONSTRINGS, CommandType.StoredProcedure, P_PROJECTTASK_CUST_CONTACT_UPDATE, parameters)); }
private Entities.ProjectTask_Cust_Contact LoadSingleProjectTask_Cust_Contact(DataRow row) { Entities.ProjectTask_Cust_Contact model = new Entities.ProjectTask_Cust_Contact(); if (row["ID"].ToString() != "") { model.ID = int.Parse(row["ID"].ToString()); } model.PTID = row["PTID"].ToString(); if (row["OriginalContactID"].ToString() != "") { model.OriginalContactID = int.Parse(row["OriginalContactID"].ToString()); } if (row["PID"].ToString() != "") { model.PID = int.Parse(row["PID"].ToString()); } model.CName = row["CName"].ToString(); model.EName = row["EName"].ToString(); model.Sex = row["Sex"].ToString(); model.DepartMent = row["DepartMent"].ToString(); if (row["OfficeTypeCode"].ToString() != "") { model.OfficeTypeCode = int.Parse(row["OfficeTypeCode"].ToString()); } model.Title = row["Title"].ToString(); model.OfficeTel = row["OfficeTel"].ToString(); model.Phone = row["Phone"].ToString(); model.Email = row["Email"].ToString(); model.Fax = row["Fax"].ToString(); model.Remarks = row["Remarks"].ToString(); model.Address = row["Address"].ToString(); model.ZipCode = row["ZipCode"].ToString(); model.MSN = row["MSN"].ToString(); model.Birthday = row["Birthday"].ToString(); if (row["Status"].ToString() != "") { model.Status = int.Parse(row["Status"].ToString()); } if (row["CreateUserID"].ToString() != "") { model.CreateUserID = int.Parse(row["CreateUserID"].ToString()); } if (row["CreateTime"].ToString() != "") { model.CreateTime = DateTime.Parse(row["CreateTime"].ToString()); } if (row["ModifyUserID"].ToString() != "") { model.ModifyUserID = int.Parse(row["ModifyUserID"].ToString()); } model.Hobby = row["Hobby"].ToString(); model.Responsible = row["Responsible"].ToString(); return(model); }
public void DeleteContact(int id) { Entities.ProjectTask_Cust_Contact c = this.GetContactInfo(id); if (c == null) { throw new Exception("无法得到此联系人"); } if (c.OriginalContactID > 0) { throw new Exception("不可删除CRM中已有的联系人"); } Dal.ProjectTask_Cust_Contact.Instance.Delete(id); }
internal string ShowContact() { string message = string.Empty; Entities.ProjectTask_Cust_Contact model = new Entities.ProjectTask_Cust_Contact(); model = BLL.ProjectTask_Cust_Contact.Instance.GetContactInfo(int.Parse(this.ContactID)); if (model != null) { model.CreateUserTrueName = GetUserInfoTrueName(model.CreateUserID.ToString()); model.CreateTimeFormat = string.Format("{0:yyyy-MM-dd}", model.CreateTime); model.ModifyUserTrueName = GetUserInfoTrueName(model.ModifyUserID.ToString()); model.ModifyTimeFormat = string.Format("{0:yyyy-MM-dd}", model.ModifyTime); message = JavaScriptConvert.SerializeObject(model); } return(message); }
internal void EditContact() { int _ContranctID = -1; if (int.TryParse(this.ContactID, out _ContranctID)) { } Entities.ProjectTask_Cust_Contact c = BLL.ProjectTask_Cust_Contact.Instance.GetContactInfo(_ContranctID); if (c == null) { throw new Exception("无法得到此联系人"); } int _PID = -2; if (int.TryParse(this.ContactPID, out _PID)) { } c.PID = _PID; c.CName = this.CName; c.EName = this.EName; c.Sex = this.Sex; if (this.CustType != "20010") { c.DepartMent = this.DepartMent; } else { c.DepartMent = string.Empty; } //c.DepartMent = this.DepartMent; c.OfficeTypeCode = int.Parse(this.OfficeTypeCode.Trim()); c.Title = this.Title; c.OfficeTel = this.OfficeTel; c.Phone = this.Phone; c.Email = this.Email; c.Fax = this.Fax; c.Remarks = this.Reamrk; c.Address = this.Address; c.ZipCode = this.ZipCode; c.MSN = this.MSN; c.Birthday = this.Birthday; c.ModifyTime = DateTime.Now; c.ModifyUserID = BLL.Util.GetLoginUserID(); c.Hobby = this.Hobby; c.Responsible = this.Responsible; try { BLL.ProjectTask_Cust_Contact.Instance.UpdateContact(c); //负责会员处理(按顺序执行) YesSelectMemberHandle(_ContranctID); NotSelectMemberHandle(_ContranctID); YesSelectMainHandle(_ContranctID); NotSelectMainHandle(_ContranctID); } catch (Exception ex) { } }
/// <summary> /// 更新 /// </summary> public void UpdateContact(Entities.ProjectTask_Cust_Contact c) { Dal.ProjectTask_Cust_Contact.Instance.Update(c); }
/// <summary> /// 新增 /// </summary> public int InsertContact(Entities.ProjectTask_Cust_Contact c) { c.Status = 0; return(Dal.ProjectTask_Cust_Contact.Instance.Insert(c)); }
/// <summary> /// 增加一条数据 /// </summary> public int Insert(Entities.ProjectTask_Cust_Contact model) { SqlParameter[] parameters = { new SqlParameter("@PTID", SqlDbType.VarChar), new SqlParameter("@OriginalContactID", SqlDbType.Int, 4), new SqlParameter("@PID", SqlDbType.Int, 4), new SqlParameter("@CName", SqlDbType.VarChar, 50), new SqlParameter("@EName", SqlDbType.VarChar, 50), new SqlParameter("@Sex", SqlDbType.Char, 2), new SqlParameter("@DepartMent", SqlDbType.VarChar, 100), new SqlParameter("@OfficeTypeCode", SqlDbType.Int, 4), new SqlParameter("@Title", SqlDbType.VarChar, 100), new SqlParameter("@OfficeTel", SqlDbType.VarChar, 500), new SqlParameter("@Phone", SqlDbType.VarChar, 100), new SqlParameter("@Email", SqlDbType.VarChar, 100), new SqlParameter("@Fax", SqlDbType.VarChar, 50), new SqlParameter("@Remarks", SqlDbType.VarChar, 1000), new SqlParameter("@Address", SqlDbType.VarChar, 500), new SqlParameter("@ZipCode", SqlDbType.VarChar, 50), new SqlParameter("@MSN", SqlDbType.VarChar, 50), new SqlParameter("@Birthday", SqlDbType.VarChar, 50), new SqlParameter("@Status", SqlDbType.Int, 4), new SqlParameter("@CreateUserID", SqlDbType.Int, 4), new SqlParameter("@CreateTime", SqlDbType.DateTime), new SqlParameter("@ModifyUserID", SqlDbType.Int, 4), new SqlParameter("@ModifyTime", SqlDbType.DateTime), new SqlParameter("@Hobby", SqlDbType.VarChar, 500), new SqlParameter("@Responsible", SqlDbType.VarChar, 500), new SqlParameter("@ID", SqlDbType.Int) }; parameters[0].Value = model.PTID; parameters[1].Value = model.OriginalContactID; parameters[2].Value = model.PID; parameters[3].Value = model.CName; parameters[4].Value = model.EName; parameters[5].Value = model.Sex; parameters[6].Value = model.DepartMent; parameters[7].Value = model.OfficeTypeCode; parameters[8].Value = model.Title; parameters[9].Value = model.OfficeTel; parameters[10].Value = model.Phone; parameters[11].Value = model.Email; parameters[12].Value = model.Fax; parameters[13].Value = model.Remarks; parameters[14].Value = model.Address; parameters[15].Value = model.ZipCode; parameters[16].Value = model.MSN; parameters[17].Value = model.Birthday; parameters[18].Value = model.Status; parameters[19].Value = model.CreateUserID; parameters[20].Value = DateTime.Now; parameters[21].Value = null; parameters[22].Value = DateTime.Now; parameters[23].Value = model.Hobby; parameters[24].Value = model.Responsible; parameters[25].Direction = ParameterDirection.Output; SqlHelper.ExecuteNonQuery(CONNECTIONSTRINGS, CommandType.StoredProcedure, P_PROJECTTASK_CUST_CONTACT_INSERT, parameters); return(Convert.ToInt32(parameters[25].Value.ToString())); }