Beispiel #1
0
 public ActionResult Bom(string id = "")
 {
     List<BomModel> model = new List<BomModel>();
     if (id != "")
     {
         model = new Dac_Bom().BomSelect(ObjectId.Parse(ConfigurationManager.AppSettings["COM"]), ObjectId.Parse(id)).ToList();
     }
     else
     {
         model = new Dac_Bom().BomSelect(ObjectId.Parse(ConfigurationManager.AppSettings["COM"])).ToList();
     }
     ViewBag.id = id;
     return View(model);
 }
Beispiel #2
0
 public JsonResult BomInsert(string unit = "", string category = "", string name = "")
 {
     bool result = true;
     try
     {
         CompanyModel company = new Dac_Company().CompanyInfoDetail(ObjectId.Parse(ConfigurationManager.AppSettings["COM"]));
         BomCategoryModel bomCategory = new Dac_Bom().BomCategorySelectById(ObjectId.Parse(category));
         BomModel model = new BomModel();
         model.Unit = unit;
         model.Company = company;
         model.BomName = name; ;
         model.BomCategory = bomCategory;
         new Dac_Bom().BomSave(model);
     }
     catch (Exception ex)
     {
         result = false;
     }
     return Json(result);
 }
Beispiel #3
0
        public ActionResult BomSell(string catid = "", string bomId = "", string outId = "", string sdate = "", string edate = "")
        {
            ViewBag.catid = catid;
            ViewBag.bomId = bomId;
            ViewBag.outId = outId;
            ViewBag.sdate = sdate == "" ? DateTime.Now.ToShortDateString() : sdate;
            ViewBag.edate = edate == "" ? DateTime.Now.ToShortDateString() : edate;

            List<BomSellModel> list = new Dac_Bom().BomSellSelect(
                ObjectId.Parse(ConfigurationManager.AppSettings["COM"]),
                catid,
                outId,
                bomId,
                WebUtill.ConvertDatetime_S(sdate),
                WebUtill.ConvertDatetime_E(edate)
                ).ToList();
            return View(list);
        }
Beispiel #4
0
 public JsonResult BomCount(string id)
 {
     List<BomModel> model = new Dac_Bom().BomSelectById(ObjectId.Parse(id)).ToList();
     return Json(model.Count);
 }
Beispiel #5
0
 public ActionResult OutCompany()
 {
     List<OutCompanyModel> model = new Dac_Bom().OutCompanySelect(ObjectId.Parse(ConfigurationManager.AppSettings["COM"])).ToList();
     return View(model);
 }
Beispiel #6
0
 public JsonResult GetOutCompany()
 {
     List<OutCompanyModel> model = new Dac_Bom().OutCompanySelect(ObjectId.Parse(ConfigurationManager.AppSettings["COM"])).ToList();
     var data = from e in model
                select new
                {
                    OutComName = e.OutComName,
                    Id = e.Id.ToString()
                };
     return Json(data);
 }
Beispiel #7
0
 public JsonResult GetCategory()
 {
     List<BomCategoryModel> model = new Dac_Bom().BomCategorySelect(ObjectId.Parse(ConfigurationManager.AppSettings["COM"])).ToList();
     var data = from e in model
                select new
                {
                    BomCategoryName = e.BomCategoryName,
                    Id = e.Id.ToString()
                };
     return Json(data);
 }
Beispiel #8
0
 public JsonResult GetBomList(string catid = "")
 {
     if (catid != "")
     {
         List<BomModel> model = new Dac_Bom().BomSelect(ObjectId.Parse(ConfigurationManager.AppSettings["COM"]),
             ObjectId.Parse(catid)
             ).ToList();
         var data = from e in model
                    select new
                    {
                        BomName = e.BomName,
                        Id = e.Id.ToString()
                    };
         return Json(data);
     }
     else
     {
         return Json("");
     }
 }
Beispiel #9
0
 public JsonResult CategoryDelete(string id)
 {
     bool result = true;
     List<BomModel> model = new Dac_Bom().BomSelectById(ObjectId.Parse(id)).ToList();
     if (model.Count == 0)
     {
         new Dac_Bom().BomCategoryDelete(ObjectId.Parse(id));
     }
     else
     {
         result = false;
     }
     return Json(result);
 }
Beispiel #10
0
 public ActionResult Category()
 {
     List<BomCategoryModel> model = new Dac_Bom().BomCategorySelect(ObjectId.Parse(ConfigurationManager.AppSettings["COM"])).ToList();
     return View(model);
 }
Beispiel #11
0
        public JsonResult BomSellInsert(string catid, string bomId, string outId, DateTime date, int price, int qty, int totalPrice)
        {
            var result = true;
            try
            {
                CompanyModel company = new Dac_Company().CompanyInfoDetail(ObjectId.Parse(ConfigurationManager.AppSettings["COM"]));
                BomModel bom = new Dac_Bom().BomSelecOnetById(ObjectId.Parse(bomId));
                OutCompanyModel outcompany = new Dac_Bom().OutCompanySelecOnetById(ObjectId.Parse(outId));

                BomSellModel model = new BomSellModel();
                model.Indate = date;
                model.OutCompany = outcompany;
                model.Price = price;
                model.Qty = qty;
                model.TotalPrice = totalPrice;
                model.Bom = bom;
                model.Company = company;

                new Dac_Bom().BomSellSave(model);
            }
            catch (Exception ex)
            {
                result = false;
            }

            return Json(result);
        }