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); } }
public IHttpActionResult ISBNAssign(IList <ACS.Core.Domain.Master.ISBNBag> IListISBNBag) { foreach (ACS.Core.Domain.Master.ISBNBag isbnbag in IListISBNBag) { ACS.Core.Domain.Master.ISBNBag mobj_ISBNbag = _AddendumServices.GetISBNBagById(isbnbag); if (mobj_ISBNbag.Blocked == "Y" && mobj_ISBNbag.ModifiedBy == isbnbag.EnteredBy && mobj_ISBNbag.Used == "N") { mobj_ISBNbag.ProductId = isbnbag.ProductId; mobj_ISBNbag.Used = "Y"; mobj_ISBNbag.ModifiedBy = isbnbag.EnteredBy; mobj_ISBNbag.ModifiedDate = DateTime.Now; _AddendumServices.UpdateISBNBag(mobj_ISBNbag); ACS.Core.Domain.Product.ProductMaster mobj_ProductMaster = new ACS.Core.Domain.Product.ProductMaster(); mobj_ProductMaster.Id = isbnbag.ProductId.GetValueOrDefault(); ACS.Core.Domain.Product.ProductMaster mobj_Product = _ProductMasterService.GetProductById(mobj_ProductMaster); mobj_Product.OUPISBN = mobj_ISBNbag.ISBN; mobj_Product.ModifiedBy = isbnbag.EnteredBy; mobj_Product.ModifiedDate = DateTime.Now; _ProductMasterService.UpdateProductMaster(mobj_Product); try { //Call Function to Send Mail SendISBNAssignMail(mobj_Product); } catch (ACSException ex) { _ILog.LogException("", Severity.ProcessingError, "AddendumController.cs", "ISBNAssign", ex); } catch (Exception ex) { _ILog.LogException("", Severity.ProcessingError, "AddendumController.cs", "ISBNAssign", ex); } } else { return(Json("otheruser")); } } return(Json("OK")); }
// // GET: /SeriesProductEntry/ //public ActionResult Index() //{ // return View(); //} #region InsertSeries public IHttpActionResult InsertSeries(SeriesProductEntryModel Object) { string status = "notOK"; //int Id = 0; int ProductId = 0; try { //Check Duplicate Value bool value = true; foreach (var dup in Object.testArr) { if (value == true) { // get Ilist and check if any of the value contains duplicate WorkingProduct //if (dup.WorkingProduct != "") //{ // status = _SeriesProductEntryService.DuplicateWorkingPro(dup.WorkingProduct); // if (status == "duplicate") // { // value = false; // status = "Duplicate WorkingProduct (" + dup.WorkingProduct + "). already exist !"; // break; // } //} //// get Ilist and check if any of the value contains duplicate ISBN //if (dup.OUPISBN != "") //{ // status = _SeriesProductEntryService.DuplicateISBNNo(dup.OUPISBN); // if (status == "duplicate") // { // value = false; // status = "Duplicate ISBN (" + dup.OUPISBN + "). already exist !"; // break; // } //} // get Ilist and check OrgISBN has Author Contract or not if (dup.OrgISBN != null) { IList <AuthorContractOriginal> AuthorContractList = _SeriesProductEntryService.CheckAuthorContract(dup.OrgISBN); if (AuthorContractList != null) { if (AuthorContractList.Count == 0) { value = false; status = "Author Contract Not Avaiblable for " + dup.OrgISBN + " Derivative ISBN"; break; } } } } } // value "true" means no duplicate isbn found if (value == true) { foreach (var item in Object.testArr) { //------------start Capital First Letter string product_WorkingProduct = ""; string product_WorkingSubProduct = ""; StringBuilder sb; if (item.WorkingProduct != null) { string str_WorkingProduct = item.WorkingProduct.Trim(); sb = new StringBuilder(str_WorkingProduct.Length); bool capitalize = true; foreach (char c in str_WorkingProduct) { sb.Append(capitalize ? Char.ToUpper(c) : Char.ToLower(c)); //capitalize = !Char.IsLetter(c); capitalize = Char.IsWhiteSpace(c); } product_WorkingProduct = sb.ToString().Trim(); } if (item.WorkingSubProduct != null) { string str_WorkingSubProduct = item.WorkingSubProduct.Trim(); sb = new StringBuilder(str_WorkingSubProduct.Length); bool capitalize = true; foreach (char c in str_WorkingSubProduct) { sb.Append(capitalize ? Char.ToUpper(c) : Char.ToLower(c)); //capitalize = !Char.IsLetter(c); capitalize = Char.IsWhiteSpace(c); } product_WorkingSubProduct = sb.ToString().Trim(); } //---------end Capital First Letter //if (status != "duplicate") //{ ACS.Core.Domain.Product.ProductMaster mobj_productMaster = new ACS.Core.Domain.Product.ProductMaster(); mobj_productMaster.DivisionId = item.DivisionId; mobj_productMaster.SubdivisionId = item.SubdivisionId; mobj_productMaster.ProductCategoryId = item.ProductCategoryId; mobj_productMaster.ProductTypeId = item.ProductTypeId; mobj_productMaster.SubProductTypeId = item.SubProductTypeId; mobj_productMaster.SeriesId = item.SeriesId; mobj_productMaster.OUPISBN = item.OUPISBN; mobj_productMaster.WorkingProduct = item.WorkingProduct != null ? product_WorkingProduct : item.WorkingProduct; mobj_productMaster.WorkingSubProduct = item.WorkingSubProduct != null ? product_WorkingSubProduct : item.WorkingSubProduct; mobj_productMaster.OUPEdition = item.OUPEdition; mobj_productMaster.ProjectedPublishingDate = item.ProjectPublishingDate; mobj_productMaster.CopyrightYear = item.CopyrightYear; mobj_productMaster.ImprintId = item.ImprintId; mobj_productMaster.LanguageId = item.LanguageId; mobj_productMaster.OrgISBN = item.OrgISBN; mobj_productMaster.Deactivate = "N"; mobj_productMaster.EnteredBy = item.EnteredBy; mobj_productMaster.EntryDate = DateTime.Now; mobj_productMaster.ModifiedBy = null; mobj_productMaster.ModifiedDate = null; mobj_productMaster.DeactivateBy = null; mobj_productMaster.DeactivateDate = null; //mobj_productMaster.ProductCode = item.ProductCode; mobj_productMaster.Derivatives = item.Derivatives; mobj_productMaster.ProductCode = _SeriesProductEntryService.GetProductCode(item.ProductCategoryId); mobj_productMaster.ProjectedPrice = item.ProjectedPrice; mobj_productMaster.ProjectedCurrencyId = item.ProjectedCurrencyId; mobj_productMaster.ThirdPartyPermission = item.ThirdPartyPermission; ProductId = _SeriesProductEntryService.InsertSeriesProduct(mobj_productMaster); if (ProductId != 0) { int j = 0; ProductAuthorLink mobj_ProductAuthorLink = new ProductAuthorLink(); foreach (var auth in item.AuthorObject) { if (auth != null) { mobj_ProductAuthorLink.AuthorId = auth.AuthorId; mobj_ProductAuthorLink.EnteredBy = item.EnteredBy; mobj_ProductAuthorLink.ProductId = ProductId; _SeriesProductEntryService.InsertProductAuthorLink(mobj_ProductAuthorLink); } } IList <AuthorContractOriginal> AuthorContractList = _SeriesProductEntryService.CheckAuthorContract(item.OrgISBN); if (AuthorContractList != null) { foreach (AuthorContractOriginal AuthorContract in AuthorContractList) { ProductPreviousProductLink _ProductPreviousProductLink = new ProductPreviousProductLink(); _ProductPreviousProductLink.ProductId = ProductId; _ProductPreviousProductLink.PreviousProductId = AuthorContract.ProductId; _ProductPreviousProductLink.AuthorContractId = AuthorContract.Id; _ProductPreviousProductLink.Deactivate = "N"; _ProductPreviousProductLink.EnteredBy = item.EnteredBy; _ProductPreviousProductLink.EntryDate = DateTime.Now; _ProductPreviousProductLink.ModifiedBy = null; _ProductPreviousProductLink.ModifiedDate = null; _ProductPreviousProductLink.DeactivateBy = null; _ProductPreviousProductLink.DeactivateDate = null; _SeriesProductEntryService.InsertProductPreviousProductLink(_ProductPreviousProductLink); } } } //} } status = _localizationService.GetResource("Master.API.Success.Message"); } //else //{ // status = "Duplicate"; //} } catch (ACSException ex) { status = ex.InnerException.Message; } catch (Exception ex) { status = ex.InnerException.Message; } return(Json(new { status })); }