Ejemplo n.º 1
0
        public ActionResult ProUpdateClass(FormCollection formCollection)
        {
            // 1. 取得formCollection資訊
            System.Diagnostics.Debug.WriteLine(" >>>> ProUpdateClass -------------------------->>>> ");
            System.Diagnostics.Debug.WriteLine(" >>>> ProUpdateClass app_ser: " + formCollection["app_ser"]);
            System.Diagnostics.Debug.WriteLine(" >>>> ProUpdateClass clasee_No: " + formCollection["pro_class_no"]);
            System.Diagnostics.Debug.WriteLine(" >>>> ProUpdateClass clasee_Name: " + formCollection["pro_class_name"]);
            System.Diagnostics.Debug.WriteLine(" >>>> ProUpdateClass clasee_desc: " + formCollection["pro_class_desc"]);
            System.Diagnostics.Debug.WriteLine(" >>>> ProUpdateClass class_active: " + formCollection["class_active"]);

            Models.ShopCarDatasetTableAdapters.Product_ClassTableAdapter classadp = new Models.ShopCarDatasetTableAdapters.Product_ClassTableAdapter();

            // 2. 將欄位存到資料庫
            classadp.UpdateClassData(formCollection["pro_class_no"], formCollection["pro_class_name"], formCollection["pro_class_desc"], formCollection["class_active"], Convert.ToInt32(formCollection["app_ser"]));

            // 3. Redirect ProClass
            return RedirectToAction("ProClass");
        }
Ejemplo n.º 2
0
        public ActionResult ProCreateClass(FormCollection formCollection)
        {
            // 1. 取得formCollection資訊
            // 1. 取得前端 form 的欄位資料
            System.Diagnostics.Debug.WriteLine(" >>>> ProCreateClass -------------------------->>>> ");
            System.Diagnostics.Debug.WriteLine(" >>>> ProCreateClass clasee_No: " + formCollection["pro_class_no"]);
            System.Diagnostics.Debug.WriteLine(" >>>> ProCreateClass clasee_Name: " + formCollection["pro_class_name"]);
            System.Diagnostics.Debug.WriteLine(" >>>> ProCreateClass clasee_desc: " + formCollection["pro_class_desc"]);

            // 因為是新增calss, 故將class_active預設為on
            Models.ShopCarDatasetTableAdapters.Product_ClassTableAdapter classadp = new Models.ShopCarDatasetTableAdapters.Product_ClassTableAdapter();

            // 2. 將欄位存到資料庫
            classadp.InsertProClass(formCollection["pro_class_no"], formCollection["pro_class_name"], formCollection["pro_class_desc"], "on");

            // 3. Redirect ProClass
            return RedirectToAction("ProClass");
        }
Ejemplo n.º 3
0
        // 產品分類資料
        public ActionResult GetProClassList()
        {
            // 1. 取得所有分類
            //----->
            Models.ShopCarDatasetTableAdapters.Product_ClassTableAdapter classadp = new Models.ShopCarDatasetTableAdapters.Product_ClassTableAdapter();
            DataTable dt = classadp.GetData();

            // 2. 將資料塞到 arraylist
            ArrayList list = new ArrayList();

            foreach (DataRow drow in dt.Rows)
            {
                var prodClass = new
                {
                    app_ser = wf.tos(drow["app_ser"]),
                    pro_class_no = wf.tos(drow["pro_class_no"]),
                    pro_class_name = wf.tos(drow["pro_class_name"]),
                    pro_class_desc = wf.tos(drow["pro_class_desc"]),
                    class_active = wf.tos(drow["class_active"])
                };
                list.Add(prodClass);

            }

            // 3. 將 arraylist 放到Hashtable
            Hashtable myHT = new Hashtable();

            myHT.Add("classList", list);

            // 3. 回傳json
            return Json(myHT, JsonRequestBehavior.AllowGet);
        }
Ejemplo n.º 4
0
        public ActionResult ProClasDelete(FormCollection formCollection)
        {
            System.Diagnostics.Debug.WriteLine(" >>>> ProClasDelete -------------------------->>>> ");
            System.Diagnostics.Debug.WriteLine(" >>>> ProClasDelete app_ser: " + formCollection["app_ser"]);

            Int32 appser = Convert.ToInt32(formCollection["app_ser"]);
            // 1. 刪除該appser產品
            //----> 程式碼

            Models.ShopCarDatasetTableAdapters.Product_ClassTableAdapter classadp = new Models.ShopCarDatasetTableAdapters.Product_ClassTableAdapter();

            classadp.DeleteClassData(appser);

            // 2. Return pro_list
            return RedirectToAction("ProClass");
        }
Ejemplo n.º 5
0
        // 取得單一產品分類資料
        public ActionResult GetProClassItem(string app_ser)
        {
            System.Diagnostics.Debug.WriteLine(" >>>> GetProClassItem -------------------------->>>> ");
            System.Diagnostics.Debug.WriteLine(" >>>> app_serxxx : " + app_ser);

            Models.ShopCarDatasetTableAdapters.Product_ClassTableAdapter classadp = new Models.ShopCarDatasetTableAdapters.Product_ClassTableAdapter();
            DataTable dt = classadp.GetOneClassData(Convert.ToInt32(app_ser));

            ArrayList list = new ArrayList();

            foreach (DataRow drow in dt.Rows)
            {
                var prodClass = new
                {
                    app_ser = wf.tos(drow["app_ser"]),
                    pro_class_no = wf.tos(drow["pro_class_no"]),
                    pro_class_name = wf.tos(drow["pro_class_name"]),
                    pro_class_desc = wf.tos(drow["pro_class_desc"]),
                    class_active = wf.tos(drow["class_active"])
                };

                System.Diagnostics.Debug.WriteLine(" >>>> class name: : " + prodClass.pro_class_name);
                list.Add(prodClass);

            }

            Hashtable myHT = new Hashtable();
            myHT.Add("classItem", list);

            //return Json(myHT);
            return Json(myHT, JsonRequestBehavior.AllowGet);
        }