public ActionResult AddEditProductMaster(int ProductID = 0) { BuyerListManager objBuyerListManager = new BuyerListManager(new DataContext()); BuyerOrderNumberListManager objBuyerOrderNumberListManager = new BuyerOrderNumberListManager(new DataContext()); ProcessListManager objProcessListManager = new ProcessListManager(new DataContext()); SupplierListManager objSupplierListManager = new SupplierListManager(new DataContext()); ProductListManager objProductListManager = new ProductListManager(new DataContext()); UnitListManager objUnitListManager = new UnitListManager(new DataContext()); SetNoteListManager objSetNoteListManager = new SetNoteListManager(new DataContext()); ProductManager context = new ProductManager(new DataContext()); ProductUpdateGrid_Model objModel = new ProductUpdateGrid_Model(); if (ProductID != 0) { objModel.Table = context.GetProductMasterById(ProductID); } else { objModel.Table = new ProductUpdateGrid(); } objModel.BuyerList = Extens.ToSelectList(objBuyerListManager.GetDtBuyer(), "Buyername", "Buyername"); objModel.BuyerOrderNumberList = Extens.ToSelectList(objBuyerOrderNumberListManager.GetDtBuyerOrderNumber(), "BuyerOrderNumberName", "BuyerOrderNumberName"); objModel.ProcessList = Extens.ToSelectList(objProcessListManager.GetDtProcess(), "Processname", "Processname"); objModel.SupplierList = Extens.ToSelectList(objSupplierListManager.GetDtSupplier(), "Suppliername", "Suppliername"); objModel.ProductList = Extens.ToSelectList(objProductListManager.GetDtProduct(), "Productname", "Productname"); objModel.UnitList = Extens.ToSelectList(objUnitListManager.GetDtUnit(), "Unitname", "Unitname"); objModel.SetNoteList = Extens.ToSelectList(objSetNoteListManager.GetDtSetNote(), "Setnotename", "Setnotename"); return(PartialView("ProductMasterCRUD", objModel)); }
public void BindProductGrid(ProductUpdateGrid_Model objModel, int page, int pageSize) { BuyerListManager objBuyerListManager = new BuyerListManager(new DataContext()); BuyerOrderNumberListManager objBuyerOrderNumberListManager = new BuyerOrderNumberListManager(new DataContext()); ProcessListManager objProcessListManager = new ProcessListManager(new DataContext()); SupplierListManager objSupplierListManager = new SupplierListManager(new DataContext()); ProductListManager objProductListManager = new ProductListManager(new DataContext()); UnitListManager objUnitListManager = new UnitListManager(new DataContext()); SetNoteListManager objSetNoteListManager = new SetNoteListManager(new DataContext()); ProductManager context = new ProductManager(new DataContext()); PlannerManager pln_context = new PlannerManager(new DataContext()); FinishingManager fis_context = new FinishingManager(new DataContext()); objModel.PlannerUpdateGridList = pln_context.GetPlannerUpdateGridList(); objModel.FinishingUpdateGridList = fis_context.GetFinishingUpdateGridList(); StringBuilder query = new StringBuilder(); var colName = common.GetColumns(CommonFunction.module.ProductMaster.ToString()); query = common.GetSqlTableQuery(CommonFunction.module.ProductMaster.ToString()); string uProcess = ""; if (Session["UserProcess"] != null) { uProcess = Session["UserProcess"].ToString(); } uProcess = "'" + uProcess.Replace(",", "','") + "'"; query.Append(" AND Processname IN (" + uProcess + ") AND "); if (objModel != null) { objModel.StaticPageSize = pageSize; } objModel.BuyerList = Extens.ToSelectList(objBuyerListManager.GetDtBuyer(), "ByrID", "Buyername"); objModel.BuyerOrderNumberList = Extens.ToSelectList(objBuyerOrderNumberListManager.GetDtBuyerOrderNumber(), "BuyerOrderNumberID", "BuyerOrderNumberName"); objModel.ProcessList = Extens.ToSelectList(objProcessListManager.GetDtProcess(), "ProcID", "Processname"); objModel.SupplierList = Extens.ToSelectList(objSupplierListManager.GetDtSupplier(), "SupID", "Suppliername"); objModel.ProductList = Extens.ToSelectList(objProductListManager.GetDtProduct(), "PrdID", "Productname"); objModel.UnitList = Extens.ToSelectList(objUnitListManager.GetDtUnit(), "UnitID", "Unitname"); objModel.SetNoteList = Extens.ToSelectList(objSetNoteListManager.GetDtSetNote(), "SetID", "Setnotename"); objModel.sortOrder = "desc"; objModel.fieldName = "ProductID"; context.setModel(query, objModel, colName, "ProductID", page, pageSize); }