public JsonResult SaveSupplierProduct(NetStock.Contract.Customer supplier) { try { supplier.Status = true; supplier.CreatedBy = Session["DEFAULTUSER"].ToString(); supplier.ModifiedBy = Session["DEFAULTUSER"].ToString(); var lstCustomerProducts = supplier.CustomerProducts; if (lstCustomerProducts != null || lstCustomerProducts.Count > 0) { lstCustomerProducts.Update(p => { p.CustomerCode = supplier.CustomerCode; p.CostPrice = 0; }); } var result = new NetStock.BusinessFactory.CustomerProductBO().SaveList(lstCustomerProducts); } catch (Exception ex) { ModelState.AddModelError("Error", ex.Message); } return(Json(new { success = true, Message = "Products saved successfully.", supplierData = supplier })); }
public ActionResult EditSupplier(NetStock.Contract.Customer supplier) { try { supplier.CreatedBy = Session["DEFAULTUSER"].ToString(); supplier.ModifiedBy = Session["DEFAULTUSER"].ToString(); supplier.CustomerType = "SUPPLIER"; supplier.Status = true; if (supplier.CustomerAddress.AddressId == 0 || supplier.CustomerAddress.AddressId == null) { supplier.CustomerAddress.AddressType = "SUPPLIER";// "Customer"; supplier.CustomerAddress.SeqNo = 1; supplier.CustomerAddress.AddressLinkID = supplier.CustomerCode; } var result = new NetStock.BusinessFactory.CustomerBO().SaveCustomer(supplier); } catch (Exception ex) { throw ex; } return(RedirectToAction("Suppliers")); //return View(Suppliers); }
public ActionResult SupplierProducts(NetStock.Contract.Customer supplier) { var items = ((NetStock.Contract.Customer)HttpContext.Session["SupplierProducts"]).CustomerProducts; foreach (var item in items) { item.CustomerCode = supplier.CustomerCode; item.CustomerName = supplier.CustomerName; var result = new NetStock.BusinessFactory.CustomerProductBO().SaveCustomerProduct(item); } return(RedirectToAction("Suppliers")); }
public ActionResult EditCustomer(NetStock.Contract.Customer customer) { try { customer.CreatedBy = Session["DEFAULTUSER"].ToString(); customer.ModifiedBy = Session["DEFAULTUSER"].ToString(); customer.CustomerMode = Utility.DEFAULTCUSTOMERMODE; customer.CustomerType = "CUSTOMER"; customer.Status = true; if (customer.CustomerAddress.AddressId == 0 || customer.CustomerAddress.AddressId == null) { customer.CustomerAddress.AddressType = "Customer"; customer.CustomerAddress.SeqNo = 1; customer.CustomerAddress.AddressLinkID = customer.CustomerCode; } var result = new NetStock.BusinessFactory.CustomerBO().SaveCustomer(customer); if (result) { TempData["isSaved"] = result; TempData["resultMessage"] = string.Format("Customer Details [{0}] Saved Successfully", customer.CustomerCode); } else { TempData["resultMessage"] = "Unable to Save the Record!"; } } catch (Exception ex) { TempData["isSaved"] = false; TempData["resultMessage"] = string.Format("Error Occurred {0}", ex.Message.ToString()); ModelState.AddModelError("Error", ex.Message); } return(RedirectToAction("Customers")); //return View(Suppliers); }