Esempio n. 1
0
 public JsonResult ImageDelet(string name = "")
 {
     bool result = true;
     string id = WebUtill.Request("id");
     try
     {
         if (name != "" && id != "")
         {
             ProductModel product = new Dac_Product().ProductView(ObjectId.Parse(id));
             List<string> img = new List<string>();
             string path = Server.MapPath("/Upload/");
             WebUtill.ImageDelete(path, name);
             foreach (var data in product.ImagUrl)
             {
                 if (data != name)
                 {
                     img.Add(data);
                 }
             }
             product.ImagUrl = img;
             new Dac_Product().ProductSave(product);
         }
         else
         {
             result = false;
         }
     }
     catch(Exception ex)
     {
         result = false;
     }
     return Json(result);
 }
Esempio n. 2
0
 public JsonResult GetCategory()
 {
     List<ProductCategoryModel> model = new Dac_Product().ProductCategorySelect(ObjectId.Parse(ConfigurationManager.AppSettings["COM"])).ToList();
     var data = from e in model
                select new
                {
                    name = e.ProductCategoryNm,
                    Id = e.Id.ToString()
                };
     return Json(data);
 }
Esempio n. 3
0
        public ActionResult Sell(string sdate = "", string edate = "")
        {
            ViewBag.sdate = sdate == "" ? DateTime.Now.ToShortDateString() : sdate;
            ViewBag.edate = edate == "" ? DateTime.Now.ToShortDateString() : edate;
            List<ProductSellMasterModel> list = new Dac_Product().ProductSellMasterSelect(
                ObjectId.Parse(ConfigurationManager.AppSettings["COM"]),
                WebUtill.ConvertDatetime_S(sdate),
                WebUtill.ConvertDatetime_E(edate)
                ).ToList();

            return View(list);
        }
Esempio n. 4
0
 public JsonResult SellDetail(string orno = "")
 {
     List<ProductSellModel> list = new Dac_Product().ProductSellSelectOrNo(orno).ToList();
     var data = from e in list
                select new
                {
                    name = e.Product.ProductNm,
                    price = e.Price,
                    category = e.Product.ProductCategory.ProductCategoryNm,
                    sale = e.DiscountYn == "O" ? "N" : "Y"
                };
     data.OrderByDescending(x => x.category);
     return Json(data);
 }
Esempio n. 5
0
 public JsonResult CategoryDelete(string id)
 {
     bool result = true;
     List<ProductModel> model = new Dac_Product().ProductSelectById(ObjectId.Parse(id)).ToList();
     if (model.Count == 0)
     {
         new Dac_Product().ProductCategoryDelete(ObjectId.Parse(id));
     }
     else
     {
         result = false;
     }
     return Json(result);
 }
Esempio n. 6
0
        //
        // GET: /Sell/
        public ActionResult Index(string cate = "", string prod = "", string sdate = "", string edate = "")
        {
            ViewBag.cate = cate;
            ViewBag.prod = prod;
            ViewBag.sdate = sdate == "" ? DateTime.Now.ToShortDateString() : sdate;
            ViewBag.edate = edate == "" ? DateTime.Now.ToShortDateString() : edate;

            //ViewBag.Count = countList.Count;

            List<ProductSellModel> list = new Dac_Product().ProductSellSelect(cate, prod,
                WebUtill.ConvertDatetime_S(sdate),
                WebUtill.ConvertDatetime_E(edate)
                ).ToList();
            return View(list);
        }
