Exemplo n.º 1
0
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            //แคมเปญ
            AppUtil.BuildCombo(cmbCampaignId, SlmScr011Biz.GetCampaignEditData());
            //ช่องทาง
            AppUtil.BuildCombo(cmbChannelId, SlmScr003Biz.GetChannelData());
            //status
            AppUtil.BuildCombo(cmbStatus, SlmScr003Biz.GetOptionList("lead status"));
            //Owner Branch
            AppUtil.BuildCombo(cmbOwnerBranch, BranchBiz.GetBranchList(SLMConstant.Branch.Active));
            //Title
            AppUtil.BuildCombo(cmbTitle, SlmScr046Biz.GetTitleDataList());

            AppUtil.SetIntTextBox(txtTelNo_1);
            AppUtil.SetIntTextBox(txtTelNo2);
            if (cmbCampaignId.Enabled == true)
            {
                AppUtil.SetAutoCompleteDropdown(new DropDownList[] {
                    cmbCampaignId,
                    cmbOwnerBranch,
                    cmbOwner,
                    cmbDelegateLead,
                    cmbDelegateBranch,
                    cmbTitle
                }
                                                , Page
                                                , this.ClientID + "_Autocomplete");
            }
        }
Exemplo n.º 2
0
        private SearchLeadCondition GetSearchCondition()
        {
            SearchLeadCondition data = new SearchLeadCondition();

            data.TicketId        = txtTicketID.Text.Trim();
            data.Firstname       = txtFirstname.Text.Trim();
            data.Lastname        = txtLastname.Text.Trim();
            data.CardType        = cmbCardType.Items.Count > 0 ? cmbCardType.SelectedItem.Value : string.Empty; //ประเภทบุคคล
            data.CitizenId       = txtCitizenId.Text.Trim();
            data.CampaignId      = cmbCampaign.SelectedItem.Value;
            data.ChannelId       = cmbChannel.SelectedItem.Value;
            data.OwnerUsername   = cmbOwnerLeadSearch.Items.Count > 0 ? cmbOwnerLeadSearch.SelectedItem.Value : string.Empty;           //Owner Lead
            data.OwnerBranch     = cmbOwnerBranchSearch.Items.Count > 0 ? cmbOwnerBranchSearch.SelectedItem.Value : string.Empty;       //Owner Branch
            data.DelegateBranch  = cmbDelegateBranchSearch.Items.Count > 0 ? cmbDelegateBranchSearch.SelectedItem.Value : string.Empty; //Delegate Branch
            data.DelegateLead    = cmbDelegateLeadSearch.Items.Count > 0 ? cmbDelegateLeadSearch.SelectedItem.Value : string.Empty;     //Delegate Lead
            data.CreateByBranch  = cmbCreatebyBranchSearch.Items.Count > 0 ? cmbCreatebyBranchSearch.SelectedItem.Value : string.Empty; //CreateBy Branch
            data.CreateBy        = cmbCreatebySearch.Items.Count > 0 ? cmbCreatebySearch.SelectedItem.Value : string.Empty;             //CreateBy
            data.CreatedDate     = tdmCreateDate.DateValue;
            data.AssignedDate    = tdmAssignDate.DateValue;
            data.StatusList      = GetStatusList();
            data.PageIndex       = pcTop.SelectedPageIndex > -1 ? pcTop.SelectedPageIndex : 0;
            data.StaffType       = SlmScr003Biz.GetStaffType(HttpContext.Current.User.Identity.Name);
            data.SortExpression  = SortExpressionProperty;
            data.SortDirection   = SortDirectionProperty.ToString();
            data.AdvancedSearch  = txtAdvanceSearch.Text.Trim() == "Y" ? true : false;
            data.ContractNoRefer = txtContractNoRefer.Text.Trim();
            return(data);
        }
Exemplo n.º 3
0
        protected void btnAttachDocYes_Click(object sender, EventArgs e)
        {
            try
            {
                btnAttachDocYes.Enabled = false;
                btnAttachDocNo.Enabled  = false;

                string type = new ConfigProductScreenBiz().GetFieldType(lblResultTicketId.Text.Trim(), SLMConstant.ConfigProductScreen.ActionType.View);

                if (cbResultHasAdamsUrl.Checked)
                {
                    LeadDataForAdam leadData = SlmScr003Biz.GetLeadDataForAdam(lblResultTicketId.Text.Trim());
                    StaffData       staff    = SlmScr003Biz.GetStaff(HttpContext.Current.User.Identity.Name);

                    string script = AppUtil.GetCallAdamScript(leadData, HttpContext.Current.User.Identity.Name, (staff.EmpCode != null ? staff.EmpCode : ""), true, type);

                    ScriptManager.RegisterClientScriptBlock(Page, GetType(), "calladam", script, true);
                }
                else
                {
                    Response.Redirect("SLM_SCR_004.aspx?ticketid=" + lblResultTicketId.Text.Trim() + "&type=" + type);
                }
            }
            catch (Exception ex)
            {
                string message = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
                _log.Error(message);
                AppUtil.ClientAlertAndRedirect(Page, message, "SLM_SCR_003.aspx");
            }
        }
Exemplo n.º 4
0
 private void BindComboProductGroup()
 {
     cmbProductGroup.DataSource     = SlmScr003Biz.GetProductGroupData();
     cmbProductGroup.DataTextField  = "TextField";
     cmbProductGroup.DataValueField = "ValueField";
     cmbProductGroup.DataBind();
     cmbProductGroup.Items.Insert(0, new ListItem("", ""));
 }
