Exemplo 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"));
        }
Exemplo n.º 2
0
 public ActionResult EditUser(t_siz_users good)
 {
     if (good.department == 0)
     {
         good.department = null;
     }
     repository.AddUser(good);
     return(RedirectToAction("UserList"));
 }
Exemplo n.º 3
0
 public ActionResult CreateGood(t_siz_goods good)
 {
     currentuser = GetUserAu();
     good.author = currentuser.login;
     good.date   = DateTime.Now;
     //УКАЗАТЬ ОТДЕЛ
     repository.AddGood(good);
     repository.InitSize(good);
     return(RedirectToAction("Print"));
 }
Exemplo n.º 4
0
        public ActionResult EditGood(t_siz_goods good)
        {
            currentuser = GetUserAu();
            good.author = currentuser.login;
            good.date   = DateTime.Now;
            long oldid = good.id;

            repository.AddGood(good);
            repository.InitSize(good, oldid);
            return(RedirectToAction("Print"));
        }
Exemplo n.º 5
0
        public ActionResult RejectOrder(long id)
        {
            currentuser = GetUserAu();
            t_siz_orders_mas matrix = repository.GetById(id, typeof(t_siz_orders_mas).ToString()) as t_siz_orders_mas;

            matrix.acceptor     = currentuser.id;
            matrix.accepted     = 2;
            matrix.dateaccepted = System.DateTime.Now;
            repository.EditMatrix(matrix);
            return(RedirectToAction("OrdersMatrix"));
        }
Exemplo n.º 6
0
        public ActionResult OrdersItems(string id)
        {
            currentuser  = GetUserAu();
            ViewBag.Role = style;
            long        identificator = long.Parse(id);
            List <long> val           = repository.OrdersItems.Where(p => p.order == identificator).Select(t => t.order_item).ToList();

            ViewBag.Ident       = identificator;
            ViewBag.OrderStatus = (repository.GetById(identificator, typeof(t_siz_orders_mas).ToString()) as t_siz_orders_mas).accepted;
            return(PartialView("OrdersItems", repository.SIZOrdersList.Where(p => val.Contains(p.id) && p.deleted != 1).OrderBy(t => t.t_siz_goods.name)));
        }
Exemplo n.º 7
0
 public ViewResult OrdersMatrix(int open = 0)
 {
     currentuser       = GetUserAu();
     ViewBag.Role      = style;
     ViewBag.OpenOrder = open;
     if (style == "User.css")
     {
         return(View(repository.SIZOrdersMatrix.Where(p => p.deleted != 1 && p.department == currentuser.department)));
     }
     else
     {
         return(View(repository.SIZOrdersMatrix.Where(p => p.deleted != 1).OrderBy(t => t.t_siz_department.name)));
     }
 }
Exemplo n.º 8
0
        public ActionResult CreateOrder(string id = "0")//Добавление лота
        {
            currentuser = GetUserAu();
            if (currentuser.department == null)
            {
                return(PartialView("Wrong"));
            }

            long        identificator = long.Parse(id);
            List <long> allowedgood;

            if (style == "User.css")
            {
                allowedgood = new List <long>(repository.DepGood.Where(p => p.department == currentuser.department).Select(t => t.good));
            }
            else
            {
                allowedgood = new List <long>(repository.SIZGoodsList.Where(p => p.deleted != 1).Select(s => s.id));
            }
            ViewBag.Ident = identificator;//ID заявки
            int selectIndex          = 0;
            List <t_siz_goods> goods = new List <t_siz_goods>(repository.SIZGoodsList.Where(p => p.deleted != 1 && allowedgood.Contains(p.id)).OrderBy(t => t.name));

            //goods.Add(new t_siz_goods() { id = 0, name = string.Empty });
            foreach (var t in goods)
            {
                t.name = t.code + " ----- " + t.name;
            }
            SelectList Goods = new SelectList(goods, "id", "name");

            ViewBag.Goods = Goods;
            List <long>             lgs  = repository.GoodSize.Where(s => s.good == selectIndex).Select(p => p.size).ToList();
            List <t_siz_goods_size> size = new List <t_siz_goods_size>(repository.SIZSizeList.Where(p => lgs.Contains(p.id)));
            //size.Add(new t_siz_goods_size() { id = 0, size = string.Empty });
            SelectList Sizes = new SelectList(size, "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("CreateOrder", new t_siz_orders()));
        }
Exemplo n.º 9
0
 public void AddUser(t_siz_users user)
 {
     if (user.id == 0)
         context.t_siz_users.Add(user);
     else
     {
         t_siz_users dbEbtry = context.t_siz_users.Find(user.id);
         if (dbEbtry != null)
         {
             dbEbtry.department = user.department;
             dbEbtry.role = user.role;
         }
     }
     context.SaveChanges();
 }
Exemplo n.º 10
0
        public ActionResult CreateGood()
        {
            currentuser = GetUserAu();
            int        selectIndex = 1;
            SelectList Goods       = new SelectList(repository.SIZGoodsList, "id", "name", selectIndex);

            ViewBag.Goods = Goods;
            SelectList Mans = new SelectList(repository.SIZManList, "id", "name", selectIndex);

            ViewBag.Mans = Mans;
            SelectList Sizes = new SelectList(repository.SIZSizeType, "id", "name");

            ViewBag.Sizes = Sizes;
            return(PartialView("CreateGood"));
        }
Exemplo n.º 11
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"));
        }
