コード例 #1
0
        public ActionResult NewEmployee(string name, int?workgroup, string modificator)
        {
            bool res;

            using (DBAgent.DBAgent agent = new DBAgent.DBAgent())
            {
                float mod;
                try
                {
                    mod = float.Parse(modificator);
                }
                catch (Exception ex)
                {
                    return(View("~/Views/Shared/Error.cshtml"));
                }
                res = agent.NewWorker(name, workgroup, mod);
            }
            if (res)
            {
                return(Redirect("/Home/Employees"));
            }
            else
            {
                return(View("~/Views/Shared/Error.cshtml"));
            }
        }
コード例 #2
0
 public ActionResult MaterialReg(string template)
 {
     using (DBAgent.DBAgent agent = new DBAgent.DBAgent())
     {
         ViewBag.material_reg = agent.GetMaterialReg(template);
     }
     return(View());
 }
コード例 #3
0
 public ActionResult GetWageReportAdvance()
 {
     using (DBAgent.DBAgent agent = new DBAgent.DBAgent())
     {
         ViewBag.wages = agent.GetWageReportAdvance(null, null);
     }
     return(View());
 }
コード例 #4
0
 public ActionResult Index()
 {
     using (DBAgent.DBAgent agent = new DBAgent.DBAgent())
     {
         ViewBag.Products = agent.GetProducts(null, null, null, null);
     }
     return(View());
 }
コード例 #5
0
 public ActionResult GetWageReportAdvance(DateTime?startDate, DateTime?endDate)
 {
     using (DBAgent.DBAgent agent = new DBAgent.DBAgent())
     {
         ViewBag.wages = agent.GetWageReportAdvance(startDate, endDate);
     }
     return(View());
 }
コード例 #6
0
 public ActionResult Materials()
 {
     using (DBAgent.DBAgent agent = new DBAgent.DBAgent())
     {
         ViewBag.materials = agent.GetMaterials(null);
     }
     return(View());
 }
コード例 #7
0
 public ActionResult NewProduct()
 {
     using (DBAgent.DBAgent agent = new DBAgent.DBAgent())
     {
         ViewBag.categories = agent.GetProdCategories();
     }
     return(View());
 }
コード例 #8
0
 public ActionResult EditEmployee(int ID)
 {
     using (DBAgent.DBAgent agent = new DBAgent.DBAgent())
     {
         ViewBag.employee   = agent.getEmployee(ID);
         ViewBag.workgroups = agent.GetWorkgroups();
     }
     return(View());
 }
コード例 #9
0
 public ActionResult Money()
 {
     using (DBAgent.DBAgent agent = new DBAgent.DBAgent())
     {
         ViewBag.money  = agent.GetFinancialReport(null, null);
         ViewBag.amount = agent.GetAmountOfMoney();
     }
     return(View());
 }
コード例 #10
0
 public ActionResult NewOrder()
 {
     using (DBAgent.DBAgent agent = new DBAgent.DBAgent())
     {
         ViewBag.products   = agent.GetProducts(null, null, null, null);
         ViewBag.purchasers = agent.getPurchasers();
     }
     return(View());
 }
コード例 #11
0
 public ActionResult Employees(int?workgroup)
 {
     using (DBAgent.DBAgent agent = new DBAgent.DBAgent())
     {
         ViewBag.employees  = agent.GetEmployees(null, workgroup, null, null);
         ViewBag.workgroups = agent.GetWorkgroups();
     }
     return(View());
 }
コード例 #12
0
 public Wage(int EmployeID, int?WorkgroupID, float wage)
 {
     using (DBAgent.DBAgent agent = new DBAgent.DBAgent())
     {
         employee  = agent.getEmployee(EmployeID);
         workgroup = agent.getWorkgroup(employee.workgroupID);
         this.wage = wage;
     }
 }
