public string InsertUpdateServiceCall(ServiceCallViewModel serviceCallVM) { try { AppUA appUA = Session["AppUA"] as AppUA; serviceCallVM.PSASysCommon = new PSASysCommonViewModel(); serviceCallVM.PSASysCommon.CreatedBy = appUA.UserName; serviceCallVM.PSASysCommon.CreatedDate = _pSASysCommon.GetCurrentDateTime(); serviceCallVM.PSASysCommon.UpdatedBy = appUA.UserName; serviceCallVM.PSASysCommon.UpdatedDate = _pSASysCommon.GetCurrentDateTime(); object ResultFromJS = JsonConvert.DeserializeObject(serviceCallVM.DetailJSON); string ReadableFormat = JsonConvert.SerializeObject(ResultFromJS); serviceCallVM.ServiceCallDetailList = JsonConvert.DeserializeObject <List <ServiceCallDetailViewModel> >(ReadableFormat); ResultFromJS = JsonConvert.DeserializeObject(serviceCallVM.CallChargeJSON); ReadableFormat = JsonConvert.SerializeObject(ResultFromJS); serviceCallVM.ServiceCallChargeList = JsonConvert.DeserializeObject <List <ServiceCallChargeViewModel> >(ReadableFormat); object result = _serviceCallBusiness.InsertUpdateServiceCall(Mapper.Map <ServiceCallViewModel, ServiceCall>(serviceCallVM)); if (serviceCallVM.ID == Guid.Empty) { return(JsonConvert.SerializeObject(new { Status = "OK", Record = result, Message = "Insertion successfull" })); } else { return(JsonConvert.SerializeObject(new { Status = "OK", Record = result, Message = "Updation successfull" })); } } catch (Exception ex) { AppConstMessage cm = _appConstant.GetMessage(ex.Message); return(JsonConvert.SerializeObject(new { Status = "ERROR", Record = "", Message = cm.Message })); } }
public ActionResult ServiceCallForm(Guid id) { ServiceCallViewModel serviceCallVM = null; try { if (id != Guid.Empty) { serviceCallVM = Mapper.Map <ServiceCall, ServiceCallViewModel>(_serviceCallBusiness.GetServiceCall(id)); serviceCallVM.IsUpdate = true; AppUA appUA = Session["AppUA"] as AppUA; serviceCallVM.IsDocLocked = serviceCallVM.DocumentOwners.Contains(appUA.UserName); serviceCallVM.Customer = new CustomerViewModel() { CompanyName = serviceCallVM.Customer.CompanyName, Titles = new TitlesViewModel() { TitlesSelectList = _customerBusiness.GetTitleSelectList(), }, }; serviceCallVM.Currency = new CurrencyViewModel(); } else //(id == Guid.Empty) { serviceCallVM = new ServiceCallViewModel(); serviceCallVM.IsUpdate = false; serviceCallVM.ID = Guid.Empty; serviceCallVM.DocumentStatus = new DocumentStatusViewModel(); serviceCallVM.DocumentStatus.Description = "-"; serviceCallVM.Branch = new BranchViewModel(); serviceCallVM.Branch.Description = "-"; serviceCallVM.Customer = new CustomerViewModel { //CompanyName = serviceCallVM.Customer.CompanyName, Titles = new TitlesViewModel() { TitlesSelectList = _customerBusiness.GetTitleSelectList(), }, }; serviceCallVM.CurrencyCode = "INR"; serviceCallVM.CurrencyRate = 1; serviceCallVM.Currency = new CurrencyViewModel() { CurrencyList = Mapper.Map <List <Currency>, List <CurrencyViewModel> >(_currencyBusiness.GetCurrencyForSelectList()) }; } } catch (Exception ex) { throw ex; } return(PartialView("_ServiceCallForm", serviceCallVM)); }
public ActionResult GetSaleInvoiceByCustomerID(Guid?customerID) { ServiceCallViewModel serviceCallVM = new ServiceCallViewModel(); serviceCallVM.SaleInvoiceList = new List <SaleInvoiceViewModel>(); if (customerID != null && customerID != Guid.Empty) { SaleInvoiceAdvanceSearchViewModel saleInvoiceAdvanceSearchVM = new SaleInvoiceAdvanceSearchViewModel() { AdvCustomerID = (Guid)customerID, DataTablePaging = new DataTablePagingViewModel() { Start = 0, Length = 50 } }; serviceCallVM.SaleInvoiceList = Mapper.Map <List <SaleInvoice>, List <SaleInvoiceViewModel> >(_saleInvoiceBusiness.GetAllSaleInvoice(Mapper.Map <SaleInvoiceAdvanceSearchViewModel, SaleInvoiceAdvanceSearch>(saleInvoiceAdvanceSearchVM))); } return(PartialView("_GetSaleInvoiceByCustomerID", serviceCallVM)); }