Exemplo n.º 12
0
        public ActionResult DeleteCurrentGood(long id)
        {
            currentuser = GetUserAu();
            t_siz_goods current = repository.GetById(id, typeof(t_siz_goods).ToString()) as t_siz_goods;

            if (current != null)
            {
                current.author  = currentuser.login;
                current.date    = DateTime.Now;
                current.deleted = 1;
                //УКАЗАТЬ ОТДЕЛ
                repository.AddGood(current);
                return(RedirectToAction("Print"));
            }
            else
            {
                return(PartialView("Error"));
            }
        }
Exemplo n.º 13
0
        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"));
        }
Exemplo n.º 14
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"));
        }
Exemplo n.º 15
0
        public ActionResult CreateOrder()
        {
            currentuser = GetUserAu();

            if (currentuser.department == null)
            {
                return(PartialView("Wrong"));
            }
            int selectIndex          = 0;
            List <t_siz_goods> goods = new List <t_siz_goods>(repository.SIZGoodsList.Where(p => p.deleted != 1));
            //goods.Add(new t_siz_goods() { id = 0, name = string.Empty });
            SelectList Goods = new SelectList(goods, "id", "name");

            ViewBag.Goods = Goods;
            List <long>             lgs  = repository.GoodSize.Where(s => s.good == selectIndex).Select(p => p.size).ToList();
            List <t_siz_goods_size> size = new List <t_siz_goods_size>(repository.SIZSizeList.Where(p => lgs.Contains(p.id)));
            //size.Add(new t_siz_goods_size() { id = 0, size = string.Empty });
            SelectList Sizes = new SelectList(size, "id", "size");

            ViewBag.Sizes = Sizes;
            return(PartialView("CreateOrder"));
        }
Exemplo n.º 16
0
        /// //////////////////////////////////////////////////////////////////////////////////////
        #region Заявки
        public ViewResult Orders()
        {
            currentuser  = GetUserAu();
            ViewBag.POLZ = currentuser.login;
            ViewBag.Role = style;
            int        selectIndex = 1;
            SelectList Goods       = new SelectList(repository.SIZGoodsList, "id", "name", selectIndex);

            ViewBag.Goods = Goods;
            SelectList Sizes = new SelectList(repository.SIZSizeList, "id", "size", selectIndex);

            ViewBag.Sizes = Sizes;
            ViewBag.User  = currentuser.name;
            if (style == "User.css")
            {
                return(View(repository.SIZOrdersList.Where(t => t.deleted != 1).Where(p => p.department == currentuser.department)));
            }
            else
            {
                return(View(repository.SIZOrdersList.Where(t => t.deleted != 1)));
            }
        }
Exemplo n.º 17
0
        public ActionResult AddUser(string user)
        {
            DirectorySearcher dssearch = new DirectorySearcher("LDAP://gz.local");

            dssearch.Filter = "(mail=" + user + ")";
            SearchResult sresult = dssearch.FindOne();

            if (sresult != null)
            {
                DirectoryEntry dsresult = sresult.GetDirectoryEntry();
                String         email    = dsresult.Properties["mail"][0].ToString().Split('@')[0];
                t_siz_users    usera    = new t_siz_users()
                {
                    login = email, system = "SIZ", name = dsresult.Properties["displayName"][0].ToString()
                };
                repository.AddUser(usera);
            }
            else
            {
                return(PartialView("Error"));
            }
            return(RedirectToAction("UserList"));
        }
Exemplo n.º 18
0
        public t_siz_users GetUserAu()
        {
            string cur = System.Security.Principal.WindowsIdentity.GetCurrent().Name.ToLower().Split('\\')[1];
            //cur = "GRADSKIY_R_I".ToLower();
            t_siz_users cuser = repository.SIZUsersList.Where(p => p.login.ToLower() == cur).FirstOrDefault();

            paramet = repository.SIZParameters;
            switch (cuser.role)
            {
            case "Администратор": style = "Admin.css"; break;

            case "Руководитель": style = "Manager.css"; break;

            case "Пользователь": style = "User.css"; break;

            default: style = "User.css"; break;
            }
            if (paramet.admin.ToLower() == cuser.login.ToLower() || paramet.admin2.ToLower() == cuser.login.ToLower())
            {
                style = "Admin.css";
            }
            return(cuser);
        }
Exemplo n.º 19
0
        public ActionResult EditUser(long id)
        {
            currentuser = GetUserAu();
            t_siz_users current = repository.GetById(id, typeof(t_siz_users).ToString()) as t_siz_users;

            if (current != null)
            {
                List <t_siz_department> dept = repository.SIZDepartmentList.ToList();
                dept.Add(new t_siz_department()
                {
                    id = 0, name = String.Empty
                });
                ViewBag.Dept = new SelectList(dept, "id", "name", current.department != null?current.department:0);
                List <string> roles;
                if (style == "Admin.css")
                {
                    roles = new List <string>()
                    {
                        "Администратор", "Руководитель", "Пользователь", string.Empty
                    }
                }
                ;
                else
                {
                    roles = new List <string>()
                    {
                        "Руководитель", "Пользователь", string.Empty
                    }
                };
                ViewBag.Roles = new SelectList(roles, current.role != null ? current.role : string.Empty);
                return(PartialView("EditUser", current));
            }
            else
            {
                return(PartialView("Error"));
            }
        }
Exemplo n.º 20
0
 public ActionResult SendOrderAccept(long id)
 {
     currentuser = GetUserAu();
     repository.SendToManager(id, currentuser.id);
     return(RedirectToAction("OrdersMatrix"));
 }