Esempio n. 1
0
        public ActionResult EditOrder(long id, long identificator = 0)
        {
            currentuser = GetUserAu();

            ViewBag.Ident = identificator;
            t_siz_orders current = repository.GetById(id, typeof(t_siz_orders).ToString()) as t_siz_orders;

            if (current != null && currentuser.department != null)
            {
                int        selectIndex = 1;
                SelectList Goods       = new SelectList(repository.SIZGoodsList.Where(p => p.deleted != 1).OrderBy(t => t.name), "id", "name", current.goods);
                ViewBag.Goodss = Goods;
                List <long>             lgs   = repository.GoodSize.Where(s => s.good == current.goods).Select(p => p.size).ToList();
                List <t_siz_goods_size> sizes = new List <t_siz_goods_size>(repository.SIZSizeList.Where(p => lgs.Contains(p.id)));
                //sizes.Add(new t_siz_goods_size() { id = 0, size = string.Empty });
                SelectList Sizes = new SelectList(sizes, "id", "size");
                ViewBag.Sizes = Sizes;
                List <int> q = new List <int>()
                {
                    0, 0, 0, 0
                };
                foreach (var t in paramet.quarter.Split(','))
                {
                    q[int.Parse(t.Trim()) - 1] = 1;
                }
                ViewBag.Quarters = q;
                return(PartialView("EditOrder", current));
            }
            return(PartialView("Error"));
        }
        public ActionResult DeleteCurrentOrder(long id)
        {
            t_siz_orders order = repository.SIZOrdersList.Where(t => t.id == id).First();

            order.deleted = 1;
            repository.AddOrder(order);
            return(RedirectToAction("Orders"));
        }
 public ActionResult EditOrder(t_siz_orders order)
 {
     paramet          = repository.SIZParameters;
     order.date       = DateTime.Now;
     order.year       = paramet.year;
     order.quarter    = paramet.quarter;
     order.month      = DateTime.Now.Month;
     order.department = currentuser.department;
     order.user       = currentuser.id;
     repository.AddOrder(order);
     return(RedirectToAction("Orders"));
 }
Esempio n. 4
0
 public void AddOrder(t_siz_orders order)
 {
     if (order.id == 0)
         context.t_siz_orders.Add(order);
     else
     {
         t_siz_orders dbEbtry = context.t_siz_orders.Find(order.id);
         if (dbEbtry != null)
         {
             dbEbtry.deleted = 1;
             if(order.deleted!=1)
                 context.t_siz_orders.Add(order);
         }
     }
     context.SaveChanges();
 }
Esempio n. 5
0
        public ActionResult EditOrder(t_siz_orders order, string identificator)
        {
            currentuser      = GetUserAu();
            order.date       = DateTime.Now;
            order.year       = paramet.year;
            order.quarter    = paramet.quarter;
            order.month      = DateTime.Now.Month;
            order.department = currentuser.department;
            order.user       = currentuser.id;
            long olditmid = order.id;

            repository.AddOrder(order);
            if (identificator != "0")
            {
                repository.AddOrdersItems(order.id, long.Parse(identificator), olditmid);
                return(RedirectToAction("OrdersMatrix"));
            }
            return(RedirectToAction("Orders"));
        }
        public ActionResult EditOrder(long id)
        {
            currentuser = GetUserAu();

            t_siz_orders current = repository.GetById(id, typeof(t_siz_orders).ToString()) as t_siz_orders;

            if (current != null && currentuser.department != null)
            {
                int        selectIndex = 1;
                SelectList Goods       = new SelectList(repository.SIZGoodsList.Where(p => p.deleted != 1), "id", "name", current.goods);
                ViewBag.Goodss = Goods;
                List <long>             lgs   = repository.GoodSize.Where(s => s.good == current.goods).Select(p => p.size).ToList();
                List <t_siz_goods_size> sizes = new List <t_siz_goods_size>(repository.SIZSizeList.Where(p => lgs.Contains(p.id)));
                //sizes.Add(new t_siz_goods_size() { id = 0, size = string.Empty });
                SelectList Sizes = new SelectList(sizes, "id", "size");
                ViewBag.Sizes = Sizes;
                return(PartialView("EditOrder", current));
            }
            return(PartialView("Error"));
        }
Esempio n. 7
0
        public ActionResult CreateOrder(t_siz_orders order, string matrix = "0")
        {
            currentuser      = GetUserAu();
            order.id         = 0;
            order.date       = DateTime.Now;
            order.year       = paramet.year;
            order.quarter    = paramet.quarter;
            order.month      = DateTime.Now.Month;
            order.department = currentuser.department;
            order.user       = currentuser.id;
            //УКАЗАТЬ ОТДЕЛ
            repository.AddOrder(order);
            long id = long.Parse(matrix);

            if (id != 0)
            {
                repository.AddOrdersItems(order.id, id);
                return(RedirectToAction("OrdersMatrix", new { open = matrix }));
            }
            return(RedirectToAction("Orders"));
        }