コード例 #13
0
 public ActionResult Purchasers()
 {
     using (DBAgent.DBAgent agent = new DBAgent.DBAgent())
     {
         List <Purchaser> purchasers = agent.getPurchasers();
         ViewBag.purchasers = purchasers;
     }
     return(View());
 }
コード例 #14
0
 public ActionResult ProductMaterials(string template)
 {
     using (DBAgent.DBAgent agent = new DBAgent.DBAgent())
     {
         ViewBag.Products  = agent.GetProducts(null, null, null, template);
         ViewBag.materials = agent.GetMaterials("");
     }
     return(View());
 }
コード例 #15
0
        public static Purchaser getAuthoriz(string username, string password, DBAgent.DBAgent agent)
        {
            Purchaser purchaser = null;

            if (agent.CheckAuthoriz(username, password))
            {
                purchaser = agent.getPurchaser(username, password);
            }
            return(purchaser);
        }
コード例 #16
0
        private void setAuth(DBAgent.DBAgent agent)
        {
            string username, passwd;

            if (HttpContext.Request.Cookies["username"] != null && HttpContext.Request.Cookies["passwd"] != null)
            {
                username         = HttpContext.Request.Cookies["username"].Value;
                passwd           = HttpContext.Request.Cookies["passwd"].Value;
                ViewBag.username = Authoriz.getAuthoriz(username, passwd, agent);
            }
        }
コード例 #17
0
 public ActionResult NewOrder(int?productID, int?purchaserID, int?number)
 {
     using (DBAgent.DBAgent agent = new DBAgent.DBAgent())
     {
         bool result = agent.NewOrder(productID, purchaserID, number);
         if (result)
         {
             return(Redirect("/Home/Orders"));
         }
         else
         {
             return(View("~/Views/Shared/Error.cshtml"));
         }
     }
 }
コード例 #18
0
 public ActionResult Orders(int?productID, int?purchaser, DateTime?startDate, DateTime?endDate)
 {
     getAdmin();
     using (DBAgent.DBAgent agent = new DBAgent.DBAgent())
     {
         List <Order>     orders     = agent.GetOrders(productID, purchaser, startDate, endDate, null);
         List <Product>   products   = agent.GetProducts(null, null, null, null);
         List <Purchaser> purchasers = agent.getPurchasers();
         ViewBag.Orders     = orders;
         ViewBag.products   = products;
         ViewBag.purchasers = purchasers;
         ViewBag.workgroups = agent.GetWorkgroups();
     }
     return(View());
 }
コード例 #19
0
 public ActionResult Orders()
 {
     getAdmin();
     using (DBAgent.DBAgent agent = new DBAgent.DBAgent())
     {
         List <Order>     orders     = agent.GetOrders(null, null, null, null, null);
         List <Product>   products   = agent.GetProducts(null, null, null, null);
         List <Purchaser> purchasers = agent.getPurchasers();
         ViewBag.Orders     = orders;
         ViewBag.products   = products;
         ViewBag.purchasers = purchasers;
         ViewBag.workgroups = agent.GetWorkgroups();
     }
     return(View());
 }
コード例 #20
0
 public ActionResult NewProduct(int?price, string name, int?categoryID, int?salary)
 {
     using (DBAgent.DBAgent agent = new DBAgent.DBAgent())
     {
         bool result = agent.NewProduct(name, price, categoryID, salary);
         if (result)
         {
             return(Redirect("/Home/Index"));
         }
         else
         {
             return(View("~/Views/Shared/Error.cshtml"));
         }
     }
 }
コード例 #21
0
        public ActionResult DeleteProductMaterial(int materialID, int productID)
        {
            bool res;

            using (DBAgent.DBAgent agent = new DBAgent.DBAgent())
            {
                res = agent.DeleteProductMaterial(materialID, productID);
            }
            if (res)
            {
                return(Redirect("/Home/ProductMaterials"));
            }
            else
            {
                return(View("~/Views/Shared/Error.cshtml"));
            }
        }
