public Client GetClient(int clientID) { bizMessage biz = new bizMessage(); try { enGageDataContext db = new enGageDataContext(); DataLoadOptions loadOptions = new DataLoadOptions(); loadOptions.LoadWith <Client>(o => o.Contacts); loadOptions.LoadWith <Client>(o => o.Opportunities); db.LoadOptions = loadOptions; Client c; c = db.Clients.SingleOrDefault(cli => cli.ClientID == clientID); if (c == null) { this.MSGS.AddMessage(biz.GetMessageText("EmptyRecord"), Enums.enMsgType.Err); } return(c); } catch (Exception ex) { this.MSGS.AddMessage(biz.GetMessageText("Exception"), Enums.enMsgType.Err); bizLog.InsertExceptionLog(ex); return(null); } }
public List <sp_web_SharedFollowUpsResult> GetSharedFollowUps(string accountExecutiveID , int estimatedIncomeID , int businessTypeID , int flagged , string action , DateTime cutOffDate) { bizMessage biz = new bizMessage(); try { enGageDataContext db = new enGageDataContext(); List <sp_web_SharedFollowUpsResult> f = db.sp_web_SharedFollowUps(accountExecutiveID, estimatedIncomeID, businessTypeID, flagged, action, cutOffDate.ToString("yyyy-M-dd")).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 UpdateContact(Contact c) { bizMessage biz = new bizMessage(); try { enGageDataContext db = new enGageDataContext(); Contact ec = db.Contacts.Single(cli => cli.ContactID == c.ContactID); //general ec.ContactName = c.ContactName; ec.Title = c.Title; ec.Mobile = c.Mobile; ec.DirectLine = c.DirectLine; ec.Email = c.Email; // 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); } }
public bool SetPrimaryContact(int clientID, int contactID) { bizMessage biz = new bizMessage(); try { enGageDataContext db = new enGageDataContext(); Client ec = db.Clients.Single(cli => cli.ClientID == clientID); ec.PrimaryContactID = contactID; ec.ModifiedBy = bizUser.GetCurrentUserName(); ec.Modified = DateTime.Now; 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 bool SetFlag(int opportunityID, bool flag) { bizMessage biz = new bizMessage(); try { enGageDataContext db = new enGageDataContext(); Opportunity eo = db.Opportunities.Single(op => op.OpportunityID == opportunityID); eo.Flagged = flag; eo.ModifiedBy = bizUser.GetCurrentUserName(); eo.Modified = DateTime.Now; 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 Activity GetActivity(int activityID) { bizMessage biz = new bizMessage(); try { enGageDataContext db = new enGageDataContext(); DataLoadOptions loadOptions = new DataLoadOptions(); loadOptions.LoadWith <Activity>(act => act.Opportunity); loadOptions.LoadWith <Opportunity>(opp => opp.Client); db.LoadOptions = loadOptions; Activity a; a = db.Activities.SingleOrDefault(ac => ac.ActivityID == activityID); if (a == null) { this.MSGS.AddMessage(biz.GetMessageText("EmptyRecord"), Enums.enMsgType.Err); } return(a); } catch (Exception ex) { this.MSGS.AddMessage(biz.GetMessageText("Exception"), Enums.enMsgType.Err); bizLog.InsertExceptionLog(ex); return(null); } }
public bool TransferClient(int clientID, string userName) { bizMessage biz = new bizMessage(); try { enGageDataContext db = new enGageDataContext(); Client ec = db.Clients.Single(cli => cli.ClientID == clientID); ec.AccountExecutiveID = userName; ec.Modified = ec.Modified; ec.ModifiedBy = ec.ModifiedBy; ActionLog al = new ActionLog(); al.ID = clientID; al.TableName = "Client"; al.Action = "Transfer"; al.Detail = "From " + bizUser.GetCurrentUserNameWithoutDomain() + " to " + userName; al.ActionDate = DateTime.Now; al.ActionedBy = bizUser.GetCurrentUserName(); db.ActionLogs.InsertOnSubmit(al); 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 bool SetToInactive(int activityID) { bizMessage biz = new bizMessage(); try { enGageDataContext db = new enGageDataContext(); Activity ea = db.Activities.Single(act => act.ActivityID == activityID); ea.Inactive = true; ea.ModifiedBy = bizUser.GetCurrentUserName(); ea.Modified = DateTime.Now; ActionLog al = new ActionLog(); al.ID = activityID; al.TableName = "Activity"; al.Action = "Inactivate"; al.Detail = ""; al.ActionDate = DateTime.Now; al.ActionedBy = bizUser.GetCurrentUserName(); db.ActionLogs.InsertOnSubmit(al); 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 bool ValidateSuburbPostCodeStateCombination(string suburb, string postCode, string stateCode) { try { bizMessage biz = new bizMessage(); enGageDataContext db = new enGageDataContext(); AUPostCode pc = db.AUPostCodes.SingleOrDefault(pcr => pcr.Suburb == suburb && pcr.PostCode == postCode && pcr.StateCode == stateCode); if (pc == null) { this.MSGS.AddMessage(biz.GetMessageText("InvalidSuburbPostCodeState"), Enums.enMsgType.Warn); return(false); } this.MSGS.AddMessage(biz.GetMessageText("ValidSuburbPostCodeState"), Enums.enMsgType.OK); return(true); } catch (Exception ex) { bizMessage biz = new bizMessage(); this.MSGS.AddMessage(biz.GetMessageText("Exception"), Enums.enMsgType.Err); bizLog.InsertExceptionLog(ex); return(false); } }
public void FollowUpsSummary(string accountExecutiveID , ref int?followUpsCount , ref int?followUpsOverdue , ref int?submittedCount , ref decimal?submittedAmount , ref int?submittedOverdue) { bizMessage biz = new bizMessage(); try { enGageDataContext db = new enGageDataContext(); db.sp_web_FollowUpsSummary(accountExecutiveID , ref followUpsCount , ref followUpsOverdue , ref submittedCount , ref submittedAmount , ref submittedOverdue); } catch (Exception ex) { this.MSGS.AddMessage(biz.GetMessageText("Exception"), Enums.enMsgType.Err); bizLog.InsertExceptionLog(ex); } }
public List <proc_rpt_DashboardTotalsResult> GetDashboardTotalsData(DateTime reportStart, DateTime reportEnd, string region, string branch, int?businessTypeID, int?classificationID, string source, string anzsic, string opportunities) { bizMessage biz = new bizMessage(); try { if (businessTypeID == 0) { businessTypeID = null; } if (classificationID == 0) { classificationID = null; } enGageDataContext db = new enGageDataContext(); db.CommandTimeout = 240; return(db.proc_rpt_DashboardTotals(reportStart, reportEnd, region, branch, businessTypeID, classificationID, source, anzsic, opportunities).ToList()); } catch (Exception ex) { this.MSGS.AddMessage(biz.GetMessageText("Exception"), Enums.enMsgType.Err); bizLog.InsertExceptionLog(ex); return(null); } }
public void FollowUpsMatrix(string accountExecutiveID , string ActionNames , bool IsOnlyInPipeline , DateTime CutOffDate , ref int?followUpsCount , ref decimal?followUpsEstimated , ref decimal?followUpsQuoted , ref decimal?followUpsActual ) { bizMessage biz = new bizMessage(); try { enGageDataContext db = new enGageDataContext(); var dbResult = db.sp_web_FollowUpsMatrix(accountExecutiveID , ActionNames, CutOffDate.ToString("dd/MM/yyyy"), IsOnlyInPipeline).ToList(); if (dbResult != null && dbResult.Count != 0) { var record = dbResult.FirstOrDefault(); followUpsCount = record.NoOppo; followUpsEstimated = record.Estimated; followUpsQuoted = record.Quoted; followUpsActual = record.Actual; } } catch (Exception ex) { this.MSGS.AddMessage(biz.GetMessageText("Exception"), Enums.enMsgType.Err); bizLog.InsertExceptionLog(ex); } }
public bool ValidateClient(Client c) { try { bizMessage biz = new bizMessage(); if (c.ClientName == string.Empty) { this.MSGS.AddMessage("Client Name: " + biz.GetMessageText("EmptyField"), Enums.enMsgType.Err, DateTime.Now, "ClientName", typeof(TextBox)); return(false); } if (c.ClientID == 0) { if (c.AccountExecutiveID == "") { this.MSGS.AddMessage("Account Executive: " + biz.GetMessageText("ValueNotSelected"), Enums.enMsgType.Err, DateTime.Now, "AccountExecutive", typeof(DropDownList)); return(false); } } if (c.ABNACN != null) { if (c.ABNACN.Length > 20) { this.MSGS.AddMessage("ABN/ACN: " + biz.GetMessageText("ABNACN"), Enums.enMsgType.Err, DateTime.Now, "ABNACN", typeof(TextBox)); return(false); } } //if (c.PostCode != string.Empty) //{ // enGageDataContext db = new enGageDataContext(); // AUPostCode pc = db.AUPostCodes.SingleOrDefault(pcr => pcr.Suburb == c.Location && pcr.PostCode == c.PostCode && pcr.StateCode == c.StateCode); // if (pc == null) // { // this.MSGS.AddMessage(biz.GetMessageText("InvalidSuburbPostCodeState"), Enums.enMsgType.Warn); // } //} return(true); } catch (Exception ex) { bizMessage biz = new bizMessage(); this.MSGS.AddMessage(biz.GetMessageText("Exception"), Enums.enMsgType.Err); bizLog.InsertExceptionLog(ex); return(false); } }
public bool ValidateActivity(Activity a) { bizMessage biz = new bizMessage(); try { if (a.OpportunityStatusID == 0) { this.MSGS.AddMessage("Stage of Sales / Aspire Cycle: " + biz.GetMessageText("ValueNotSelected"), Enums.enMsgType.Err, DateTime.Now, "OpportunityStatus", typeof(DropDownList)); return(false); } var activityStatus = this.GetStatusByID(a.OpportunityStatusID); var txtPrefix = ""; txtPrefix = (activityStatus.Action == Enums.ActivityActions.Qualify.ToString() || activityStatus.Action == Enums.ActivityActions.Recognise.ToString()) ? "Qualify" : txtPrefix; txtPrefix = (new string[] { Enums.ActivityActions.Contact.ToString(), Enums.ActivityActions.Discover.ToString(), Enums.ActivityActions.Respond.ToString() }.Contains(activityStatus.Action)) ? "Respond" : txtPrefix; txtPrefix = (new string[] { Enums.ActivityActions.Agree.ToString(), Enums.ActivityActions.Process.ToString() }.Contains(activityStatus.Action)) ? "Complete" : txtPrefix; if (activityStatus.OutcomeType != "C") { if (a.FollowUpDate.HasValue == false) { this.MSGS.AddMessage("Follow-up Date: " + biz.GetMessageText("EmptyField"), Enums.enMsgType.Err, DateTime.Now, txtPrefix + "FollowUpDate", typeof(TextBox)); return(false); } else { if (a.FollowUpDate.Value < new DateTime(1900, 1, 1) || a.FollowUpDate.Value > new DateTime(2079, 6, 6)) { this.MSGS.AddMessage("Follow-up Date: " + biz.GetMessageText("DateOutOfRange"), Enums.enMsgType.Err, DateTime.Now, "FollowUpDate", typeof(TextBox)); return(false); } } } return(true); } catch (Exception ex) { this.MSGS.AddMessage(biz.GetMessageText("Exception"), Enums.enMsgType.Err); bizLog.InsertExceptionLog(ex); return(false); } }
public bool ValidateOpportunity(Opportunity o) { try { bizMessage biz = new bizMessage(); if (o.OpportunityName == string.Empty) { this.MSGS.AddMessage("Opportunity Name: " + biz.GetMessageText("EmptyField"), Enums.enMsgType.Err, DateTime.Now, "OpportunityName", typeof(TextBox)); return(false); } if (o.BusinessTypeID == null) { this.MSGS.AddMessage("Opportunity Type: " + biz.GetMessageText("EmptyField"), Enums.enMsgType.Err, DateTime.Now, "BusinessType", typeof(DropDownList)); return(false); } if (o.Flagged == null) { this.MSGS.AddMessage("Flagged: " + biz.GetMessageText("EmptyField"), Enums.enMsgType.Err, DateTime.Now, "Flagged", typeof(DropDownList)); return(false); } if (o.OpportunityDue.HasValue == true) { if (o.OpportunityDue.Value < new DateTime(1900, 1, 1) || o.OpportunityDue.Value > new DateTime(2079, 6, 6)) { this.MSGS.AddMessage("Renewal Date: " + biz.GetMessageText("DateOutOfRange"), Enums.enMsgType.Err, DateTime.Now, "OpportunityDue", typeof(TextBox)); return(false); } } return(true); } catch (Exception ex) { bizMessage biz = new bizMessage(); this.MSGS.AddMessage(biz.GetMessageText("Exception"), Enums.enMsgType.Err); bizLog.InsertExceptionLog(ex); return(false); } }
public int InsertOpportunity(Opportunity o) { bizMessage biz = new bizMessage(); try { enGageDataContext db = new enGageDataContext(); db.Opportunities.InsertOnSubmit(o); db.SubmitChanges(); this.MSGS.AddMessage(biz.GetMessageText("InsertSuccess"), Enums.enMsgType.OK); return(o.OpportunityID); } catch (Exception ex) { this.MSGS.AddMessage(biz.GetMessageText("Exception"), Enums.enMsgType.Err); bizLog.InsertExceptionLog(ex); return(0); } }
public int InsertClient(Client c) { bizMessage biz = new bizMessage(); try { enGageDataContext db = new enGageDataContext(); db.Clients.InsertOnSubmit(c); db.SubmitChanges(); this.MSGS.AddMessage(biz.GetMessageText("InsertSuccess"), Enums.enMsgType.OK); return(c.ClientID); } catch (Exception ex) { this.MSGS.AddMessage(biz.GetMessageText("Exception"), Enums.enMsgType.Err); bizLog.InsertExceptionLog(ex); return(0); } }
public bool ValidateContact(Contact c) { bizMessage biz = new bizMessage(); try { if (c.ContactName == string.Empty) { this.MSGS.AddMessage("Contact Name: " + biz.GetMessageText("EmptyField"), Enums.enMsgType.Err, DateTime.Now, "ContactName", typeof(TextBox)); return(false); } return(true); } catch (Exception ex) { this.MSGS.AddMessage(biz.GetMessageText("Exception"), Enums.enMsgType.Err); bizLog.InsertExceptionLog(ex); return(false); } }
public bool SetInactiveField(int clientID, bool value) { bizMessage biz = new bizMessage(); try { enGageDataContext db = new enGageDataContext(); Client ec = db.Clients.Single(cli => cli.ClientID == clientID); ec.Inactive = value; ec.ModifiedBy = bizUser.GetCurrentUserName(); ec.Modified = DateTime.Now; ActionLog al = new ActionLog(); al.ID = clientID; al.TableName = "Client"; if (value == true) { al.Action = "Inactivate"; } else { al.Action = "Activate"; } al.Detail = ""; al.ActionDate = DateTime.Now; al.ActionedBy = bizUser.GetCurrentUserName(); db.ActionLogs.InsertOnSubmit(al); 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 List <sp_engage_get_clientResult> GetClientFromBA(string clientCode) { bizMessage biz = new bizMessage(); try { dw_oampsDataContext db = new dw_oampsDataContext(); var query = db.sp_engage_get_client(clientCode); if (query == null) { this.MSGS.AddMessage(biz.GetMessageText("EmptyRecord"), Enums.enMsgType.Err); } return(query.ToList()); } catch (Exception ex) { this.MSGS.AddMessage(biz.GetMessageText("Exception"), Enums.enMsgType.Err); bizLog.InsertExceptionLog(ex); return(null); } }
public bool ValidateActivity(Activity a, bool newClient) { bizMessage biz = new bizMessage(); try { if (a.OpportunityStatusID == 0) { this.MSGS.AddMessage("Stage of Sales / Aspire Cycle: " + biz.GetMessageText("ValueNotSelected"), Enums.enMsgType.Err, DateTime.Now, "OpportunityStatus", typeof(DropDownList)); return(false); } return(true); } catch (Exception ex) { this.MSGS.AddMessage(biz.GetMessageText("Exception"), Enums.enMsgType.Err); bizLog.InsertExceptionLog(ex); return(false); } }
public List <sp_web_ListStatusesByOutcomeTypeResult> ListStatusesByOutcomeType(char outcomeType) { bizMessage biz = new bizMessage(); try { enGageDataContext db = new enGageDataContext(); var query = db.sp_web_ListStatusesByOutcomeType(outcomeType); if (query == null) { this.MSGS.AddMessage(biz.GetMessageText("EmptyRecord"), Enums.enMsgType.Err); } return(query.ToList()); } catch (Exception ex) { this.MSGS.AddMessage(biz.GetMessageText("Exception"), Enums.enMsgType.Err); bizLog.InsertExceptionLog(ex); return(null); } }
public Industry GetIndustry(string AnzsicCode) { bizMessage biz = new bizMessage(); try { enGageDataContext db = new enGageDataContext(); Industry ind = db.Industries.SingleOrDefault(i => i.AnzsicCode == AnzsicCode); if (ind == null) { this.MSGS.AddMessage(biz.GetMessageText("EmptyRecord"), Enums.enMsgType.Err); } return(ind); } catch (Exception ex) { this.MSGS.AddMessage(biz.GetMessageText("Exception"), Enums.enMsgType.Err); bizLog.InsertExceptionLog(ex); return(null); } }
public Status GetStatusByName(string statusName) { bizMessage biz = new bizMessage(); try { enGageDataContext db = new enGageDataContext(); Status s = db.Status.SingleOrDefault(st => st.StatusName == statusName); if (s == null) { this.MSGS.AddMessage(biz.GetMessageText("EmptyRecord"), Enums.enMsgType.Err); } return(s); } catch (Exception ex) { this.MSGS.AddMessage(biz.GetMessageText("Exception"), Enums.enMsgType.Err); bizLog.InsertExceptionLog(ex); return(null); } }
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 <BusinessType> ListBusinessTypes() { bizMessage biz = new bizMessage(); try { enGageDataContext db = new enGageDataContext(); var query = db.BusinessTypes.ToList(); if (query == null) { this.MSGS.AddMessage(biz.GetMessageText("EmptyRecord"), Enums.enMsgType.Err); } return(query); } catch (Exception ex) { this.MSGS.AddMessage(biz.GetMessageText("Exception"), Enums.enMsgType.Err); bizLog.InsertExceptionLog(ex); return(null); } }
public Classification GetClassification(int classificationID) { bizMessage biz = new bizMessage(); try { enGageDataContext db = new enGageDataContext(); Classification c = db.Classifications.SingleOrDefault(cl => cl.ClassificationID == classificationID); if (c == null) { this.MSGS.AddMessage(biz.GetMessageText("EmptyRecord"), Enums.enMsgType.Err); } return(c); } 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_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_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); } }