Пример #1
0
        protected void btnAddResultContact_Click(object sender, EventArgs e)
        {
            try
            {
                var data = LeadInfoBiz.GetLeadDataPhoneCallHistory(txtTicketIdSearch.Text.Trim());
                if (data != null)
                {
                    txtTicketID.Text     = data.TicketId;
                    txtFirstname.Text    = data.Name;
                    txtLastname.Text     = data.LastName;
                    txtProductId.Text    = data.ProductId;
                    txtCampaignId.Text   = data.CampaignId;
                    txtCampaign.Text     = data.CampaignName;
                    txtTelNo1.Text       = data.TelNo1;
                    txtCitizenId.Text    = data.CitizenId;
                    txtAssignedFlag.Text = data.AssignedFlag;
                    txtDelegateFlag.Text = data.DelegateFlag != null?data.DelegateFlag.ToString() : "";

                    InitialDropdownlist(data);

                    if (data.CardType != null)
                    {
                        cmbCardType.SelectedIndex = cmbCardType.Items.IndexOf(cmbCardType.Items.FindByValue(data.CardType.Value.ToString()));
                        lblCitizenId.Text         = "*";
                        txtCitizenId.Enabled      = true;
                        txtCitizenId.Text         = data.CitizenId;
                        AppUtil.SetCardTypeValidation(cmbCardType.SelectedItem.Value, txtCitizenId);
                    }
                    else
                    {
                        txtCitizenId.Text = data.CitizenId;
                    }

                    //Owner Branch
                    if (!string.IsNullOrEmpty(data.OwnerBranch))
                    {
                        txtOldOwnerBranch.Text = data.OwnerBranch;
                        ListItem item = cmbOwnerBranch.Items.FindByValue(data.OwnerBranch);
                        if (item != null)
                        {
                            cmbOwnerBranch.SelectedIndex = cmbOwnerBranch.Items.IndexOf(item);
                        }
                        else
                        {
                            //check ว่ามีการกำหนด Brach ใน Table kkslm_ms_Access_Right ไหม ถ้ามีจะเท่ากับเป็น Branch ที่ถูกปิด ถ้าไม่มีแปลว่าไม่มีการเซตการมองเห็น
                            if (SlmScr011Biz.CheckBranchAccessRightExist(SLMConstant.Branch.All, txtCampaignId.Text.Trim(), data.OwnerBranch))
                            {
                                //Branch ที่ถูกปิด
                                string branchName = BranchBiz.GetBranchName(data.OwnerBranch);
                                if (!string.IsNullOrEmpty(branchName))
                                {
                                    cmbOwnerBranch.Items.Insert(1, new ListItem(branchName, data.OwnerBranch));
                                    cmbOwnerBranch.SelectedIndex = 1;
                                }
                            }
                        }

                        cmbOwnerBranchSelectedIndexChanged();   //Bind Combo Owner
                    }

                    //Owner
                    if (!string.IsNullOrEmpty(data.Owner))
                    {
                        txtOldOwner.Text       = data.Owner;
                        cmbOwner.SelectedIndex = cmbOwner.Items.IndexOf(cmbOwner.Items.FindByValue(data.Owner));
                    }

                    //Delegate Branch
                    if (!string.IsNullOrEmpty(data.DelegateBranch))
                    {
                        txtOldDelegateBranch.Text = data.DelegateBranch;
                        ListItem item = cmbDelegateBranch.Items.FindByValue(data.DelegateBranch);
                        if (item != null)
                        {
                            cmbDelegateBranch.SelectedIndex = cmbDelegateBranch.Items.IndexOf(item);
                        }
                        else
                        {
                            //check ว่ามีการกำหนด Brach ใน Table kkslm_ms_Access_Right ไหม ถ้ามีจะเท่ากับเป็น Branch ที่ถูกปิด ถ้าไม่มีแปลว่าไม่มีการเซตการมองเห็น
                            if (SlmScr011Biz.CheckBranchAccessRightExist(SLMConstant.Branch.All, txtCampaignId.Text.Trim(), data.DelegateBranch))
                            {
                                //Branch ที่ถูกปิด
                                string branchName = BranchBiz.GetBranchName(data.DelegateBranch);
                                if (!string.IsNullOrEmpty(branchName))
                                {
                                    cmbDelegateBranch.Items.Insert(1, new ListItem(branchName, data.DelegateBranch));
                                    cmbDelegateBranch.SelectedIndex = 1;
                                }
                            }
                        }

                        cmbDelegateBranchSelectedIndexChanged();    //Bind Combo Delegate
                    }

                    if (!string.IsNullOrEmpty(data.Delegate))
                    {
                        txtOldDelegate.Text       = data.Delegate;
                        cmbDelegate.SelectedIndex = cmbDelegate.Items.IndexOf(cmbDelegate.Items.FindByValue(data.Delegate));
                    }

                    //Lead Status
                    if (cmbLeadStatus.Items.Count > 0)
                    {
                        cmbLeadStatus.SelectedIndex = cmbLeadStatus.Items.IndexOf(cmbLeadStatus.Items.FindByValue(data.LeadStatus));
                        txtOldStatus.Text           = data.LeadStatus;
                    }

                    cmbLeadStatus.Enabled = data.AssignedFlag == "1" ? true : false;
                    if (data.AssignedFlag == "1" && data.LeadStatus != "00")
                    {
                        cmbLeadStatus.Items.Remove(cmbLeadStatus.Items.FindByValue("00"));  //ถ้าจ่ายงานแล้ว และสถานะปัจจุบันไม่ใช่สนใจ ให้เอาสถานะ สนใจ ออก
                    }

                    //เช็กสิทธิการแก้ไขข้อมูล
                    if (txtAssignedFlag.Text.Trim() == "0" || txtDelegateFlag.Text.Trim() == "1")   //ยังไม่จ่ายงาน assignedFlag = 0, delegateFlag = 1
                    {
                        cmbDelegateBranch.Enabled = false;
                        cmbDelegate.Enabled       = false;
                        cmbOwnerBranch.Enabled    = false;
                        cmbOwner.Enabled          = false;
                        lblTab008Info.Text        = "ไม่สามารถแก้ไข Owner และ Delegate ได้ เนื่องจากอยู่ระหว่างรอระบบจ่ายงาน กรุณารอ 1 นาที";
                    }
                    else
                    {
                        AppUtil.CheckOwnerPrivilege(data.Owner, data.Delegate, cmbOwnerBranch, cmbOwner, cmbDelegateBranch, cmbDelegate);
                    }

                    upPopup.Update();
                    mpePopup.Show();
                }
                else
                {
                    AppUtil.ClientAlert(Page, "ไม่พบ Ticket Id " + txtTicketID.Text.Trim() + " ในระบบ");
                }
            }
            catch (Exception ex)
            {
                string message = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
                _log.Debug(message);
                AppUtil.ClientAlert(Page, message);
            }
        }
