public async Task <string> SendQuotation(QuotationsViewModel quotationsObj) { if (ModelState.IsValid) { bool sendsuccess; try { quotationsObj.logDetails = new LogDetailsViewModel(); quotationsObj.logDetails.CreatedBy = _commonBusiness.GetUA().UserName; quotationsObj.logDetails.CreatedDate = _commonBusiness.GetCurrentDateTime(); sendsuccess = await _quotationsBusiness.QuotationEmail(Mapper.Map <QuotationsViewModel, Quotations>(quotationsObj)); } catch (Exception ex) { return(JsonConvert.SerializeObject(new { Result = "ERROR", Message = ex.Message })); } if (sendsuccess) { return(JsonConvert.SerializeObject(new { Result = "OK", Message = constObj.EmailSuccess })); } else { return(JsonConvert.SerializeObject(new { Result = "Error", Message = constObj.EmailFail })); } } return(JsonConvert.SerializeObject(new { Result = "ERROR", Message = "Please Check the values" })); }
public string UpdateQuotations(QuotationsViewModel quotationObj) { if (ModelState.IsValid) { OperationsStatusViewModel OperationsStatusViewModelObj = null; try { quotationObj.logDetails = new LogDetailsViewModel(); quotationObj.logDetails.UpdatedBy = _commonBusiness.GetUA().UserName; quotationObj.logDetails.UpdatedDate = _commonBusiness.GetCurrentDateTime(); OperationsStatusViewModelObj = Mapper.Map <OperationsStatus, OperationsStatusViewModel>(_quotationsBusiness.UpdateQuotations(Mapper.Map <QuotationsViewModel, Quotations>(quotationObj))); } catch (Exception ex) { return(JsonConvert.SerializeObject(new { Result = "ERROR", Message = ex.Message })); } if (OperationsStatusViewModelObj.StatusCode == 1) { return(JsonConvert.SerializeObject(new { Result = "OK", Record = OperationsStatusViewModelObj })); } else { return(JsonConvert.SerializeObject(new { Result = "Error", Record = OperationsStatusViewModelObj })); } } return(JsonConvert.SerializeObject(new { Result = "ERROR", Message = "Please Check the values" })); }
public string GetQuotations(string id) { try { QuotationsViewModel quotation = Mapper.Map <Quotations, QuotationsViewModel>(_quotationsBusiness.GetQuotations(Int32.Parse(id))); return(JsonConvert.SerializeObject(new { Result = "OK", Records = quotation })); } catch (Exception ex) { return(JsonConvert.SerializeObject(new { Result = "ERROR", Message = ex.Message })); } }
public string GetQuotationsDetails(string id) { try { List <QuotationsViewModel> quotationdetailslist = null; QuotationsViewModel quotation = Mapper.Map <Quotations, QuotationsViewModel>(_quotationsBusiness.GetQuotations(Int32.Parse(id))); quotationdetailslist = new List <QuotationsViewModel>(); quotationdetailslist.Add(quotation); return(JsonConvert.SerializeObject(new { Result = "OK", Records = quotationdetailslist })); } catch (Exception ex) { return(JsonConvert.SerializeObject(new { Result = "ERROR", Message = ex.Message })); } }
public string InsertEventsLog(QuotationsViewModel quotationObj) { if (ModelState.IsValid) { OperationsStatusViewModel OperationsStatusViewModelObj = null; bool Mailstatus = false; try { quotationObj.EventsLogViewObj.commonObj = new LogDetailsViewModel(); quotationObj.EventsLogViewObj.commonObj.CreatedBy = _commonBusiness.GetUA().UserName; quotationObj.EventsLogViewObj.commonObj.CreatedDate = _commonBusiness.GetCurrentDateTime(); if (quotationObj.mailViewModelObj.CustomerEmail != "" && quotationObj.EventsLogViewObj.CustomerNotifiedYN == true) { quotationObj.mailViewModelObj.OrderNo = quotationObj.EventsLogViewObj.ParentID; quotationObj.mailViewModelObj.OrderComment = quotationObj.EventsLogViewObj.Comment; Mail _mail = new Mail(); using (StreamReader reader = new StreamReader(HttpContext.Server.MapPath("~/PartyEcTemplates/Notifications.html"))) { _mail.Body = reader.ReadToEnd(); } _mail.Body = _mail.Body.Replace("{CustomerName}", quotationObj.mailViewModelObj.CustomerName); _mail.Body = _mail.Body.Replace("{Message}", quotationObj.EventsLogViewObj.Comment); _mail.IsBodyHtml = true; _mail.Subject = "Quotation No:" + quotationObj.QuotationNo; _mail.To = quotationObj.mailViewModelObj.CustomerEmail; Mailstatus = _mailBusiness.SendMail(_mail); quotationObj.EventsLogViewObj.CustomerNotifiedYN = Mailstatus; } OperationsStatusViewModelObj = Mapper.Map <OperationsStatus, OperationsStatusViewModel>(_masterBusiness.InsertEventsLog(Mapper.Map <EventsLogViewModel, EventsLog>(quotationObj.EventsLogViewObj))); } catch (Exception ex) { return(JsonConvert.SerializeObject(new { Result = "ERROR", Message = ex.Message })); } if (OperationsStatusViewModelObj.StatusCode == 1) { return(JsonConvert.SerializeObject(new { Result = "OK", Record = OperationsStatusViewModelObj })); } else { return(JsonConvert.SerializeObject(new { Result = "Error", Record = OperationsStatusViewModelObj })); } } return(JsonConvert.SerializeObject(new { Result = "ERROR", Message = "Please Check the values" })); }
public ActionResult Index() { QuotationsViewModel Quotationsat_obj = new QuotationsViewModel(); List <SelectListItem> selectListItem = new List <SelectListItem>(); List <QuotationStatusViewModel> orderstatusListVM = Mapper.Map <List <QuotationStatusMaster>, List <QuotationStatusViewModel> >(_masterBusiness.GetAllQuotationStatus()); foreach (QuotationStatusViewModel ovm in orderstatusListVM) { selectListItem.Add(new SelectListItem { Text = ovm.Description, Value = ovm.Code.ToString(), Selected = false }); } Quotationsat_obj.QuotationstatusList = selectListItem; return(View(Quotationsat_obj)); }