public JsonResult Create01(string para01, string para02, string para03)
        {
            string sup_id    = para01;
            string income_id = para02;
            string spo_money = para03;

            INCOME list2 = db.INCOME.Find(income_id);
            int    money;

            int.TryParse(spo_money, out money);

            SUPPORT sUPPORT    = db.SUPPORT.Find(sup_id, income_id);
            SUPPORT newSupport = new SUPPORT();

            newSupport.SPONSOR_ID   = sup_id;
            newSupport.INCOME_ID    = income_id;
            newSupport.MONEY        = money;
            newSupport.SUPPORT_DATE = list2.INCOME_DATE;



            if (sUPPORT == null)
            {
                db.SUPPORT.Add(newSupport);
                db.SaveChanges();
            }

            var list = db.SUPPORT.Select(n => new { SPONSOR_ID = n.SPONSOR_ID, SPONSOR_NAME = n.SPONSOR.SPONSOR_NAME, INCOME_ID = n.INCOME_ID, MONEY = n.MONEY, SUPPORT_DATE = n.SUPPORT_DATE });

            return(Json(new { code = 0, msg = "", count = 1000, data = list }, JsonRequestBehavior.AllowGet));
        }
Exemple #2
0
        public JsonResult Create(string para01, string para02, string para03, string para04, string para05)
        {
            string id     = para01;
            string name   = para02;
            string salary = para03;
            string sex    = para04;
            string phone  = para05;

            int intSalary;

            int.TryParse(salary, out intSalary);
            EMPLOYEE eMPLOYEE = db.EMPLOYEE.Find(id);

            EMPLOYEE newEmployee = new EMPLOYEE();

            newEmployee.EMPLOYEE_ID   = id;
            newEmployee.EMPLOYEE_NAME = name;
            newEmployee.SALARY        = intSalary;
            newEmployee.SEX           = sex;
            newEmployee.PHONE_NUMBER  = phone;

            if (eMPLOYEE == null)
            {
                db.EMPLOYEE.Add(newEmployee);
                db.SaveChanges();
            }

            var list = db.EMPLOYEE.Select(n => new { EMPLOYEE_ID = n.EMPLOYEE_ID, EMPLOYEE_NAME = n.EMPLOYEE_NAME, SEX = n.SEX, PHONE_NUMBER = n.PHONE_NUMBER, SALARY = n.SALARY });

            return(Json(new { code = 0, msg = "", count = 1000, data = list }, JsonRequestBehavior.AllowGet));
        }
Exemple #3
0
        public JsonResult Create01(string para01, string para02, string para03)
        {
            string id          = para01;
            string pro_id      = para02;
            string plan_number = para03;

            int plan_num;

            int.TryParse(plan_number, out plan_num);

            PLAN pLAN    = db.PLAN.Find(pro_id);
            PLAN newPlan = new PLAN();

            newPlan.PRODUCT_ID = pro_id;
            newPlan.PLAN_ID    = id;
            newPlan.PLAN_NUM   = plan_num;


            if (pLAN == null)
            {
                db.PLAN.Add(newPlan);
                db.SaveChanges();
            }

            var list = db.PLAN.Select(n => new { PLAN_ID = n.PLAN_ID, PRODUCT_ID = n.PRODUCT_ID, PRODUCT_NAME = n.PRODUCT_ATTRIBUTE.PRODUCT_NAME, SUPPLIER_ID = n.PRODUCT_ATTRIBUTE.SUPPLIER_ID, PURCHASE_PRICE = n.PRODUCT_ATTRIBUTE.PURCHASE_PRICE, PLAN_NUM = n.PLAN_NUM });

            return(Json(new { code = 0, msg = "", count = 1000, data = list }, JsonRequestBehavior.AllowGet));
        }
Exemple #4
0
        public ActionResult Create([Bind(Include = "SHELF_ID,SHELF_AREA")] SHELF sHELF)
        {
            if (ModelState.IsValid)
            {
                db.SHELF.Add(sHELF);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(sHELF));
        }
Exemple #5
0
        public ActionResult Create([Bind(Include = "INCOME_ID,MONEY,INCOME_DATE,TYPE")] INCOME iNCOME)
        {
            if (ModelState.IsValid)
            {
                db.INCOME.Add(iNCOME);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(iNCOME));
        }
