Example #1
0
        public ActionResult CreateThreeLevel(ThreeLevelModel tm)
        {
            OneLevelModel oneid = new OneLevelModel()
            {
                first_kind_id = tm.first_kind_id
            };

            TwoLevelModel twoid = new TwoLevelModel()
            {
                second_kind_id = tm.second_kind_id
            };
            List <OneLevelModel> list  = tb1.SeleteByx(oneid);
            List <TwoLevelModel> list2 = tb2.SeleteByx(twoid);
            ThreeLevelModel      tm2   = new ThreeLevelModel()
            {
                first_kind_id        = tm.first_kind_id,
                first_kind_name      = list[0].first_kind_name,
                second_kind_id       = tm.second_kind_id,
                second_kind_name     = list2[0].second_kind_name,
                third_kind_id        = tm.third_kind_id,
                third_kind_is_retail = tm.third_kind_is_retail,
                third_kind_name      = tm.third_kind_name,
                third_kind_sale_id   = tm.third_kind_sale_id
            };
            int num = tb.Add(tm2);

            if (num > 0)
            {
                return(RedirectToAction("ThreeLevel_Create_success"));
            }
            else
            {
                return(View());
            }
        }
Example #2
0
 public ActionResult Create(ThreeLevelModel tm)
 {
     FirstName();
     SecondName();
     seleitem();
     return(View());
 }
Example #3
0
        public int Delete(ThreeLevelModel c)
        {
            ThreeLevel oe = new ThreeLevel()
            {
                Id = c.Id
            };

            return(Delete(oe));
        }
Example #4
0
        public ActionResult Edit(ThreeLevelModel tm)
        {
            int num = tb.Update(tm);

            if (num > 0)
            {
                return(RedirectToAction("ThreeLevel_Change_success"));
            }
            else
            {
                ViewBag.dt = tm;
                return(View());
            }
        }
Example #5
0
        public int Update(ThreeLevelModel c)
        {
            ThreeLevel oe = new ThreeLevel()
            {
                Id                   = c.Id,
                first_kind_id        = c.first_kind_id,
                first_kind_name      = c.first_kind_name,
                second_kind_id       = c.second_kind_id,
                second_kind_name     = c.second_kind_name,
                third_kind_id        = c.third_kind_id,
                third_kind_is_retail = c.third_kind_is_retail,
                third_kind_name      = c.third_kind_name,
                third_kind_sale_id   = c.third_kind_sale_id
            };

            return(Update(oe));
        }
Example #6
0
        public ActionResult Edit(string id)
        {
            seleitem();
            ThreeLevelModel om = new ThreeLevelModel()
            {
                Id = int.Parse(id)
            };
            List <ThreeLevelModel> list = tb.SeleteBys(om);
            ThreeLevelModel        oo   = new ThreeLevelModel()
            {
                Id                   = list[0].Id,
                first_kind_id        = list[0].first_kind_id,
                first_kind_name      = list[0].first_kind_name,
                second_kind_id       = list[0].second_kind_id,
                second_kind_name     = list[0].second_kind_name,
                third_kind_sale_id   = list[0].third_kind_sale_id,
                third_kind_is_retail = list[0].third_kind_is_retail,
                third_kind_id        = list[0].third_kind_id,
                third_kind_name      = list[0].third_kind_name
            };

            return(View(oo));
        }
Example #7
0
        List <ThreeLevelModel> IThreeLevelDao.QueryAll()
        {
            List <ThreeLevel>      list  = QueryAll();
            List <ThreeLevelModel> list2 = new List <ThreeLevelModel>();

            foreach (ThreeLevel item in list)
            {
                ThreeLevelModel om = new ThreeLevelModel()
                {
                    Id                   = item.Id,
                    first_kind_id        = item.first_kind_id,
                    first_kind_name      = item.first_kind_name,
                    second_kind_id       = item.second_kind_id,
                    second_kind_name     = item.second_kind_name,
                    third_kind_id        = item.third_kind_id,
                    third_kind_sale_id   = item.third_kind_sale_id,
                    third_kind_name      = item.third_kind_name,
                    third_kind_is_retail = item.third_kind_is_retail
                };
                list2.Add(om);
            }
            return(list2);
        }
Example #8
0
        public List <ThreeLevelModel> SeleteBys(ThreeLevelModel om)
        {
            List <ThreeLevel>      list  = SelectByx(e => e.Id.Equals(om.Id));
            List <ThreeLevelModel> list2 = new List <ThreeLevelModel>();

            foreach (ThreeLevel item in list)
            {
                ThreeLevelModel oo = new ThreeLevelModel()
                {
                    Id                   = item.Id,
                    first_kind_id        = item.first_kind_id,
                    first_kind_name      = item.first_kind_name,
                    second_kind_id       = item.second_kind_id,
                    second_kind_name     = item.second_kind_name,
                    third_kind_id        = item.third_kind_id,
                    third_kind_sale_id   = item.third_kind_sale_id,
                    third_kind_name      = item.third_kind_name,
                    third_kind_is_retail = item.third_kind_is_retail
                };
                list2.Add(oo);
            }
            return(list2);
        }
Example #9
0
        public ActionResult Delete(string id)
        {
            try
            {
                ThreeLevelModel od = new ThreeLevelModel()
                {
                    Id = int.Parse(id)
                };

                int num = tb.Delete(od);
                if (num > 0)
                {
                    return(Content("ok"));
                }
                else
                {
                    return(Content("on"));
                }
            }
            catch
            {
                return(View());
            }
        }
Example #10
0
 public int Update(ThreeLevelModel c)
 {
     return(td.Update(c));
 }
Example #11
0
 public List <ThreeLevelModel> SeleteBys(ThreeLevelModel om)
 {
     return(td.SeleteBys(om));
 }
Example #12
0
 public int Delete(ThreeLevelModel c)
 {
     return(td.Delete(c));
 }
Example #13
0
 public int Add(ThreeLevelModel c)
 {
     return(td.Add(c));
 }