Пример #2
0
        public void SetLeadData(LeadData lead, bool isnew, bool iscopy = false)
        {
            // setdata
            if (lead.TitleId != null)
            {
                cmbTitle.SelectedIndex = cmbTitle.Items.IndexOf(cmbTitle.Items.FindByValue(lead.TitleId.Value.ToString()));
            }
            txtName.Text              = lead.Name;
            txtLastName.Text          = lead.LastName;
            txtslm_TicketId.Text      = lead.TicketId;
            txtTelNo_1.Text           = lead.TelNo_1;
            txtTelNo2.Text            = lead.TelNo_2;
            txtContactFirstDate.Text  = lead.ContactFirstDate == null ? "" : GetDateTimeString(lead.ContactFirstDate.Value);
            txtContactLatestDate.Text = lead.ContactLatestDate == null ? "" : GetDateTimeString(lead.ContactLatestDate.Value);
            txtAssignDate.Text        = lead.AssignedDateView == null ? "" : GetDateTimeString(lead.AssignedDateView.Value);
            txtCreateDate.Text        = lead.LeadCreateDate == null ? "" : GetDateString(lead.LeadCreateDate.Value);
            txtCreateTime.Text        = lead.LeadCreateDate == null ? "" : lead.LeadCreateDate.Value.ToString("HH:mm:ss");
            txtCreateBy.Text          = lead.LeadCreateBy;
            txtAssignFlag.Text        = lead.AssignedFlag;
            txtDelegateFlag.Text      = lead.Delegate_Flag != null?lead.Delegate_Flag.ToString() : "";

            if (!iscopy)
            {
                txtOldOwner.Text = lead.Owner;
            }
            txtTicketIdRefer.Text = lead.TicketIdRefer;

            AppUtil.SetComboValue(cmbStatus, lead.Status);
            AppUtil.SetComboValue(cmbCampaignId, lead.CampaignId);
            SetComboOwnerBranch();
            AppUtil.SetComboValue(cmbChannelId, lead.ChannelId);
            AppUtil.SetComboValue(cmbOwnerBranch, lead.Owner_Branch);
            cmbOwnerBranchSelectedIndexChanged(lead.Owner == "" ? null : lead.Owner);
            AppUtil.SetComboValue(cmbOwner, lead.Owner);


            if (isnew)
            {
                return;
            }

            // delegate branch/lead
            if (!string.IsNullOrEmpty(lead.Delegate_Branch))
            {
                ListItem item = cmbDelegateBranch.Items.FindByValue(lead.Delegate_Branch);
                if (item != null)
                {
                    cmbDelegateBranch.SelectedIndex = cmbDelegateBranch.Items.IndexOf(item);
                }
                else
                {
                    //check ว่ามีการกำหนด Brach ใน Table kkslm_ms_Access_Right ไหม ถ้ามีจะเท่ากับเป็น Branch ที่ถูกปิด ถ้าไม่มีแปลว่าไม่มีการเซตการมองเห็น
                    if (SlmScr011Biz.CheckBranchAccessRightExist(SLMConstant.Branch.All, cmbCampaignId.SelectedItem.Value, lead.Delegate_Branch))
                    {
                        //Branch ที่ถูกปิด
                        string branchName = BranchBiz.GetBranchName(lead.Delegate_Branch);
                        if (!string.IsNullOrEmpty(branchName))
                        {
                            cmbDelegateBranch.Items.Insert(1, new ListItem(branchName, lead.Delegate_Branch));
                            cmbDelegateBranch.SelectedIndex = 1;
                        }
                    }
                }

                cmbDelegateBranchSelectedIndexChanged(lead.Delegate);    //Bind Combo Delegate
            }

            if (!string.IsNullOrEmpty(lead.Delegate))
            {
                txtoldDelegate.Text           = lead.Delegate;
                cmbDelegateLead.SelectedIndex = cmbDelegateLead.Items.IndexOf(cmbDelegateLead.Items.FindByValue(lead.Delegate));
            }



            if (lead.AssignedFlag == "0" || lead.Delegate_Flag == 1)   //ยังไม่จ่ายงาน assignedFlag = 0, delegateFlag = 1
            {
                cmbDelegateBranch.Enabled = false;
                cmbDelegateLead.Enabled   = false;
                cmbOwnerBranch.Enabled    = false;
                cmbOwner.Enabled          = false;
                lblAlert.Text             = "ไม่สามารถแก้ไข Owner และ Delegate ได้ เนื่องจากอยู่ระหว่างรอระบบจ่ายงาน กรุณารอ 1 นาที";
            }
            else
            {
                AppUtil.CheckOwnerPrivilege(lead.Owner, lead.Delegate, cmbOwnerBranch, cmbOwner, cmbDelegateBranch, cmbDelegateLead);
            }
        }