Exemplo n.º 1
0
 public ActionResult Save(string id = "")
 {
     CompanyModel model = new CompanyModel();
     if (id != "")
     {
         model = new Dac_Company().CompanyInfoDetail(ObjectId.Parse(id));
     }
     return View(model);
 }
Exemplo n.º 2
0
 public JsonResult GetCompany()
 {
     List<CompanyModel> company = new Dac_Company().CompanyInfo().ToList();
     var data = from e in company
                select new
                {
                    Name = e.ComName,
                    Id = e.Id.ToString()
                };
     return Json(data);
 }
Exemplo n.º 3
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);
 }
Exemplo n.º 4
0
 public JsonResult Insert(string name = "")
 {
     bool result = true;
     try
     {
         CompanyModel company = new Dac_Company().CompanyInfoDetail(ObjectId.Parse(ConfigurationManager.AppSettings["COM"]));
         ProductCategoryModel model = new ProductCategoryModel();
         model.Company = company;
         model.ProductCategoryNm = name;
         new Dac_Product().ProductCategorySave(model);
     }
     catch (Exception ex)
     {
         result = false;
     }
     return Json(result);
 }
Exemplo n.º 5
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");
        }
Exemplo n.º 6
0
 public JsonResult OutCompanyInsert(string name = "", string tell = "", string addr = "")
 {
     bool result = true;
     try
     {
         CompanyModel company = new Dac_Company().CompanyInfoDetail(ObjectId.Parse(ConfigurationManager.AppSettings["COM"]));
         OutCompanyModel model = new OutCompanyModel();
         model.OutComAddr = addr;
         model.OutComName = name;
         model.OutComTell = tell; ;
         model.Company = company;
         new Dac_Bom().OutCompanySave(model);
     }
     catch (Exception ex)
     {
         result = false;
     }
     return Json(result);
 }
Exemplo n.º 7
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);
        }
Exemplo n.º 8
0
 //
 // GET: /Company/
 public ActionResult Index()
 {
     List<CompanyModel> list = new Dac_Company().CompanyInfo().ToList();
        return View(list);
 }
Exemplo n.º 9
0
 public JsonResult GetList(string name)
 {
     List<CompanyModel> list = new Dac_Company().CompanyInfo(name).ToList();
     return Json(list);
 }
Exemplo n.º 10
0
 public JsonResult UserInsert(string company = "",  string pwd = "", string name = "", string email = "", string grade = "", string tell = "")
 {
     bool result = true;
     try
     {
         UserGrade enumgrade = new UserGrade();
         if(grade == "0")
         {
             enumgrade = UserGrade.Civil;
         }
         if (grade == "1")
         {
             enumgrade = UserGrade.Night;
         }
         if (grade == "2")
         {
             enumgrade = UserGrade.King;
         }
         CompanyModel companyModel = new Dac_Company().CompanyInfoDetail(ObjectId.Parse(ConfigurationManager.AppSettings["COM"]));
         LoginModel model = new LoginModel();
         model.name = name;
         model.company = companyModel;
         model.password = pwd;
         model.email = email;
         model.tell = tell;
         model.grade = enumgrade;
         new Dac_User().UserSave(model);
     }
     catch (Exception ex)
     {
         result = false;
     }
     return Json(result);
 }