Exemplo n.º 5
0
        private void DoSearchLeadData(int pageIndex, string sortExpression, SortDirection sortDirection)
        {
            try
            {
                string orderByFlag = "";

                if (sortExpression == "Notice" && sortDirection == SortDirection.Ascending)
                {
                    orderByFlag = SLMConstant.SearchOrderBy.Note;
                }
                else if (sortExpression == "CampaignName" || sortExpression == "StatusDesc")
                {
                    orderByFlag = SLMConstant.SearchOrderBy.None;
                }
                else
                {
                    orderByFlag = SLMConstant.SearchOrderBy.SLA;    //Default
                }
                string logError = "";
                List <SearchLeadResult> result = SlmScr003Biz.SearchLeadSeeAllData(GetSearchCondition(), HttpContext.Current.User.Identity.Name, orderByFlag, out logError);
                if (!string.IsNullOrEmpty(logError))
                {
                    _log.Error(logError);
                }

                if (sortExpression == "CampaignName")
                {
                    if (sortDirection == SortDirection.Ascending)
                    {
                        result = result.OrderBy(p => p.CampaignName).ToList();
                    }
                    else
                    {
                        result = result.OrderByDescending(p => p.CampaignName).ToList();
                    }
                }
                else if (sortExpression == "StatusDesc")
                {
                    if (sortDirection == SortDirection.Ascending)
                    {
                        result = result.OrderBy(p => p.StatusDesc).ToList();
                    }
                    else
                    {
                        result = result.OrderByDescending(p => p.StatusDesc).ToList();
                    }
                }

                //Session[nextleadlist] = AppUtil.GetNextLeadList(result);
                BindGridview((SLM.Application.Shared.GridviewPageController)pcTop, result.ToArray(), pageIndex);
                upResult.Update();
            }
            catch
            {
                throw;
            }
        }
Exemplo n.º 6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!IsPostBack)
                {
                    //เก็บไว้ส่งไปที่ Adam, AolSummaryReport
                    StaffData staff = SlmScr003Biz.GetStaff(HttpContext.Current.User.Identity.Name);
                    txtEmpCode.Text     = staff.EmpCode;
                    txtStaffTypeId.Text = staff.StaffTypeId != null?staff.StaffTypeId.ToString() : "";

                    txtStaffTypeDesc.Text   = staff.StaffTypeDesc;
                    txtStaffId.Text         = staff.StaffId.ToString();
                    txtStaffBranchCode.Text = staff.BranchCode;


                    //Set AdvanceSearch
                    if (staff.Collapse == null || staff.Collapse == true)
                    {
                        lbAdvanceSearch.Text             = "[+] <b>Advance Search</b>";
                        pnAdvanceSearch.Style["display"] = "none";
                        txtAdvanceSearch.Text            = "N";
                    }
                    else
                    {
                        lbAdvanceSearch.Text             = "[-] <b>Advance Search</b>";
                        pnAdvanceSearch.Style["display"] = "block";
                        txtAdvanceSearch.Text            = "Y";
                    }

                    InitialControl();
                    if (Session[searchcondition] != null)
                    {
                        SetSerachCondition((SearchLeadCondition)Session[searchcondition]);  //Page Load กลับมาจากหน้าอื่น
                        Session[searchcondition] = null;
                    }
                    //else
                    //    DoSearchLeadData(0, string.Empty, SortDirection.Ascending);    //First Load ครั้งแรก
                    StaffData Staff = StaffBiz.GetDefaultSearch(HttpContext.Current.User.Identity.Name);

                    if (Staff != null)
                    {
                        ViewState["SearchDefault"] = Staff.DefaultSearch;
                    }
                }
            }
            catch (Exception ex)
            {
                string message = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
                _log.Debug(message);
                AppUtil.ClientAlert(Page, message);
            }
        }
Exemplo n.º 7
0
        protected void gvResult_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                if (((Label)e.Row.FindControl("lblCalculatorUrl")).Text.Trim() != "")
                {
                    ((ImageButton)e.Row.FindControl("imbCal")).Visible       = true;
                    ((ImageButton)e.Row.FindControl("imbCal")).OnClientClick = AppUtil.GetCallCalculatorScript(((Label)e.Row.FindControl("lblTicketId")).Text.Trim()
                                                                                                               , ((Label)e.Row.FindControl("lblCalculatorUrl")).Text.Trim());
                }
                else
                {
                    ((ImageButton)e.Row.FindControl("imbCal")).Visible = false;
                }


                if (((Label)e.Row.FindControl("lblHasAdamUrl")).Text.Trim().ToUpper() == "Y")
                {
                    ((ImageButton)e.Row.FindControl("imbDoc")).Visible = true;
                }
                else
                {
                    ((ImageButton)e.Row.FindControl("imbDoc")).Visible = false;
                }


                //ปุ่ม Others
                if (((Label)e.Row.FindControl("lblAppNo")).Text.Trim() != "")
                {
                    string privilegeNCB = SlmScr003Biz.GetPrivilegeNCB(((Label)e.Row.FindControl("lblProductId")).Text.Trim(), (txtStaffTypeId.Text.Trim() != "" ? Convert.ToDecimal(txtStaffTypeId.Text.Trim()) : 0));
                    ((ImageButton)e.Row.FindControl("imbOthers")).Visible = privilegeNCB != "" ? true : false;
                }
                else
                {
                    ((ImageButton)e.Row.FindControl("imbOthers")).Visible = false;
                }

                //กรณีเข้า COC และ COCCurrentTeam ไม่ใช่ Marketing หรือ งานปิดไปแล้ว แล้วจะซ่อนปุ่ม Edit
                if ((((Label)e.Row.FindControl("lblIsCOC")).Text.Trim() == "1" && ((Label)e.Row.FindControl("lblCOCCurrentTeam")).Text.Trim() != SLMConstant.COCTeam.Marketing) ||
                    ((Label)e.Row.FindControl("lbslmStatusCode")).Text.Trim() == SLMConstant.StatusCode.Reject ||
                    ((Label)e.Row.FindControl("lbslmStatusCode")).Text.Trim() == SLMConstant.StatusCode.Cancel ||
                    ((Label)e.Row.FindControl("lbslmStatusCode")).Text.Trim() == SLMConstant.StatusCode.Close)
                {
                    ((ImageButton)e.Row.FindControl("imbEdit")).Visible = false;
                }
                else
                {
                    ((ImageButton)e.Row.FindControl("imbEdit")).Visible = true;
                }
            }
        }
