Exemplo n.º 1
0
        private void btn_OK_Click(object sender, System.EventArgs e)
        {
            UDS.Components.CM cm = new UDS.Components.CM();
            UDS.Components.Contact contact = new UDS.Components.Contact();
            UDS.Components.ClientInfo client = cm.GetClientAllInfo(clientid);
            //���Эͬ��Ա
            foreach(ListItem lt in lbx_Cooperater.Items)
            {
                UDS.Components.Cooperater cooperater = new UDS.Components.Cooperater();
                cooperater.StaffID = Int32.Parse(lt.Value);
                contact.AddCooperater(cooperater);
            }
            //�����ϵ��Ա
            foreach(ListItem lt in lbx_Linkman.Items)
            {
                UDS.Components.Linkman linkman = new UDS.Components.Linkman();
                linkman.ID = Int32.Parse(lt.Value);
                contact.AddLinkman(linkman);
            }

            contact.ID = contactid;

            #region ���contact
            contact.UpdateTime = DateTime.Now;
            contact.ContactTimes = Int32.Parse(ltl_ContactTimes.Text);
            contact.StaffID = client.AddManID;
            contact.ContactTime = DateTime.Parse(tbx_contacttime.Text);
            contact.ClientID = clientid;
            contact.ContactAim = tbx_contactaim.Text;
            contact.SellMoney = tbx_sellmoney.Text;
            contact.BargainPrognosis = ddl_bargainprognosis.SelectedItem.Value;
            if(cbx_telephone.Checked) contact.ContactType += ContactType.telephone.ToString() + ",";
            if(cbx_fax.Checked) contact.ContactType += ContactType.fax.ToString() + ",";
            if(cbx_email.Checked) contact.ContactType += ContactType.email.ToString() + ",";
            if(cbx_mail.Checked) contact.ContactType += ContactType.mail.ToString() + ",";
            if(cbx_sms.Checked) contact.ContactType += ContactType.sms.ToString() + ",";
            if(cbx_callin.Checked) contact.ContactType += ContactType.interview.ToString() + ",";
            if(cbx_meeting.Checked) contact.ContactType += ContactType.meeting.ToString() + ",";

            if(rbtn_trace.Checked) contact.ContactStatus += ContactStat.trace.ToString() + ",";
            if(rbtn_boot.Checked) contact.ContactStatus += ContactStat.boot.ToString() + ",";
            if(rbtn_commend.Checked) contact.ContactStatus += ContactStat.commend.ToString() + ",";
            if(rbtn_requirement.Checked) contact.ContactStatus += ContactStat.requirement.ToString() + ",";
            if(rbtn_submit.Checked) contact.ContactStatus += ContactStat.submit.ToString() + ",";
            if(rbtn_negotiate.Checked) contact.ContactStatus += ContactStat.negotiate.ToString() + ",";
            if(rbtn_actualize.Checked) contact.ContactStatus += ContactStat.actualize.ToString() + ",";
            if(rbtn_traceservice.Checked) contact.ContactStatus += ContactStat.traceservice.ToString() + ",";
            if(rbtn_last.Checked) contact.ContactStatus += ContactStat.last.ToString() + ",";

            contact.ThisFee = float.Parse(tbx_thisfee.Text);
            if(cbx_travel.Checked) contact.FeeUsed += ContactFeeUsed.travel.ToString() + ",";
            if(cbx_food.Checked)  contact.FeeUsed += ContactFeeUsed.food.ToString() + ",";
            if(cbx_gift.Checked) contact.FeeUsed += ContactFeeUsed.gift.ToString() + ",";
            if(cbx_out.Checked) contact.FeeUsed += ContactFeeUsed.outer.ToString() + ",";
            contact.ContactContent = tbx_contactcontent.Text;
            contact.NextContactAim = tbx_nextcontactaim.Text;
            contact.NextContactTime = DateTime.Parse(tbx_nextcontacttime.Text);
            #endregion

            //���contactid==0���������������޸�
            if(contactid==0)
            {
                contact.ContactTimes++;
                contact.ID = cm.AddContact(contact);
                contactid = contact.ID;
                ViewState["ContactID"] = contact.ID.ToString();
                Response.Write("<script>alert('��ӳɹ���');close();opener.document.location.href=opener.document.location.href</script>");
            }
            else
            {
                cm.UpdateContact(contact);
                Response.Write("<script>alert('�޸ijɹ���');close();</script>");
            }

            //�޸�client��Ϣ

            client.BargainPrognosis = contact.BargainPrognosis;
            client.ContactTimes = contact.ContactTimes;
            client.CurStatus = contact.ContactStatus;
            client.SellPhase = contact.ContactStatus;
            client.Fee += contact.ThisFee;
            client.UpdateTime = contact.UpdateTime;
            client.ContactTime = contact.ContactTime;
            client.NextContactTime = DateTime.Parse(tbx_nextcontacttime.Text);
            if(client.FirstContactTime==DateTime.Parse("1900-1-1")) client.FirstContactTime = contact.ContactTime;
            cm.UpdateClient(client);
            DisplayClientInfo();

            //�ϴ�����
            UploadAtt();

            ControlClientContactHistory1.MyClientID = clientid;
            ControlClientContactHistory1.BindData();
        }
