public static void PopulateRegionsBranchesAndExecutives(bizUser.enGageUser user, DropDownList ddlRegion, DropDownList ddlBranch, DropDownList ddlExecutive, bool DisableExecutives, bool overrideDefaultRegion) { bizBranchRegion biz = new bizBranchRegion(); ddlRegion.Items.Clear(); ddlBranch.Items.Clear(); ddlExecutive.Items.Clear(); switch (user.Role) { case (int)Enums.enUserRole.Executive: ddlRegion.Items.Add(new ListItem(user.Region, user.Region)); ddlBranch.Items.Add(new ListItem(user.Branch, user.Branch)); if (DisableExecutives == false) { ddlExecutive.Items.Add(new ListItem(user.DisplayName, user.UserName)); } else { ddlExecutive.Items.Add(new ListItem("Executives (All)", "(All)")); } break; case (int)Enums.enUserRole.Branch: ddlRegion.Items.Add(new ListItem(user.Region, user.Region)); ddlBranch.Items.Add(new ListItem(user.Branch, user.Branch)); if (DisableExecutives == false) { using (Timeline.Capture("bizActiveDirectory.ListAccountExecutivesByBranchForDropDown", "AD")) { bizSetting bizS = new bizSetting(); NameValueCollection execs = bizActiveDirectory.ListAccountExecutivesByBranchForDropDown(ddlBranch.SelectedValue); if (execs == null) { return; } foreach (String exec in execs) { ddlExecutive.Items.Add(new ListItem(exec, execs[exec])); } SortDropDownList(ref ddlExecutive); } } ddlExecutive.Items.Insert(0, new ListItem("Executives (All)", "(All)")); break; case (int)Enums.enUserRole.Region: ddlRegion.Items.Add(new ListItem(user.Region, user.Region)); List <String> bs = biz.ListBranchesByRegion(ddlRegion.SelectedValue); if (bs == null) { return; } ddlBranch.Items.Add(new ListItem("Branches (All)", "(All)")); foreach (String b in bs) { ddlBranch.Items.Add(new ListItem(b, b)); } ddlExecutive.Items.Add(new ListItem("Executives (All)", "(All)")); break; case (int)Enums.enUserRole.Company: case (int)Enums.enUserRole.Administrator: List <String> rs = biz.ListRegions(); if (rs == null) { return; } ddlRegion.Items.Add(new ListItem("Regions (All)", "(All)")); foreach (String r in rs) { ddlRegion.Items.Add(new ListItem(r, r)); } ddlBranch.Items.Add(new ListItem("Branches (All)", "(All)")); ddlExecutive.Items.Add(new ListItem("Executives (All)", "(All)")); if (overrideDefaultRegion) { ddlRegion.SelectedValue = user.Region; ddlRegion.Items.RemoveAt(0); } break; } }
private void Insert() { Client c = new Client(); bizClient biz = new bizClient(); //CLIENT// //general c.Inactive = false; bizUser.enGageUser user = (bizUser.enGageUser)Session["USER"]; c.AccountExecutiveID = user.UserName; c.ClientCode = this.txtClientCode.Text; c.ClientName = this.txtClientName.Text; c.RegisteredName = this.txtRegisteredName.Text; //c.InsuredName = this.txtInsuredName.Text; if (this.txtABNACN.Text != "") { c.ABNACN = this.txtABNACN.Text; } c.Source = this.txtSource.Text; c.OfficeFacsimilie = this.txtOfficeFacsimilie.Text; c.OfficePhone = this.txtOfficePhone.Text; //address if (this.txtAddress.Text != "") { c.Address = this.txtAddress.Text; } if (this.rblAddressTypes.SelectedIndex == 0) { if (this.ucAUPSS1.PostCode != "") { c.PostCode = this.ucAUPSS1.PostCode; } if (this.ucAUPSS1.StateCode != "") { c.StateCode = this.ucAUPSS1.StateCode; } if (this.ucAUPSS1.Suburb != "") { c.Location = this.ucAUPSS1.Suburb; } } //industry if (this.lstIndustry.SelectedValue != "") { c.AnzsicCode = this.lstIndustry.SelectedValue; } if (this.ddlAssociation.SelectedValue != "") { c.AssociationCode = this.ddlAssociation.SelectedValue; } c.AssociationMemberNumber = this.txtAssociationMemberNumber.Text; //audit c.AddedBy = bizUser.GetCurrentUserName(); c.Added = DateTime.Now; //CONTACT// Contact cl = new Contact(); bizContact bizC = new bizContact(); if (this.ckbAddContact.Checked == true) { //general cl.ContactName = this.txtContactName.Text; cl.Title = this.ddlTitle.SelectedValue; cl.Mobile = this.txtMobile.Text; cl.DirectLine = this.txtDirectLine.Text; cl.Email = this.txtEmail.Text; //audit cl.AddedBy = bizUser.GetCurrentUserName(); cl.Added = DateTime.Now; } //OPPORTUNITY// Opportunity o = new Opportunity(); bizOpportunity bizO = new bizOpportunity(); //general o.OpportunityName = this.txtOpportunityName.Text; if (this.txtOpportunityDue.Text != "") { o.OpportunityDue = DateTime.Parse(this.txtOpportunityDue.Text); } o.IncumbentBroker = this.txtIncumbentBroker.Text; o.IncumbentInsurer = this.txtIncumbentInsurer.Text; if (this.ddlClassification.SelectedValue != "") { o.ClassificationID = int.Parse(this.ddlClassification.SelectedValue); } if (this.ddlBusinessType.SelectedValue != "") { o.BusinessTypeID = int.Parse(this.ddlBusinessType.SelectedValue); } if (this.ddlFlagged.SelectedValue != "") { o.Flagged = bool.Parse(this.ddlFlagged.SelectedValue); } //audit o.AddedBy = bizUser.GetCurrentUserName(); o.Added = DateTime.Now; //ACTIVITY// Activity na = new Activity(); bizActivity bizA = new bizActivity(); //general na.OpportunityStatusID = bizA.GetInitialStatus().StatusID; if (this.txtFollowUpDate.Text != "") { na.FollowUpDate = DateTime.Parse(this.txtFollowUpDate.Text); } na.Inactive = false; na.ActivityNote = ""; //audit na.AddedBy = bizUser.GetCurrentUserName(); na.Added = DateTime.Now; //action if (biz.ValidateClient(c) == false) { this.ucMessanger1.ProcessMessages(biz.MSGS, true); return; } if (this.ckbAddContact.Checked == true) { if (bizC.ValidateContact(cl) == false) { this.ucMessanger1.ProcessMessages(bizC.MSGS, true); return; } c.Contacts.Add(cl); } if (bizO.ValidateOpportunity(o) == false) { this.ucMessanger1.ProcessMessages(bizO.MSGS, true); return; } c.Opportunities.Add(o); if (bizA.ValidateActivity(na, true) == false) { this.ucMessanger1.ProcessMessages(bizA.MSGS, true); return; } o.Activities.Add(na); int oid = biz.InsertClient(c); if (oid != 0) { this.ucMessanger1.ProcessMessages(biz.MSGS, true); Response.Redirect("ViewClient.aspx?cid=" + oid.ToString(), false); } this.ucMessanger1.ProcessMessages(biz.MSGS, true); }
private void LoadDashboardReport() { this.ucMessanger1.ClearMessages(); this.ucMessanger1.UnmarkControls(); SearchOptions so = this.ucSearchOptions1.GetSearchOptions(); if (so == null) { this.pnlResults_CollapsiblePanelExtender.ClientState = "true"; this.pnlResults_CollapsiblePanelExtender.Collapsed = true; return; } bizMessage bizM = new bizMessage(); if (Session["USER"] == null) { this.ucMessanger1.ProcessMessage("Session: " + bizM.GetMessageText("SessionMissing"), Enums.enMsgType.Err, "", null, true); this.pnlResults_CollapsiblePanelExtender.ClientState = "true"; this.pnlResults_CollapsiblePanelExtender.Collapsed = true; return; } bizUser.enGageUser user = (bizUser.enGageUser)Session["USER"]; bizReport biz = new bizReport(); List <proc_rpt_DashboardResult> rs = biz.GetDashboardData( so.DateFrom, so.DateTo, so.Region, so.Branch, so.Executive, so.Classification, so.BusinessType, so.Industries, so.Sources, so.Opportunities); this.ucMessanger1.ProcessMessages(biz.MSGS, true); if (rs == null) { return; } StringBuilder sb = new StringBuilder(); rptDashboard.DataSource = rs; rptDashboard.DataBind(); //Do the sums for the other fields. Decimal sumActivitiesQuoted = 0; Decimal sumActivitiesActual = 0; Decimal sumFollowUpsQuoted = 0; Decimal sumFollowUpsActual = 0; Decimal sumPipelineQuoted = 0; Decimal sumPipelineActual = 0; Decimal sumToWinQuoted = 0; Decimal sumWonActual = 0; Decimal sumLostQuoted = 0; Decimal sumDueQuoted = 0; Decimal sumDueActual = 0; foreach (proc_rpt_DashboardResult r in rs) { sumActivitiesQuoted += r.ActivitiesQuoted != null ? (decimal)r.ActivitiesQuoted : 0; sumActivitiesActual += r.ActivitiesActual != null ? (decimal)r.ActivitiesActual : 0; sumFollowUpsQuoted += r.FollowUpsQuoted != null ? (decimal)r.FollowUpsQuoted : 0; sumFollowUpsActual += r.FollowUpsActual != null ? (decimal)r.FollowUpsActual : 0; sumPipelineQuoted += r.PipelineQuoted != null ? (decimal)r.PipelineQuoted : 0; sumPipelineActual += r.PipelineActual != null ? (decimal)r.PipelineActual : 0; sumToWinQuoted += r.ToWinQuoted != null ? (decimal)r.ToWinQuoted : 0; sumWonActual += r.WonActual != null ? (decimal)r.WonActual : 0; sumLostQuoted += r.LostQuoted != null ? (decimal)r.LostQuoted : 0; sumDueQuoted += r.DueQuoted != null ? (decimal)r.DueQuoted : 0; sumDueActual += r.DueActual != null ? (decimal)r.DueActual : 0; //sb.AppendLine(r.Action + " "+r.Activities+" "+r.ActivitiesActual+" "+r.ActivitiesQuoted+" "+r.CompleteOutcomes+" "+r.DueActual+" "+r.DueOutcomes+" "+r.DueQuoted+" "+r.FollowUps+" "+r.FollowUpsActual+" "+r.FollowUpsQuoted+" "+r.LostQuoted+" "+r.PipelineActual+" "+r.PipelineOutcomes+" "+r.PipelineQuoted+" "+r.PreviousStatusID+" "+r.SuccessOutcomes+" "+r.ToWinQuoted+" "+r.WonActual+"<br/>"); } /* * foreach(proc_rpt_DashboardResult r in rs) * { * sb.AppendLine(r.Action + " "+r.Activities+" "+r.ActivitiesActual+" "+r.ActivitiesQuoted+" "+r.CompleteOutcomes+" "+r.DueActual+" "+r.DueOutcomes+" "+r.DueQuoted+" "+r.FollowUps+" "+r.FollowUpsActual+" "+r.FollowUpsQuoted+" "+r.LostQuoted+" "+r.PipelineActual+" "+r.PipelineOutcomes+" "+r.PipelineQuoted+" "+r.PreviousStatusID+" "+r.SuccessOutcomes+" "+r.ToWinQuoted+" "+r.WonActual+"<br/>"); * } * ltrText.Text = sb.ToString(); */ /* * this.ReportViewer1.Reset(); * this.ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local; * this.ReportViewer1.LocalReport.EnableHyperlinks = true; * this.ReportViewer1.LocalReport.ReportPath = "Reports//Dashboard.rdlc"; * ReportParameter p1 = new ReportParameter("parDateFrom", so.DateFrom.ToString()); * ReportParameter p2 = new ReportParameter("parDateTo", so.DateTo.ToString()); * ReportParameter p3 = new ReportParameter("parRegion", so.Region); * ReportParameter p4 = new ReportParameter("parBranch", so.Branch); * ReportParameter p5 = new ReportParameter("parExecutive", so.Executive); * ReportParameter p6 = new ReportParameter("parClassification", so.Classification.ToString()); * ReportParameter p7 = new ReportParameter("parBusinessType", so.BusinessType.ToString()); * ReportParameter p8 = new ReportParameter("parIndustries", so.Industries == null ? "" : so.Industries); * ReportParameter p9 = new ReportParameter("parSources", so.Sources == null ? "" : so.Sources); * string ExecutiveName = this.ucSearchOptions1.GetExecutiveName(so.Executive); * string label = so.Executive != "(All)" ? ExecutiveName : so.Branch != "(All)" && so.Executive == "(All)" ? so.Region + " (" + so.Branch + ")" : so.Region != "(All)" && so.Branch == "(All)" ? so.Region : so.Region == "(All)" ? "OAMPS Insurance Brokers Ltd" : ""; * ReportParameter p10 = new ReportParameter("parReportLabel", label); * this.ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { p1, p2, p3, p4, p5, p6, p7, p8, p9, p10 }); * ReportDataSource myRDS = new ReportDataSource("proc_rpt_DashboardResult", rs); * this.ReportViewer1.LocalReport.DataSources.Clear(); * this.ReportViewer1.LocalReport.DataSources.Add(myRDS); * this.ReportViewer1.LocalReport.Refresh(); * this.ReportViewer1.Height = Unit.Point(480); * this.ReportViewer1.Visible = true; * * this.pnlResults_CollapsiblePanelExtender.ClientState = "false"; * this.pnlResults_CollapsiblePanelExtender.Collapsed = false; * */ }
public static String GetExecutives(bizUser.enGageUser user, DropDownList ddlExecutive, DropDownList ddlRegion, DropDownList ddlBranch, bool DisableExecutives) { string execs = ""; switch (user.Role) { case (int)Enums.enUserRole.Executive: execs = ddlExecutive.SelectedValue; break; case (int)Enums.enUserRole.Branch: if (ddlRegion.SelectedIndex == 0 && ddlBranch.SelectedIndex == 0 && ddlExecutive.SelectedIndex == 0) { if (DisableExecutives == true) { using (Timeline.Capture("bizActiveDirectory.ListAccountExecutivesByRegion", "AD")) { bizSetting bizS = new bizSetting(); execs = bizActiveDirectory.ListAccountExecutivesByRegion(ddlRegion.SelectedValue); } } else { execs = BuildExecsFromDropDownList(ddlExecutive); } } if (ddlRegion.SelectedIndex == 0 && ddlBranch.SelectedIndex == 0 && ddlExecutive.SelectedIndex > 0) { execs = ddlExecutive.SelectedValue; } break; case (int)Enums.enUserRole.Region: if (ddlRegion.SelectedIndex == 0 && ddlBranch.SelectedIndex == 0 && ddlExecutive.SelectedIndex == 0) { using (Timeline.Capture("bizActiveDirectory.ListAccountExecutivesByRegion", "AD")) { bizSetting bizS = new bizSetting(); execs = bizActiveDirectory.ListAccountExecutivesByRegion(ddlRegion.SelectedValue); } } if (ddlRegion.SelectedIndex == 0 && ddlBranch.SelectedIndex > 0 && ddlExecutive.SelectedIndex == 0) { using (Timeline.Capture("bizActiveDirectory.ListAccountExecutivesByBranch", "AD")) { bizSetting bizS = new bizSetting(); execs = bizActiveDirectory.ListAccountExecutivesByBranch(ddlBranch.SelectedValue); } } if (ddlRegion.SelectedIndex == 0 && ddlBranch.SelectedIndex > 0 && ddlExecutive.SelectedIndex > 0) { execs = ddlExecutive.SelectedValue; } break; case (int)Enums.enUserRole.Company: case (int)Enums.enUserRole.Administrator: if (ddlRegion.SelectedIndex == 0 && ddlBranch.SelectedIndex == 0 && ddlExecutive.SelectedIndex == 0) { execs = "(All)"; } if (ddlRegion.SelectedIndex > 0 && ddlBranch.SelectedIndex == 0 && ddlExecutive.SelectedIndex == 0) { using (Timeline.Capture("bizActiveDirectory.ListAccountExecutivesByRegion", "AD")) { bizSetting bizS = new bizSetting(); execs = bizActiveDirectory.ListAccountExecutivesByRegion(ddlRegion.SelectedValue); } } if (ddlRegion.SelectedIndex > 0 && ddlBranch.SelectedIndex > 0 && ddlExecutive.SelectedIndex == 0) { execs = BuildExecsFromDropDownList(ddlExecutive); } if (ddlRegion.SelectedIndex > 0 && ddlBranch.SelectedIndex > 0 && ddlExecutive.SelectedIndex > 0) { execs = ddlExecutive.SelectedValue; } break; } return(execs); }
private void SetHeader() { SearchOptions so = this.ucSearchOptions1.GetSearchOptions(); bizUser.enGageUser user = (bizUser.enGageUser)Session["USER"]; //First set the header according to the user's selection. switch (user.Role) { case (int)Enums.enUserRole.Executive: TallyForHeader = "Account Executive"; TotalColumn = so.Executive + " Results"; break; case (int)Enums.enUserRole.Branch: TallyForHeader = "Account Executive"; TotalColumn = so.Branch + " Results"; break; case (int)Enums.enUserRole.Region: TallyForHeader = "Branch"; TotalColumn = so.Region + " Results"; break; case (int)Enums.enUserRole.Company: TallyForHeader = "Branch (Region)"; TotalColumn = "OAMPS Insurance Brokers Ltd Results"; break; case (int)Enums.enUserRole.Administrator: TallyForHeader = "Branch (Region)"; TotalColumn = "OAMPS Insurance Brokers Ltd Results"; break; default: break; } if (so != null) { //Then set the header according to the selection. if (so.Region == "(All)" && so.Branch == "(All)" && so.Executive == "(All)") { TallyForHeader = "Branch (Region)"; TotalColumn = "OAMPS Insurance Brokers Ltd Results"; } else if (so.Branch == "(All)" && so.Executive == "(All)") { TallyForHeader = "Branch"; TotalColumn = so.Region + " Results"; } else if (so.Executive == "(All)") { TallyForHeader = "Account Executive"; TotalColumn = so.Branch + " Results"; } else { TallyForHeader = "Account Executive"; TotalColumn = so.Executive + " Results"; } } }
private void LoadClients() { bizMessage biz = new bizMessage(); this.ucMessanger1.ClearMessages(); this.txtSearchCriteria.CssClass = "control"; //this.ucMessanger1.UnmarkControls(); // todo: doesn't work this.grvClientsClientName.Visible = false; this.grvClientsAddress.Visible = false; this.grvClientsIndustry.Visible = false; if (this.txtSearchCriteria.Text == "") { this.ucMessanger1.ProcessMessage(biz.GetMessageText("EmptyField"), Enums.enMsgType.Err, "SearchCriteria", typeof(TextBox), false); return; } bizSetting bizS = new bizSetting(); int MaxRecords = int.Parse(bizS.GetSetting("FindClient.MaxRecords")); bizClient bizC = new bizClient(); int? records = 0; List <sp_web_FindClientByFieldResult> clients = bizC.FindClientByField(this.txtSearchCriteria.Text , this.ddlClient.SelectedValue , char.Parse(this.ddlMatch.SelectedValue) , null , MaxRecords , ref records); this.ucMessanger1.ProcessMessages(bizC.MSGS, true); if (clients == null) { return; } // get all users in AD var allusersResult = bizUser.GetUsersAccountExecutives(clients.Select <sp_web_FindClientByFieldResult, string>(x => x.AccountExecutiveID).Distinct().ToList()); // change all clients clients.ForEach( x => { if (x.AccountExecutiveID != "" && allusersResult.ContainsKey(x.AccountExecutiveID)) { bizUser.enGageUser exec = allusersResult[x.AccountExecutiveID]; //bizUser.GetAccountExecutive(x.AccountExecutiveID); if (exec != null) { x.DisplayName = exec.DisplayName; } else { x.DisplayName = x.AccountExecutiveID; } } } ); List <sp_web_FindClientByFieldResult> cn = clients.Where(c => c.Match == "client").ToList(); List <sp_web_FindClientByFieldResult> add = clients.Where(c => c.Match == "address").ToList(); List <sp_web_FindClientByFieldResult> ind = clients.Where(c => c.Match == "industry").ToList(); if (records == 0) { this.btnAdd.Visible = true; this.tdHeaderCN.Visible = false; this.tdFooterCN.Visible = false; this.tdHeaderAD.Visible = false; this.tdFooterAD.Visible = false; this.tdHeaderIND.Visible = false; this.tdFooterIND.Visible = false; this.ucMessanger1.ProcessMessage("enGage: " + biz.GetMessageText("NoClientsFound"), Enums.enMsgType.Warn, "", null, false); // change the new postpack url btnAdd.PostBackUrl += "?name=" + HttpUtility.UrlEncode(this.txtSearchCriteria.Text); return; } if (records > 0 && records <= MaxRecords) { this.btnAdd.Visible = true; /*foreach (sp_web_FindClientByFieldResult c in cn) * { * if (c.AccountExecutiveID != "") * { * bizUser.enGageUser exec = bizUser.GetAccountExecutive(c.AccountExecutiveID); * if (exec != null) * c.DisplayName = exec.DisplayName; * else * c.DisplayName = c.AccountExecutiveID; * } * } * foreach (sp_web_FindClientByFieldResult c in add) * { * if (c.AccountExecutiveID != "") * { * bizUser.enGageUser exec = bizUser.GetAccountExecutive(c.AccountExecutiveID); * if (exec != null) * c.DisplayName = exec.DisplayName; * else * c.DisplayName = c.AccountExecutiveID; * } * } * foreach (sp_web_FindClientByFieldResult c in ind) * { * if (c.AccountExecutiveID != "") * { * bizUser.enGageUser exec = bizUser.GetAccountExecutive(c.AccountExecutiveID); * if (exec != null) * c.DisplayName = exec.DisplayName; * else * c.DisplayName = c.AccountExecutiveID; * } * }*/ if (cn.Count == 0) { this.tdHeaderCN.Visible = false; this.grvClientsClientName.Visible = false; this.tdFooterCN.Visible = false; } else { this.lblResultCountCN.Text = cn.Count.ToString(); this.lblSearchCN.Text = this.txtSearchCriteria.Text; this.tdHeaderCN.Visible = true; this.grvClientsClientName.DataSource = cn; this.grvClientsClientName.DataBind(); this.grvClientsClientName.Visible = true; this.tdFooterCN.Visible = true; this.lnkCN.Enabled = true; if (cn.Count <= this.grvClientsClientName.PageSize) { this.lnkCN.Enabled = false; } } if (add.Count == 0) { this.tdHeaderAD.Visible = false; this.grvClientsAddress.Visible = false; this.tdFooterAD.Visible = false; } else { this.lblResultCountAD.Text = add.Count.ToString(); this.lblSearchAD.Text = this.txtSearchCriteria.Text; this.tdHeaderAD.Visible = true; this.grvClientsAddress.DataSource = add; this.grvClientsAddress.DataBind(); this.grvClientsAddress.Visible = true; this.tdFooterAD.Visible = true; this.lnkAD.Enabled = true; if (add.Count <= this.grvClientsAddress.PageSize) { this.lnkAD.Enabled = false; } } if (ind.Count == 0) { this.tdHeaderIND.Visible = false; this.grvClientsIndustry.Visible = false; this.tdFooterIND.Visible = false; } else { this.lblResultCountIND.Text = ind.Count.ToString(); this.lblSearchIND.Text = this.txtSearchCriteria.Text; this.tdHeaderIND.Visible = true; this.grvClientsIndustry.DataSource = ind; this.grvClientsIndustry.DataBind(); this.grvClientsIndustry.Visible = true; this.tdFooterIND.Visible = true; this.lnkIND.Enabled = true; if (ind.Count <= this.grvClientsIndustry.PageSize) { this.lnkIND.Enabled = false; } } if (records == MaxRecords) { this.ucMessanger1.ProcessMessage("enGage: " + biz.GetMessageText("MaxClientsReached"), Enums.enMsgType.Warn, "", null, false); } return; } if (records > MaxRecords) { this.btnAdd.Visible = false; this.tdHeaderCN.Visible = false; this.tdFooterCN.Visible = false; this.tdHeaderAD.Visible = false; this.tdFooterAD.Visible = false; this.tdHeaderIND.Visible = false; this.tdFooterIND.Visible = false; this.ucMessanger1.ProcessMessage("enGage: " + biz.GetMessageText("TooManyClientsFound"), Enums.enMsgType.Warn, "", null, false); return; } }
protected void grvClients_RowDataBound(object sender, GridViewRowEventArgs e) { try { if (e.Row.RowType == DataControlRowType.DataRow) { if (Session["USER"] == null) { return; } bizUser.enGageUser user = (bizUser.enGageUser)Session["USER"]; sp_web_FindClientByFieldResult client = (sp_web_FindClientByFieldResult)e.Row.DataItem; bizClient biz = new bizClient(); var u = bizUser.GetSMIAccountExecutiveIdBOAMPSUserName(client.AccountExecutiveID); bizUser.enGageUser exec = bizUser.GetAccountExecutive(u); //if (client.ClientName != null) //{ // if (client.ClientName.Length > 35) e.Row.Cells[2].Text = client.ClientName.Remove(33) + ".."; //} //if (client.IndustryName != null) //{ // if (client.IndustryName.Length > 35) e.Row.Cells[3].Text = client.IndustryName.Remove(33) + ".."; //} //if (e.Row.Cells[4].Text != "") //{ // if (e.Row.Cells[4].Text.Length > 15) e.Row.Cells[4].Text = e.Row.Cells[4].Text.Remove(13) + ".."; //} //if (e.Row.Cells[5].Text != "") //{ // if (e.Row.Cells[5].Text.Length > 15) e.Row.Cells[5].Text = e.Row.Cells[5].Text.Remove(13) + ".."; //} if (e.Row.Cells[5].Text != "") { e.Row.Cells[5].Text = Regex.Replace(e.Row.Cells[5].Text, this.txtSearchCriteria.Text, "<b>" + this.txtSearchCriteria.Text.ToUpper() + "</b>", RegexOptions.IgnoreCase); } if (client.Inactive == true) { e.Row.CssClass = "lightgrey"; } else { if (client.FollowUpDate < DateTime.Now) { e.Row.Cells[2].CssClass = "ochre-bold"; } } // SECURITY Image img = (Image)e.Row.FindControl("imgArrow"); switch (user.Role) { case (int)Enums.enUserRole.Executive: if (exec != null) { if (user.DisplayName != exec.DisplayName) { e.Row.CssClass = "darkgrey"; } if (user.Branch != exec.Branch) { img.ImageUrl = "~/images/ArrowHollowSmall.gif"; e.Row.Enabled = false; if (client.Inactive == true) { e.Row.CssClass = "lightgrey-italic"; } else { e.Row.CssClass = "darkgrey"; } } } else { e.Row.CssClass = "darkgrey"; img.ImageUrl = "~/images/ArrowHollowSmall.gif"; e.Row.Enabled = false; if (client.Inactive == true) { e.Row.CssClass = "lightgrey-italic"; } else { e.Row.CssClass = "darkgrey"; } } break; case (int)Enums.enUserRole.Branch: if (exec != null) { if (user.DisplayName != exec.DisplayName) { e.Row.CssClass = "darkgrey"; } if (user.Branch != exec.Branch) { img.ImageUrl = "~/images/ArrowHollowSmall.gif"; e.Row.Enabled = false; if (client.Inactive == true) { e.Row.CssClass = "lightgrey-italic"; } else { e.Row.CssClass = "darkgrey"; } } } else { e.Row.CssClass = "darkgrey"; img.ImageUrl = "~/images/ArrowHollowSmall.gif"; //e.Row.Enabled = false; if (client.Inactive == true) { e.Row.CssClass = "lightgrey-italic"; } else { e.Row.CssClass = "darkgrey"; } } break; case (int)Enums.enUserRole.Region: if (exec != null) { if (user.DisplayName != exec.DisplayName) { e.Row.CssClass = "darkgrey"; } if (user.Region != exec.Region) { img.ImageUrl = "~/images/ArrowHollowSmall.gif"; e.Row.Enabled = false; if (client.Inactive == true) { e.Row.CssClass = "lightgrey-italic"; } else { e.Row.CssClass = "darkgrey"; } } } else { e.Row.CssClass = "darkgrey"; img.ImageUrl = "~/images/ArrowHollowSmall.gif"; e.Row.Enabled = false; if (client.Inactive == true) { e.Row.CssClass = "lightgrey-italic"; } else { e.Row.CssClass = "darkgrey"; } } break; case (int)Enums.enUserRole.Company: if (exec != null) { if (user.DisplayName != exec.DisplayName) { e.Row.CssClass = "darkgrey"; } } else { e.Row.CssClass = "darkgrey"; img.ImageUrl = "~/images/ArrowHollowSmall.gif"; e.Row.Enabled = false; if (client.Inactive == true) { e.Row.CssClass = "lightgrey-italic"; } else { e.Row.CssClass = "darkgrey"; } } break; case (int)Enums.enUserRole.Administrator: // do nothing if (exec == null) { //e.Row.CssClass = "darkgrey"; img.ImageUrl = "~/images/ArrowHollowSmall.gif"; e.Row.Cells[4].Enabled = false; //if (client.Inactive == true) e.Row.CssClass = "lightgrey-italic"; //else e.Row.CssClass = "darkgrey"; } break; } e.Row.Attributes.Add("OnMouseOver", "this.style.backgroundColor = '#F4F3F0';this.style.cursor='hand';"); e.Row.Attributes.Add("OnMouseOut", "this.style.backgroundColor = 'white';"); e.Row.Attributes["onClick"] = "location.href='ViewClient.aspx?cid=" + DataBinder.Eval(e.Row.DataItem, "ClientID") + "'"; } } catch (Exception ex) { bizLog.InsertExceptionLog(ex); Response.Redirect("~/ErrorPage.aspx", false); } }
private void PopulateClientDetails() { bizMessage bizM = new bizMessage(); bizSetting bizS = new bizSetting(); bizClient biz = new bizClient(); Client c; c = biz.GetClient(Convert.ToInt32(Request.QueryString["cid"])); this.ucMessanger1.ProcessMessages(biz.MSGS, true); if (c == null) { return; } //read only this.lblClientName.Text = c.ClientName; this.lblOfficeFacsimilie.Text = c.OfficeFacsimilie; this.lblOfficePhone.Text = c.OfficePhone; if (c.Address == null) { this.lblAddress.Text = "no address"; this.lblAddress.CssClass = "page-text-nodata"; } else { this.lblAddress.Text = c.Address + ", " + c.Location + " " + c.StateCode + " " + c.PostCode; } //executive var u = bizUser.GetSMIAccountExecutiveIdBOAMPSUserName(c.AccountExecutiveID); bizUser.enGageUser exec = bizUser.GetAccountExecutive(u); ucMessanger1.ProcessMessages(biz.MSGS, false); lblAccountExecutive.Text = "<b>" + exec.DisplayName + "</b>" + ", " + exec.Branch + " (" + exec.Region + ")"; //general //this.ddlAccountExecutive.SelectedValue = c.AccountExecutiveID.ToString(); this.txtClientCode.Text = c.ClientCode; this.txtClientName.Text = c.ClientName; this.txtRegisteredName.Text = c.RegisteredName; this.txtInsuredName.Text = c.InsuredName; if (c.ABNACN != null) { this.txtABNACN.Text = c.ABNACN; } this.txtSource.Text = c.Source; this.txtOfficeFacsimilie.Text = c.OfficeFacsimilie; this.txtOfficePhone.Text = c.OfficePhone; //address this.txtAddress.Text = c.Address; if (c.Location != null) { this.ucAUPSS1.PostCode = c.PostCode; this.ucAUPSS1.SetSuburbAndStateCode(c.Location, c.StateCode); //this.ucAUPSS1.Suburb = c.Location; //this.ucAUPSS1.StateCode = c.StateCode; this.rblAddressTypes.SelectedIndex = 0; } else { this.rblAddressTypes.SelectedIndex = 1; } //industry if (c.AnzsicCode != null) { bizIndustry bizI = new bizIndustry(); Industry ind = bizI.GetIndustry(c.AnzsicCode); this.ucMessanger1.ProcessMessages(bizI.MSGS, false); this.lstIndustry.Items.Add(new ListItem(ind.IndustryName + " (" + ind.AnzsicCode + ")", ind.AnzsicCode)); this.lstIndustry.SelectedIndex = 0; if (this.lstIndustry.Items.Count > 0) { this.lstIndustry.Visible = true; } PopulateAssociations(); if (c.AssociationCode == null) { this.ddlAssociation.SelectedIndex = 0; } else { this.ddlAssociation.Items.RemoveAt(0); this.ddlAssociation.SelectedValue = c.AssociationCode; } this.txtAssociationMemberNumber.Text = c.AssociationMemberNumber; } //audit ((Main)Master).HeaderDetails = "Client added by " + bizActiveDirectory.GetUserFullName(c.AddedBy) + " (" + string.Format("{0:dd-MMM-yy}", c.Added) + ")"; if (c.Modified.HasValue == true) { ((Main)Master).HeaderDetails += " / modified by " + bizActiveDirectory.GetUserFullName(c.ModifiedBy) + " (" + string.Format("{0:dd-MMM-yy}", c.Modified.Value) + ")"; } }
private void PopulateContactDetails() { bizMessage bizM = new bizMessage(); bizSetting bizS = new bizSetting(); bizContact biz = new bizContact(); Contact c; c = biz.GetContact(Convert.ToInt32(Request.QueryString["coid"])); this.ucMessanger1.ProcessMessages(biz.MSGS, true); if (c == null) { return; } //general this.txtContactName.Text = c.ContactName; this.ddlTitle.SelectedValue = c.Title; this.txtMobile.Text = c.Mobile; this.txtDirectLine.Text = c.DirectLine; this.txtEmail.Text = c.Email; //audit ((Main)Master).HeaderDetails = "Client added by " + bizActiveDirectory.GetUserFullName(c.AddedBy) + " (" + string.Format("{0:dd-MMM-yy}", c.Added) + ")"; if (c.Modified.HasValue == true) { ((Main)Master).HeaderDetails += " / modified by " + bizActiveDirectory.GetUserFullName(c.ModifiedBy) + " (" + string.Format("{0:dd-MMM-yy}", c.Modified.Value) + ")"; } bizClient bizC = new bizClient(); Client cl = bizC.GetClient(int.Parse(Request.QueryString["cid"])); var u = bizUser.GetSMIAccountExecutiveIdBOAMPSUserName(cl.AccountExecutiveID); bizUser.enGageUser exec = bizUser.GetAccountExecutive(u); this.ucMessanger1.ProcessMessages(bizC.MSGS, false); if (Session["USER"] == null) { this.ucMessanger1.ProcessMessage("Session: " + bizM.GetMessageText("SessionMissing"), Enums.enMsgType.Err, "", null, true); return; } bizUser.enGageUser user = (bizUser.enGageUser)Session["USER"]; switch (user.Role) { case (int)Enums.enUserRole.Executive: if (user.Branch == exec.Branch) { if (user.DisplayName != exec.DisplayName) { this.btnSave.Visible = false; } } else { Response.Redirect("~/FindClient.aspx", false); return; } break; case (int)Enums.enUserRole.Branch: if (user.Branch != exec.Branch) { Response.Redirect("~/FindClient.aspx", false); return; } break; case (int)Enums.enUserRole.Region: if (user.Region == exec.Region) { this.btnSave.Visible = false; } else { Response.Redirect("~/FindClient.aspx", false); return; } break; case (int)Enums.enUserRole.Company: this.btnSave.Visible = false; break; case (int)Enums.enUserRole.Administrator: // full access break; } }