Esempio n. 7
0
        public ActionResult DailyPrice(string yyyy = "", string mm = "")
        {
            List<StaticsDailyPrice> model = new List<StaticsDailyPrice>();
            yyyy = yyyy == "" ? DateTime.Now.Year.ToString() : yyyy;
            mm = mm == "" ? (DateTime.Now.Month.ToString().Length == 1 ? "0" + DateTime.Now.Month.ToString() : DateTime.Now.Month.ToString()) : mm;
            ViewBag.yyyy = yyyy;
            ViewBag.mm = mm;
            DateTime date = new DateTime(WebUtill.ConvertInt(yyyy), WebUtill.ConvertInt(mm), 1);

            DateTime sdate = DateTime.Parse(yyyy + "-" + mm + "-01 00:00:00");
            DateTime edate = DateTime.Parse(sdate.AddMonths(1).AddDays(-1).ToShortDateString() + " 23:59:59");

            List<ProductSellModel> sellModel = new Dac_Product().ProductSellSelect(
               "", "",
                sdate,
                edate
                ).ToList();

            int totalDate = DateTime.DaysInMonth(WebUtill.ConvertInt(yyyy), WebUtill.ConvertInt(mm));
            for (int i = 1; i <= totalDate; i++ )
            {
                StaticsDailyPrice data = new StaticsDailyPrice();
                DateTime dateValue = new DateTime(WebUtill.ConvertInt(yyyy), WebUtill.ConvertInt(mm), i);
                data.yyyy = yyyy;
                data.mm = mm;
                data.dd = dateValue.ToString("dd");
                data.weekend = dateValue.ToString("ddd");
                var sellModelData = sellModel.Where(x => x.Indate.ToString("yyyyMMdd") == dateValue.ToString("yyyyMMdd"));
                int count = 0;
                int totalPrice = 0;
                foreach(var datas in sellModelData)
                {
                    count++;
                    totalPrice += datas.Price;
                }
                data.price = totalPrice;
                data.count = count;
                model.Add(data);
            }
            return View(model);
        }
Esempio n. 8
0
        //
        // GET: /Statics/
        public ActionResult Price(string yyyy = "")
        {
            yyyy = yyyy == "" ? DateTime.Now.Year.ToString() : yyyy;
            ViewBag.yyyy = yyyy;
            DateTime sdate = DateTime.Parse(yyyy+"-01-01 00:00:00");
            DateTime edate = DateTime.Parse(sdate.AddYears(1).AddDays(-1).ToShortDateString() + " 23:59:59");

            List<ProductSellMasterModel> list = new Dac_Product().ProductSellMasterSelect(
                ObjectId.Parse(ConfigurationManager.AppSettings["COM"]),
                sdate,
                edate
                ).ToList();

            List<StaticsModel> model = new List<StaticsModel>();
            if(list != null)
            {
                for (int i = 1; i <= 12; i++ )
                {
                    DateTime ssdate = DateTime.Parse(yyyy + "-" + i.ToString() + "-01 00:00:00");
                    DateTime eedate = DateTime.Parse(ssdate.AddMonths(1).AddDays(-1).ToShortDateString() + " 23:59:59");
                    int totalParice = 0;
                    StaticsModel smodel = new StaticsModel();
                    smodel.yyyy = ssdate.Year.ToString();
                    smodel.mm = i.ToString().Length == 1 ? "0" + i.ToString() : i.ToString();

                    List<ProductSellMasterModel> priceList = list.Where(x => x.Indate >= ssdate && x.Indate <= eedate).ToList();
                    smodel.count = priceList.Count;
                    if(priceList != null)
                    {
                        foreach(var dataPrice in priceList)
                        {
                            totalParice += dataPrice.TotalPrice;
                        }
                    }
                    smodel.price = totalParice;
                    model.Add(smodel);
                }
            }
            return View(model);
        }
Esempio n. 9
0
        public JsonResult GetProduct(string id = "")
        {
            List<ProductModel> model = new List<ProductModel>();
            if (id == "")
            {
                model = new Dac_Product().ProductSelect(ObjectId.Parse(ConfigurationManager.AppSettings["COM"])).ToList();
            }
            else
            {
                model = new Dac_Product().ProductSelect(ObjectId.Parse(ConfigurationManager.AppSettings["COM"]), ObjectId.Parse(id)).ToList();
            }

            var data = from e in model
                       select new
                       {
                           name = e.ProductNm,
                           Id = e.Id.ToString(),
                           price = e.Price,
                           sale = e.PriceSale
                       };

            return Json(data);
        }
Esempio n. 10
0
 public ActionResult Views(string id = "")
 {
     ViewBag.id = id;
     ProductModel product = new Dac_Product().ProductView(ObjectId.Parse(id));
     return View(product);
 }
Esempio n. 11
0
 public ActionResult Category()
 {
     List<ProductCategoryModel> model = new Dac_Product().ProductCategorySelect(ObjectId.Parse(ConfigurationManager.AppSettings["COM"])).ToList();
     return View(model);
 }
