// Get Detail public TaxModels GetDetail(string ID) { List <TaxModels> LstTaxDTO = new List <TaxModels>(); TaxModels TaxDTO = new TaxModels(); try { TaxRequestModels paraBody = new TaxRequestModels(); paraBody.ID = ID; NSLog.Logger.Info("Tax GetDetail Request", paraBody); var result = (NSApiResponse)ApiResponse.Post <NSApiResponse>(Commons.TaxAPIGetList, null, paraBody); NSLog.Logger.Info("Tax GetDetail Request", result); dynamic data = result.Data; var lstDataRaw = data["ListTax"]; var lstContent = JsonConvert.SerializeObject(lstDataRaw); LstTaxDTO = JsonConvert.DeserializeObject <List <TaxModels> >(lstContent); NSLog.Logger.Info("TaxGetDetail", LstTaxDTO); TaxDTO = LstTaxDTO.FirstOrDefault(); if (TaxDTO.ListProduct != null && TaxDTO.ListProduct.Count > 0) { for (int i = 0; i < TaxDTO.ListProduct.Count; i++) { var item = TaxDTO.ListProduct[i]; item.OffSet = i; TaxDTO.ItemDetail += item.Name + ","; } } return(TaxDTO); } catch (Exception ex) { NSLog.Logger.Error("TaxGetDetail_Fail", ex); return(null); } }
public PartialViewResult View(string id) { TaxModels model = _factory.GetDetail(id); model.ListProduct = model.ListProduct.OrderBy(x => x.ProductType).ToList(); return(PartialView("_View", model)); }
public OrderDetailModels() { //ListItem = new List<Item>(); /*update*/ ListItems = new List <Item>(); PaidByMethod = new List <PaymentDetail>(); TaxInfo = new TaxModels(); DiscountTotalBill = new Item(); CustomerDetail = new Customermodel(); LstPayment = new List <PaymentMethodModels>(); MerchantDetail = new MerchantDTO(); }
public ActionResult Edit(TaxModels model) { try { if (string.IsNullOrEmpty(model.TaxName)) { ModelState.AddModelError("TaxName", "Name field is required"); } if (model.ListProduct != null && model.ListProduct.Any()) { model.ListProduct = model.ListProduct.Where(x => x.Status != (int)Commons.EStatus.Deleted).ToList(); } //if (!model.ListProduct.Any()) //{ // ModelState.AddModelError("itemdetail", "Please select Applicable items in item detail for Tax no"); //} if (!ModelState.IsValid) { Response.StatusCode = (int)HttpStatusCode.BadRequest; return(PartialView("_Edit", model)); } string msg = ""; bool result = _factory.InsertOrUpdateTax(model, CurrentUser.UserId, ref msg); if (result) { return(RedirectToAction("Index")); } else { //model = _factory.GetDetail(model.Id); if (!string.IsNullOrEmpty(msg)) { ModelState.AddModelError("TaxName", msg); } else { ModelState.AddModelError("TaxName", Commons.ErrorMsg); } Response.StatusCode = (int)HttpStatusCode.BadRequest; return(PartialView("_Edit", model)); } } catch (Exception ex) { NSLog.Logger.Error("Tax_Edit: ", ex); ModelState.AddModelError("TaxName", Commons.ErrorMsg /*msg*/); Response.StatusCode = (int)HttpStatusCode.BadRequest; return(PartialView("_Edit", model)); } }
public PartialViewResult Edit(string id) { TaxModels model = _factory.GetDetail(id); var lstDish = _productFactory.GetListData(null, 0); if (lstDish != null) { model.TotalAllItem = lstDish.Count(x => x.ProductType == (int)Commons.EProductType.Package || x.ProductType == (int)Commons.EProductType.Product || x.ProductType == (int)Commons.EProductType.Addition); } if (model.ListProduct != null) { model.TotalSpecipicItem = model.ListProduct.Count; } return(PartialView("_Edit", model)); }
public ActionResult Delete(TaxModels model) { try { string msg = ""; var result = _factory.Delete(model.Id, CurrentUser.UserId, ref msg); if (!result) { ModelState.AddModelError("Name", Commons.ErrorMsg); Response.StatusCode = (int)HttpStatusCode.BadRequest; return(PartialView("_Delete", model)); } return(new HttpStatusCodeResult(HttpStatusCode.OK)); } catch (Exception ex) { NSLog.Logger.Error("Tax_Delete: ", ex); ModelState.AddModelError("Name", Commons.ErrorMsg); Response.StatusCode = (int)HttpStatusCode.BadRequest; return(PartialView("_Delete", model)); } }
// Create Catagory public bool InsertOrUpdateTax(TaxModels model, string userid, ref string msg) { try { TaxRequestModels paraBody = new TaxRequestModels(); paraBody.CreatedUser = userid; paraBody.ID = model.Id; paraBody.TaxData = model; NSLog.Logger.Info("Tax Update Request", paraBody); //==================== var result = (NSApiResponse)ApiResponse.Post <NSApiResponse>(Commons.TaxAPICreateOrEdit, null, paraBody); NSLog.Logger.Info("Tax Update Request", result); if (result != null) { if (result.Success) { return(true); } else { msg = result.Message; NSLog.Logger.Info("TaxCreateorEdit", result.Message); return(false); } } else { NSLog.Logger.Info("TaxCreateorEdit", result); return(false); } } catch (Exception e) { NSLog.Logger.Error("TaxInsertOrUpdate_Fail", e); return(false); } }
//Load Products Item public ActionResult LoadItems(int ItemType) { var search = ""; var lstDish = _productFactory.GetListData(search, ItemType); TaxModels model = new TaxModels(); if (lstDish != null) { model.LstProduct = new List <ProductModels>(); foreach (var item in lstDish) { ProductModels product = new ProductModels() { ID = item.ID, Name = item.Name, Code = item.Code, ProductType = ItemType }; model.LstProduct.Add(product); } } return(PartialView("_TabChooseItems", model)); }
public ActionResult Create() { TaxModels model = new TaxModels(); model.IsActive = true; model.TaxType = (byte)Commons.ETaxType.AddOn; model.ItemDetail = "All"; // Get list all item (product, package, addition) var lstDish = _productFactory.GetListData(null, 0); if (lstDish != null) { model.ListProduct = new List <ProductModels>(); int offSet = 0; foreach (var item in lstDish) { ProductModels product = new ProductModels() { ID = item.ID, Name = item.Name, Code = item.Code, ProductType = item.ProductType, OffSet = offSet }; model.ListProduct.Add(product); offSet++; } model.TotalAllItem = lstDish.Count(x => x.ProductType == (int)Commons.EProductType.Package || x.ProductType == (int)Commons.EProductType.Product || x.ProductType == (int)Commons.EProductType.Addition); model.TotalSpecipicItem = lstDish.Count; } return(View(model)); }
// Add Products Items public ActionResult AddItems(TaxModels data) { TaxModels model = new TaxModels(); if (data.LstProduct != null && data.LstProduct.Count > 0) { model.LstProduct = new List <ProductModels>(); } for (int i = 0; i < data.LstProduct.Count; i++) { ProductModels item = new ProductModels(); item.OffSet = data.currentItemOffset; item.ID = data.LstProduct[i].ID; item.Code = data.LstProduct[i].Code; item.Name = data.LstProduct[i].Name; item.ProductType = data.LstProduct[i].ProductType; model.ListProduct.Add(item); data.currentItemOffset++; } //model.offset = data.currentgroupOffSet; return(PartialView("_ProductsItem", model)); }