Exemple #1
0
        private void btn_ChangeAddMan_Click(object sender, System.EventArgs e)
        {
            UDS.Components.CM         cm     = new UDS.Components.CM();
            UDS.Components.ClientInfo client = cm.GetClientAllInfo(clientid);
            if (Page.IsValid)
            {
                client.AddManID = Int32.Parse(ddl_AddMan.SelectedItem.Value);
                cm.UpdateClient(client);
                //判断权限
                if (ddl_AddMan.SelectedItem.Value == Request.Cookies["UserID"].Value)
                {
                    Session["cm_permission"] = "administrator";
                }
                else
                {
                    Session["cm_permission"] = "leader";
                }

                Response.Write("<script>alert('修改成功!');opener.location.href='ClientListView.aspx';close();</script>");
            }
        }
        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();
        }
Exemple #3
0
        private void btn_OK_Click(object sender, System.EventArgs e)
        {
            UDS.Components.CM         cm     = new UDS.Components.CM();
            UDS.Components.ClientInfo client = cm.GetClientAllInfo(clientid);
            if (Page.IsValid)
            {
                #region 填充client结构
                client.ClientShortName = tbx_ShortName.Text;
                client.ClientName      = tbx_Name.Text;
                client.AddManID        = Int32.Parse(Request.Cookies["UserID"].Value);
                client.UpdateTime      = DateTime.Parse(tbx_UpdateTime.Text);
                client.Affiliatedarea  = tbx_affiliatedarea.Text;
                client.URL             = tbx_URL.Text;
                client.ZIP             = tbx_zip.Text;
                client.Address         = tbx_address.Text;
                client.Type            = "";

                if (cbx_zhongduan.Checked)
                {
                    client.Type += ClientType.terminal.ToString() + ",";
                }
                if (cbx_qudao.Checked)
                {
                    client.Type += ClientType.channal.ToString() + ",";
                }
                if (cbx_shehui.Checked)
                {
                    client.Type += ClientType.social.ToString() + ",";
                }
                if (cbx_meiti.Checked)
                {
                    client.Type += ClientType.media.ToString() + ",";
                }

                client.EnterpriseType = "";
                if (cbx_government.Checked)
                {
                    client.EnterpriseType += EnterpriseType.government.ToString() + ",";
                }
                if (cbx_stateowned.Checked)
                {
                    client.EnterpriseType += EnterpriseType.contry.ToString() + ",";
                }
                if (cbx_private.Checked)
                {
                    client.EnterpriseType += EnterpriseType.privateowned.ToString() + ",";
                }
                if (cbx_foreign.Checked)
                {
                    client.EnterpriseType += EnterpriseType.oversea.ToString() + ",";
                }

                if (cbx_market.Checked)
                {
                    client.EnterpriseType += EnterpriseType.stock.ToString() + ",";
                }

                client.Calling = "";
                if (cbx_realestate.Checked)
                {
                    client.Calling += ClientTrade.realty.ToString() + ",";
                }
                if (cbx_IT.Checked)
                {
                    client.Calling += ClientTrade.IT.ToString() + ",";
                }
                if (cbx_business.Checked)
                {
                    client.Calling += ClientTrade.business.ToString() + ",";
                }
                if (cbx_telecom.Checked)
                {
                    client.Calling += ClientTrade.telecom.ToString() + ",";
                }
                if (cbx_post.Checked)
                {
                    client.Calling += ClientTrade.post.ToString() + ",";
                }
                if (cbx_consultation.Checked)
                {
                    client.Calling += ClientTrade.refer.ToString() + ",";
                }
                if (cbx_travel.Checked)
                {
                    client.Calling += ClientTrade.travel.ToString() + ",";
                }
                if (cbx_bus.Checked)
                {
                    client.Calling += ClientTrade.bus.ToString() + ",";
                }
                if (cbx_stock.Checked)
                {
                    client.Calling += ClientTrade.stock.ToString() + ",";
                }
                if (cbx_insurance.Checked)
                {
                    client.Calling += ClientTrade.insurance.ToString() + ",";
                }
                if (cbx_tax.Checked)
                {
                    client.Calling += ClientTrade.tax.ToString() + ",";
                }
                if (cbx_make.Checked)
                {
                    client.Calling += ClientTrade.make.ToString() + ",";
                }
                if (cbx_electric.Checked)
                {
                    client.Calling += ClientTrade.he.ToString() + ",";
                }
                if (cbx_clothe.Checked)
                {
                    client.Calling += ClientTrade.clothe.ToString() + ",";
                }
                if (cbx_food.Checked)
                {
                    client.Calling += ClientTrade.food.ToString() + ",";
                }
                if (cbx_medicine.Checked)
                {
                    client.Calling += ClientTrade.medicine.ToString() + ",";
                }
                if (cbx_mechanism.Checked)
                {
                    client.Calling += ClientTrade.mechanism.ToString() + ",";
                }
                if (cbx_auto.Checked)
                {
                    client.Calling += ClientTrade.auto.ToString() + ",";
                }

                client.CompanySize = tbx_staffnumber.Text;
                client.Money       = tbx_money.Text;
                client.Operation   = tbx_operation.Text;
                client.Introduce   = tbx_introduce.Text;
                client.ITGrade     = tbx_IT.Text;
                client.PCNumber    = Int32.Parse(tbx_pcnumber.Text);

                client.Net = "";
                if (cbx_LAN.Checked)
                {
                    client.Net += ClientNet.LAN.ToString() + ",";
                }
                if (cbx_WAN.Checked)
                {
                    client.Net += ClientNet.WAN.ToString() + ",";
                }
                if (cbx_internet.Checked)
                {
                    client.Net += ClientNet.INTERNET.ToString() + ",";
                }
                client.ITStaffs     = Int32.Parse(tbx_ITStaffs.Text);
                client.ITDepartment = tbx_ITdepartment.Text;
                client.Principal    = tbx_principal.Text;
                client.System       = tbx_system.Text;

                client.ClientSource = "";
                if (cbx_sellman.Checked)
                {
                    client.ClientSource += ClientSource.sellman + ",";
                }
                if (cbx_just.Checked)
                {
                    client.ClientSource += ClientSource.familiar + ",";
                }
                if (cbx_introduce.Checked)
                {
                    client.ClientSource += ClientSource.introduce + ",";
                }
                if (cbx_customer.Checked)
                {
                    client.ClientSource += ClientSource.client + ",";
                }

                client.ClientInitiative = "";
                if (cbx_media.Checked)
                {
                    client.ClientInitiative += ClientInitiative.media + ",";
                }
                if (cbx_Web.Checked)
                {
                    client.ClientInitiative += ClientInitiative.searchweb + ",";
                }
                if (cbx_proseminar.Checked)
                {
                    client.ClientInitiative += ClientInitiative.proseminar + ",";
                }
                if (cbx_exhibition.Checked)
                {
                    client.ClientInitiative += ClientInitiative.exhibition + ",";
                }
                if (cbx_EMS.Checked)
                {
                    client.ClientInitiative += ClientInitiative.post + ",";
                }
                if (cbx_Email.Checked)
                {
                    client.ClientInitiative += ClientInitiative.email + ",";
                }
                #endregion

                client.ChiefLinkmanID = (Session["tmpchief"] == null)?0:Int32.Parse(Session["tmpchief"].ToString());

                //根据clientid==0判断是update还是add
                try
                {
                    if (clientid != 0)                  //修改
                    {
                        SqlDataReader dr_chief = cm.GetLinkmanByID(client.ChiefLinkmanID.ToString());
                        while (dr_chief.Read())
                        {
                            if (Session["cm_permission"].ToString() == "administrator")
                            {
                                hlk_Chiefman.Text        = dr_chief["name"].ToString();
                                hlk_Chiefman.NavigateUrl = "Linkman.aspx?LinkmanID=" + dr_chief["id"].ToString();
                                hlk_Chiefman.Target      = "_blank";
                            }
                            else
                            {
                                hlk_Chiefman.Text = dr_chief["name"].ToString();
                            }
                        }
                        dr_chief.Close();
                        cm.UpdateClient(client);
                        Response.Write("<script>alert('修改成功!');opener.location.href=opener.location.href;close();</script>");
                    }
                    else                     //新增
                    {
                        CustomValidator1.Enabled = true;
                        CustomValidator1.Validate();
                        string tmplinkmanid = (Session["tmplinkmanid"] == null)?"":Session["tmplinkmanid"].ToString();
                        client.Birthday       = DateTime.Now;
                        client.ID             = cm.AddClinet(client);
                        ViewState["ClientID"] = client.ID.ToString();
                        ltl_ID.Text           = client.ID.ToString();
                        clientid = client.ID;
                        SqlDataReader dr_chief = cm.GetLinkmanByID(client.ChiefLinkmanID.ToString());
                        while (dr_chief.Read())
                        {
                            if (Session["cm_permission"].ToString() == "administrator")
                            {
                                hlk_Chiefman.Text        = dr_chief["name"].ToString();
                                hlk_Chiefman.NavigateUrl = "Linkman.aspx?LinkmanID=" + dr_chief["id"].ToString();
                                hlk_Chiefman.Target      = "_blank";
                            }
                            else
                            {
                                hlk_Chiefman.Text = dr_chief["name"].ToString();
                            }
                            lbl_position.Text = dr_chief["Position"].ToString();
                            lbl_chieftel.Text = dr_chief["Telephone"].ToString();
                        }
                        dr_chief.Close();
                        //分析session中的tmplinkmanid使他们得到clientid
                        foreach (string linkmanid in tmplinkmanid.Split(','))
                        {
                            if (linkmanid.Trim() != "")
                            {
                                UDS.Components.Linkman linkman = new UDS.Components.Linkman();
                                UDS.Components.CM      cm1     = new UDS.Components.CM();
                                linkman          = cm1.GetLinkmanStructByID(linkmanid);
                                linkman.ClientID = client.ID;
                                linkman.ID       = Int32.Parse(linkmanid);
                                cm.UpdateLinkman(linkman);
                            }
                        }
                        //清空Session
                        Session.Remove("tmpchief");
                        Session.Remove("tmplinkmanid");
                        Response.Write("<script>alert('添加成功!');opener.location.href=opener.location.href;close();</script>");
                    }
                }
                catch (Exception ex)
                {
                    UDS.Components.Error.Log(ex.Message);
                    Server.Transfer("../Error.aspx");
                }
                //Response.Write("<script>if(opener!=null) opener.location.reload();</script>");
                //刷新页面显示
                if (clientid == 0)
                {
                    btn_AddContact.Visible = false;
                }
                else
                {
                    btn_AddContact.Visible = true;
                }

                penal.Visible = cbx_customer.Checked;

                //上传附件
                UploadAtt();

                //显示附件
                if (clientid != 0)
                {
                    rpt_Attachment.DataSource = cm.GetAttachmentByClientID(clientid);
                    rpt_Attachment.DataBind();
                }
            }
        }
        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();
        }
