Exemplo n.º 1
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.º 2
0
        public static List <SearchLeadResult> SearchLeadData(SearchLeadCondition data, string username, string orderByFlag)
        {
            SearchLeadModel search     = new SearchLeadModel();
            string          createDate = data.CreatedDate.Year != 1 ? data.CreatedDate.Year + data.CreatedDate.ToString("-MM-dd") : string.Empty;
            string          assignDate = data.AssignedDate.Year != 1 ? data.AssignedDate.Year + data.AssignedDate.ToString("-MM-dd") : string.Empty;

            return(search.SearchLeadData(data.TicketId, data.Firstname, data.Lastname, data.CardType, data.CitizenId, data.CampaignId, data.ChannelId, data.OwnerUsername,
                                         createDate, assignDate, data.StatusList, username, data.StaffType, data.OwnerBranch, data.DelegateBranch, data.DelegateLead, data.ContractNoRefer, data.CreateByBranch, data.CreateBy, orderByFlag));
        }
Exemplo n.º 3
0
        public static bool CheckTicketIdPrivilege(string ticketId, string username, string recursiveList, string teamRecursiveList, string staffTypeId)
        {
            SearchLeadCondition condition = new SearchLeadCondition();

            condition.TicketId = ticketId;

            List <SearchLeadData> list = SearchLeadDal.SearchLeadData(condition, username, recursiveList, teamRecursiveList, staffTypeId);

            return(list.Count > 0 ? true : false);
        }
Exemplo n.º 4
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.PageSize        = SLMConstant.GridviewPageSize;
            data.SortExpression  = SortExpressionProperty;
            data.SortDirection   = SortDirectionProperty.ToString();
            data.AdvancedSearch  = txtAdvanceSearch.Text.Trim() == "Y" ? true : false;
            data.ContractNoRefer = txtContractNoRefer.Text.Trim();
            data.ScreenCode      = "SLM_SCR_003";
            //2016-12-26 --> SR:5905-123
            data.SubStatus        = txtSubStatus.Text.Trim();
            data.ChangeStatusDate = tdmChangeStatusDate.DateValue;
            //Login Staff Info
            data.StaffType       = txtStaffTypeId.Text.Trim() != "" ? (decimal?)decimal.Parse(txtStaffTypeId.Text.Trim()) : null;
            data.StaffBranchCode = txtStaffBranchCode.Text.Trim();

            return(data);
        }
