예제 #1
0
        public PartialViewResult _SupplierList(string keyText = "", int pageNumber = 1, int pageSize = 10)
        {
            List <TB_SUPPLIERS> list = new List <TB_SUPPLIERS>();

            int count = 0;

            try
            {
                keyText = keyText.Trim();
                list    = Suppliers_Service.GetAll()
                          .Where(x => string.IsNullOrEmpty(keyText) || x.SupplierCode.IndexOf(keyText) >= 0 || x.SupplierName.IndexOf(keyText) >= 0)
                          .ToList();
                count = list.Count;
                list  = list
                        .Skip((pageNumber - 1) * pageSize).Take(pageSize)
                        .ToList();
            }
            catch (Exception ex)
            {
                CORE.Helpers.IOHelper.WriteLog(StartUpPath, IpAddress, "Products/_SupplierList :", ex.Message, ex.ToString());
            }

            ViewBag.maxNumber  = Math.Ceiling((double)count / pageSize);
            ViewBag.pageNumber = pageNumber;
            ViewBag.pageSize   = pageSize;

            return(PartialView(list));
        }
예제 #2
0
        public PartialViewResult _ChiTiet(string productId = "")
        {
            int height = (int)(Request.Browser.ScreenPixelsHeight * 0.85);

            TB_PRODUCTS s = Products_Service.GetById(productId);

            ViewBag.Product = s;

            List <TB_SUPPLIERS> list = Suppliers_Service.GetAll()
                                       .Where(x => x.SupplierState == "A").ToList();

            ViewBag.SupplierList = list;

            List <TB_CATEGORIES> list2 = Categories_Service.GetAll()
                                         .Where(x => x.CategoryState == "A").ToList();

            ViewBag.CategoryList = list2;

            try
            {
                ViewBag.Images = Files_Service.GetByRefecense("" + s.ProductCode).Where(x => x.FileType == "PRODUCT").ToList();
            }
            catch (Exception ex)
            {
                CORE.Helpers.IOHelper.WriteLog(StartUpPath, IpAddress, "Blogs/_List :", ex.Message, ex.ToString());
            }

            return(PartialView(height));
        }
예제 #3
0
        public JsonResult UpdateSupplier(string supplier_code, string supplier_name, string supplier_state, string supplier_note)
        {
            AjaxResultModel Result = new AjaxResultModel();

            try
            {
                TB_SUPPLIERS t = Suppliers_Service.GetById(supplier_code);
                t.SupplierName  = supplier_name;
                t.SupplierState = supplier_state;
                t.SupplierNote  = supplier_note;

                if (Suppliers_Service.Update(t))
                {
                    Result.Code   = 000;
                    Result.Result = "Thành công";
                }
                else
                {
                    Result.Code   = 001;
                    Result.Result = "Không thành công";
                }
            }
            catch (Exception Ex)
            {
                Result.Code   = 2000;
                Result.Result = "Có lỗi xảy ra. Vui lòng thử lại sau hoặc liên hệ với người quản trị.";
                CORE.Helpers.IOHelper.WriteLog(StartUpPath, IpAddress, "UpdatePassword :", Ex.Message, Ex.ToString());
            }

            return(Json(Result));
        }
예제 #4
0
        public PartialViewResult _SupplierListDetail(string supplierCode = "")
        {
            int height = (int)(Request.Browser.ScreenPixelsHeight * 0.85);

            TB_SUPPLIERS sup = Suppliers_Service.GetById(supplierCode);

            ViewBag.Supplier = sup;

            return(PartialView(height));
        }