public ActionResult Details(int?Id) { try { var Result = webServices.Post(new LPOInvoiceViewModel(), "Invoice/Edit/" + Id); if (Result.Data != "[]") { lPOInvoiceViewModel = (new JavaScriptSerializer().Deserialize <LPOInvoiceViewModel>(Result.Data.ToString())); ViewBag.lPOInvoiceViewModel = lPOInvoiceViewModel; lPOInvoiceViewModel.Heading = "Invoice"; var Results = webServices.Post(new LPOInvoiceDetails(), "Invoice/EditDetails/" + Id); if (Results.Data != "[]") { lPOInvoiceDetails = (new JavaScriptSerializer().Deserialize <List <LPOInvoiceDetails> >(Results.Data.ToString())); ViewBag.lPOInvoiceDetails = lPOInvoiceDetails; VenderController venderController = new VenderController(); var venders = venderController.Venders(); ViewBag.Vender = venders; if (TempData["Success"] == null) { if (TempData["Download"] != null) { ViewBag.IsDownload = TempData["Download"].ToString(); ViewBag.Id = Id; } } else { ViewBag.Success = TempData["Success"]; } return(View()); } else { return(View()); } } else { return(View()); } } catch (Exception ex) { throw ex; } }
public ActionResult Details(int?Id) { try { var Result = webServices.Post(new LPOInvoiceViewModel(), "LPO/Edit/" + Id); if (Result.StatusCode == System.Net.HttpStatusCode.Accepted) { if (Result.Data != "[]") { lPOInvoiceViewModel = (new JavaScriptSerializer().Deserialize <LPOInvoiceViewModel>(Result.Data.ToString())); lPOInvoiceViewModel.FromDate = lPOInvoiceViewModel.FromDate.AddDays(1); lPOInvoiceViewModel.DueDate = lPOInvoiceViewModel.DueDate.AddDays(1); ViewBag.lPOInvoiceViewModel = lPOInvoiceViewModel; lPOInvoiceViewModel.Heading = "LPO"; lPOInvoiceDetails = lPOInvoiceViewModel.lPOInvoiceDetailsList; VenderController venderController = new VenderController(); var venders = venderController.Venders(); ViewBag.Vender = venders; ViewBag.lPOInvoiceDetails = lPOInvoiceDetails; if (TempData["Success"] == null) { if (TempData["Download"] != null) { ViewBag.IsDownload = TempData["Download"].ToString(); ViewBag.Id = Id; } } else { ViewBag.Success = TempData["Success"]; } } return(View()); } else { return(View()); } } catch (Exception ex) { throw ex; } }
public ActionResult Edit(int?Id) { try { var Result = webServices.Post(new LPOInvoiceViewModel(), "LPO/Edit/" + Id); var result = webServices.Post(new ProductViewModel(), "Product/All"); if (result.StatusCode == System.Net.HttpStatusCode.Accepted) { if (result.Data != "[]") { ProductViewModel = (new JavaScriptSerializer()).Deserialize <List <ProductViewModel> >(result.Data.ToString()); ProductViewModel.Insert(0, new ProductViewModel() { Id = 0, Name = "Select Item" }); } } ViewBag.Product = ProductViewModel; var results = webServices.Post(new ProductUnitViewModel(), "ProductUnit/All"); if (results.StatusCode == System.Net.HttpStatusCode.Accepted) { if (results.Data != "[]") { productUnitViewModels = (new JavaScriptSerializer()).Deserialize <List <ProductUnitViewModel> >(results.Data.ToString()); productUnitViewModels.Insert(0, new ProductUnitViewModel() { Id = 0, Name = "Select Unit" }); } } ViewBag.ProductUnit = productUnitViewModels; List <VatModel> model = new List <VatModel> { new VatModel() { Id = 0, VAT = 0 }, new VatModel() { Id = 5, VAT = 5 }, }; ViewBag.VatDrop = model; VenderController venderController = new VenderController(); venderViewModels = venderController.Venders(); ViewBag.Vender = venderViewModels; if (Result.Data != "[]") { lPOInvoiceViewModel = (new JavaScriptSerializer().Deserialize <LPOInvoiceViewModel>(Result.Data.ToString())); lPOInvoiceViewModel.FromDate = lPOInvoiceViewModel.FromDate.AddDays(1); lPOInvoiceViewModel.DueDate = lPOInvoiceViewModel.DueDate.AddDays(1); ViewBag.lPOInvoiceViewModel = lPOInvoiceViewModel; var Results = webServices.Post(new LPOInvoiceDetails(), "LPO/EditDetails/" + Id); if (Results.Data != "[]") { lPOInvoiceDetails = (new JavaScriptSerializer().Deserialize <List <LPOInvoiceDetails> >(Results.Data.ToString())); ViewBag.lPOInvoiceDetails = lPOInvoiceDetails; lPOInvoiceViewModel.Heading = "LPO"; return(View()); } else { return(View()); } } else { return(View()); } } catch (Exception ex) { throw ex; } }
public ActionResult Create() { try { string SerailNO = ""; string AlreadyNumber = ""; var LPONoResult = webServices.Post(new SingleStringValueResult(), "LPO/LPOGetPONumber"); if (LPONoResult.StatusCode == System.Net.HttpStatusCode.Accepted) { if (LPONoResult.Data != "\"\"") { string LPNo = (new JavaScriptSerializer()).Deserialize <string>(LPONoResult.Data); SerailNO = LPNo.Substring(4, 8); SerailNO = SerailNO.ToString().Substring(0, 6); string TotdayNumber = POClass.PONumber().Substring(0, 6); int Counts = 0; if (SerailNO == TotdayNumber) { Counts = Convert.ToInt32(LPNo.Substring(10, 2)) + 1; if (Counts.ToString().Length == 1) { SerailNO = "LPO-" + TotdayNumber + "0" + Counts; } else { SerailNO = "LPO-" + TotdayNumber + Counts.ToString(); } } else { AlreadyNumber = POClass.PONumber(); SerailNO = "LPO-" + AlreadyNumber; } } else { AlreadyNumber = POClass.PONumber(); SerailNO = "LPO-" + AlreadyNumber; } } else { AlreadyNumber = POClass.PONumber(); SerailNO = "LPO-" + AlreadyNumber; } var result = webServices.Post(new ProductViewModel(), "Product/All"); if (result.StatusCode == System.Net.HttpStatusCode.Accepted) { if (result.Data != "[]") { ProductViewModel = (new JavaScriptSerializer()).Deserialize <List <ProductViewModel> >(result.Data.ToString()); ProductViewModel.Insert(0, new ProductViewModel() { Id = 0, Name = "Select Item" }); } else { ProductViewModel.Add(new ProductViewModel() { Id = 0, Name = "Select Item" }); } } ViewBag.Product = ProductViewModel; var results = webServices.Post(new ProductUnitViewModel(), "ProductUnit/All"); if (results.StatusCode == System.Net.HttpStatusCode.Accepted) { if (results.Data != "[]") { productUnitViewModels = (new JavaScriptSerializer()).Deserialize <List <ProductUnitViewModel> >(results.Data.ToString()); productUnitViewModels.Insert(0, new ProductUnitViewModel() { Id = 0, Name = "Select Unit" }); } else { productUnitViewModels.Add(new ProductUnitViewModel() { Id = 0, Name = "Select Unit" }); } } ViewBag.ProductUnit = productUnitViewModels; VenderController venderController = new VenderController(); venderViewModels = venderController.Venders(); ViewBag.Vender = venderViewModels; ViewBag.titles = "LPO"; ViewBag.PO = SerailNO; LPOInvoiceViewModel lPOInvoiceVModel = new LPOInvoiceViewModel { FromDate = System.DateTime.Now, DueDate = System.DateTime.Now.AddMonths(1), }; return(View(lPOInvoiceVModel)); } catch (Exception ex) { throw ex; } }