public Contact GetContact(int contactID) { bizMessage biz = new bizMessage(); try { enGageDataContext db = new enGageDataContext(); Contact con = db.Contacts.SingleOrDefault(c => c.ContactID == contactID); if (con == null) { this.MSGS.AddMessage(biz.GetMessageText("EmptyRecord"), Enums.enMsgType.Err); } return(con); } catch (Exception ex) { this.MSGS.AddMessage(biz.GetMessageText("Exception"), Enums.enMsgType.Err); bizLog.InsertExceptionLog(ex); return(null); } }
public List <sp_web_ListOpportunityInactiveActivitiesResult> ListOpportunityInactiveActivites(int opportunityID) { bizMessage biz = new bizMessage(); try { enGageDataContext db = new enGageDataContext(); List <sp_web_ListOpportunityInactiveActivitiesResult> a = db.sp_web_ListOpportunityInactiveActivities(opportunityID).ToList(); if (a.Count() == 0) { this.MSGS.AddMessage(biz.GetMessageText("EmptyRecord"), Enums.enMsgType.Err); return(null); } return(a); } catch (Exception ex) { this.MSGS.AddMessage(biz.GetMessageText("Exception"), Enums.enMsgType.Err); bizLog.InsertExceptionLog(ex); return(null); } }
public List <sp_web_GetCurrentOpportunityStatusResult> GetCurrentOpportunityStatus(int opportunityID) { bizMessage biz = new bizMessage(); try { enGageDataContext db = new enGageDataContext(); List <sp_web_GetCurrentOpportunityStatusResult> s = db.sp_web_GetCurrentOpportunityStatus(opportunityID).ToList(); if (s.Count() == 0) { this.MSGS.AddMessage(biz.GetMessageText("EmptyRecord"), Enums.enMsgType.Err); return(null); } return(s); } catch (Exception ex) { this.MSGS.AddMessage(biz.GetMessageText("Exception"), Enums.enMsgType.Err); bizLog.InsertExceptionLog(ex); return(null); } }
public List <sp_web_FollowUpsResult> GetFollowUps(string accountExecutiveID , int estimatedIncomeID , int businessTypeID , int flagged , string action , string FilteredRegion , string FilteredBranch , bool IsAll ) { bizMessage biz = new bizMessage(); try { //if(String.Equals(FilteredBranch, "Melbourne Commercial and Industry", StringComparison.OrdinalIgnoreCase)){ // FilteredBranch = @"Melbourne Commercial &Industry"; //} //else if (String.Equals(FilteredBranch, "Clayton", StringComparison.OrdinalIgnoreCase)) //{ // FilteredBranch = @"Instrat"; //} enGageDataContext db = new enGageDataContext(); List <sp_web_FollowUpsResult> f = db.sp_web_FollowUps(accountExecutiveID, estimatedIncomeID, businessTypeID, flagged, action, FilteredRegion, FilteredBranch, IsAll).ToList(); if (f == null) { this.MSGS.AddMessage(biz.GetMessageText("EmptyRecord"), Enums.enMsgType.Err); } return(f); } catch (Exception ex) { this.MSGS.AddMessage(biz.GetMessageText("Exception"), Enums.enMsgType.Err); bizLog.InsertExceptionLog(ex); return(null); } }
public bool IsThisLatestActivity(int opportunityID, int activityID) { bizMessage biz = new bizMessage(); try { enGageDataContext db = new enGageDataContext(); Activity a = db.Activities.Where(act => act.OpportunityID == opportunityID && act.Inactive == false).OrderByDescending(ac => ac.Added).First(); if (a.ActivityID == activityID) { return(true); } else { return(false); } } catch (Exception ex) { this.MSGS.AddMessage(biz.GetMessageText("Exception"), Enums.enMsgType.Err); bizLog.InsertExceptionLog(ex); return(false); } }
public string GetSetting(String code) { bizMessage biz = new bizMessage(); try { enGageDataContext db = new enGageDataContext(); Setting pre = db.Settings.SingleOrDefault(p => p.SettingCode == code); if (pre == null) { return(""); } else { return(pre.SettingValue); } } catch (Exception ex) { this.MSGS.AddMessage(biz.GetMessageText("Exception"), Enums.enMsgType.Err); bizLog.InsertExceptionLog(ex); return(""); } }
public bool UpdateActivity(Activity a, Opportunity extraFieldsOppo) { bizMessage biz = new bizMessage(); try { enGageDataContext db = new enGageDataContext(); Activity ea = db.Activities.SingleOrDefault(act => act.ActivityID == a.ActivityID); //general ea.OpportunityID = a.OpportunityID; ea.OpportunityStatusID = a.OpportunityStatusID; ea.ActivityNote = a.ActivityNote; ea.FollowUpDate = a.FollowUpDate; ea.Inactive = a.Inactive; ea.ContactID = a.ContactID; // audit ea.Modified = a.Modified; ea.ModifiedBy = a.ModifiedBy; Opportunity eo = db.Opportunities.SingleOrDefault(opp => opp.OpportunityID == a.OpportunityID); switch (ea.Status.StatusName) { case "Identified": break; case "Qualified-in": if (eo.NetBrokerageEstimated != a.Opportunity.NetBrokerageEstimated) { ActionLog al = new ActionLog(); al.ID = a.ActivityID; al.TableName = "Opportunity"; al.Action = "Estimated Broking Income changed"; al.Detail = "From " + String.Format("{0:C2}", eo.NetBrokerageEstimated) + " to " + String.Format("{0:C2}", a.Opportunity.NetBrokerageEstimated); al.ActionDate = DateTime.Now; al.ActionedBy = bizUser.GetCurrentUserName(); db.ActionLogs.InsertOnSubmit(al); } eo.NetBrokerageEstimated = a.Opportunity.NetBrokerageEstimated; eo.ClassificationID = a.Opportunity.ClassificationID; break; case "Qualified-out": eo.DateCompleted = a.Opportunity.DateCompleted; break; case "Interested": if (eo.OpportunityDue != a.Opportunity.OpportunityDue) { ActionLog al = new ActionLog(); al.ID = a.ActivityID; al.TableName = "Opportunity"; al.Action = "Due date changed"; al.Detail = "From " + String.Format("{0:dd-MMM-yy}", eo.OpportunityDue) + " to " + String.Format("{0:dd-MMM-yy}", a.Opportunity.OpportunityDue); al.ActionDate = DateTime.Now; al.ActionedBy = bizUser.GetCurrentUserName(); db.ActionLogs.InsertOnSubmit(al); } eo.OpportunityDue = a.Opportunity.OpportunityDue; eo.IncumbentBroker = a.Opportunity.IncumbentBroker; eo.IncumbentInsurer = a.Opportunity.IncumbentInsurer; eo.ClassificationID = a.Opportunity.ClassificationID; break; case "Not Interested": eo.DateCompleted = a.Opportunity.DateCompleted; break; case "Go-to-Market": break; case "Revisit next year": eo.DateCompleted = a.Opportunity.DateCompleted; break; case "Quoted": if (eo.NetBrokerageQuoted != a.Opportunity.NetBrokerageQuoted) { ActionLog al = new ActionLog(); al.ID = a.ActivityID; al.TableName = "Opportunity"; al.Action = "Broking Income Quoted changed"; al.Detail = "From " + String.Format("{0:C2}", eo.NetBrokerageQuoted) + " to " + String.Format("{0:C2}", a.Opportunity.NetBrokerageQuoted); al.ActionDate = DateTime.Now; al.ActionedBy = bizUser.GetCurrentUserName(); db.ActionLogs.InsertOnSubmit(al); } eo.NetBrokerageQuoted = a.Opportunity.NetBrokerageQuoted; eo.ClassificationID = a.Opportunity.ClassificationID; break; case "Can't place": eo.DateCompleted = a.Opportunity.DateCompleted; break; case "Accepted": if (eo.NetBrokerageActual != a.Opportunity.NetBrokerageActual) { ActionLog al = new ActionLog(); al.ID = a.ActivityID; al.TableName = "Opportunity"; al.Action = "Actual Broking Income changed"; al.Detail = "From " + String.Format("{0:C2}", eo.NetBrokerageActual) + " to " + String.Format("{0:C2}", a.Opportunity.NetBrokerageActual); al.ActionDate = DateTime.Now; al.ActionedBy = bizUser.GetCurrentUserName(); db.ActionLogs.InsertOnSubmit(al); } eo.NetBrokerageActual = a.Opportunity.NetBrokerageActual; eo.ClassificationID = a.Opportunity.ClassificationID; break; case "Lost": eo.DateCompleted = a.Opportunity.DateCompleted; break; case "Processed": eo.DateCompleted = a.Opportunity.DateCompleted; if (eo.MemoNumber != a.Opportunity.MemoNumber) { ActionLog al = new ActionLog(); al.ID = a.Opportunity.OpportunityID; al.TableName = "Opportunity"; al.Action = "Memo number changed"; al.Detail = "From " + String.Format("{0:C2}", eo.MemoNumber) + " to " + String.Format("{0:C2}", a.Opportunity.MemoNumber); al.ActionDate = DateTime.Now; al.ActionedBy = bizUser.GetCurrentUserName(); db.ActionLogs.InsertOnSubmit(al); } eo.MemoNumber = a.Opportunity.MemoNumber; if (eo.Client.ClientCode != a.Opportunity.Client.ClientCode) { ActionLog al = new ActionLog(); al.ID = a.Opportunity.Client.ClientID; al.TableName = "Client"; al.Action = "Client code changed"; al.Detail = "From " + String.Format("{0:C2}", eo.Client.ClientCode) + " to " + String.Format("{0:C2}", a.Opportunity.Client.ClientCode); al.ActionDate = DateTime.Now; al.ActionedBy = bizUser.GetCurrentUserName(); db.ActionLogs.InsertOnSubmit(al); } eo.Client.ClientCode = a.Opportunity.Client.ClientCode; break; case "Can't process": eo.DateCompleted = a.Opportunity.DateCompleted; break; default: // all pending statuses break; } // save extra fields SaveExtraMissingControls(eo, extraFieldsOppo, ea.Status.StatusName); db.SubmitChanges(); this.MSGS.AddMessage(biz.GetMessageText("UpdateSuccess"), Enums.enMsgType.OK); return(true); } catch (Exception ex) { this.MSGS.AddMessage(biz.GetMessageText("Exception"), Enums.enMsgType.Err); bizLog.InsertExceptionLog(ex); return(false); } }
public int InsertActivity(Activity a, Opportunity o, Client c, Opportunity extraFieldsOppo) { bizMessage biz = new bizMessage(); try { enGageDataContext db = new enGageDataContext(); db.Activities.InsertOnSubmit(a); Opportunity eo = db.Opportunities.SingleOrDefault(opp => opp.OpportunityID == a.OpportunityID); Client ec = db.Clients.SingleOrDefault(cl => cl.ClientID == eo.ClientID); Status es = db.Status.SingleOrDefault(st => st.StatusID == a.OpportunityStatusID); switch (es.StatusName) { case "Identified": break; case "Qualified-in": eo.NetBrokerageEstimated = o.NetBrokerageEstimated; // as a special condition, the classification will always change depending on the dollar value eo.ClassificationID = o.ClassificationID; break; case "Qualified-out": eo.DateCompleted = o.DateCompleted; break; case "Interested": eo.OpportunityDue = o.OpportunityDue; eo.IncumbentBroker = o.IncumbentBroker; eo.IncumbentInsurer = o.IncumbentInsurer; eo.ClassificationID = o.ClassificationID; break; case "Not Interested": eo.DateCompleted = o.DateCompleted; break; case "Go-to-Market": break; case "Revisit next year": eo.DateCompleted = o.DateCompleted; break; case "Quoted": eo.NetBrokerageQuoted = o.NetBrokerageQuoted; eo.ClassificationID = o.ClassificationID; break; case "Can't place": eo.DateCompleted = o.DateCompleted; break; case "Accepted": eo.NetBrokerageActual = o.NetBrokerageActual; eo.ClassificationID = o.ClassificationID; break; case "Lost": eo.DateCompleted = o.DateCompleted; break; case "Processed": eo.DateCompleted = o.DateCompleted; eo.MemoNumber = o.MemoNumber; ec.ClientCode = c.ClientCode; break; case "Can't process": eo.DateCompleted = o.DateCompleted; break; default: // all pending statuses break; } // save extra fields SaveExtraMissingControls(eo, extraFieldsOppo, es.StatusName); db.SubmitChanges(); this.MSGS.AddMessage(biz.GetMessageText("InsertSuccess"), Enums.enMsgType.OK); return(a.ActivityID); } catch (Exception ex) { this.MSGS.AddMessage(biz.GetMessageText("Exception"), Enums.enMsgType.Err); bizLog.InsertExceptionLog(ex); return(0); } }
public bool UpdateOpportunity(Opportunity o) { bizMessage biz = new bizMessage(); try { enGageDataContext db = new enGageDataContext(); Opportunity eo = db.Opportunities.Single(opp => opp.OpportunityID == o.OpportunityID); if (eo.OpportunityDue != o.OpportunityDue) { ActionLog al = new ActionLog(); al.ID = o.OpportunityID; al.TableName = "Opportunity"; al.Action = "Due date changed"; al.Detail = "From " + String.Format("{0:dd-MMM-yy}", eo.OpportunityDue) + " to " + String.Format("{0:dd-MMM-yy}", o.OpportunityDue); al.ActionDate = DateTime.Now; al.ActionedBy = bizUser.GetCurrentUserName(); db.ActionLogs.InsertOnSubmit(al); } if (eo.NetBrokerageEstimated != o.NetBrokerageEstimated) { ActionLog al = new ActionLog(); al.ID = o.OpportunityID; al.TableName = "Opportunity"; al.Action = "Estimated Broking Income changed"; al.Detail = "From " + String.Format("{0:C2}", eo.NetBrokerageEstimated) + " to " + String.Format("{0:C2}", o.NetBrokerageEstimated); al.ActionDate = DateTime.Now; al.ActionedBy = bizUser.GetCurrentUserName(); db.ActionLogs.InsertOnSubmit(al); } if (eo.NetBrokerageQuoted != o.NetBrokerageQuoted) { ActionLog al = new ActionLog(); al.ID = o.OpportunityID; al.TableName = "Opportunity"; al.Action = "Broking Income Quoted changed"; al.Detail = "From " + String.Format("{0:C2}", eo.NetBrokerageQuoted) + " to " + String.Format("{0:C2}", o.NetBrokerageQuoted); al.ActionDate = DateTime.Now; al.ActionedBy = bizUser.GetCurrentUserName(); db.ActionLogs.InsertOnSubmit(al); } if (eo.NetBrokerageActual != o.NetBrokerageActual) { ActionLog al = new ActionLog(); al.ID = o.OpportunityID; al.TableName = "Opportunity"; al.Action = "Actual Broking Income changed"; al.Detail = "From " + String.Format("{0:C2}", eo.NetBrokerageActual) + " to " + String.Format("{0:C2}", o.NetBrokerageActual); al.ActionDate = DateTime.Now; al.ActionedBy = bizUser.GetCurrentUserName(); db.ActionLogs.InsertOnSubmit(al); } if (eo.MemoNumber != o.MemoNumber) { ActionLog al = new ActionLog(); al.ID = o.OpportunityID; al.TableName = "Opportunity"; al.Action = "Memo number changed"; al.Detail = "From " + String.Format("{0:C2}", eo.MemoNumber) + " to " + String.Format("{0:C2}", o.MemoNumber); al.ActionDate = DateTime.Now; al.ActionedBy = bizUser.GetCurrentUserName(); db.ActionLogs.InsertOnSubmit(al); } //general eo.OpportunityName = o.OpportunityName; eo.OpportunityDue = o.OpportunityDue; eo.Flagged = o.Flagged; eo.IncumbentBroker = o.IncumbentBroker; eo.IncumbentInsurer = o.IncumbentInsurer; eo.ClassificationID = o.ClassificationID; eo.BusinessTypeID = o.BusinessTypeID; eo.ContactID = o.ContactID; eo.NetBrokerageEstimated = o.NetBrokerageEstimated; eo.NetBrokerageQuoted = o.NetBrokerageQuoted; eo.NetBrokerageActual = o.NetBrokerageActual; eo.DateCompleted = o.DateCompleted; eo.MemoNumber = o.MemoNumber; // audit eo.Modified = o.Modified; eo.ModifiedBy = o.ModifiedBy; db.SubmitChanges(); this.MSGS.AddMessage(biz.GetMessageText("UpdateSuccess"), Enums.enMsgType.OK); return(true); } catch (Exception ex) { this.MSGS.AddMessage(biz.GetMessageText("Exception"), Enums.enMsgType.Err); bizLog.InsertExceptionLog(ex); return(false); } }
private void SetHeaderAndFooter() { bizSetting biz = new bizSetting(); this.lblVersion.Text = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(); this.lblReleased.Text = String.Format("{0:dd MMMM yyyy}", System.IO.File.GetLastWriteTime(System.Reflection.Assembly.GetExecutingAssembly().Location)); bizUser.enGageUser currentUser = (bizUser.enGageUser)Session["USER"]; var env = Cache.Get("env") as string; if (String.IsNullOrEmpty(env)) { this.Environment = biz.GetSetting("Application.Environment"); Cache.Insert("env", Environment); } if (this.Environment == "Production") { if (this.GetCurrentPageName().ToLower() == "northsydneyreport.aspx" || this.GetCurrentPageName().ToLower() == "dashboardtotals.aspx" || this.GetCurrentPageName().ToLower() == "dashboard.aspx" || this.GetCurrentPageName().ToLower() == "tallyboard.aspx" ) { this.header.Attributes["class"] = "header"; this.footer.Attributes["class"] = "footer"; } else { this.header.Attributes["class"] = "header"; this.footer.Attributes["class"] = "footer"; } // this.lblHeaderLine1.CssClass = "header-line1-alt"; // this.lblHeaderLine2.CssClass = "header-line2-alt"; this.lblHeaderLine1.Text = this.lblHeaderLine1.Text.Replace("???", "<span class='header-line1-name' runat='server'>" + currentUser.DisplayName + "</span>"); } else { this.lblEnvironment.Text = this.Environment; this.lblHeaderLine1.Text = this.lblHeaderLine1.Text.Replace("???", "<span class='header-line1-name-alt' runat='server'>" + currentUser.DisplayName + "</span>"); if (this.GetCurrentPageName().ToLower() == "northsydneyreport.aspx" || this.GetCurrentPageName().ToLower() == "dashboardtotals.aspx" || this.GetCurrentPageName().ToLower() == "dashboard.aspx" || this.GetCurrentPageName().ToLower() == "tallyboard.aspx" ) { this.header.Attributes["class"] = "header-wide-alt"; this.footer.Attributes["class"] = "footer-wide-alt"; } else { this.header.Attributes["class"] = "header-alt"; this.footer.Attributes["class"] = "footer-alt"; } this.lblHeaderLine1.CssClass = "header-line1-alt"; this.lblHeaderLine2.CssClass = "header-line2-alt"; enGageDataContext db = new enGageDataContext(); this.lblDatabase.Text = "database " + db.Connection.Database + " on " + db.Connection.DataSource + " server"; } }
public bool UpdateClient(Client c) { bizMessage biz = new bizMessage(); try { enGageDataContext db = new enGageDataContext(); Client ec = db.Clients.Single(cli => cli.ClientID == c.ClientID); // general if (ec.ClientCode != c.ClientCode) { ActionLog al = new ActionLog(); al.ID = c.ClientID; al.TableName = "Client"; al.Action = "Client code changed"; al.Detail = "From " + ec.ClientCode + " to " + c.ClientCode; al.ActionDate = DateTime.Now; al.ActionedBy = bizUser.GetCurrentUserName(); db.ActionLogs.InsertOnSubmit(al); } ec.ClientCode = c.ClientCode; if (ec.ClientName != c.ClientName) { ActionLog al = new ActionLog(); al.ID = c.ClientID; al.TableName = "Client"; al.Action = "Client name changed"; al.Detail = "From " + ec.ClientName + " to " + c.ClientName; al.ActionDate = DateTime.Now; al.ActionedBy = bizUser.GetCurrentUserName(); db.ActionLogs.InsertOnSubmit(al); } ec.ClientName = c.ClientName; ec.RegisteredName = c.RegisteredName; ec.InsuredName = c.InsuredName; ec.ABNACN = c.ABNACN; ec.Source = c.Source; ec.OfficeFacsimilie = c.OfficeFacsimilie; ec.OfficePhone = c.OfficePhone; // address ec.Address = c.Address; ec.Location = c.Location; ec.StateCode = c.StateCode; ec.PostCode = c.PostCode; // industry ec.AnzsicCode = c.AnzsicCode; ec.AssociationCode = c.AssociationCode; ec.AssociationMemberNumber = c.AssociationMemberNumber; // audit ec.Modified = c.Modified; ec.ModifiedBy = c.ModifiedBy; db.SubmitChanges(); this.MSGS.AddMessage(biz.GetMessageText("UpdateSuccess"), Enums.enMsgType.OK); return(true); } catch (Exception ex) { this.MSGS.AddMessage(biz.GetMessageText("Exception"), Enums.enMsgType.Err); bizLog.InsertExceptionLog(ex); return(false); } }