public async Task <int> AddNewFollowUp(TBL_MP_CRM_ScheduleCallLogFollowUp model, int empID) { int newID = 0; try { model.CreatedBy = empID; model.CreatedDatetime = AppCommon.GetServerDateTime(); _dbContext.TBL_MP_CRM_ScheduleCallLogFollowUp.Add(model); _dbContext.SaveChanges(); int cnt = (from xx in _dbContext.TBL_MP_CRM_ScheduleCallLogFollowUp where xx.ScheduleID == model.ScheduleID select xx).Count(); model.FollowUpSequence = cnt; _dbContext.SaveChanges(); if (model.FollowUpStatus == FOLLOWUP_STATUS_CLOSE_ID) { TBL_MP_CRM_ScheduleCallLog log = _dbContext.TBL_MP_CRM_ScheduleCallLog.Where(x => x.ScheduleID == model.ScheduleID).FirstOrDefault(); log.ScheduleStatus = CALL_STATUS_CLOSE_ID; _dbContext.SaveChanges(); } newID = model.FollowUpID; this.IsScuccess = await this.SendFollowUpEmail(newID); Application.DoEvents(); } catch (Exception ex) { MessageBox.Show(ex.Message, "ServiceScheduleCallLog::AddNewFollowUp", MessageBoxButtons.OK, MessageBoxIcon.Error); } return(newID); }
public async Task <bool> UpdateFollowUp(TBL_MP_CRM_ScheduleCallLogFollowUp model, int empID) { bool result = false; try { TBL_MP_CRM_ScheduleCallLogFollowUp followup = _dbContext.TBL_MP_CRM_ScheduleCallLogFollowUp.Where(x => x.FollowUpID == model.FollowUpID).FirstOrDefault(); if (followup != null) { followup.FollowUpRemark = model.FollowUpRemark; followup.FollowUpStatus = model.FollowUpStatus; followup.NextFollowupRequired = model.NextFollowupRequired; if ((bool)followup.NextFollowupRequired) { followup.NextFollowupRequired = true; followup.NextFollowUpContactName = model.NextFollowUpContactName; followup.NextFollowUpContactNumber = model.NextFollowUpContactNumber; followup.NextFollowUpEndDatetime = model.NextFollowUpEndDatetime; followup.NextFollowUpLocation = model.NextFollowUpLocation; followup.NextFollowUpRemainder = model.NextFollowUpRemainder; followup.NextFollowUpStartDatetime = model.NextFollowUpStartDatetime; followup.NextFollowUpSubject = model.NextFollowUpSubject; } else { followup.NextFollowupRequired = false; followup.NextFollowUpContactName = ""; followup.NextFollowUpContactNumber = ""; followup.NextFollowUpEndDatetime = null; followup.NextFollowUpLocation = ""; followup.NextFollowUpRemainder = null; followup.NextFollowUpStartDatetime = null; followup.NextFollowUpSubject = ""; } } followup.ReasonClose = model.ReasonClose; followup.ModifiedBy = empID; followup.ModifiedDatetime = AppCommon.GetServerDateTime(); _dbContext.SaveChanges(); if (model.FollowUpStatus == FOLLOWUP_STATUS_CLOSE_ID) { TBL_MP_CRM_ScheduleCallLog log = _dbContext.TBL_MP_CRM_ScheduleCallLog.Where(x => x.ScheduleID == model.ScheduleID).FirstOrDefault(); log.ScheduleStatus = CALL_STATUS_CLOSE_ID; _dbContext.SaveChanges(); } result = await this.SendFollowUpEmail(model.FollowUpID); Application.DoEvents(); } catch (Exception ex) { MessageBox.Show(ex.Message, "ServiceScheduleCallLog::AddNewFollowUp", MessageBoxButtons.OK, MessageBoxIcon.Error); } return(result); }
public void PrepareForEdit() { ScheduleCallAddEditModel editModel = (new ServiceScheduleCallLog()).GetSchdeuledCallAddEditModelForSchedule(this.ScheduleID); if (editModel != null) { this.SOURCE_ENTITY = editModel.SOURCE_ENTITY; this.SOURCE_ENTITY_ID = editModel.SOURCE_ENTITY_ID; this.DB_MODEL = editModel.DB_MODEL; this.listAssignees = editModel.listAssignees; this.HeaderTitle = editModel.HeaderTitle; } }
public ScheduleCallAddEditModel GetSchdeuledCallAddEditModelForSchedule(int scheduleID) { ScheduleCallAddEditModel model = new ScheduleCallAddEditModel() { ScheduleID = scheduleID }; try { TBL_MP_CRM_ScheduleCallLog log = _dbContext.TBL_MP_CRM_ScheduleCallLog.Where(x => x.ScheduleID == model.ScheduleID).FirstOrDefault(); if (log != null) { model.SOURCE_ENTITY = (APP_ENTITIES)log.EntityType; model.SOURCE_ENTITY_ID = (int)log.EntityID; model.DB_MODEL = log; model.listAssignees = this.GelAllAssigneesForSchedule(model.ScheduleID); string strCaption = string.Empty; switch (model.SOURCE_ENTITY) { case APP_ENTITIES.SALES_LEAD: LeadMasterInfoModel leadInfo = (new ServiceSalesLead(_dbContext)).GetLeadMasterInfo(model.SOURCE_ENTITY_ID); strCaption = string.Format("LEAD: {0} {1} dt. {2}", leadInfo.LeadNo, leadInfo.LeadName, leadInfo.LeadDate.Value.ToString("dd MMM yyyy")); break; case APP_ENTITIES.SALES_ENQUIRY: TBL_MP_CRM_SalesEnquiry EnquiryInfo = (new ServiceSalesEnquiry(_dbContext)).GetEnquiryMasterDBInfo(model.SOURCE_ENTITY_ID); strCaption = string.Format("ENQURIY: {0} dt. {1}", EnquiryInfo.SalesEnquiry_No, EnquiryInfo.SalesEnquiry_Date.ToString("dd MMM yyyy")); break; case APP_ENTITIES.SALES_QUOTATION: TBL_MP_CRM_SalesQuotation QuotationInfo = (new ServiceSalesQuotation(_dbContext)).GetSalesQuotationMasterDBInfo(model.SOURCE_ENTITY_ID); strCaption = string.Format("QUOTATION: {0} dt. {1}", QuotationInfo.Quotation_No, QuotationInfo.Quotation_Date.ToString("dd MMM yyyy")); break; case APP_ENTITIES.SALES_ORDER: TBL_MP_CRM_SalesOrder OrderInfo = (new ServiceSalesOrder(_dbContext)).GetSalesOrderDBInfoByID(model.SOURCE_ENTITY_ID); strCaption = string.Format("ORDER: {0} dt. {1}", OrderInfo.SalesOrderNo, OrderInfo.SalesOrderDate.ToString("dd MMM yyyy")); break; } model.HeaderTitle = strCaption; } } catch (Exception ex) { MessageBox.Show(ex.Message, "ServiceScheduleCallLog::GetSchdeuledCallInfo", MessageBoxButtons.OK, MessageBoxIcon.Error); } return(model); }
public bool IsSchdeuleClosed(int schdeuleID) { bool result = false; try { TBL_MP_CRM_ScheduleCallLog model = _dbContext.TBL_MP_CRM_ScheduleCallLog.Where(x => x.ScheduleID == schdeuleID).FirstOrDefault(); if (model.ScheduleStatus == CALL_STATUS_CLOSE_ID) { result = true; } } catch (Exception ex) { MessageBox.Show(ex.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error); } return(result); }
public bool DeletedScheduledcallLog(int scheduledCallID, int empID) { bool result = false; try { TBL_MP_CRM_ScheduleCallLog dbScheduledCall = _dbContext.TBL_MP_CRM_ScheduleCallLog.Where(x => x.ScheduleID == scheduledCallID).FirstOrDefault(); dbScheduledCall.DeleteDateTime = AppCommon.GetServerDateTime(); dbScheduledCall.DeletedBy = empID; dbScheduledCall.IsDeleted = true; // dbScheduledCall.DeleteRemarks = reason; _dbContext.SaveChanges(); result = true; } catch (Exception ex) { MessageBox.Show(String.Format("{0}\n{1}", ex.Message, ex.InnerException.Message), "ServiceParties::DeleteParty", MessageBoxButtons.OK, MessageBoxIcon.Error); } return(result); }
public void PrepareForInsert() { DB_MODEL = new TBL_MP_CRM_ScheduleCallLog(); string strCaption = string.Empty; string strContactNames = string.Empty; string strContactNumbers = string.Empty; string strContactAddresses = string.Empty; try { switch (this.SOURCE_ENTITY) { case APP_ENTITIES.SALES_LEAD: LeadMasterInfoModel leadInfo = (new ServiceSalesLead()).GetLeadMasterInfo(this.SOURCE_ENTITY_ID); strCaption = string.Format("LEAD: {0} {1} dt. {2}", leadInfo.LeadNo, leadInfo.LeadName, leadInfo.LeadDate.Value.ToString("dd MMM yyyy")); DB_MODEL.CustomerName = leadInfo.LeadName; List <SelectContactModel> listContacts = (new ServiceSalesLead()).GetContactsForLeadID(this.SOURCE_ENTITY_ID); DB_MODEL.ContactPerson = string.Empty; foreach (SelectContactModel model in listContacts) { string[] names = model.Description1.Split('\n'); DB_MODEL.ContactPerson += names[0] + ", "; DB_MODEL.ContactNumber += model.Description2 + ", "; DB_MODEL.Location += model.Description1.Replace(names[0], ""); } DB_MODEL.ContactPerson = DB_MODEL.ContactPerson.TrimEnd(' ').TrimEnd(','); DB_MODEL.ContactNumber = DB_MODEL.ContactNumber.TrimEnd(' ').TrimEnd(','); break; case APP_ENTITIES.SALES_ENQUIRY: TBL_MP_CRM_SalesEnquiry dbEnquiry = (new ServiceSalesEnquiry()).GetEnquiryMasterDBInfo(this.SOURCE_ENTITY_ID); strCaption = string.Format("ENQUIRY: {0} {1} dt. {2}", dbEnquiry.SalesEnquiry_No, dbEnquiry.Project_Name, dbEnquiry.SalesEnquiry_Date.ToString("dd MMM yyyy")); DB_MODEL.CustomerName = dbEnquiry.Tbl_MP_Master_Party.PartyName; List <TBL_MP_CRM_SM_ContactReferences> listEnquiryContacts = (new ServiceSalesEnquiry()).GetAllCompanyContactsForSalesEnquiryDB(this.SOURCE_ENTITY_ID); strContactNames = strContactNumbers = strContactAddresses = string.Empty; foreach (TBL_MP_CRM_SM_ContactReferences refContact in listEnquiryContacts) { strContactNames += string.Format("{0}\n", refContact.Tbl_MP_Master_PartyContact_Detail.ContactPersoneName); strContactAddresses += string.Format("{0}\n\n", refContact.Tbl_MP_Master_PartyContact_Detail.Address); strContactNumbers += string.Format("Mobile: {0} {1}", refContact.Tbl_MP_Master_PartyContact_Detail.MobileNo, refContact.Tbl_MP_Master_PartyContact_Detail.AltMobileNo); strContactNumbers += string.Format("Tel: {0} {1}\n", refContact.Tbl_MP_Master_PartyContact_Detail.TelephoneNo, refContact.Tbl_MP_Master_PartyContact_Detail.AltTelephoneNo); } DB_MODEL.ContactPerson = strContactNames.TrimEnd(' ').TrimEnd(','); DB_MODEL.ContactNumber = strContactNumbers.TrimEnd(' ').TrimEnd(','); DB_MODEL.Location = strContactAddresses; break; case APP_ENTITIES.SALES_QUOTATION: TBL_MP_CRM_SalesQuotation dbQuote = (new ServiceSalesQuotation()).GetSalesQuotationMasterDBInfo(this.SOURCE_ENTITY_ID); strCaption = string.Format("ENQUIRY: {0} dt. {1}", dbQuote.Quotation_No, dbQuote.Quotation_Date.ToString("dd MMM yyyy")); DB_MODEL.CustomerName = dbQuote.Tbl_MP_Master_Party.PartyName; List <TBL_MP_CRM_SM_ContactReferences> listQuoteContacts = (new ServiceSalesQuotation()).GetAllCompanyContactsForSalesQuotationDB(this.SOURCE_ENTITY_ID); strContactNames = strContactNumbers = strContactAddresses = string.Empty; foreach (TBL_MP_CRM_SM_ContactReferences refContact in listQuoteContacts) { strContactNames += string.Format("{0}\n", refContact.Tbl_MP_Master_PartyContact_Detail.ContactPersoneName); strContactAddresses += string.Format("{0}\n\n", refContact.Tbl_MP_Master_PartyContact_Detail.Address); strContactNumbers += string.Format("Mobile: {0} {1}", refContact.Tbl_MP_Master_PartyContact_Detail.MobileNo, refContact.Tbl_MP_Master_PartyContact_Detail.AltMobileNo); strContactNumbers += string.Format("Tel: {0} {1}\n", refContact.Tbl_MP_Master_PartyContact_Detail.TelephoneNo, refContact.Tbl_MP_Master_PartyContact_Detail.AltTelephoneNo); } DB_MODEL.ContactPerson = strContactNames.TrimEnd(' ').TrimEnd(','); DB_MODEL.ContactNumber = strContactNumbers.TrimEnd(' ').TrimEnd(','); DB_MODEL.Location = strContactAddresses; break; case APP_ENTITIES.SALES_ORDER: TBL_MP_CRM_SalesOrder dbOrder = (new ServiceSalesOrder()).GetSalesOrderDBInfoByID(this.SOURCE_ENTITY_ID); strCaption = string.Format("ORDER: {0} dt. {1}", dbOrder.SalesOrderNo, dbOrder.SalesOrderDate.ToString("dd MMM yyyy")); DB_MODEL.CustomerName = dbOrder.Tbl_MP_Master_Party.PartyName; List <TBL_MP_CRM_SM_ContactReferences> listOrderContacts = (new ServiceSalesOrder()).GetAllCompanyContactsForSalesOrderDB(this.SOURCE_ENTITY_ID); strContactNames = strContactNumbers = strContactAddresses = string.Empty; foreach (TBL_MP_CRM_SM_ContactReferences refContact in listOrderContacts) { strContactNames += string.Format("{0}\n", refContact.Tbl_MP_Master_PartyContact_Detail.ContactPersoneName); strContactAddresses += string.Format("{0}\n\n", refContact.Tbl_MP_Master_PartyContact_Detail.Address); strContactNumbers += string.Format("Mobile: {0} {1}", refContact.Tbl_MP_Master_PartyContact_Detail.MobileNo, refContact.Tbl_MP_Master_PartyContact_Detail.AltMobileNo); strContactNumbers += string.Format("Tel: {0} {1}\n", refContact.Tbl_MP_Master_PartyContact_Detail.TelephoneNo, refContact.Tbl_MP_Master_PartyContact_Detail.AltTelephoneNo); } DB_MODEL.ContactPerson = strContactNames.TrimEnd(' ').TrimEnd(','); DB_MODEL.ContactNumber = strContactNumbers.TrimEnd(' ').TrimEnd(','); DB_MODEL.Location = strContactAddresses; break; } DateTime currDatetime = AppCommon.GetServerDateTime(); DB_MODEL.StartAt = currDatetime; DB_MODEL.EndsAt = currDatetime.AddDays(1); DB_MODEL.Reminder = currDatetime.AddHours(-1); HeaderTitle = strCaption; BindingList <MultiSelectListItem> allEmployees = AppCommon.ConvertToBindingList <MultiSelectListItem>((new ServiceMASTERS()).GetAllEmployeesMultiSelect()); this.listAssignees = new BindingList <MultiSelectListItem>(); MultiSelectListItem emp = allEmployees.Where(x => x.ID == currEmpID).FirstOrDefault(); if (emp != null) { this.listAssignees.Add(emp); } } catch (Exception ex) { string errMessage = ex.Message; if (ex.InnerException != null) { errMessage += string.Format("\n{0}", ex.InnerException.Message); } MessageBox.Show(errMessage, "ScheduleCallAddEditModel::PrepareForInsert", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public async Task <bool> SendFollowUpEmail(int followupID) { bool result = false; string strSubject = string.Empty; string strMessage = string.Empty; string strMailTo = string.Empty; try { TBL_MP_CRM_ScheduleCallLogFollowUp followup = _dbContext.TBL_MP_CRM_ScheduleCallLogFollowUp.Where(x => x.FollowUpID == followupID).FirstOrDefault(); if (followup == null) { MessageBox.Show("Unable to locate a valid Followup"); return(false); } TBL_MP_CRM_ScheduleCallLog schdeule = _dbContext.TBL_MP_CRM_ScheduleCallLog.Where(x => x.ScheduleID == followup.ScheduleID).FirstOrDefault(); if (schdeule == null) { MessageBox.Show("Unable to locate a valid Schedule for the selected FolowUp"); return(false); } strSubject = string.Format("FOLLOWUP- {0}", schdeule.Subject); strMessage += string.Format("REMARKS\n{0}\n", followup.FollowUpRemark); strMessage += string.Format("\nAttended By - {0}", followup.TBL_MP_Master_Employee.EmployeeName); strMessage += string.Format("\nStatus - {0}", followup.TBL_MP_Admin_UserList.Admin_UserList_Desc); if ((bool)followup.NextFollowupRequired) { strMessage += string.Format("\n\nNEXT FOLLOWUP DETAILS\n\n"); strMessage += String.Format("{0}\n", followup.NextFollowUpSubject); strMessage += String.Format("Timings: {0} - {1}\n\n", followup.NextFollowUpStartDatetime.Value.ToString("dd MMM yy hh:mmtt"), followup.NextFollowUpEndDatetime.Value.ToString("dd MMM yy hh:mmtt")); strMessage += String.Format("\nParty Name: {0}", schdeule.CustomerName.ToUpper()); strMessage += String.Format("\nContact: {0}", followup.NextFollowUpContactName.ToUpper()); strMessage += String.Format("\nPhone: {0}", followup.NextFollowUpContactNumber); strMessage += String.Format("\nLocation: {0}\n", followup.NextFollowUpLocation); } else { strMessage += string.Format("\n\nCLIENT INFO.\n"); strMessage += String.Format("\nParty Name: {0}", schdeule.CustomerName.ToUpper()); strMessage += String.Format("\nContact: {0}", schdeule.ContactPerson); strMessage += String.Format("\nPhone: {0}", schdeule.ContactNumber); strMessage += String.Format("\nLocation: {0}\n", schdeule.Location); } strMessage += String.Format("\n\nSOURCE INFO:\n"); switch ((APP_ENTITIES)schdeule.EntityType) { case APP_ENTITIES.SALES_LEAD: TBL_MP_CRM_SM_SalesLead lead = _dbContext.TBL_MP_CRM_SM_SalesLead.Where(x => x.PK_SalesLeadID == schdeule.EntityID).FirstOrDefault(); if (lead != null) { strMessage += String.Format("\nLead: {0} dt. {1}\n", lead.LeadNo, lead.LeadDate.ToString("dd MMM yyyy")); strMessage += String.Format("\n{0}\n", lead.LeadRequirement); } break; } List <TBL_MP_CRM_ScheduleCallLogAssignee> lstAssignees = _dbContext.TBL_MP_CRM_ScheduleCallLogAssignee.Where(x => x.ScheduleID == schdeule.ScheduleID).Where(x => x.IsDeleted == false).ToList(); foreach (TBL_MP_CRM_ScheduleCallLogAssignee ass in lstAssignees) { strMailTo += ass.TBL_MP_Master_Employee.EmailAddress + ";"; } string strMailFrom = ServiceEmployee.GetEmployeeEmailByID((int)followup.CreatedBy); ServiceEmail mail = new ServiceEmail(); await mail.SendEmail((int)followup.CreatedBy, strMailFrom, strMailTo, strSubject, strMessage); result = true; } catch (Exception ex) { MessageBox.Show(ex.Message, "ServiceScheduleCallLog::SendFollowUpEmail", MessageBoxButtons.OK, MessageBoxIcon.Error); } return(result); }
public async Task <bool> UpdateScheduleCall(ScheduleCallAddEditModel model, int empID) { try { progressForm = new frmProgress(); progressForm.Text = "UPDAING SCHEDULE CALL ID: " + model.ScheduleID; progressForm.lblProgressText.Text = "Updating Business Schecule Call Master Info"; progressForm.Show(); Application.DoEvents(); int statusClose = _dbContext.APP_DEFAULTS.Where(x => x.ID == (int)APP_DEFAULT_VALUES.ScheduleCallStatusClose).FirstOrDefault().DEFAULT_VALUE; if (model.DB_MODEL.ScheduleStatus == statusClose) { model.DB_MODEL.Completed = true; } model.DB_MODEL.EntityType = (int)model.SOURCE_ENTITY; model.DB_MODEL.EntityID = (int)model.SOURCE_ENTITY_ID; model.DB_MODEL.ModifiedBy = empID; model.DB_MODEL.ModifiedDatetime = AppCommon.GetServerDateTime(); model.DB_MODEL.Reminder = model.DB_MODEL.Reminder; TBL_MP_CRM_ScheduleCallLog dbModel = _dbContext.TBL_MP_CRM_ScheduleCallLog.Where(x => x.ScheduleID == model.ScheduleID).FirstOrDefault(); if (dbModel != null) { dbModel.Subject = model.DB_MODEL.Subject; dbModel.Priority = model.DB_MODEL.Priority; dbModel.ActionID = model.DB_MODEL.ActionID; dbModel.ScheduleStatus = model.DB_MODEL.ScheduleStatus; dbModel.Completed = model.DB_MODEL.Completed; dbModel.ContactNumber = model.DB_MODEL.ContactNumber; dbModel.ContactPerson = model.DB_MODEL.ContactPerson; dbModel.CustomerName = model.DB_MODEL.CustomerName; dbModel.EndsAt = model.DB_MODEL.EndsAt; dbModel.StartAt = model.DB_MODEL.StartAt; dbModel.Reminder = model.DB_MODEL.Reminder; dbModel.EntityID = model.DB_MODEL.EntityID; dbModel.EntityType = model.DB_MODEL.EntityType; dbModel.ModifiedBy = empID; dbModel.ModifiedDatetime = AppCommon.GetServerDateTime(); dbModel.Remarks = model.DB_MODEL.Remarks; _dbContext.SaveChanges(); } progressForm.SetProgress(25, string.Format("\nSuccess: Updated Schedule Call Information into the Database")); Application.DoEvents(); progressForm.SetProgress(30, string.Format("\nSuccess ID: \n\nUpdating Assignees for this schedule in Database.")); Application.DoEvents(); string mailTo = string.Empty; // MARK ALL ASSIGNEES AS DELETED List <TBL_MP_CRM_ScheduleCallLogAssignee> dbAssignees = _dbContext.TBL_MP_CRM_ScheduleCallLogAssignee.Where(x => x.ScheduleID == model.ScheduleID).ToList(); foreach (TBL_MP_CRM_ScheduleCallLogAssignee item in dbAssignees) { item.IsDeleted = true; } _dbContext.SaveChanges(); // OF EMPLOYEE FOUND SET DELETED=FALSE OR INSERT IF NOT FOUND foreach (MultiSelectListItem item in model.listAssignees) { TBL_MP_CRM_ScheduleCallLogAssignee emp = _dbContext.TBL_MP_CRM_ScheduleCallLogAssignee.Where(x => x.ScheduleID == model.ScheduleID).Where(x => x.EmployeeID == item.ID).FirstOrDefault(); if (emp != null) { emp.IsDeleted = false; } else { _dbContext.TBL_MP_CRM_ScheduleCallLogAssignee.Add(new TBL_MP_CRM_ScheduleCallLogAssignee() { EmployeeID = item.ID, IsDeleted = false, ScheduleID = model.ScheduleID }); } _dbContext.SaveChanges(); mailTo += ServiceEmployee.GetEmployeeEmailByID(item.ID) + ";"; } mailTo += "*****@*****.**"; progressForm.SetProgress(60, string.Format("\nSuccess: {0} Assignee(s) updated in Database for Schdeule #{1}", model.listAssignees.Count, model.ScheduleID)); progressForm.SetProgress(60, string.Format("\n\n\nSending Email to {0}", mailTo.Replace(";", "; "))); Application.DoEvents(); List <SelectListItem> scheduleStatusList = (new ServiceMASTERS()).GetAllScheduleCallsStatus(); ServiceEmail mail = new ServiceEmail(); string strSubject = string.Format("Updated Schedule Call: {0}", model.DB_MODEL.Subject); string strMessage = string.Empty; strMessage += string.Format("{0}\nStatus: {1}", model.DB_MODEL.Subject.ToUpper(), scheduleStatusList.Where(x => x.ID == model.DB_MODEL.ScheduleStatus).FirstOrDefault().Description); strMessage += string.Format("\nRemarks:{0}\n", model.DB_MODEL.Remarks); strMessage += string.Format("\nParty : {0}", model.DB_MODEL.CustomerName); strMessage += string.Format("\nContact Person(s) : {0}", model.DB_MODEL.ContactPerson); strMessage += string.Format("\nContact Number(s) : {0}", model.DB_MODEL.ContactNumber); strMessage += string.Format("\nLocation : {0}", model.DB_MODEL.Location); strMessage += string.Format("\n\nStarts At : {0}", model.DB_MODEL.StartAt.Value.ToString("dd MMMyy hh:mmtt")); strMessage += string.Format("\nEnds At : {0}", model.DB_MODEL.StartAt.Value.ToString("dd MMMyyy hh:mmtt")); switch (model.SOURCE_ENTITY) { case APP_ENTITIES.SALES_LEAD: LeadMasterInfoModel lead = (new ServiceSalesLead(_dbContext)).GetLeadMasterInfo(model.SOURCE_ENTITY_ID); if (lead != null) { strMessage += String.Format("\n\n\nSOURCE INFO.\nLead: {0} dt. {1}\n{2}", lead.LeadNo, lead.LeadDate.Value.ToString("dd MMMyy"), lead.LeadRequirement); } break; } string strEmailAddress = ServiceEmployee.GetEmployeeEmailByID(empID); await mail.SendScheduleCallCreatedEmailNotification(empID, strEmailAddress, mailTo, strSubject, strMessage); Application.DoEvents(); progressForm.Close(); this.IsScuccess = true; } catch (Exception ex) { MessageBox.Show(ex.Message, "ServiceScheduleCallLog::UpdateScheduleCall", MessageBoxButtons.OK, MessageBoxIcon.Error); } return(IsScuccess); }