public void SendISBNAssignMail(ACS.Core.Domain.Product.ProductMaster mobj_ProductMaster) { try { ExecutiveMaster mobj_ExecutiveMaster = _ExecutiveService.GetExecutiveById(mobj_ProductMaster.EnteredBy); string mstr_body = string.Empty; using (StreamReader reader = new StreamReader(Path.Combine(System.Web.HttpContext.Current.Server.MapPath(@"~/MailHtml/ISBNAssignMail.html")))) { mstr_body = reader.ReadToEnd(); } mstr_body = mstr_body.Replace("{ExecutiveName}", mobj_ExecutiveMaster.executiveName); mstr_body = mstr_body.Replace("{ProductCode}", mobj_ProductMaster.ProductCode); mstr_body = mstr_body.Replace("{ISBN}", mobj_ProductMaster.OUPISBN); string mstrFromEmailID = _ISettingService.getValueByKey("FromEmailID"); string mstrBCCEmailID = _ISettingService.getValueByKey("BCCEmailId"); if (mstrFromEmailID != "" && mstrFromEmailID != null) { MailSend.SendMail(mstr_body, mobj_ExecutiveMaster.Emailid, mstrFromEmailID, mstrBCCEmailID); } } catch (Exception ex) { //_ILogger.Error(string.Format("Problem in Send Reply For Service", ex.Message), ex); } }
//Added by Saddam/ public IHttpActionResult insertExecutive(ExecutiveModel Executive) { string status = ""; using (TransactionScope scope = new TransactionScope()) { try { ExecutiveMaster _Executive = new ExecutiveMaster(); _Executive.executiveName = Executive.executiveName; _Executive.executivecode = Executive.executivecode; _Executive.Emailid = Executive.Emailid; _Executive.DepartmentId = Executive.DepartmentId; _Executive.Mobile = Executive.Mobile; _Executive.Phoneno = Executive.Phoneno; _Executive.DepartmentId = Executive.DepartmentId; _Executive.Password = _encryptionService.EncryptText(Executive.Password, _ExecutiveService.KeyValue("encriptionkey")); _Executive.Id = Executive.Id; _Executive.EnteredBy = Executive.EnteredBy; // status = _ExecutiveService.DuplicityCheck(_Executive); status = _ExecutiveService.DuplicityExecutiveCodeCheck(_Executive); if (status == "Y") { if (Executive.Id == 0) { int ExecutiveIdId = _ExecutiveService.InsertExecutive(_Executive); if (ExecutiveIdId != 0) { ExecutiveDivisionLink Link = new ExecutiveDivisionLink(); foreach (var item in Executive.Division) { Link.executiveid = ExecutiveIdId; Link.divisionid = item; Link.EnteredBy = Executive.EnteredBy; _ExecutiveService.InsertExecutiveDivisionLinking(Link); } } if (Executive.ReportingId != 0 && ExecutiveIdId != 0 && Executive.RoleName == "executive") { ExecutiveReporting Reporting = new ExecutiveReporting(); Reporting.executiveid = ExecutiveIdId; Reporting.reportingidto = Executive.ReportingId; Reporting.EnteredBy = Executive.EnteredBy; _ExecutiveService.InsertExecutiveReporting(Reporting); } } else { ExecutiveMaster mobj_Excutive = _ExecutiveService.GetExecutiveById(_Executive.Id); //_ExecutiveService.GetDivisionById(Executive); mobj_Excutive.executiveName = Executive.executiveName; mobj_Excutive.executivecode = Executive.executivecode; mobj_Excutive.Emailid = Executive.Emailid; mobj_Excutive.Password = _encryptionService.EncryptText(Executive.Password, _ExecutiveService.KeyValue("encriptionkey")); mobj_Excutive.Mobile = Executive.Mobile; mobj_Excutive.Phoneno = Executive.Phoneno; mobj_Excutive.DepartmentId = Executive.DepartmentId; mobj_Excutive.ModifiedBy = Executive.EnteredBy; mobj_Excutive.ModifiedDate = System.DateTime.Now; _ExecutiveService.UpdateExecutive(mobj_Excutive); ExecutiveDivisionLink Link = new ExecutiveDivisionLink(); _ExecutiveService.DeactivateExecutiveDivisionLinking(Executive.Id, Executive.EnteredBy); foreach (var item in Executive.Division) { Link.executiveid = Executive.Id; Link.divisionid = item; Link.EnteredBy = Executive.EnteredBy; _ExecutiveService.InsertExecutiveDivisionLinking(Link); } if (Executive.ReportingId != 0) { _ExecutiveService.DeavtivateExecutiveReporting(Executive.Id, Executive.EnteredBy); ExecutiveReporting Reporting = new ExecutiveReporting(); Reporting.executiveid = Executive.Id; if (Executive.RoleName == "executive") { Reporting.reportingidto = Executive.ReportingId; Reporting.EnteredBy = Executive.EnteredBy; _ExecutiveService.InsertExecutiveReporting(Reporting); } else { Reporting.EnteredBy = Executive.EnteredBy; _ExecutiveService.UpdateExecutiveReporting(Reporting); } } } //--set executive repoting to or not if (Executive.ReportingId != 0) { ExecutiveMaster mobj_Excutive = _ExecutiveService.GetExecutiveById(Executive.ReportingId); mobj_Excutive.ProcessTransferTo = Executive.ProcessTransferTo; _ExecutiveService.UpdateExecutive(mobj_Excutive); } //------------------------- status = _localizationService.GetResource("Master.API.Success.Message"); scope.Complete(); } else { status = "Duplicate"; } } catch (ACSException ex) { status = ex.InnerException.Message; } catch (Exception ex) { status = ex.InnerException.Message; } } return(Json(status)); }