public void Add(CRM_Contact contact)
 {
     if (contact != null)
     {
         _dbContext.CRM_Contact.Add(contact);
     }
 }
Example #2
0
    private void Show(string cid, string ctid)
    {
        CRM_ContactInfo byId = CRM_Contact.Init().GetById(Convert.ToInt32(ctid));

        if (byId != null)
        {
            this.ViewState["cti"] = byId;
            this.ContactAim.Value = byId.ContactAim;
            DateTime arg_48_0 = byId.AddTime;
            this.AddTime.Value              = byId.AddTime.ToString("yyyy-MM-dd");
            this.ContactCharge.Value        = byId.ContactCharge;
            this.ContactState.SelectedValue = byId.ContactState;
            this.ContactDetail.Value        = byId.ContactDetail;
            this.ContactPeople.Value        = byId.ContactPeople;
            for (int i = 0; i < this.ContactChargeType.Items.Count; i++)
            {
                if (byId.ContactChargeType.Contains(this.ContactChargeType.Items[i].Value))
                {
                    this.ContactChargeType.Items[i].Selected = true;
                }
            }
            for (int i = 0; i < this.ContactType.Items.Count; i++)
            {
                if (byId.ContactType.Contains(this.ContactType.Items[i].Value))
                {
                    this.ContactType.Items[i].Selected = true;
                }
            }
        }
    }
Example #3
0
    protected void Del_Btn(object obj, EventArgs e)
    {
        LinkButton        linkButton        = obj as LinkButton;
        RepeaterItem      repeaterItem      = linkButton.Parent as RepeaterItem;
        HtmlInputCheckBox htmlInputCheckBox = repeaterItem.FindControl("chk") as HtmlInputCheckBox;
        int id = Convert.ToInt32(htmlInputCheckBox.Value);

        CRM_Contact.Init().Delete(id);
        this.Show(base.Request.QueryString["cid"]);
    }
Example #4
0
 private void frmCreateContact_Load(object sender, EventArgs e)
 {
     //加载时,默认显示第一个tab
     metroTabControl1.TabPages[0].Select();
     if (this.Text == "修改联系人信息")
     {
         frmContact fc;
         fc  = (frmContact)this.Owner;
         cct = fc.GetCRM_ContactModel();
         //加载到修改表单
         LoadUpdateContact();
     }
 }
Example #5
0
 protected void Del_All(object sender, EventArgs e)
 {
     foreach (RepeaterItem repeaterItem in this.rpt.Items)
     {
         HtmlInputCheckBox htmlInputCheckBox = repeaterItem.FindControl("chk") as HtmlInputCheckBox;
         if (htmlInputCheckBox.Checked)
         {
             int id = Convert.ToInt32(htmlInputCheckBox.Value);
             CRM_Contact.Init().Delete(id);
         }
     }
     this.Show(base.Request.QueryString["cid"]);
 }
Example #6
0
        /// <summary>
        /// 更新一个联系人信息
        /// </summary>
        /// <param name="contact"></param>
        /// <returns></returns>
        public int Update(CRM_Contact contact)
        {
            ccs.Update(contact);
            int result = ccs.SaveChanges();

            if (result > 0)
            {
                return(1);
            }
            else
            {
                return(0);
            }
        }
Example #7
0
    private void Show(string ctid)
    {
        CRM_ContactInfo byId = CRM_Contact.Init().GetById(Convert.ToInt32(ctid));

        this.CRM_Name1.InnerText    = byId.CRM_Name;
        this.ContactAim.Text        = byId.ContactAim;
        this.ContactPeople.Text     = byId.ContactPeople;
        this.AddTime.Text           = Utils.ConvertDate3(byId.AddTime);
        this.ContactType.Text       = byId.ContactType;
        this.ContactCharge.Text     = byId.ContactCharge;
        this.ContactChargeType.Text = byId.ContactChargeType;
        this.ContactDetail.Text     = byId.ContactDetail;
        this.ContactState.Text      = "[" + byId.ContactState + "]";
    }
        public void Update(CRM_Contact contact)
        {
            var updatecontact = _dbContext.CRM_Contact.Find(contact.Id);

            if (updatecontact != null)
            {
                updatecontact.MId      = contact.MId;
                updatecontact.MDate    = contact.MDate;
                updatecontact.CusId    = contact.CusId;
                updatecontact.Name     = contact.Name;
                updatecontact.Gender   = contact.Gender;
                updatecontact.JiGuan   = contact.JiGuan;
                updatecontact.DeptName = contact.DeptName;
                updatecontact.Position = contact.Position;
                updatecontact.Mobile   = contact.Mobile;
                updatecontact.WX       = contact.WX;
                updatecontact.Email    = contact.WX;
            }
        }
