Пример #1
0
        public ActionResult RaiseRequisition()
        {
            string    error = "";
            string    token = GetToken();
            UserModel um    = GetUser();
            DepartmentCollectionPointModel dcpm = new DepartmentCollectionPointModel();
            List <ItemModel>     ItemsList      = new List <ItemModel>();
            RequisitionViewModel reqvm          = new RequisitionViewModel();

            try
            {
                reqvm.Reqdate     = DateTime.Now;
                reqvm.Raisedby    = um.Userid;
                reqvm.Depid       = um.Deptid;
                dcpm              = APICollectionPoint.GetActiveDepartmentCollectionPointByDeptID(token, um.Deptid, out error);
                reqvm.Cpid        = dcpm.CpID;
                reqvm.Cpname      = dcpm.CpName;
                reqvm.Status      = ConRequisition.Status.PENDING;
                ItemsList         = APIItem.GetAllItems(token, out error);
                ViewBag.ItemsList = ItemsList;
            }
            catch (Exception ex)
            {
                return(RedirectToAction("Index", "Error", new { error = ex.Message }));
            }
            return(View(reqvm));
        }
        public ActionResult ItemUsageReport()
        {
            string        token = GetToken();
            SupplierModel sm    = new SupplierModel();
            string        error = "";

            UserModel um = GetUser();

            ViewBag.SupplierModel = sm;
            MonthlyItemUsageViewModel viewmodel = new MonthlyItemUsageViewModel();
            List <SupplierModel>      sml       = new List <SupplierModel>();

            sml = APISupplier.GetAllSuppliers(token, out error);

            try
            {
                //ViewBag.SupplierModel = APISupplier.GetAllSuppliers(token, out error);
                ViewBag.count       = 0;
                viewmodel.supplier1 = sm.SupId;
                viewmodel.supplier2 = sm.SupId;
                viewmodel.supplier3 = sm.SupId;
                List <int> suppliername = new List <int>();

                ViewBag.supplier = sml;

                foreach (SupplierModel s in sml)
                {
                    suppliername.Add(s.SupId);
                }
                List <SupplierModel> sups = APISupplier.GetAllSuppliers(token, out error);
                ViewBag.slist = sups;
                ViewBag.ilist = APIItem.GetAllItems(token, out error);
            }
            catch (Exception ex)
            {
                return(RedirectToAction("Index", "Error", new
                {
                    error = ex.Message
                }));
            }
            ViewBag.count = 0;
            return(View(viewmodel));
        }