Beispiel #1
0
        private void LoadClients()
        {
            bizMessage bizM       = new bizMessage();
            bizSetting bizS       = new bizSetting();
            int        MaxRecords = int.Parse(bizS.GetSetting("FindClient.MaxRecords"));

            bizClient biz = new bizClient();

            this.ucMessanger1.ClearMessages();
            if (Request.QueryString["gr"] == "ba")
            {
                int?records = 0;
                List <sp_engage_search_clientResult> clients = biz.FindClientInBA(Request.QueryString["sc"]
                                                                                  , Request.QueryString["f1"]
                                                                                  , char.Parse(Request.QueryString["f2"])
                                                                                  , MaxRecords
                                                                                  , ref records);
                this.ucMessanger1.ProcessMessages(biz.MSGS, true);

                if (clients == null)
                {
                    return;
                }

                this.grvClientsBA.DataSource = clients;
                this.grvClientsBA.DataBind();
                this.lblResultCount.Text = clients.Count.ToString();
            }
            else
            {
                int?records = 0;
                List <sp_web_FindClientByFieldResult> clients = biz.FindClientByField(Request.QueryString["sc"]
                                                                                      , Request.QueryString["f1"]
                                                                                      , char.Parse(Request.QueryString["f2"])
                                                                                      , Request.QueryString["gr"]
                                                                                      , MaxRecords
                                                                                      , ref records);
                this.ucMessanger1.ProcessMessages(biz.MSGS, true);

                if (clients == null)
                {
                    return;
                }

                foreach (sp_web_FindClientByFieldResult c in clients)
                {
                    if (c.AccountExecutiveID != "")
                    {
                        using (Timeline.Capture("bizUser.GetAccountExecutive", "AD"))
                        {
                            var u = bizUser.GetSMIAccountExecutiveIdBOAMPSUserName(c.AccountExecutiveID);
                            bizUser.enGageUser exec = bizUser.GetAccountExecutive(u);
                            if (exec != null)
                            {
                                c.DisplayName = exec.DisplayName;
                            }
                            else
                            {
                                c.DisplayName = c.AccountExecutiveID;
                            }
                        }
                    }
                }
                this.grvClients.DataSource = clients;
                this.grvClients.DataBind();
                this.lblResultCount.Text = clients.Count.ToString();
            }

            this.lblSearch.Text      = Request.QueryString["sc"];
            this.btnBack.PostBackUrl = "FindClient.aspx?" +
                                       "sc=" + Request.QueryString["sc"] + "&" +
                                       "f1=" + Request.QueryString["f1"] + "&" +
                                       "f2=" + Request.QueryString["f2"];
        }
Beispiel #2
0
        private void LoadClientsBA()
        {
            bizMessage bizM = new bizMessage();

            //this.ucMessanger1.ClearMessages();

            if (this.txtSearchCriteria.Text == "")
            {
                this.ucMessanger1.ProcessMessage(bizM.GetMessageText("EmptyField"), Enums.enMsgType.Err, "SearchCriteria", typeof(TextBox), false);
                return;
            }

            bizSetting bizS       = new bizSetting();
            int        MaxRecords = int.Parse(bizS.GetSetting("FindClient.MaxRecords"));

            bizClient biz     = new bizClient();
            int?      records = 0;
            List <sp_engage_search_clientResult> clients = biz.FindClientInBA(this.txtSearchCriteria.Text
                                                                              , this.ddlClient.SelectedValue
                                                                              , char.Parse(this.ddlMatch.SelectedValue)
                                                                              , MaxRecords
                                                                              , ref records);

            this.ucMessanger1.ProcessMessages(biz.MSGS, false);

            if (clients == null)
            {
                return;
            }

            if (records == 0)
            {
                this.btnAdd.Visible       = true;
                this.tdHeaderBA.Visible   = false;
                this.grvClientsBA.Visible = false;
                this.tdFooterBA.Visible   = false;
                this.ucMessanger1.ProcessMessage("iBAIS: " + bizM.GetMessageText("NoClientsFound"), Enums.enMsgType.Warn, "", null, false);
            }
            if (records > 0 && records <= MaxRecords)
            {
                this.btnAdd.Visible          = true;
                this.lblResultCountBA.Text   = clients.Count.ToString();
                this.lblSearchBA.Text        = this.txtSearchCriteria.Text;
                this.tdHeaderBA.Visible      = true;
                this.grvClientsBA.DataSource = clients;
                this.grvClientsBA.DataBind();
                this.grvClientsBA.Visible = true;
                this.tdFooterBA.Visible   = true;
                this.lnkBA.Enabled        = true;
                if (clients.Count <= this.grvClientsBA.PageSize)
                {
                    this.lnkBA.Enabled = false;
                }
                if (records == MaxRecords)
                {
                    this.ucMessanger1.ProcessMessage("iBAIS: " + bizM.GetMessageText("MaxClientsReached"), Enums.enMsgType.Warn, "", null, false);
                }
            }
            if (records > MaxRecords)
            {
                this.btnAdd.Visible       = false;
                this.tdHeaderBA.Visible   = false;
                this.grvClientsBA.Visible = false;
                this.tdFooterBA.Visible   = false;
                this.ucMessanger1.ProcessMessage("iBAIS: " + bizM.GetMessageText("TooManyClientsFound"), Enums.enMsgType.Warn, "", null, false);
            }
        }