Exemple #6
0
        public ActionResult Create([Bind(Include = "SPONSOR_ID,SPONSOR_NAME,PHONE_NUMBER")] SPONSOR sPONSOR)
        {
            if (ModelState.IsValid)
            {
                db.SPONSOR.Add(sPONSOR);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(sPONSOR));
        }
Exemple #7
0
        public ActionResult Create([Bind(Include = "EXPENSE_ID,EXPENSE_DATE,MONEY,TYPE")] EXPENSE eXPENSE)
        {
            if (ModelState.IsValid)
            {
                db.EXPENSE.Add(eXPENSE);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(eXPENSE));
        }
        public ActionResult Create([Bind(Include = "PRODUCT_ID,SUPPLIER_ID,PRODUCT_NAME,EXP,PURCHASE_PRICE,SELL_PRICE,TOTAL")] PRODUCT_ATTRIBUTE pRODUCT_ATTRIBUTE)
        {
            if (ModelState.IsValid)
            {
                db.PRODUCT_ATTRIBUTE.Add(pRODUCT_ATTRIBUTE);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.SUPPLIER_ID = new SelectList(db.SUPPLIER, "SUPPLIER_ID", "SUPPLIER_NAME", pRODUCT_ATTRIBUTE.SUPPLIER_ID);
            return(View(pRODUCT_ATTRIBUTE));
        }
Exemple #9
0
        public ActionResult Create([Bind(Include = "PLAN_ID,PRODUCT_ID,PLAN_NUM")] PLAN pLAN)
        {
            if (ModelState.IsValid)
            {
                db.PLAN.Add(pLAN);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.PRODUCT_ID = new SelectList(db.PRODUCT_ATTRIBUTE, "PRODUCT_ID", "SUPPLIER_ID", pLAN.PRODUCT_ID);
            return(View(pLAN));
        }
Exemple #10
0
        public ActionResult Create([Bind(Include = "BATCH_ID,LOT_DATE,INCOME_ID,MONEY,LOT_NUMBER")] SALES_LOT sALES_LOT)
        {
            if (ModelState.IsValid)
            {
                db.SALES_LOT.Add(sALES_LOT);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.INCOME_ID = new SelectList(db.INCOME, "INCOME_ID", "TYPE", sALES_LOT.INCOME_ID);
            return(View(sALES_LOT));
        }
Exemple #11
0
        public JsonResult Create01(string para01, string para02, string para03, string para04, string para05, string para06, string para07)
        {
            string stock_id   = para01;
            string bat_id     = para02;
            string plan_id    = para03;
            string pro_date   = para04;
            string expense_id = para05;
            string stock_num  = para06;
            string stock_date = para07;


            int num;

            int.TryParse(stock_num, out num);
            DateTime x = Convert.ToDateTime(stock_date);
            DateTime y = Convert.ToDateTime(pro_date);

            PRODUCT pRODUCT    = db.PRODUCT.Find(bat_id);
            PLAN    pLAN       = db.PLAN.Find(plan_id);
            PRODUCT newProduct = new PRODUCT();

            newProduct.PRODUCT_ID   = pLAN.PRODUCT_ID;
            newProduct.SHEIF_ID     = "0";
            newProduct.DISCOUNT     = 1;
            newProduct.BATCH_ID     = bat_id;
            newProduct.BATCH_NUMBER = num;
            newProduct.PRODUCT_DATE = y;
            if (pRODUCT == null)
            {
                db.PRODUCT.Add(newProduct);
                db.SaveChanges();
            }

            STOCK sTOCK    = db.STOCK.Find(stock_id);
            STOCK newStock = new STOCK();

            newStock.STOCK_ID   = stock_id;
            newStock.BATCH_ID   = bat_id;
            newStock.EXPENSE_ID = expense_id;
            newStock.STOCK_NUM  = num;
            newStock.STOCK_DATE = x;
            newStock.PLAN_ID    = plan_id;

            if (sTOCK == null)
            {
                db.STOCK.Add(newStock);
                db.SaveChanges();
            }

            var list = db.STOCK.Select(n => new { STOCK_ID = n.STOCK_ID, BATCH_ID = n.PRODUCT.BATCH_ID, PRODUCT_ID = n.PRODUCT.PRODUCT_ID, PRODUCT_NAME = n.PRODUCT.PRODUCT_ATTRIBUTE.PRODUCT_NAME, PLAN_ID = n.PLAN_ID, EXPENSE_ID = n.EXPENSE_ID, STOCK_NUM = n.STOCK_NUM, STOCK_DATE = n.STOCK_DATE });

            return(Json(new { code = 0, msg = "", count = 1000, data = list }, JsonRequestBehavior.AllowGet));
        }
Exemple #12
0
        public ActionResult Create([Bind(Include = "BATCH_ID,PRODUCT_ID,PRODUCT_DATE,DISCOUNT,BATCH_NUMBER")] PRODUCT pRODUCT)
        {
            if (ModelState.IsValid)
            {
                db.PRODUCT.Add(pRODUCT);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.PRODUCT_ID = new SelectList(db.PRODUCT_ATTRIBUTE, "PRODUCT_ID", "SUPPLIER_ID", pRODUCT.PRODUCT_ID);
            return(View(pRODUCT));
        }
Exemple #13
0
        public ActionResult Create([Bind(Include = "EXPENSE_ID,EMPLOYEE_ID,SALARY_DATE")] SALARY sALARY)
        {
            if (ModelState.IsValid)
            {
                db.SALARY.Add(sALARY);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.EMPLOYEE_ID = new SelectList(db.EMPLOYEE, "EMPLOYEE_ID", "EMPLOYEE_NAME", sALARY.EMPLOYEE_ID);
            ViewBag.EXPENSE_ID  = new SelectList(db.EXPENSE, "EXPENSE_ID", "TYPE", sALARY.EXPENSE_ID);
            return(View(sALARY));
        }
Exemple #14
0
        public ActionResult Create([Bind(Include = "SPONSOR_ID,INCOME_ID,SUPPORT_DATE,MONEY")] SUPPORT sUPPORT)
        {
            if (ModelState.IsValid)
            {
                db.SUPPORT.Add(sUPPORT);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.INCOME_ID  = new SelectList(db.INCOME, "INCOME_ID", "TYPE", sUPPORT.INCOME_ID);
            ViewBag.SPONSOR_ID = new SelectList(db.SPONSOR, "SPONSOR_ID", "SPONSOR_NAME", sUPPORT.SPONSOR_ID);
            return(View(sUPPORT));
        }
Exemple #15
0
        public ActionResult Create([Bind(Include = "STOCK_ID,BATCH_ID,PLAN_ID,EXPENSE_ID,STOCK_NUM,STOCK_DATE")] STOCK sTOCK)
        {
            if (ModelState.IsValid)
            {
                db.STOCK.Add(sTOCK);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.EXPENSE_ID = new SelectList(db.EXPENSE, "EXPENSE_ID", "TYPE", sTOCK.EXPENSE_ID);
            ViewBag.PLAN_ID    = new SelectList(db.PLAN, "PLAN_ID", "PRODUCT_ID", sTOCK.PLAN_ID);
            ViewBag.BATCH_ID   = new SelectList(db.PRODUCT, "BATCH_ID", "PRODUCT_ID", sTOCK.BATCH_ID);
            return(View(sTOCK));
        }
        public JsonResult Edit(string para01, string para02, string para03, string para04, string para05, string para06)
        {
            string v_id    = para01;
            string name    = para02;
            string sex     = para03;
            string phone   = para04;
            string credits = para05;
            string e_id    = para06;

            int intCredits;

            int.TryParse(credits, out intCredits);

            /*
             * if (id == null)
             * {
             *  return Json(null);
             * }
             */
            VIP vIP = db.VIP.Find(v_id);

            /*
             * if (eMPLOYEE == null)
             * {
             *  //return Json(null);
             * }
             */
            vIP.VIP_NAME     = name;
            vIP.SEX          = sex;
            vIP.PHONE_NUMBER = phone;
            vIP.CREDITS      = intCredits;
            vIP.EMPLOYEE_ID  = e_id;

            db.Entry(vIP).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (Exception ex)
            {
                throw;
            }

            var list = db.VIP.Select(n => new { VIP_ID = n.VIP_ID, VIP_NAME = n.VIP_NAME, SEX = n.SEX, PHONE_NUMBER = n.PHONE_NUMBER, CREDITS = n.CREDITS, EMPLOYEE_ID = n.EMPLOYEE_ID });

            return(Json(new { code = 0, msg = "", count = 1000, data = list }));
        }
        public JsonResult Create(string para01, string para02, string para03)
        {
            string employee_id = para01;
            string expense_id  = para02;
            string date        = para03;

            SALARY newSalary = new SALARY();

            newSalary.EXPENSE_ID  = expense_id;
            newSalary.EMPLOYEE_ID = employee_id;
            newSalary.SALARY_DATE = Convert.ToDateTime(date);

            EMPLOYEE myEmployee = db.EMPLOYEE.Find(employee_id);
            EXPENSE  myExpense  = db.EXPENSE.Find(expense_id);

            myExpense.MONEY           = myExpense.MONEY + myEmployee.SALARY;
            db.Entry(myExpense).State = EntityState.Modified;

            db.SALARY.Add(newSalary);
            db.SaveChanges();

            var list = db.SALARY.Include(s => s.EMPLOYEE).Include(s => s.EXPENSE).Select(n => new { EMPLOYEE_ID = n.EMPLOYEE_ID, EMPLOYEE_NAME = n.EMPLOYEE.EMPLOYEE_NAME, SALARY_DATE = n.SALARY_DATE, SALARY = n.EMPLOYEE.SALARY, EXPENSE_ID = n.EXPENSE_ID });

            return(Json(new { code = 0, msg = "", count = 1000, data = list }, JsonRequestBehavior.AllowGet));
        }
        public JsonResult createShelf(string para01, string para02)
        {
            string shelf_id   = para01;
            string shelf_area = para02;

            SHELF newShelf = new SHELF();

            newShelf.SHELF_ID   = shelf_id;
            newShelf.SHELF_AREA = shelf_area;
            db.SHELF.Add(newShelf);
            db.SaveChanges();

            var list2 = db.SHELF.Where(n => n.SHELF_ID != "0").Select(n => new { SHELF_ID = n.SHELF_ID, SHELF_AREA = n.SHELF_AREA });

            return(Json(new { code = 0, msg = "", count = 1000, data = list2 }, JsonRequestBehavior.AllowGet));
        }
Exemple #19
0
        public JsonResult creatRecord(string para01, string para02, string para03)
        {
            var b_id = para01;
            int num;

            int.TryParse(para02, out num);
            var date = Convert.ToDateTime(para03);

            SALES_LOT sALES_LOT = new SALES_LOT();

            PRODUCT pRODUCT = db.PRODUCT.Find(b_id);

            sALES_LOT.PRODUCT = pRODUCT;
            PRODUCT_ATTRIBUTE pRODUCT_ATTRIBUTE = db.PRODUCT_ATTRIBUTE.Find(pRODUCT.PRODUCT_ID);


            sALES_LOT.BATCH_ID           = b_id;
            sALES_LOT.PRODUCT.PRODUCT_ID = pRODUCT.PRODUCT_ID;
            sALES_LOT.PRODUCT.PRODUCT_ATTRIBUTE.PRODUCT_NAME = pRODUCT_ATTRIBUTE.PRODUCT_NAME;
            sALES_LOT.LOT_NUMBER = num;
            sALES_LOT.MONEY      = num * pRODUCT_ATTRIBUTE.SELL_PRICE * pRODUCT.DISCOUNT;
            sALES_LOT.LOT_DATE   = date;

            db.SALES_LOT.Add(sALES_LOT);
            db.SaveChanges();

            var list = db.SALES_LOT.Select(n => new { BATCH_ID = n.BATCH_ID, PRODUCT_ID = n.PRODUCT.PRODUCT_ID, PRODUCT_NAME = n.PRODUCT.PRODUCT_ATTRIBUTE.PRODUCT_NAME, LOT_NUMBER = n.LOT_NUMBER, MONEY = n.MONEY, LOT_DATE = n.LOT_DATE });

            return(Json(new { code = 0, msg = "", count = 1000, data = list }, JsonRequestBehavior.AllowGet));
        }
Exemple #20
0
        public JsonResult Create(string para01, string para02, string para03, string para04, string para05, string para06, string para07)
        {
            string p_id    = para01;
            string name    = para02;
            string s_id    = para03;
            string p_price = para04;
            string s_price = para05;
            string exp     = para06;
            string total   = para07;

            int p_p;

            int.TryParse(p_price, out p_p);
            int s_p;

            int.TryParse(s_price, out s_p);
            int int_exp;

            int.TryParse(exp, out int_exp);
            int int_tot;

            int.TryParse(total, out int_tot);

            PRODUCT_ATTRIBUTE pRODUCT_ATTRIBUTE = db.PRODUCT_ATTRIBUTE.Find(p_id);

            PRODUCT_ATTRIBUTE newPRODUCT_ATTRIBUTE = new PRODUCT_ATTRIBUTE();

            newPRODUCT_ATTRIBUTE.PRODUCT_ID     = p_id;
            newPRODUCT_ATTRIBUTE.PRODUCT_NAME   = name;
            newPRODUCT_ATTRIBUTE.SUPPLIER_ID    = s_id;
            newPRODUCT_ATTRIBUTE.PURCHASE_PRICE = p_p;
            newPRODUCT_ATTRIBUTE.SELL_PRICE     = s_p;
            newPRODUCT_ATTRIBUTE.EXP            = int_exp;
            newPRODUCT_ATTRIBUTE.TOTAL          = int_tot;

            if (pRODUCT_ATTRIBUTE == null)
            {
                db.PRODUCT_ATTRIBUTE.Add(newPRODUCT_ATTRIBUTE);
                db.SaveChanges();
            }

            var list = db.PRODUCT_ATTRIBUTE.Select(n => new { PRODUCT_ID = n.PRODUCT_ID, PRODUCT_NAME = n.PRODUCT_NAME, SUPPLIER_ID = n.SUPPLIER_ID, PURCHASE_PRICE = n.PURCHASE_PRICE, SELL_PRICE = n.SELL_PRICE, EXP = n.EXP, TOTAL = n.TOTAL });

            return(Json(new { code = 0, msg = "", count = 1000, data = list }, JsonRequestBehavior.AllowGet));
        }
Exemple #21
0
        public JsonResult EditAllDiscount(string para01, string para02)
        {
            string product_id = para01;

            decimal discount;

            decimal.TryParse(para02, out discount);
            discount = discount / 100;


            var myProduct = db.PRODUCT.Where(n => n.PRODUCT_ID == product_id);

            foreach (var x in myProduct)
            {
                PRODUCT testProduct = db.PRODUCT.Find(x.BATCH_ID);
                testProduct.BATCH_ID        = x.BATCH_ID;
                testProduct.PRODUCT_ID      = x.PRODUCT_ID;
                testProduct.PRODUCT_DATE    = x.PRODUCT_DATE;
                testProduct.BATCH_NUMBER    = x.BATCH_NUMBER;
                testProduct.SHEIF_ID        = x.SHEIF_ID;
                db.Entry(testProduct).State = EntityState.Modified;
                db.SaveChanges();
            }



            try
            {
                db.SaveChanges();
            }
            catch (Exception ex)
            {
                throw;
            }

            var list1 = db.PRODUCT.Include(n => n.PRODUCT_ATTRIBUTE).Select(n => new { BATCH_ID = n.BATCH_ID, PRODUCT_ID = n.PRODUCT_ID, PRODUCT_NAME = n.PRODUCT_ATTRIBUTE.PRODUCT_NAME, DISCOUNT = n.DISCOUNT });

            return(Json(new { code = 0, msg = "", count = 1000, data = list1 }, JsonRequestBehavior.AllowGet));
        }
Exemple #22
0
        public JsonResult Create01(string para01, string para02, string para03)
        {
            string id     = para01;
            string name   = para02;
            string number = para03;

            SUPPLIER sUPPLIER    = db.SUPPLIER.Find(id);
            SUPPLIER newSupplier = new SUPPLIER();

            newSupplier.SUPPLIER_ID   = id;
            newSupplier.SUPPLIER_NAME = name;
            newSupplier.PHONE_NUMBER  = number;


            if (sUPPLIER == null)
            {
                db.SUPPLIER.Add(newSupplier);
                db.SaveChanges();
            }

            var list = db.SUPPLIER.Select(n => new { SUPPLIER_ID = n.SUPPLIER_ID, SUPPLIER_NAME = n.SUPPLIER_NAME, PHONE_NUMBER = n.PHONE_NUMBER });

            return(Json(new { code = 0, msg = "", count = 1000, data = list }, JsonRequestBehavior.AllowGet));
        }