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 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 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 <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 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 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 <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 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 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 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 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 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 ValidateQuickWinOpportunity(Opportunity o) { bizMessage biz = new bizMessage(); try { 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); } } if (o.NetBrokerageQuoted == null) { this.MSGS.AddMessage("Broking Income Quoted: " + biz.GetMessageText("EmptyField"), Enums.enMsgType.Err, DateTime.Now, "NetBrokerageQuoted", typeof(TextBox)); return(false); } if (o.NetBrokerageActual == null) { this.MSGS.AddMessage("Expected OAMPS income Actual: " + biz.GetMessageText("EmptyField"), Enums.enMsgType.Err, DateTime.Now, "NetBrokerageActual", typeof(TextBox)); return(false); } return(true); } catch (Exception ex) { this.MSGS.AddMessage(biz.GetMessageText("Exception"), Enums.enMsgType.Err); bizLog.InsertExceptionLog(ex); return(false); } }
public void ShareQueueOppportunitiesWithExcutive(string shareFromExecutiveID, string shareToExecutiveID, string opportunityIDs) { bizMessage biz = new bizMessage(); try { enGageDataContext db = new enGageDataContext(); db.sp_web_ShareQueue(shareFromExecutiveID, shareToExecutiveID, opportunityIDs); } catch (Exception ex) { this.MSGS.AddMessage(biz.GetMessageText("Exception"), Enums.enMsgType.Err); bizLog.InsertExceptionLog(ex); } }
public List <sp_web_ListClientContactsResult> ListClientContacts(int clientID) { bizMessage biz = new bizMessage(); try { enGageDataContext db = new enGageDataContext(); return(db.sp_web_ListClientContacts(clientID).ToList()); } catch (Exception ex) { this.MSGS.AddMessage(biz.GetMessageText("Exception"), Enums.enMsgType.Err); bizLog.InsertExceptionLog(ex); return(null); } }
public List <proc_rpt_DashboardNorthSydneyResult> GetNorthSydneyReportData(DateTime reportStart, DateTime reportEnd, String teamLeaderName) { bizMessage biz = new bizMessage(); try { enGageDataContext db = new enGageDataContext(); return(db.proc_rpt_DashboardNorthSydney(reportStart, reportEnd, teamLeaderName).ToList()); } catch (Exception ex) { this.MSGS.AddMessage(biz.GetMessageText("Exception"), Enums.enMsgType.Err); bizLog.InsertExceptionLog(ex); return(null); } }
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 List <sp_web_FindClientByFieldResult> FindClientByField(string clientName, string clientFilter, char?matchFilter, string fieldName, int maxRecords, ref int?records) { bizMessage biz = new bizMessage(); try { enGageDataContext db = new enGageDataContext(); var query = db.sp_web_FindClientByField(clientName, clientFilter, matchFilter, fieldName, maxRecords, ref records); return(query.ToList()); } catch (Exception ex) { this.MSGS.AddMessage(biz.GetMessageText("enGageClientSearchError"), Enums.enMsgType.Err); bizLog.InsertExceptionLog(ex); return(null); } }
public int GetAddressMaxLength() { bizMessage biz = new bizMessage(); try { enGageDataContext db = new enGageDataContext(); int maxLength = db.Clients.Max(x => x.Address.Length); return(maxLength); } catch (Exception ex) { this.MSGS.AddMessage(biz.GetMessageText("Exception"), Enums.enMsgType.Err); bizLog.InsertExceptionLog(ex); return(0); } }
public List <sp_web_ListCurrentOpportunityStatusesResult> ListCurrentOpportunityStatuses(int opportunityID) { bizMessage biz = new bizMessage(); try { enGageDataContext db = new enGageDataContext(); var query = db.sp_web_ListCurrentOpportunityStatuses(opportunityID); return(query.ToList()); } catch (Exception ex) { this.MSGS.AddMessage(biz.GetMessageText("Exception"), Enums.enMsgType.Err); bizLog.InsertExceptionLog(ex); return(null); } }
public List <sp_engage_search_clientResult> FindClientInBA(string clientName, string clientFilter, char?matchFilter, int maxRecords, ref int?records) { bizMessage biz = new bizMessage(); try { dw_oampsDataContext db = new dw_oampsDataContext(); var query = db.sp_engage_search_client(clientName, clientFilter, matchFilter, maxRecords, ref records); return(query.ToList()); } catch (Exception ex) { this.MSGS.AddMessage(biz.GetMessageText("iBAISClientSearchError"), Enums.enMsgType.Err); bizLog.InsertExceptionLog(ex); return(null); } }
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 DateTime?GetCurrentFollowUpDate(int opportunityID) { bizMessage biz = new bizMessage(); try { enGageDataContext db = new enGageDataContext(); DateTime? d = null; db.sp_web_GetCurrentFollowUpDate(opportunityID, ref d); return(d); } catch (Exception ex) { this.MSGS.AddMessage(biz.GetMessageText("Exception"), Enums.enMsgType.Err); bizLog.InsertExceptionLog(ex); return(null); } }
public bool IsOpportunityCompleted(int?opportunityID) { bizMessage biz = new bizMessage(); try { enGageDataContext db = new enGageDataContext(); bool?result = false; db.sp_web_IsOpportunityCompleted(opportunityID, ref result); return((bool)result); } catch (Exception ex) { this.MSGS.AddMessage(biz.GetMessageText("Exception"), Enums.enMsgType.Err); bizLog.InsertExceptionLog(ex); return(false); } }
public List <String> ListBranches() { bizMessage biz = new bizMessage(); try { enGageDataContext db = new enGageDataContext(); var query = (from br in db.BranchRegions select br.Branch); return(query.ToList()); } catch (Exception ex) { this.MSGS.AddMessage(biz.GetMessageText("Exception"), Enums.enMsgType.Err); bizLog.InsertExceptionLog(ex); return(null); } }
//public AUPostCode GetAUPostCodeBySPS(string suburb, string postcode, string statecode) //{ // bizMessage bizMessage = new bizMessage(); // try // { // enGageDataContext db = new enGageDataContext(); // var query = from pc in db.AUPostCodes // where pc.Suburb.Equals(suburb) && pc.PostCode.Equals(postcode) && pc.StateCode.Equals(statecode) // select pc; // return query.SingleOrDefault(); // } // catch (Exception ex) // { // this.MSGS.AddMessage(bizMessage.GetMessageText("Exception"), Enums.enMsgType.Err); // bizLog.InsertExceptionLog(ex); // return null; // } //} public IList <AUPostCode> ListSuburbState(string postcode) { bizMessage bizMessage = new bizMessage(); try { enGageDataContext db = new enGageDataContext(); var query = from pc in db.AUPostCodes where pc.PostCode.Equals(postcode) select pc; return(query.ToList()); } catch (Exception ex) { this.MSGS.AddMessage(bizMessage.GetMessageText("Exception"), Enums.enMsgType.Err); bizLog.InsertExceptionLog(ex); return(null); } }
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 List <String> GetNorthSydneyTeams() { bizMessage biz = new bizMessage(); try { enGageDataContext db = new enGageDataContext(); var query = (from t in db._ibais_TeamLists orderby t.Team_Name ascending select t.TeamLeaderName).Distinct(); return(query.ToList()); } catch (Exception ex) { this.MSGS.AddMessage(biz.GetMessageText("Exception"), Enums.enMsgType.Err); bizLog.InsertExceptionLog(ex); return(null); } }
public List <String> FindOpportunities(string text) { bizMessage biz = new bizMessage(); try { enGageDataContext db = new enGageDataContext(); var query = (from c in db.Opportunities where c.OpportunityName.Contains(text) select c.OpportunityName).Distinct(); return(query.ToList()); } catch (Exception ex) { this.MSGS.AddMessage(biz.GetMessageText("Exception"), Enums.enMsgType.Err); bizLog.InsertExceptionLog(ex); return(null); } }
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); } }