Exemplo n.º 8
0
 protected void lbDocument_Click(object sender, EventArgs e)
 {
     try
     {
         LeadDataForAdam leadData = SlmScr003Biz.GetLeadDataForAdam(((ImageButton)sender).CommandArgument);
         ScriptManager.RegisterClientScriptBlock(Page, GetType(), "calladam", AppUtil.GetCallAdamScript(leadData, HttpContext.Current.User.Identity.Name, txtEmpCode.Text.Trim(), false), true);
     }
     catch (Exception ex)
     {
         string message = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
         _log.Debug(message);
         AppUtil.ClientAlert(Page, message);
     }
 }
Exemplo n.º 9
0
        //private void DoSearchLeadData(int pageIndex, string sortExpression, SortDirection sortDirection)
        //{
        //    try
        //    {
        //        string orderByFlag = "";
        //        string[] sortExpArray = { "CampaignName", "StatusDesc", "AssignedDate", "DelegateDate" };

        //        if (sortExpression == "Notice" && sortDirection == SortDirection.Ascending)
        //            orderByFlag = SLMConstant.SearchOrderBy.Note;
        //        else if (sortExpArray.Contains(sortExpression))
        //            orderByFlag = SLMConstant.SearchOrderBy.None;
        //        else
        //            orderByFlag = SLMConstant.SearchOrderBy.SLA;    //Default

        //        string searchLogError = "";
        //        List<SearchLeadResult> result = SlmScr003Biz.SearchLeadData(GetSearchCondition(), HttpContext.Current.User.Identity.Name, orderByFlag, out searchLogError);
        //        if (!string.IsNullOrEmpty(searchLogError))
        //        {
        //            _log.Error(searchLogError);
        //        }

        //        if (sortExpression == "CampaignName")
        //        {
        //            result = sortDirection == SortDirection.Ascending ? result.OrderBy(p => p.CampaignName).ToList() : result.OrderByDescending(p => p.CampaignName).ToList();
        //        }
        //        else if (sortExpression == "StatusDesc")
        //        {
        //            result = sortDirection == SortDirection.Ascending ? result.OrderBy(p => p.StatusDesc).ToList() : result.OrderByDescending(p => p.StatusDesc).ToList();
        //        }
        //        else if (sortExpression == "AssignedDate")
        //        {
        //            result = sortDirection == SortDirection.Ascending ? result.OrderBy(p => p.AssignedDate).ToList() : result.OrderByDescending(p => p.AssignedDate).ToList();
        //        }
        //        else if (sortExpression == "DelegateDate")
        //        {
        //            result = sortDirection == SortDirection.Ascending ? result.OrderBy(p => p.DelegateDate).ToList() : result.OrderByDescending(p => p.DelegateDate).ToList();
        //        }

        //        Session[nextleadlist] = AppUtil.GetNextLeadList(result, pageIndex);
        //        BindGridview((SLM.Application.Shared.GridviewPageController)pcTop, result.ToArray(), pageIndex);
        //        upResult.Update();
        //    }
        //    catch
        //    {
        //        throw;
        //    }
        //}

        private void DoSearchLeadData(int pageIndex, string sortExpression, SortDirection sortDirection)
        {
            try
            {
                string   orderByFlag      = "";
                string   orderByDirection = "";
                string[] sortExpArray     = { SLMConstant.SearchOrderBy.CampaignName,
                                              SLMConstant.SearchOrderBy.StatusDesc,
                                              SLMConstant.SearchOrderBy.AssignedDate,
                                              SLMConstant.SearchOrderBy.DelegateDate };

                if (sortExpression == "Notice" && sortDirection == SortDirection.Ascending)
                {
                    orderByFlag = SLMConstant.SearchOrderBy.Note;
                }
                else if (sortExpArray.Contains(sortExpression))
                {
                    orderByFlag      = sortExpression;
                    orderByDirection = sortDirection == SortDirection.Ascending ? "ASC" : "DESC";
                }
                else
                {
                    orderByFlag = SLMConstant.SearchOrderBy.SLA;    //Default
                }

                var condition = GetSearchCondition();
                condition.PageIndex = pageIndex;
                string searchLogError = "";
                int    totalRecord;
                //List<NextLeadData> allLeadList = new List<NextLeadData>();

                List <SearchLeadResult> result = SlmScr003Biz.SearchLeadDataNew(condition, HttpContext.Current.User.Identity.Name, orderByFlag, orderByDirection, out searchLogError, out totalRecord);
                if (!string.IsNullOrEmpty(searchLogError))
                {
                    _log.Error(searchLogError);
                }

                //var nextLeadList = allLeadList.Skip(condition.PageIndex * condition.PageSize).Take(300).ToList();
                //var nextLeadList = result;
                Session[nextleadlist] = CreateNextLeadList(result);
                gvResult.DataSource   = result.Take(10).ToList();
                gvResult.DataBind();
                pcTop.UpdateSearchLead(totalRecord, pageIndex, SLMConstant.GridviewPageSize);
                upResult.Update();
            }
            catch
            {
                throw;
            }
        }