Example #9
0
 protected void Save_Btn(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(base.Request.QueryString["cid"]) && !string.IsNullOrEmpty(base.Request.QueryString["ctid"]))
     {
         CRM_ContactInfo cRM_ContactInfo = this.ViewState["cti"] as CRM_ContactInfo;
         if (!string.IsNullOrEmpty(this.AddTime.Value))
         {
             cRM_ContactInfo.AddTime = Convert.ToDateTime(this.AddTime.Value);
         }
         else
         {
             cRM_ContactInfo.AddTime = DateTime.Now;
         }
         cRM_ContactInfo.cid           = Convert.ToInt32(base.Request.QueryString["cid"]);
         cRM_ContactInfo.ContactAim    = this.ContactAim.Value;
         cRM_ContactInfo.ContactCharge = this.ContactCharge.Value;
         cRM_ContactInfo.ContactDetail = this.ContactDetail.Value;
         cRM_ContactInfo.ContactState  = this.ContactState.SelectedValue;
         string text = "";
         for (int i = 0; i < this.ContactChargeType.Items.Count; i++)
         {
             if (this.ContactChargeType.Items[i].Selected)
             {
                 text += this.ContactChargeType.Items[i].Value;
             }
         }
         cRM_ContactInfo.ContactChargeType = "";
         cRM_ContactInfo.ContactChargeType = text;
         string text2 = "";
         for (int i = 0; i < this.ContactType.Items.Count; i++)
         {
             if (this.ContactType.Items[i].Selected)
             {
                 text2 += this.ContactType.Items[i].Value;
             }
         }
         cRM_ContactInfo.ContactType = "";
         cRM_ContactInfo.ContactType = text2;
         if (this.ContactPeople.Value.Trim() != "")
         {
             cRM_ContactInfo.ContactPeople = this.ContactPeople.Value;
         }
         else
         {
             cRM_ContactInfo.ContactPeople = this.RealName;
         }
         CRM_Contact.Init().Update(cRM_ContactInfo);
         string str = HttpContext.Current.Server.HtmlEncode("您好!客户接触已保存成功!");
         base.Response.Redirect("~/InfoTip/Operate_Success.aspx?returnpage=" + base.Request.Url.AbsoluteUri + "&tip=" + str);
     }
     if (!string.IsNullOrEmpty(base.Request.QueryString["cid"]) && string.IsNullOrEmpty(base.Request.QueryString["ctid"]))
     {
         CRM_ContactInfo cRM_ContactInfo = new CRM_ContactInfo();
         CRMInfo         cRMInfo         = this.ViewState["ci"] as CRMInfo;
         if (!string.IsNullOrEmpty(this.AddTime.Value))
         {
             cRM_ContactInfo.AddTime = Convert.ToDateTime(this.AddTime.Value);
         }
         else
         {
             cRM_ContactInfo.AddTime = DateTime.Now;
         }
         cRM_ContactInfo.cid             = Convert.ToInt32(base.Request.QueryString["cid"]);
         cRM_ContactInfo.ContactAim      = this.ContactAim.Value;
         cRM_ContactInfo.ContactCharge   = this.ContactCharge.Value;
         cRM_ContactInfo.ContactDetail   = this.ContactDetail.Value;
         cRM_ContactInfo.ContactState    = this.ContactState.SelectedValue;
         cRM_ContactInfo.CreatorID       = cRMInfo.CreatorID;
         cRM_ContactInfo.CreatorDepName  = cRMInfo.CreatorDepName;
         cRM_ContactInfo.CreatorRealName = cRMInfo.CreatorRealName;
         cRM_ContactInfo.CRM_Name        = cRMInfo.CRM_Name;
         string text = "";
         for (int i = 0; i < this.ContactChargeType.Items.Count; i++)
         {
             if (this.ContactChargeType.Items[i].Selected)
             {
                 text += this.ContactChargeType.Items[i].Value;
             }
         }
         cRM_ContactInfo.ContactChargeType = text;
         string text2 = "";
         for (int i = 0; i < this.ContactType.Items.Count; i++)
         {
             if (this.ContactType.Items[i].Selected)
             {
                 text2 += this.ContactType.Items[i].Value;
             }
         }
         cRM_ContactInfo.ContactType = text2;
         if (this.ContactPeople.Value.Trim() != "")
         {
             cRM_ContactInfo.ContactPeople = this.ContactPeople.Value;
         }
         else
         {
             cRM_ContactInfo.ContactPeople = this.RealName;
         }
         CRM_Contact.Init().Add(cRM_ContactInfo);
         string str = HttpContext.Current.Server.HtmlEncode("您好!客户接触已添加成功!");
         base.Response.Redirect("~/InfoTip/Operate_Success.aspx?returnpage=" + base.Request.Url.AbsoluteUri + "&tip=" + str);
     }
 }