Exemplo n.º 2
0
        private void btn_OK_Click(object sender, System.EventArgs e)
        {
            UDS.Components.CM         cm      = new UDS.Components.CM();
            UDS.Components.Contact    contact = new UDS.Components.Contact();
            UDS.Components.ClientInfo client  = cm.GetClientAllInfo(clientid);
            //添加协同人员
            foreach (ListItem lt in lbx_Cooperater.Items)
            {
                UDS.Components.Cooperater cooperater = new UDS.Components.Cooperater();
                cooperater.StaffID = Int32.Parse(lt.Value);
                contact.AddCooperater(cooperater);
            }
            //添加联系人员
            foreach (ListItem lt in lbx_Linkman.Items)
            {
                UDS.Components.Linkman linkman = new UDS.Components.Linkman();
                linkman.ID = Int32.Parse(lt.Value);
                contact.AddLinkman(linkman);
            }

            contact.ID = contactid;

            #region 填充contact
            contact.UpdateTime       = DateTime.Now;
            contact.ContactTimes     = Int32.Parse(ltl_ContactTimes.Text);
            contact.StaffID          = client.AddManID;
            contact.ContactTime      = DateTime.Parse(tbx_contacttime.Text);
            contact.ClientID         = clientid;
            contact.ContactAim       = tbx_contactaim.Text;
            contact.SellMoney        = tbx_sellmoney.Text;
            contact.BargainPrognosis = ddl_bargainprognosis.SelectedItem.Value;
            if (cbx_telephone.Checked)
            {
                contact.ContactType += ContactType.telephone.ToString() + ",";
            }
            if (cbx_fax.Checked)
            {
                contact.ContactType += ContactType.fax.ToString() + ",";
            }
            if (cbx_email.Checked)
            {
                contact.ContactType += ContactType.email.ToString() + ",";
            }
            if (cbx_mail.Checked)
            {
                contact.ContactType += ContactType.mail.ToString() + ",";
            }
            if (cbx_sms.Checked)
            {
                contact.ContactType += ContactType.sms.ToString() + ",";
            }
            if (cbx_callin.Checked)
            {
                contact.ContactType += ContactType.interview.ToString() + ",";
            }
            if (cbx_meeting.Checked)
            {
                contact.ContactType += ContactType.meeting.ToString() + ",";
            }

            if (rbtn_trace.Checked)
            {
                contact.ContactStatus += ContactStat.trace.ToString() + ",";
            }
            if (rbtn_boot.Checked)
            {
                contact.ContactStatus += ContactStat.boot.ToString() + ",";
            }
            if (rbtn_commend.Checked)
            {
                contact.ContactStatus += ContactStat.commend.ToString() + ",";
            }
            if (rbtn_requirement.Checked)
            {
                contact.ContactStatus += ContactStat.requirement.ToString() + ",";
            }
            if (rbtn_submit.Checked)
            {
                contact.ContactStatus += ContactStat.submit.ToString() + ",";
            }
            if (rbtn_negotiate.Checked)
            {
                contact.ContactStatus += ContactStat.negotiate.ToString() + ",";
            }
            if (rbtn_actualize.Checked)
            {
                contact.ContactStatus += ContactStat.actualize.ToString() + ",";
            }
            if (rbtn_traceservice.Checked)
            {
                contact.ContactStatus += ContactStat.traceservice.ToString() + ",";
            }
            if (rbtn_last.Checked)
            {
                contact.ContactStatus += ContactStat.last.ToString() + ",";
            }

            contact.ThisFee = float.Parse(tbx_thisfee.Text);
            if (cbx_travel.Checked)
            {
                contact.FeeUsed += ContactFeeUsed.travel.ToString() + ",";
            }
            if (cbx_food.Checked)
            {
                contact.FeeUsed += ContactFeeUsed.food.ToString() + ",";
            }
            if (cbx_gift.Checked)
            {
                contact.FeeUsed += ContactFeeUsed.gift.ToString() + ",";
            }
            if (cbx_out.Checked)
            {
                contact.FeeUsed += ContactFeeUsed.outer.ToString() + ",";
            }
            contact.ContactContent  = tbx_contactcontent.Text;
            contact.NextContactAim  = tbx_nextcontactaim.Text;
            contact.NextContactTime = DateTime.Parse(tbx_nextcontacttime.Text);
            #endregion

            //如果contactid==0则插入操作,否则修改
            if (contactid == 0)
            {
                contact.ContactTimes++;
                contact.ID             = cm.AddContact(contact);
                contactid              = contact.ID;
                ViewState["ContactID"] = contact.ID.ToString();
                Response.Write("<script>alert('添加成功!');close();opener.document.location.href=opener.document.location.href</script>");
            }
            else
            {
                cm.UpdateContact(contact);
                Response.Write("<script>alert('修改成功!');close();</script>");
            }

            //修改client信息

            client.BargainPrognosis = contact.BargainPrognosis;
            client.ContactTimes     = contact.ContactTimes;
            client.CurStatus        = contact.ContactStatus;
            client.SellPhase        = contact.ContactStatus;
            client.Fee            += contact.ThisFee;
            client.UpdateTime      = contact.UpdateTime;
            client.ContactTime     = contact.ContactTime;
            client.NextContactTime = DateTime.Parse(tbx_nextcontacttime.Text);
            if (client.FirstContactTime == DateTime.Parse("1900-1-1"))
            {
                client.FirstContactTime = contact.ContactTime;
            }
            cm.UpdateClient(client);
            DisplayClientInfo();

            //上传附件
            UploadAtt();

            ControlClientContactHistory1.MyClientID = clientid;
            ControlClientContactHistory1.BindData();
        }