コード例 #22
0
        public ActionResult NewPurchaser(Purchaser purchaser)
        {
            bool res;

            using (DBAgent.DBAgent agent = new DBAgent.DBAgent())
            {
                res = agent.NewPurchaser(purchaser);
            }
            if (res)
            {
                return(Redirect("/Home/Purchasers"));
            }
            else
            {
                return(View("~/Views/Shared/Error.cshtml"));
            }
        }
コード例 #23
0
        public ActionResult DeleteMaterial(int ID)
        {
            bool res;

            using (DBAgent.DBAgent agent = new DBAgent.DBAgent())
            {
                res = agent.DeleteMaterial(ID);
            }
            if (res)
            {
                return(Redirect("/Home/Index"));
            }
            else
            {
                return(View("~/Views/Shared/Error.cshtml"));
            }
        }
コード例 #24
0
        public ActionResult SetWorkgroup(int orderID, int workgroupID)
        {
            bool res;

            using (DBAgent.DBAgent agent = new DBAgent.DBAgent())
            {
                res = agent.SetWorkgroupOnOrder(orderID, workgroupID);
            }
            if (res)
            {
                return(Redirect("/Home/Orders"));
            }
            else
            {
                return(View("~/Views/Shared/Error.cshtml"));
            }
        }
コード例 #25
0
        public ActionResult CompleteOrder(int ID)
        {
            bool res;

            using (DBAgent.DBAgent agent = new DBAgent.DBAgent())
            {
                res = agent.CompleteOrder(ID);
            }
            if (res)
            {
                return(Redirect("/Home/Orders"));
            }
            else
            {
                return(View("~/Views/Shared/Error.cshtml"));
            }
        }
コード例 #26
0
        public ActionResult EditEmployee(Employee employee)
        {
            bool res;

            using (DBAgent.DBAgent agent = new DBAgent.DBAgent())
            {
                res = agent.EditEmployee(employee);
            }
            if (res)
            {
                return(Redirect("/Home/Employees"));
            }
            else
            {
                return(View("~/Views/Shared/Error.cshtml"));
            }
        }
コード例 #27
0
 public ActionResult Money(DateTime?startDate, DateTime?endDate)
 {
     using (DBAgent.DBAgent agent = new DBAgent.DBAgent())
     {
         if (startDate == null)
         {
             startDate = agent.FirstMoneyEntry().AddMinutes(-1);
         }
         if (endDate == null)
         {
             endDate = DateTime.Now.AddMinutes(1);
         }
         ViewBag.money  = agent.GetFinancialReport(startDate, endDate);
         ViewBag.amount = agent.GetAmountOfMoney();
     }
     return(View());
 }
コード例 #28
0
        public ActionResult NewMoneyEntry(float?change, string note)
        {
            bool res;

            using (DBAgent.DBAgent agent = new DBAgent.DBAgent())
            {
                res = agent.NewMoneyEntry(change, note);
            }
            if (res)
            {
                return(Redirect("/Home/Money"));
            }
            else
            {
                return(View("~/Views/Shared/Error.cshtml"));
            }
        }
コード例 #29
0
        public ActionResult PurchaseMaterial(int materialID, float price_of_one, float addNumber)
        {
            bool res;

            using (DBAgent.DBAgent agent = new DBAgent.DBAgent())
            {
                res = agent.PurchaseMaterial(materialID, price_of_one, addNumber);
            }
            if (res)
            {
                return(Redirect("/Home/Materials"));
            }
            else
            {
                return(View("~/Views/Shared/Error.cshtml"));
            }
        }
コード例 #30
0
        public ActionResult NewProductMaterial(int productID, int materialID, int number)
        {
            bool res;

            using (DBAgent.DBAgent agent = new DBAgent.DBAgent())
            {
                res = agent.NewProductMaterial(productID, materialID, number);
            }
            if (res)
            {
                return(Redirect("/Home/productMaterials"));
            }
            else
            {
                return(View("~/Views/Shared/Error.cshtml"));
            }
        }