Exemplo n.º 10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!IsPostBack)
                {
                    _log.Debug(DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss") + " " + (Request["ticketid"] != null ? Request["ticketid"] : (" PreleadId " + Request["preleadid"])) + " Begin Page_Load(SLM_SCR_070)");
                    Session.Remove(SLMConstant.SessionName.tabscreenlist);
                    Session.Remove(SLMConstant.SessionName.configscreen);

                    //เก็บไว้ส่งไปที่ Adam, AolSummaryReport
                    StaffData staff = SlmScr003Biz.GetStaff(HttpContext.Current.User.Identity.Name);
                    txtEmpCode.Text     = staff.EmpCode;
                    txtStaffTypeId.Text = staff.StaffTypeId != null?staff.StaffTypeId.ToString() : "";

                    txtStaffTypeDesc.Text   = staff.StaffTypeDesc;
                    txtStaffId.Text         = staff.StaffId.ToString();
                    txtStaffBranchCode.Text = staff.BranchCode;

                    //Set AdvanceSearch
                    if (staff.Collapse == null || staff.Collapse == true)
                    {
                        lbAdvanceSearch.Text             = "[+] <b>Advance Search</b>";
                        pnAdvanceSearch.Style["display"] = "none";
                        txtAdvanceSearch.Text            = "N";
                    }
                    else
                    {
                        lbAdvanceSearch.Text             = "[-] <b>Advance Search</b>";
                        pnAdvanceSearch.Style["display"] = "block";
                        txtAdvanceSearch.Text            = "Y";
                    }

                    InitialControl();
                    if (Session[searchcondition] != null)
                    {
                        SetSearchCondition((SearchLeadCondition)Session[searchcondition]);  //Page Load กลับมาจากหน้าอื่น
                        Session[searchcondition] = null;
                    }
                    _log.Debug(DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss") + " " + (Request["ticketid"] != null ? Request["ticketid"] : (" PreleadId " + Request["preleadid"])) + " End Page_Load(SLM_SCR_070)");
                }
            }
            catch (Exception ex)
            {
                string message = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
                _log.Error(message);
                AppUtil.ClientAlert(Page, message);
            }
        }
Exemplo n.º 11
0
        private void DoSearchCampaign()
        {
            List <ProductData> result = null;

            if (rbSearchByCombo.Checked)
            {
                result = SlmScr003Biz.SearchCampaignNew(cmbProductGroup.SelectedItem.Value, cmbProduct.SelectedItem.Value, cmbCampaign.SelectedItem.Value);
            }
            else
            {
                result = SlmScr003Biz.SearchCampaignNew(txtFullSearchCampaign.Text.Trim());
            }

            BindGridview((SLM.Application.Shared.GridviewPageController)pcGridCampaign, result.ToArray(), 0);
            gvCampaign.Visible = true;
            upPopupSearchCampaign.Update();
        }
Exemplo n.º 12
0
        protected void lbDocument_Click(object sender, EventArgs e)
        {
            try
            {
                LeadDataForAdam leadData = SlmScr003Biz.GetLeadDataForAdam(((ImageButton)sender).CommandArgument);
                //convert customerdetail.contactBranch, channelInfo.Branch, to newBranchCode
                leadData.ContactBranch = BranchBiz.GetBranchCodeNew(leadData.ContactBranch);
                leadData.Branch        = BranchBiz.GetBranchCodeNew(leadData.Branch);

                ScriptManager.RegisterClientScriptBlock(Page, GetType(), "calladam", AppUtil.GetCallAdamScript(leadData, HttpContext.Current.User.Identity.Name, txtEmpCode.Text.Trim(), false, ""), true);
            }
            catch (Exception ex)
            {
                string message = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
                _log.Error(message);
                AppUtil.ClientAlert(Page, message);
            }
        }
Exemplo n.º 13
0
        protected void cmbProduct_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                cmbCampaign.DataSource     = SlmScr003Biz.GetCampaignDataNew(cmbProductGroup.SelectedItem.Value, cmbProduct.SelectedItem.Value);
                cmbCampaign.DataTextField  = "TextField";
                cmbCampaign.DataValueField = "ValueField";
                cmbCampaign.DataBind();
                cmbCampaign.Items.Insert(0, new ListItem("", ""));

                mpePopupSearchCampaign.Show();
            }
            catch (Exception ex)
            {
                string message = ex.Message;
                _log.Debug(message);
                AppUtil.ClientAlert(Page, message);
            }
            btnSearchCampaign.Focus();
        }
Exemplo n.º 14
0
        protected void lbAolSummaryReport_Click(object sender, EventArgs e)
        {
            try
            {
                int    index        = int.Parse(((ImageButton)sender).CommandArgument);
                string appNo        = ((Label)gvResult.Rows[index].FindControl("lblAppNo")).Text.Trim(); //"1002363";
                string productId    = ((Label)gvResult.Rows[index].FindControl("lblProductId")).Text.Trim();
                string privilegeNCB = "";

                if (txtStaffTypeId.Text.Trim() != "")
                {
                    privilegeNCB = SlmScr003Biz.GetPrivilegeNCB(productId, Convert.ToDecimal(txtStaffTypeId.Text.Trim()));
                }

                ScriptManager.RegisterClientScriptBlock(Page, GetType(), "callaolsummaryreport", AppUtil.GetCallAolSummaryReportScript(appNo, txtEmpCode.Text.Trim(), txtStaffTypeDesc.Text.Trim(), privilegeNCB), true);
            }
            catch (Exception ex)
            {
                string message = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
                _log.Error(message);
                AppUtil.ClientAlert(Page, message);
            }
        }
Exemplo n.º 15
0
        protected void cmbProductGroup_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                //cmbProduct.DataSource = SlmScr003Biz.GetProductData(cmbProductGroup.SelectedItem.Value);
                cmbProduct.DataSource     = SlmScr003Biz.GetProductDataNew(cmbProductGroup.SelectedItem.Value);
                cmbProduct.DataTextField  = "TextField";
                cmbProduct.DataValueField = "ValueField";
                cmbProduct.DataBind();
                cmbProduct.Items.Insert(0, new ListItem("", "0"));  //value = 0 ป้องกันในกรณีส่งค่า ช่องว่างไป where ใน CMT_CAMPAIGN_PRODUCT แล้วค่า PR_ProductId บาง record เป็นช่องว่าง

                cmbCampaign.Items.Clear();
                cmbCampaign.Items.Insert(0, new ListItem("", ""));

                mpePopupSearchCampaign.Show();
            }
            catch (Exception ex)
            {
                string message = ex.Message;
                _log.Debug(message);
                AppUtil.ClientAlert(Page, message);
            }
            btnSearchCampaign.Focus();
        }