Esempio n. 12
0
        public RedirectResult ProductUpdate(string id = "", string selCategory = "", string txtName = "", int txtPrice = 0, int txtSalePrice = 0, string txtDesc = "", string selUse = "", string txtBom = "")
        {
            ProductModel product = new Dac_Product().ProductView(ObjectId.Parse(id));
            HttpFileCollectionBase files = Request.Files;
            List<string> img = new List<string>();
            ProductModel model = new ProductModel();
            CompanyModel company = new Dac_Company().CompanyInfoDetail(ObjectId.Parse(ConfigurationManager.AppSettings["COM"]));
            ProductCategoryModel category = new Dac_Product().ProductCategorySelectById(ObjectId.Parse(selCategory));
            model.Id = ObjectId.Parse(id);
            model.Company = company;
            model.Description = txtDesc;
            model.Price = txtPrice;
            model.PriceSale = txtSalePrice;
            model.ProductNm = txtName;
            model.ProductCategory = category;
            model.UseYn = selUse == "0" ? true : false;
            model.Bom = txtBom;
            if (files.Count > 0)
            {
                string path = Server.MapPath("/Upload/");
                for (int i = 0; i < files.Count; i++)
                {
                    if (files[i].ContentLength > 0)
                    {
                        img.Add(WebUtill.ImageSave(path, files[i]));
                    }
                }
            }

            if (product.ImagUrl != null)
            {
                foreach (var data in product.ImagUrl)
                {
                    img.Add(data);
                }
            }
            model.ImagUrl = img;
            new Dac_Product().ProductSave(model);
            return Redirect("/Pr/Product");
        }
Esempio n. 13
0
 public JsonResult ProductCount(string id)
 {
     List<ProductModel> model = new Dac_Product().ProductSelectById(ObjectId.Parse(id)).ToList();
     return Json(model.Count);
 }
Esempio n. 14
0
        public ActionResult Product(string id = "")
        {
            List<ProductModel> model = new List<ProductModel>();
            ViewBag.id = id;
            if(id == "")
            {
                model = new Dac_Product().ProductSelect(ObjectId.Parse(ConfigurationManager.AppSettings["COM"])).ToList();
            }
            else
            {
                model = new Dac_Product().ProductSelect(ObjectId.Parse(ConfigurationManager.AppSettings["COM"]), ObjectId.Parse(id)).ToList();
            }

            return View(model);
        }
Esempio n. 15
0
        public ActionResult Product(string yyyy = "2015")
        {
            yyyy = yyyy == "" ? DateTime.Now.Year.ToString() : yyyy;
            ViewBag.yyyy = yyyy;
            DateTime sdate = DateTime.Parse(yyyy + "-01-01 00:00:00");
            DateTime edate = DateTime.Parse(sdate.AddYears(1).AddDays(-1).ToShortDateString() + " 23:59:59");

            List<ProductSellModel> list = new Dac_Product().ProductSellSelect(
               "", "",
                sdate,
                edate
                ).ToList();
            List<StaticProductMasterModel> modelList = new List<StaticProductMasterModel>();
            if (list != null)
            {
                //1.달별
                for (int i = 1; i <= 12; i++)
                {
                    StaticProductMasterModel modelMaster = new StaticProductMasterModel();

                    DateTime ssdate = DateTime.Parse(yyyy + "-" + i.ToString() + "-01 00:00:00");
                    DateTime eedate = DateTime.Parse(ssdate.AddMonths(1).AddDays(-1).ToShortDateString() + " 23:59:59");

                    modelMaster.yyyy = ssdate.Year.ToString();
                    modelMaster.mm = i.ToString().Length == 1 ? "0" + i.ToString() : i.ToString();

                    List<ProductSellModel> prList = list.Where(x => x.Indate >= ssdate && x.Indate <= eedate).ToList();

                    //2. 상품별
                    List<ProductModel> productModel = new Dac_Product().ProductSelect(ObjectId.Parse(ConfigurationManager.AppSettings["COM"])).ToList();
                    List<StaticsProductProModel> modelProductList = new List<StaticsProductProModel>();
                    foreach(var productModelData in productModel)
                    {
                        StaticsProductProModel modelProduct = new StaticsProductProModel();
                        modelProduct.productName = productModelData.ProductNm;
                        modelProduct.Id = productModelData.Id;
                        //3. Detail
                        int totalPrice = 0;
                        int totalQty = 0;
                        foreach(var detailData in prList)
                        {
                            if(productModelData.Id == detailData.Product.Id)
                            {
                                totalPrice += detailData.Price;
                                totalQty++;
                            }
                        }
                        modelProduct.qty = totalQty;
                        modelProduct.price = totalPrice;

                        modelProductList.Add(modelProduct);
                    }
                    modelMaster.ProductList = modelProductList;
                    modelList.Add(modelMaster);
                }

            }

            return View(modelList);
        }