Exemple #5
0
        private void btn_OK_Click(object sender, System.EventArgs e)
        {
            UDS.Components.CM cm = new UDS.Components.CM();
            UDS.Components.ClientInfo client = cm.GetClientAllInfo(clientid);
            if(Page.IsValid)
            {
                #region ���client�ṹ
                client.ClientShortName = tbx_ShortName.Text;
                client.ClientName = tbx_Name.Text;
                client.AddManID = Int32.Parse(Request.Cookies["UserID"].Value);
                client.UpdateTime = DateTime.Parse(tbx_UpdateTime.Text);
                client.Affiliatedarea = tbx_affiliatedarea.Text;
                client.URL = tbx_URL.Text;
                client.ZIP = tbx_zip.Text;
                client.Address = tbx_address.Text;
                client.Type = "";

                if(cbx_zhongduan.Checked)
                {
                    client.Type += ClientType.terminal.ToString() + ",";
                }
                if(cbx_qudao.Checked)
                {
                    client.Type += ClientType.channal.ToString() + ",";
                }
                if(cbx_shehui.Checked)
                {
                    client.Type += ClientType.social.ToString() + ",";
                }
                if(cbx_meiti.Checked)
                {
                    client.Type += ClientType.media.ToString() + ",";
                }

                client.EnterpriseType = "";
                if(cbx_government.Checked)
                {
                    client.EnterpriseType += EnterpriseType.government.ToString() + ",";
                }
                if(cbx_stateowned.Checked)
                {
                    client.EnterpriseType += EnterpriseType.contry.ToString() + ",";
                }
                if(cbx_private.Checked)
                {
                    client.EnterpriseType += EnterpriseType.privateowned.ToString() + ",";
                }
                if(cbx_foreign.Checked)
                {
                    client.EnterpriseType += EnterpriseType.oversea.ToString() + ",";
                }

                if(cbx_market.Checked) client.EnterpriseType += EnterpriseType.stock.ToString() + ",";

                client.Calling = "";
                if(cbx_realestate.Checked) client.Calling += ClientTrade.realty.ToString() + ",";
                if(cbx_IT.Checked) client.Calling += ClientTrade.IT.ToString() + ",";
                if(cbx_business.Checked) client.Calling += ClientTrade.business.ToString() + ",";
                if(cbx_telecom.Checked) client.Calling += ClientTrade.telecom.ToString() + ",";
                if(cbx_post.Checked) client.Calling += ClientTrade.post.ToString() + ",";
                if(cbx_consultation.Checked) client.Calling += ClientTrade.refer.ToString() + ",";
                if(cbx_travel.Checked) client.Calling += ClientTrade.travel.ToString() + ",";
                if(cbx_bus.Checked) client.Calling += ClientTrade.bus.ToString() + ",";
                if(cbx_stock.Checked) client.Calling += ClientTrade.stock.ToString() + ",";
                if(cbx_insurance.Checked) client.Calling += ClientTrade.insurance.ToString() + ",";
                if(cbx_tax.Checked) client.Calling += ClientTrade.tax.ToString() + ",";
                if(cbx_make.Checked) client.Calling += ClientTrade.make.ToString() + ",";
                if(cbx_electric.Checked) client.Calling += ClientTrade.he.ToString() + ",";
                if(cbx_clothe.Checked) client.Calling += ClientTrade.clothe.ToString() + ",";
                if(cbx_food.Checked) client.Calling += ClientTrade.food.ToString() + ",";
                if(cbx_medicine.Checked) client.Calling += ClientTrade.medicine.ToString() + ",";
                if(cbx_mechanism.Checked) client.Calling += ClientTrade.mechanism.ToString() + ",";
                if(cbx_auto.Checked) client.Calling += ClientTrade.auto.ToString() + ",";

                client.CompanySize = tbx_staffnumber.Text;
                client.Money = tbx_money.Text;
                client.Operation = tbx_operation.Text;
                client.Introduce = tbx_introduce.Text;
                client.ITGrade = tbx_IT.Text;
                client.PCNumber = Int32.Parse(tbx_pcnumber.Text);

                client.Net = "";
                if(cbx_LAN.Checked) client.Net += ClientNet.LAN.ToString() + ",";
                if(cbx_WAN.Checked)  client.Net += ClientNet.WAN.ToString() + ",";
                if(cbx_internet.Checked) client.Net += ClientNet.INTERNET.ToString() + ",";
                client.ITStaffs = Int32.Parse(tbx_ITStaffs.Text);
                client.ITDepartment = tbx_ITdepartment.Text;
                client.Principal = tbx_principal.Text;
                client.System = tbx_system.Text;

                client.ClientSource = "";
                if(cbx_sellman.Checked) client.ClientSource += ClientSource.sellman + ",";
                if(cbx_just.Checked)  client.ClientSource += ClientSource.familiar + ",";
                if(cbx_introduce.Checked)  client.ClientSource += ClientSource.introduce + ",";
                if(cbx_customer.Checked)  client.ClientSource += ClientSource.client + ",";

                client.ClientInitiative = "";
                if(cbx_media.Checked) client.ClientInitiative += ClientInitiative.media + ",";
                if(cbx_Web.Checked) client.ClientInitiative += ClientInitiative.searchweb + ",";
                if(cbx_proseminar.Checked) client.ClientInitiative += ClientInitiative.proseminar + ",";
                if(cbx_exhibition.Checked) client.ClientInitiative += ClientInitiative.exhibition + ",";
                if(cbx_EMS.Checked) client.ClientInitiative += ClientInitiative.post + ",";
                if(cbx_Email.Checked) client.ClientInitiative += ClientInitiative.email + ",";
            #endregion

                client.ChiefLinkmanID = (Session["tmpchief"]==null)?0:Int32.Parse(Session["tmpchief"].ToString());

                //����clientid==0���update����add
                try
                {
                    if(clientid!=0) //�޸�
                    {
                        SqlDataReader dr_chief = cm.GetLinkmanByID(client.ChiefLinkmanID.ToString());
                        try
                        {
                            while (dr_chief.Read())
                            {
                                if (Session["cm_permission"].ToString() == "administrator")
                                {
                                    hlk_Chiefman.Text = dr_chief["name"].ToString();
                                    hlk_Chiefman.NavigateUrl = "Linkman.aspx?LinkmanID=" + dr_chief["id"].ToString();
                                    hlk_Chiefman.Target = "_blank";
                                }
                                else
                                {
                                    hlk_Chiefman.Text = dr_chief["name"].ToString();
                                }

                            }
                        }
                        finally
                        {
                            dr_chief.Close();
                            dr_chief.Dispose();
                        }
                        cm.UpdateClient(client);
                        Response.Write("<script>alert('�޸ijɹ���');opener.location.href=opener.location.href;close();</script>");
                    }
                    else //����
                    {
                        CustomValidator1.Enabled = true;
                        CustomValidator1.Validate();
                        string tmplinkmanid = (Session["tmplinkmanid"]==null)?"":Session["tmplinkmanid"].ToString();
                        client.Birthday = DateTime.Now;
                        client.ID = cm.AddClinet(client);
                        ViewState["ClientID"] = client.ID.ToString();
                        ltl_ID.Text = client.ID.ToString();
                        clientid = client.ID;
                        SqlDataReader dr_chief = cm.GetLinkmanByID(client.ChiefLinkmanID.ToString());
                        try
                        {
                            while (dr_chief.Read())
                            {
                                if (Session["cm_permission"].ToString() == "administrator")
                                {
                                    hlk_Chiefman.Text = dr_chief["name"].ToString();
                                    hlk_Chiefman.NavigateUrl = "Linkman.aspx?LinkmanID=" + dr_chief["id"].ToString();
                                    hlk_Chiefman.Target = "_blank";
                                }
                                else
                                {
                                    hlk_Chiefman.Text = dr_chief["name"].ToString();
                                }
                                lbl_position.Text = dr_chief["Position"].ToString();
                                lbl_chieftel.Text = dr_chief["Telephone"].ToString();
                            }
                        }
                        finally
                        {
                            dr_chief.Close();
                            dr_chief.Dispose();
                        }
                        //����session�е�tmplinkmanidʹ���ǵõ�clientid
                        foreach(string linkmanid in tmplinkmanid.Split(','))
                        {
                            if(linkmanid.Trim()!="")
                            {
                                UDS.Components.Linkman linkman = new UDS.Components.Linkman();
                                UDS.Components.CM cm1 = new UDS.Components.CM();
                                linkman = cm1.GetLinkmanStructByID(linkmanid);
                                linkman.ClientID = client.ID;
                                linkman.ID = Int32.Parse(linkmanid);
                                cm.UpdateLinkman(linkman);
                            }
                        }
                        //���Session
                        Session.Remove("tmpchief");
                        Session.Remove("tmplinkmanid");
                        Response.Write("<script>alert('��ӳɹ���');opener.location.href=opener.location.href;close();</script>");
                    }
                }
                catch(Exception ex)
                {
                    UDS.Components.Error.Log(ex.Message);
                    Server.Transfer("../Error.aspx");
                }
                //Response.Write("<script>if(opener!=null) opener.location.reload();</script>");
                //ˢ��ҳ����ʾ
                if(clientid==0)
                    btn_AddContact.Visible = false;
                else
                    btn_AddContact.Visible = true;

                penal.Visible = cbx_customer.Checked;

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

                //��ʾ����
                if(clientid!=0)
                {
                    rpt_Attachment.DataSource = cm.GetAttachmentByClientID(clientid);
                    rpt_Attachment.DataBind();
                }
            }
        }
Exemple #6
0
        private void btn_ChangeAddMan_Click(object sender, System.EventArgs e)
        {
            UDS.Components.CM cm = new UDS.Components.CM();
            UDS.Components.ClientInfo client = cm.GetClientAllInfo(clientid);
            if(Page.IsValid)
            {
                client.AddManID = Int32.Parse(ddl_AddMan.SelectedItem.Value);
                cm.UpdateClient(client);
                //�ж�Ȩ��
                if(ddl_AddMan.SelectedItem.Value==Request.Cookies["UserID"].Value)
                {
                    Session["cm_permission"] = "administrator";
                }
                else
                    Session["cm_permission"] = "leader";

                Response.Write("<script>alert('�޸ijɹ���');opener.location.href='ClientListView.aspx';close();</script>");
            }
        }