Exemplo n.º 16
0
        protected void PageSearchChange(object sender, EventArgs e)
        {
            try
            {
                List <ProductData> result = null;

                if (rbSearchByCombo.Checked)
                {
                    result = SlmScr003Biz.SearchCampaignNew(cmbProductGroup.SelectedItem.Value, cmbProduct.SelectedItem.Value, cmbCampaign.SelectedItem.Value); //SlmScr003Biz.SearchCampaign
                }
                else
                {
                    result = SlmScr003Biz.SearchCampaignNew(txtFullSearchCampaign.Text.Trim()); // SlmScr003Biz.SearchCampaign
                }
                var pageControl = (SLM.Application.Shared.GridviewPageController)sender;
                BindGridview(pageControl, result.AsEnumerable().ToArray(), pageControl.SelectedPageIndex);
            }
            catch (Exception ex)
            {
                string message = ex.Message;
                _log.Debug(message);
                AppUtil.ClientAlert(Page, message);
            }
        }
Exemplo n.º 17
0
        private void InitialControl()
        {
            //ประเภทบุคคล
            cmbCardType.DataSource     = CardTypeBiz.GetCardTypeList();
            cmbCardType.DataTextField  = "TextField";
            cmbCardType.DataValueField = "ValueField";
            cmbCardType.DataBind();
            cmbCardType.Items.Insert(0, new ListItem("", ""));

            //cmbCampaign.DataSource = SlmScr003Biz.GetAllActiveCampaignData();
            cmbCampaign.DataSource     = SlmScr003Biz.GetSaleAndBothCampaignData();
            cmbCampaign.DataTextField  = "TextField";
            cmbCampaign.DataValueField = "ValueField";
            cmbCampaign.DataBind();
            cmbCampaign.Items.Insert(0, new ListItem("", ""));

            //GetOwnerLead(cmbCampaign.SelectedItem.Value);

            cmbChannel.DataSource     = SlmScr003Biz.GetChannelData();
            cmbChannel.DataTextField  = "TextField";
            cmbChannel.DataValueField = "ValueField";
            cmbChannel.DataBind();
            cmbChannel.Items.Insert(0, new ListItem("", ""));

            //Owner Lead
            //cmbOwnerLeadSearch.DataSource = SlmScr003Biz.GetOwnerList(HttpContext.Current.User.Identity.Name);
            //cmbOwnerLeadSearch.DataTextField = "TextField";
            //cmbOwnerLeadSearch.DataValueField = "ValueField";
            //cmbOwnerLeadSearch.DataBind();
            //cmbOwnerLeadSearch.Items.Insert(0, new ListItem("", ""));

            var branchList = BranchBiz.GetBranchList(SLMConstant.Branch.All);

            //Owner Branch
            cmbOwnerBranchSearch.DataSource     = branchList;
            cmbOwnerBranchSearch.DataTextField  = "TextField";
            cmbOwnerBranchSearch.DataValueField = "ValueField";
            cmbOwnerBranchSearch.DataBind();
            cmbOwnerBranchSearch.Items.Insert(0, new ListItem("", ""));
            cmbOwnerLeadSearch.Items.Insert(0, new ListItem("", ""));
            //BindOwnerLead();

            //Delegate Branch
            cmbDelegateBranchSearch.DataSource     = branchList;
            cmbDelegateBranchSearch.DataTextField  = "TextField";
            cmbDelegateBranchSearch.DataValueField = "ValueField";
            cmbDelegateBranchSearch.DataBind();
            cmbDelegateBranchSearch.Items.Insert(0, new ListItem("", ""));
            cmbDelegateLeadSearch.Items.Insert(0, new ListItem("", ""));
            //BindDelegateLead();

            //CreateBy Branch
            cmbCreatebyBranchSearch.DataSource     = branchList;
            cmbCreatebyBranchSearch.DataTextField  = "TextField";
            cmbCreatebyBranchSearch.DataValueField = "ValueField";
            cmbCreatebyBranchSearch.DataBind();
            cmbCreatebyBranchSearch.Items.Insert(0, new ListItem("", ""));
            cmbCreatebySearch.Items.Insert(0, new ListItem("", ""));
            //BindCreateByLead();

            var             statusList = SlmScr003Biz.GetOptionList(AppConstant.OptionType.LeadStatus);
            ControlListData data       = statusList.Where(p => p.ValueField == "16").FirstOrDefault();

            if (data != null)
            {
                statusList.Remove(data);
            }

            cbOptionList.DataSource     = statusList;
            cbOptionList.DataTextField  = "TextField";
            cbOptionList.DataValueField = "ValueField";
            cbOptionList.DataBind();

            //ListItem lst = cbOptionList.Items.FindByValue("00");
            //if (lst != null) lst.Selected = true;
            //lst = cbOptionList.Items.FindByValue("01");
            //if (lst != null) lst.Selected = true;

            pcTop.SetVisible = false;
        }