Exemplo n.º 5
0
        private void SetSearchCondition(SearchLeadCondition conn)
        {
            bool dosearch = false;

            try
            {
                if (!string.IsNullOrEmpty(conn.TicketId))
                {
                    txtTicketID.Text = conn.TicketId;
                    dosearch         = true;
                }
                if (!string.IsNullOrEmpty(conn.Firstname))
                {
                    txtFirstname.Text = conn.Firstname;
                    dosearch          = true;
                }
                if (!string.IsNullOrEmpty(conn.Lastname))
                {
                    txtLastname.Text = conn.Lastname;
                    dosearch         = true;
                }
                if (!string.IsNullOrEmpty(conn.CardType))
                {
                    cmbCardType.SelectedIndex = cmbCardType.Items.IndexOf(cmbCardType.Items.FindByValue(conn.CardType));
                    dosearch = true;
                }
                if (!string.IsNullOrEmpty(conn.CitizenId))
                {
                    txtCitizenId.Text = conn.CitizenId;
                    dosearch          = true;
                }
                if (!string.IsNullOrEmpty(conn.CampaignId))
                {
                    cmbCampaign.SelectedIndex = cmbCampaign.Items.IndexOf(cmbCampaign.Items.FindByValue(conn.CampaignId));
                    //GetOwnerLead(cmbCampaign.SelectedItem.Value);
                    dosearch = true;
                }
                if (!string.IsNullOrEmpty(conn.ChannelId))
                {
                    cmbChannel.SelectedIndex = cmbChannel.Items.IndexOf(cmbChannel.Items.FindByValue(conn.ChannelId));
                    dosearch = true;
                }
                if (!string.IsNullOrEmpty(conn.ContractNoRefer))
                {
                    txtContractNoRefer.Text = conn.ContractNoRefer;
                    dosearch = true;
                }
                if (!string.IsNullOrEmpty(conn.OwnerBranch))
                {
                    cmbOwnerBranchSearch.SelectedIndex = cmbOwnerBranchSearch.Items.IndexOf(cmbOwnerBranchSearch.Items.FindByValue(conn.OwnerBranch));
                    BindOwnerLead();
                    dosearch = true;
                }
                if (!string.IsNullOrEmpty(conn.OwnerUsername))
                {
                    cmbOwnerLeadSearch.SelectedIndex = cmbOwnerLeadSearch.Items.IndexOf(cmbOwnerLeadSearch.Items.FindByValue(conn.OwnerUsername));
                    dosearch = true;
                }
                if (!string.IsNullOrEmpty(conn.DelegateBranch))
                {
                    cmbDelegateBranchSearch.SelectedIndex = cmbDelegateBranchSearch.Items.IndexOf(cmbDelegateBranchSearch.Items.FindByValue(conn.DelegateBranch));
                    BindDelegateLead();
                    dosearch = true;
                }
                if (!string.IsNullOrEmpty(conn.DelegateLead))
                {
                    cmbDelegateLeadSearch.SelectedIndex = cmbDelegateLeadSearch.Items.IndexOf(cmbDelegateLeadSearch.Items.FindByValue(conn.DelegateLead));
                    dosearch = true;
                }
                if (!string.IsNullOrEmpty(conn.CreateByBranch))
                {
                    cmbCreatebyBranchSearch.SelectedIndex = cmbCreatebyBranchSearch.Items.IndexOf(cmbCreatebyBranchSearch.Items.FindByValue(conn.CreateByBranch));
                    BindCreateByLead();
                    dosearch = true;
                }
                if (!string.IsNullOrEmpty(conn.CreateBy))
                {
                    cmbCreatebySearch.SelectedIndex = cmbCreatebySearch.Items.IndexOf(cmbCreatebySearch.Items.FindByValue(conn.CreateBy));
                    dosearch = true;
                }
                if (conn.CreatedDate.Year != 1)
                {
                    tdmCreateDate.DateValue = conn.CreatedDate;
                    dosearch = true;
                }
                if (conn.AssignedDate.Year != 1)
                {
                    tdmAssignDate.DateValue = conn.AssignedDate;
                    dosearch = true;
                }

                //2016-12-26 --> SR:5905-123
                if (conn.ChangeStatusDate.Year != 1)
                {
                    tdmChangeStatusDate.DateValue = conn.ChangeStatusDate;
                    dosearch = true;
                }
                if (!string.IsNullOrEmpty(conn.SubStatus))
                {
                    txtSubStatus.Text = conn.SubStatus;
                    dosearch          = true;
                }

                foreach (ListItem lst in cbOptionList.Items)
                {
                    lst.Selected = false;
                }

                if (!string.IsNullOrEmpty(conn.StatusList))
                {
                    string[] vals = conn.StatusList.Split(',');
                    foreach (string val in vals)
                    {
                        ListItem lst = cbOptionList.Items.FindByValue(val.Replace("'", ""));
                        if (lst != null)
                        {
                            lst.Selected = true;
                        }
                        dosearch = true;
                    }
                }

                CheckAllCondition();

                if (conn.AdvancedSearch)
                {
                    lbAdvanceSearch.Text             = "[-] <b>Advance Search</b>";
                    pnAdvanceSearch.Style["display"] = "block";
                    txtAdvanceSearch.Text            = "Y";
                }
                else
                {
                    lbAdvanceSearch.Text             = "[+] <b>Advance Search</b>";
                    pnAdvanceSearch.Style["display"] = "none";
                    txtAdvanceSearch.Text            = "N";
                }

                SortExpressionProperty = conn.SortExpression;
                SortDirectionProperty  = conn.SortDirection == SortDirection.Ascending.ToString() ? SortDirection.Ascending : SortDirection.Descending;

                if (dosearch)
                {
                    DoSearchLeadData(conn.PageIndex, SortExpressionProperty, SortDirectionProperty);
                }
            }
            catch
            {
                throw;
            }
        }
Exemplo n.º 6
0
 public static List <SearchLeadData> SearchLeadData(SearchLeadCondition data, string username, string recursiveList, string teamRecursiveList, string staffTypeId)
 {
     return(SearchLeadDal.SearchLeadData(data, username, recursiveList, teamRecursiveList, staffTypeId));
 }