// // GET: /ModuleProduct/Product/ public ActionResult ProductsList() { try { string _url = Request.RawUrl; string _ok = CommonFunc.Nvs_Redirect_QuyenTruyCapUser(_url); if (_ok != "") { return(Redirect(_ok)); } int fromRow = 0; string htmlPaging = ""; Product_BL _Product_BL = new Product_BL(); List <Product_Info> _lst_data = _Product_BL.Product_GetAll(); List <Product_Info> lstDataBreakPage = NaviCommon.CommonFuc.GetPaging <Product_Info>(_lst_data, 1, ref fromRow, ref htmlPaging, "Sản phẩm"); ViewBag.Paging = htmlPaging; ViewBag.FromRow = fromRow; ViewBag.Obj = lstDataBreakPage; ViewBag.SumRecord = _lst_data.Count; return(View()); } catch (Exception ex) { NaviCommon.Common.log.Error(ex.ToString()); ViewBag.FromRow = 0; return(View(new List <Product_Info>())); } }
// // GET: /ModuleContracts/Product/ public ActionResult ProductList() { try { int fromRow = 0; string htmlPaging = ""; Product_BL _BL = new Product_BL(); List <Product_Info> _lst_Product = _BL.Product_GetAll(); List <Product_Info> lstContractBreakPage = NaviCommon.CommonFuc.GetPaging <Product_Info>(_lst_Product, 1, ref fromRow, ref htmlPaging, "Sản phẩm"); ViewBag.Paging = htmlPaging; ViewBag.FromRow = fromRow; ViewBag.Obj = lstContractBreakPage; ViewBag.SumRecord = _lst_Product.Count; return(View()); } catch (Exception ex) { NaviCommon.Common.log.Error(ex.ToString()); ViewBag.FromRow = 0; return(View(new List <Product_Info>())); } }
public ActionResult ShowViewProduct(decimal p_id) { try { Product_BL _Product_BL = new Product_BL(); Product_Info _Product_Info = _Product_BL.Product_GetById(p_id); ViewBag.obj = _Product_Info; return(PartialView("~/Areas/ModuleProduct/Views/Product/P_View_Product.cshtml")); } catch (Exception ex) { NaviCommon.Common.log.Error(ex.ToString()); return(PartialView("P_View_Product")); } }
public MainWindow() { //IDAL myDal = new LINQ_DAL(); IDAL myDal = new SQL_DAL(); IBL clubMember = new ClubMember_BL(myDal); IBL customer = new Customer_BL(myDal); IBL department = new Department_BL(myDal); IBL employee = new Employee_BL(myDal); IBL product = new Product_BL(myDal); IBL transaction = new Transaction_BL(myDal); IBL user = new User_BL(myDal); IPL myPL = new PL_GUI(clubMember, customer, department, employee, product, transaction, user); myPL.Run(); }
public MainProgram() { IDAL myDal = new LINQ_DAL(); IBL clubMember = new ClubMember_BL(myDal); IBL customer = new Customer_BL(myDal); IBL department = new Department_BL(myDal); IBL employee = new Employee_BL(myDal); IBL product = new Product_BL(myDal); IBL transaction = new Transaction_BL(myDal); IBL user = new User_BL(myDal); IPL myPL = new PL_GUI(clubMember, customer, department, employee, product, transaction, user); //myPL.Run(); /////////////////// //Purchase p = new Purchase(product); //p.Show(); /////////////////// }
public ActionResult DeleteProduct(decimal p_product_id) { try { // Kiểm tra có phiên làm việc không var objUser = SessionData.CurrentUser as User_Info; if (objUser == null) { // thoát đăng nhập return(Json(new { success = -1 })); } Product_BL _Product_BL = new Product_BL(); decimal _kq = _Product_BL.Product_Delete(p_product_id); return(Json(new { success = _kq })); } catch (Exception ex) { NaviCommon.Common.log.Error(ex.ToString()); return(Json(new { success = -1 })); } }
public ActionResult Edit() { try { string _url = Request.RawUrl; string _ok = CommonFunc.Nvs_Redirect_QuyenTruyCapUser(_url); if (_ok != "") { return(Redirect(_ok)); } decimal _Id = 0; int _tab = 1; if (RouteData.Values["id"] != null) { _Id = Convert.ToDecimal(RouteData.Values["id"]); } if (RouteData.Values["id1"] != null) { _tab = Convert.ToInt16(RouteData.Values["id1"].ToString()); } Product_BL _Product_BL = new Product_BL(); List <Product_Info> _lst_data = _Product_BL.Product_GetAll(); ViewBag.ListProduct = _lst_data; ViewBag.CurrTab = _tab; Declaration_Info _info = new Declaration_Info(); Declaration_BL _ObjBL = new Declaration_BL(); _info = _ObjBL.DeclarationGetById(_Id); ViewBag.DecrationInfo = _info; ViewBag.IsApprove = 1; return(View(_info)); } catch (Exception ex) { NaviCommon.Common.log.Error(ex.ToString()); return(null); } }
// // GET: /ModuleDeclaration/Waiting/ListSearchImport_Datas public ActionResult Add() { try { string _url = Request.RawUrl; string _ok = CommonFunc.Nvs_Redirect_QuyenTruyCapUser(_url); if (_ok != "") { return(Redirect(_ok)); } ContractBL _ContractBL = new ContractBL(); List <Contracts_Info> ListContract = _ContractBL.Contract_GetByStatus((int)NaviCommon.Enum_Contract_Status.Da_Duyet); ViewBag.ListContract = ListContract; Product_BL _Product_BL = new Product_BL(); List <Product_Info> _lst_data = _Product_BL.Product_GetAll(); ViewBag.ListProduct = _lst_data; return(View()); } catch (Exception ex) { NaviCommon.Common.log.Error(ex.ToString()); return(View()); } }
public ActionResult SearchProduct(string p_name) { try { int fromRow = 0; string htmlPaging = ""; Product_BL _Product_BL = new Product_BL(); List <Product_Info> _lst_data = _Product_BL.Product_Search(p_name); List <Product_Info> lstDataBreakPage = NaviCommon.CommonFuc.GetPaging <Product_Info>(_lst_data, 1, ref fromRow, ref htmlPaging, "Sản phẩm"); ViewBag.Paging = htmlPaging; ViewBag.FromRow = fromRow; ViewBag.Obj = lstDataBreakPage; ViewBag.SumRecord = _lst_data.Count; return(PartialView("PartialViewTableslistProduct")); } catch (Exception ex) { NaviCommon.Common.log.Error(ex.ToString()); return(PartialView("PartialViewTableslistProduct")); } }
public ActionResult Product_Insert(string p_product_code, string p_product_name, decimal p_category_id, string p_unit) { try { // Kiểm tra có phiên làm việc không var objUser = SessionData.CurrentUser as User_Info; if (objUser == null) { // thoát đăng nhập return(Json(new { success = -1 })); } Product_BL _Product_BL = new Product_BL(); if (_Product_BL.Product_GetByCode(p_product_code) != null) { return(Json(new { success = -2 })); } else { bool _kq = _Product_BL.Product_Insert(p_product_code, p_product_name, p_category_id, p_unit); if (_kq) { return(Json(new { success = 0 })); } else { return(Json(new { success = -1 })); } } } catch (Exception ex) { NaviCommon.Common.log.Error(ex.ToString()); return(Json(new { success = -1 })); } }
public ActionResult Products_ImportFile(HttpPostedFileBase uploadFile) { string filePath = ""; try { int _rel = 1; List <Product_Declaration_Info> lst_product_Dec = new List <Product_Declaration_Info>(); if (uploadFile != null) { if (!string.IsNullOrEmpty(uploadFile.FileName)) { // lấy ds sản phẩm lên trước Product_BL _Product_BL = new Product_BL(); List <Product_Info> _lst_data = _Product_BL.Product_GetAll(); Hashtable _hsProduct = new Hashtable(); foreach (Product_Info item in _lst_data) { _hsProduct[item.Product_Code.ToUpper()] = item; } string _temp = uploadFile.FileName; string _file_name = NaviCommon.CommonFuc.Get_File_name(ref _temp); // Lưu file vao server filePath = Server.MapPath(NaviCommon.Config_Info.c_file_Upload_Sync + _file_name); // Nếu có file rồi delete cho chắc if (System.IO.File.Exists(filePath)) { System.IO.File.Delete(filePath); } uploadFile.SaveAs(filePath); string file_extension = System.IO.Path.GetExtension(filePath); DataSet ds = new DataSet(); ds = CommonFuc.ReadXlsxFile(filePath); System.IO.File.Delete(filePath); #region Đọc file if (ds.Tables.Count > 0) { int i = 0; foreach (DataRow dr in ds.Tables[0].Rows) { i++; if (i < 3) { // chỉ lấy dòng thứ 3 trở đi continue; } Product_Declaration_Info _PruductInfo = new Product_Declaration_Info(); string _ProductCode = ""; decimal _Pack_Quantity = 0; decimal _Quantity = 0; string _MadeIn = ""; decimal _Value = 0; _ProductCode = dr[0].ToString(); if (!_hsProduct.ContainsKey(_ProductCode.ToUpper())) { // không tồn tại sản phẩm _rel = -10; break; } // số kiện try { _Pack_Quantity = Convert.ToDecimal(dr[1].ToString()); } catch (Exception) { _rel = -11;// ko phải là số break; } // số lượng try { _Quantity = Convert.ToDecimal(dr[2].ToString()); } catch (Exception) { _rel = -11;// ko phải là số break; } //nơi xuất xứ _MadeIn = dr[3].ToString(); try { _Value = Convert.ToDecimal(dr[4].ToString()); } catch (Exception) { _rel = -11;// ko phải là số break; } Product_Info _tempInfo = (Product_Info)_hsProduct[_ProductCode.ToUpper()]; _PruductInfo.Product_Id = _tempInfo.Product_Id; _PruductInfo.Product_Code = _ProductCode; _PruductInfo.Package_Quantity = _Pack_Quantity; _PruductInfo.Quantity = _Quantity; _PruductInfo.Made_In = _MadeIn; _PruductInfo.Value = _Value; lst_product_Dec.Add(_PruductInfo); } #endregion } } } if (_rel > 0) { ViewBag.ListProduct = lst_product_Dec; return(PartialView("/Areas/ModuleDeclaration/Views/YShare/PartialListProduct.cshtml")); } else { return(null); } } catch (Exception ex) { System.IO.File.Delete(filePath); NaviCommon.Common.log.Error(ex.ToString()); return(PartialView("/Areas/ModuleDeclaration/Views/YShare/PartialListProduct.cshtml")); } }