Exemplo n.º 18
0
        protected void gvResult_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.Header)
            {
                string        sortColumn    = (string)ViewState["ExpressionState"];
                SortDirection sortDirection = (SortDirection)ViewState["SortingState"];
                if (sortColumn != null && sortColumn != "")
                {
                    //sortColumn = gvResult.SortExpression.Split(' ')[0];
                    //sortDirection = gvResult.SortExpression.Split(' ')[1];
                    int cellIndex = -1;
                    foreach (DataControlField field in gvResult.Columns)
                    {
                        if (field.SortExpression.ToString() == sortColumn)
                        {
                            cellIndex = gvResult.Columns.IndexOf(field);
                        }
                    }

                    if (cellIndex > -1)
                    {
                        //  this is a header row, set the sort style
                        e.Row.Cells[cellIndex].CssClass = sortDirection == SortDirection.Ascending ? "sortasc" : "sortdesc";
                    }
                }
            }
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                if (((Label)e.Row.FindControl("lblCalculatorUrl")).Text.Trim() != "")
                {
                    ((ImageButton)e.Row.FindControl("imbCal")).Visible       = true;
                    ((ImageButton)e.Row.FindControl("imbCal")).OnClientClick = AppUtil.GetCallCalculatorScript(((Label)e.Row.FindControl("lblTicketId")).Text.Trim()
                                                                                                               , ((Label)e.Row.FindControl("lblCalculatorUrl")).Text.Trim());
                }
                else
                {
                    ((ImageButton)e.Row.FindControl("imbCal")).Visible = false;
                }


                if (((Label)e.Row.FindControl("lblHasAdamUrl")).Text.Trim().ToUpper() == "Y")
                {
                    ((ImageButton)e.Row.FindControl("imbDoc")).Visible = true;
                }
                else
                {
                    ((ImageButton)e.Row.FindControl("imbDoc")).Visible = false;
                }


                //ปุ่ม Others
                if (((Label)e.Row.FindControl("lblAppNo")).Text.Trim() != "")
                {
                    string privilegeNCB = SlmScr003Biz.GetPrivilegeNCB(((Label)e.Row.FindControl("lblProductId")).Text.Trim(), (txtStaffTypeId.Text.Trim() != "" ? Convert.ToDecimal(txtStaffTypeId.Text.Trim()) : 0));
                    ((ImageButton)e.Row.FindControl("imbOthers")).Visible = privilegeNCB != "" ? true : false;
                }
                else
                {
                    ((ImageButton)e.Row.FindControl("imbOthers")).Visible = false;
                }

                //กรณีเข้า COC และ COCCurrentTeam ไม่ใช่ Marketing หรือ งานปิดไปแล้ว แล้วจะซ่อนปุ่ม Edit
                if ((((Label)e.Row.FindControl("lblIsCOC")).Text.Trim() == "1" && ((Label)e.Row.FindControl("lblCOCCurrentTeam")).Text.Trim() != SLMConstant.COCTeam.Marketing) ||
                    ((Label)e.Row.FindControl("lbslmStatusCode")).Text.Trim() == SLMConstant.StatusCode.Reject ||
                    ((Label)e.Row.FindControl("lbslmStatusCode")).Text.Trim() == SLMConstant.StatusCode.Cancel ||
                    ((Label)e.Row.FindControl("lbslmStatusCode")).Text.Trim() == SLMConstant.StatusCode.Close)
                {
                    ((ImageButton)e.Row.FindControl("imbEdit")).Visible = false;
                }
                else
                {
                    ((ImageButton)e.Row.FindControl("imbEdit")).Visible = true;
                }
            }
        }
Exemplo n.º 19
0
        private void InitialControl()
        {
            //ประเภทบุคคล
            cmbCardType.DataSource     = CardTypeBiz.GetCardTypeList();
            cmbCardType.DataTextField  = "TextField";
            cmbCardType.DataValueField = "ValueField";
            cmbCardType.DataBind();
            cmbCardType.Items.Insert(0, new ListItem("", ""));

            cmbCampaign.DataSource     = SlmScr003Biz.GetSaleAndBothCampaignData();
            cmbCampaign.DataTextField  = "TextField";
            cmbCampaign.DataValueField = "ValueField";
            cmbCampaign.DataBind();
            cmbCampaign.Items.Insert(0, new ListItem("", ""));

            cmbChannel.DataSource     = SlmScr003Biz.GetChannelData();
            cmbChannel.DataTextField  = "TextField";
            cmbChannel.DataValueField = "ValueField";
            cmbChannel.DataBind();
            cmbChannel.Items.Insert(0, new ListItem("", ""));

            var branchList = BranchBiz.GetBranchList(SLMConstant.Branch.All);

            //Owner Branch
            cmbOwnerBranchSearch.DataSource     = branchList;
            cmbOwnerBranchSearch.DataTextField  = "TextField";
            cmbOwnerBranchSearch.DataValueField = "ValueField";
            cmbOwnerBranchSearch.DataBind();
            cmbOwnerBranchSearch.Items.Insert(0, new ListItem("", ""));
            cmbOwnerLeadSearch.Items.Insert(0, new ListItem("", ""));

            //Delegate Branch
            cmbDelegateBranchSearch.DataSource     = branchList;
            cmbDelegateBranchSearch.DataTextField  = "TextField";
            cmbDelegateBranchSearch.DataValueField = "ValueField";
            cmbDelegateBranchSearch.DataBind();
            cmbDelegateBranchSearch.Items.Insert(0, new ListItem("", ""));
            cmbDelegateLeadSearch.Items.Insert(0, new ListItem("", ""));

            //CreateBy Branch
            cmbCreatebyBranchSearch.DataSource     = branchList;
            cmbCreatebyBranchSearch.DataTextField  = "TextField";
            cmbCreatebyBranchSearch.DataValueField = "ValueField";
            cmbCreatebyBranchSearch.DataBind();
            cmbCreatebyBranchSearch.Items.Insert(0, new ListItem("", ""));
            cmbCreatebySearch.Items.Insert(0, new ListItem("", ""));

            var             statusList = SlmScr003Biz.GetOptionList(AppConstant.OptionType.LeadStatus);
            ControlListData data       = statusList.Where(p => p.ValueField == "16").FirstOrDefault();

            if (data != null)
            {
                statusList.Remove(data);
            }

            cbOptionList.DataSource     = statusList;
            cbOptionList.DataTextField  = "TextField";
            cbOptionList.DataValueField = "ValueField";
            cbOptionList.DataBind();

            pcTop.SetVisible = false;
        }
Exemplo n.º 20
0
        private void DoSearchLeadData(int pageIndex, string sortExpression, SortDirection sortDirection)
        {
            try
            {
                string orderByFlag = "";

                if (sortExpression == "Notice" && sortDirection == SortDirection.Ascending)
                {
                    orderByFlag = SLMConstant.SearchOrderBy.Note;
                }
                else if (sortExpression == "CampaignName" || sortExpression == "StatusDesc")
                {
                    orderByFlag = SLMConstant.SearchOrderBy.None;
                }
                else
                {
                    orderByFlag = SLMConstant.SearchOrderBy.SLA;    //Default
                }
                List <SearchLeadResult> result = SlmScr003Biz.SearchLeadData(GetSearchCondition(), HttpContext.Current.User.Identity.Name, orderByFlag);

                if (sortExpression == "CampaignName")
                {
                    if (sortDirection == SortDirection.Ascending)
                    {
                        result = result.OrderBy(p => p.CampaignName).ToList();
                    }
                    else
                    {
                        result = result.OrderByDescending(p => p.CampaignName).ToList();
                    }
                }
                else if (sortExpression == "StatusDesc")
                {
                    if (sortDirection == SortDirection.Ascending)
                    {
                        result = result.OrderBy(p => p.StatusDesc).ToList();
                    }
                    else
                    {
                        result = result.OrderByDescending(p => p.StatusDesc).ToList();
                    }
                }
                else if (sortExpression == "CreatedDate")
                {
                    if (sortDirection == SortDirection.Ascending)
                    {
                        result = result.OrderBy(p => p.CreatedDate).ToList();
                    }
                    else
                    {
                        result = result.OrderByDescending(p => p.StatusDesc).ToList();
                    }
                }
                else if (sortExpression == "AssignedDate")
                {
                    if (sortDirection == SortDirection.Ascending)
                    {
                        result = result.OrderBy(p => p.AssignedDate).ToList();
                    }
                    else
                    {
                        result = result.OrderByDescending(p => p.StatusDesc).ToList();
                    }
                }



                BindGridview((SLM.Application.Shared.GridviewPageController)pcTop, result.ToArray(), pageIndex);
                upResult.Update();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 21
0
        public void SetAddCampaignCombo()
        {
//            AppUtil.BuildCombo(cmbCampaignId, SlmScr003Biz.GetCampaignData());
            AppUtil.BuildCombo(cmbCampaignId, SlmScr003Biz.GetCampaignDataNew());
        }
Exemplo n.º 22
0
        private void CheckTicketIdPrivilege(string ticketId)
        {
            string logError = "";

            if (!RoleBiz.GetTicketIdPrivilege(ticketId, HttpContext.Current.User.Identity.Name, SlmScr003Biz.GetStaffType(HttpContext.Current.User.Identity.Name), "", "SLM_SCR_011", out logError))
            {
                if (!string.IsNullOrEmpty(logError))
                {
                    _log.Error(logError);
                }

                string message             = "ข้อมูลผู้มุ่งหวังรายนี้ ท่านไม่มีสิทธิในการมองเห็น";
                LeadOwnerDelegateData data = SlmScr011Biz.GetOwnerAndDelegateName(ticketId);
                if (data != null)
                {
                    if (!string.IsNullOrEmpty(data.OwnerName) && !string.IsNullOrEmpty(data.DelegateName))
                    {
                        message += " ณ ปัจจุบันผู้เป็นเจ้าของ คือ " + data.OwnerName.ToString().Trim() + " และ Delegate คือ " + data.DelegateName.ToString().Trim();
                    }
                    else if (!string.IsNullOrEmpty(data.OwnerName))
                    {
                        message += " ณ ปัจจุบันผู้เป็นเจ้าของ คือ " + data.OwnerName.ToString().Trim();
                    }
                    else if (!string.IsNullOrEmpty(data.DelegateName))
                    {
                        message += " ณ ปัจจุบัน Delegate คือ " + data.DelegateName.ToString().Trim();
                    }
                }
                else
                {
                    message = "ไม่พบ Ticket Id " + Request["ticketid"].ToString() + " ในระบบ";
                }

                AppUtil.ClientAlertAndRedirect(Page, message, "SLM_SCR_003.aspx");
            }
            else
            {
                if (!string.IsNullOrEmpty(logError))
                {
                    _log.Error(logError);
                }
            }
        }
Exemplo n.º 23
0
        public bool ValidateData(bool isValidateNewLead = true)
        {
            if (!isValidateNewLead)     //หน้า Edit
            {
                if (!IsLastestOwnerDelegate())
                {
                    AppUtil.ClientAlertAndRedirect(Page, "ข้อมูลผู้มุ่งหวังนี้ถูกจ่ายงานให้พนักงานท่านอื่นแล้ว ระบบจะทำการ Refresh หน้าจอให้", "SLM_SCR_011.aspx?ticketid=" + txtslm_TicketId.Text.Trim());
                    return(false);
                }
            }

            int i = 0;

            if (txtName.Text.Trim() == string.Empty)
            {
                vtxtName.Text = "กรุณาระบุชื่อ";
                i            += 1;
            }
            else
            {
                vtxtName.Text = "";
            }

            if (cmbCampaignId.SelectedItem.Value == string.Empty)
            {
                vcmbCampaignId.Text = "กรุณาระบุแคมเปญ";
                i += 1;
            }
            else
            {
                vcmbCampaignId.Text = "";
            }

            if (cmbChannelId.SelectedItem.Value == string.Empty)
            {
                vcmbChannelId.Text = "กรุณาระบุช่องทาง";
                i += 1;
            }
            else
            {
                vcmbChannelId.Text = "";
            }
            //****************************Owner**********************************************************
            if (isValidateNewLead)
            {
                if (cmbOwnerBranch.SelectedItem.Value != string.Empty && cmbOwner.Items.Count > 0 && cmbOwner.SelectedItem.Value == string.Empty)
                {
                    vcmbOwner.Text = "กรุณาระบุ Owner Lead";
                    i += 1;
                }
                else
                {
                    vcmbOwner.Text = "";
                    if (cmbCampaignId.SelectedItem.Value != string.Empty && cmbOwnerBranch.SelectedItem.Value != string.Empty && cmbOwner.Items.Count > 0 && cmbOwner.SelectedItem.Value != string.Empty)
                    {
                        if (!SlmScr010Biz.PassPrivilegeCampaign(SLMConstant.Branch.Active, cmbCampaignId.SelectedItem.Value, cmbOwner.SelectedItem.Value))
                        {
                            vcmbOwner.Text = "Owner Lead ไม่มีสิทธิ์ในแคมเปญนี้";
                            i += 1;
                        }
                        else
                        {
                            vcmbOwner.Text = "";
                        }
                    }
                }
            }
            else
            {
                //หน้า Edit
                //OwnerBranch, Owner
                string clearOwnerBranchText = "Y";
                if (!AppUtil.ValidateOwner(newassignflag, cmbOwnerBranch, vcmbOwnerBranch, cmbOwner, vcmbOwner, cmbCampaignId.SelectedItem.Value, ref clearOwnerBranchText))
                {
                    i += 1;
                }

                //Branch ที่ถูกปิด
                if (cmbOwnerBranch.Items.Count > 0 && cmbOwnerBranch.SelectedItem.Value != "" && !BranchBiz.CheckBranchActive(cmbOwnerBranch.SelectedItem.Value))
                {
                    vcmbOwnerBranch.Text = "สาขานี้ถูกปิดแล้ว";
                    i += 1;
                }
                else
                {
                    if (clearOwnerBranchText == "Y")
                    {
                        vcmbOwnerBranch.Text = "";
                    }
                }
            }


            //****************************Delegate**********************************************************
            //Delegate มีเฉพาะหน้า Edit
            if (!isValidateNewLead)
            {
                if (cmbDelegateBranch.Items.Count > 0 && cmbDelegateBranch.SelectedItem.Value != "" && !BranchBiz.CheckBranchActive(cmbDelegateBranch.SelectedItem.Value))
                {
                    vcmbDelegateBranch.Text = "สาขานี้ถูกปิดแล้ว";
                    i += 1;
                }
                else
                {
                    vcmbDelegateBranch.Text = "";
                }

                if (cmbDelegateBranch.SelectedItem.Value != string.Empty && cmbDelegateLead.SelectedItem.Value == string.Empty)
                {
                    vcmbDelegateLead.Text = "กรุณาระบุ Delegate Lead";
                    i += 1;
                }
                else
                {
                    vcmbDelegateLead.Text = "";
                }
            }

            //****************************หมายเลขโทรศัพท์ 1********************************************
            decimal result1;

            if (txtTelNo_1.Text.Trim() == string.Empty)
            {
                vtxtTelNo_1.Text = "กรุณาระบุหมายเลขโทรศัพท์ 1(มือถือ)ให้ถูกต้อง";
                i += 1;
            }
            else if (txtTelNo_1.Text.Trim().Length < 9 || txtTelNo_1.Text.Trim().Length > 10)
            {
                vtxtTelNo_1.Text = "กรุณาระบุหมายเลขโทรศัพท์ 1(มือถือ)ให้ถูกต้อง";
                i += 1;
            }
            else if (txtTelNo_1.Text.Trim() != string.Empty && !decimal.TryParse(txtTelNo_1.Text.Trim(), out result1))
            {
                vtxtTelNo_1.Text = "หมายเลขโทรศัพท์ 1(มือถือ)ต้องเป็นตัวเลขเท่านั้น";
                i += 1;
            }
            else if (txtTelNo_1.Text.Trim().StartsWith("0") == false)
            {
                vtxtTelNo_1.Text = "หมายเลขโทรศัพท์ 1(มือถือ)ต้องขึ้นต้นด้วยเลข 0 เท่านั้น";
                i += 1;
            }
            else
            {
                vtxtTelNo_1.Text = "";
            }

            //****************************หมายเลขโทรศัพท์ 2********************************************
            decimal result2;

            if (txtTelNo2.Text.Trim() != string.Empty && txtTelNo2.Text.Trim().Length < 9)
            {
                vtxtTelNo2.Text = "หมายเลขโทรศัพท์ 2 ต้องมีอย่างน้อย 9 หลัก";
                i += 1;
            }
            else if (txtTelNo2.Text.Trim() != string.Empty && !decimal.TryParse(txtTelNo2.Text.Trim(), out result2))
            {
                vtxtTelNo2.Text = "หมายเลขโทรศัพท์ 2 ต้องเป็นตัวเลขเท่านั้น";
                i += 1;
            }
            else if (txtTelNo2.Text.Trim() != string.Empty && txtTelNo2.Text.Trim().StartsWith("0") == false)
            {
                vtxtTelNo2.Text = "หมายเลขโทรศัพท์ 2 ต้องขึ้นต้นด้วยเลข 0 เท่านั้น";
                i += 1;
            }
            else
            {
                vtxtTelNo2.Text = "";
            }
            //****************************หมายเลขโทรศัพท์ 3********************************************

            //****************************Ticket ID Refer********************************************
            SlmScr003Biz biz = new SlmScr003Biz();

            if (txtTicketIdRefer.Text.Trim() != string.Empty && txtslm_TicketId.Text == txtTicketIdRefer.Text.Trim())
            {
                vtxtTicketIdRefer.Text = "Ticket ID Refer ต้องไม่เท่ากับ Ticket ID";
                i += 1;
            }
            else if (SlmScr003Biz.ValidateTicketIDRefer(txtTicketIdRefer.Text.Trim()))
            {
                vtxtTicketIdRefer.Text = "ไม่พบ Ticket ID Refer ที่ระบุ";
                i += 1;
            }
            //ValidateTicketIDRefer

            return(i == 0);
        }