public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(Page());
            }


            Order.Status = "InComplete";
            if (Order != null)
            {
                _context.Attach(Order).State = EntityState.Modified;
                await _context.SaveChangesAsync();
            }

            if (!ModelState.IsValid)
            {
                return(Page());
            }

            var a = new Complain();

            a.DateComplain = DateTime.Now;
            a.Status       = "InComplete";
            a.OrderID      = Order.OrderID;

            Complain = a;
            _context.Complain.Add(Complain);
            await _context.SaveChangesAsync();



            return(RedirectToPage("./ViewOrder", new { id = Order.CustomerID }));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            Product = await _context.Product.FirstOrDefaultAsync(m => m.ProductID == Project_Product.ProductID);

            double Price     = Product.CostPrice;
            int    Qty       = Project_Product.Qty;
            int    IDProJect = Project_Product.ProjectID;

            Product = await _context.Product.FirstOrDefaultAsync(m => m.ProductID == Project_Product.ProductID);

            double Price2     = Product.SellingPrice;
            int    Qty2       = Project_Product.Qty;
            int    IDProJect2 = Project_Product.ProjectID;

            _context.Project_Product.Add(Project_Product);
            await _context.SaveChangesAsync();


            double SumTotalPrice = Qty * Price;

            Project = await _context.Project.FirstOrDefaultAsync(m => m.ProjectID == IDProJect);

            Project.Cost = Project.Cost + SumTotalPrice;

            double SumTotalPrice2 = Qty2 * Price2;

            Project = await _context.Project.FirstOrDefaultAsync(m => m.ProjectID == IDProJect2);

            Project.CostGoal = Project.CostGoal + SumTotalPrice2;



            _context.Attach(Project).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ProjectExists(Project.ProjectID))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }



            return(RedirectToPage("./Index"));
        }
Exemplo n.º 3
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }
            Complains = await _context.Complain.FirstOrDefaultAsync(m => m.ComplainID == id);

            Order = await _context.Order.FirstOrDefaultAsync(m => m.OrderID == Complains.OrderID);

            Order.Status                 = "Complete";
            Complains.Status             = "Complete";
            _context.Attach(Order).State = EntityState.Modified;
            _context.Attach(Order).State = EntityState.Modified;

            if (Complain != null)
            {
                _context.Attach(Complain).State = EntityState.Modified;
                await _context.SaveChangesAsync();
            }

            if (!ModelState.IsValid)
            {
                return(Page());
            }

            var a = new Claim();

            a.DateClaim  = DateTime.Now;
            a.Status     = "Complete";
            a.ComplainID = Complains.ComplainID;

            Claim = a;
            _context.Claim.Add(Claim);
            await _context.SaveChangesAsync();



            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!OrderExists(Order.OrderID))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(RedirectToPage("./Complain"));
        }
Exemplo n.º 4
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Attach(Product_Loss_Reduction).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!Product_Loss_ReductionExists(Product_Loss_Reduction.Product_Loss_ReductionID))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(RedirectToPage("./ProductLossReduction"));
        }
Exemplo n.º 5
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Attach(Rival_Product).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!Rival_ProductExists(Rival_Product.RivProductID))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(RedirectToPage("./Index"));
        }
Exemplo n.º 6
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Attach(SurveyOperators).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!SurveyOperatorsExists(SurveyOperators.SurveyOperatorsID))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(RedirectToPage("./Surveys"));
        }
Exemplo n.º 7
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Attach(Manufacture).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ManufactureExists(Manufacture.ManufactureID))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(RedirectToPage("./List"));
        }
Exemplo n.º 8
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }


            Product = await _context.Product.FirstOrDefaultAsync(m => m.ProductID == Order_Product.ProductID);

            double Price   = Product.SellingPrice;
            int    Qty     = Order_Product.Qty;
            int    IDOrder = Order_Product.OrderID;

            _context.Order_Product.Add(Order_Product);
            await _context.SaveChangesAsync();

            double SumTotalPrice = Qty * Price;

            Order = await _context.Order.FirstOrDefaultAsync(m => m.OrderID == IDOrder);

            Order.Total = Order.Total + SumTotalPrice;

            _context.Attach(Order).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!OrderExists(Order.OrderID))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }


            return(RedirectToPage("./ViewOrder", new { id = Order.CustomerID }));
        }
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Delivery_performance.Add(Delivery_performance);
            await _context.SaveChangesAsync();

            return(RedirectToPage("./Deliverys"));
        }
Exemplo n.º 10
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.EmployeeType.Add(EmployeeType);
            await _context.SaveChangesAsync();

            return(RedirectToPage("./Index"));
        }
Exemplo n.º 11
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Product_Loss_Reduction.Add(Product_Loss_Reduction);
            await _context.SaveChangesAsync();

            return(RedirectToPage("./ProductLossReduction"));
        }
Exemplo n.º 12
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Safety.Add(Safety);
            await _context.SaveChangesAsync();

            return(RedirectToPage("./Safetys"));
        }
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Rival_Product.Add(Rival_Product);
            await _context.SaveChangesAsync();

            return(RedirectToPage("./Index"));
        }
Exemplo n.º 14
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Manufacture.Add(Manufacture);
            await _context.SaveChangesAsync();

            return(RedirectToPage("./List"));
        }
Exemplo n.º 15
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.GradeHistory.Add(GradeHistory);
            await _context.SaveChangesAsync();

            return(RedirectToPage("./Index"));
        }
Exemplo n.º 16
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }
            Project.Cost     = 0;
            Project.CostGoal = 0;
            _context.Project.Add(Project);
            await _context.SaveChangesAsync();

            return(RedirectToPage("./Index"));
        }
Exemplo n.º 17
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Safety = await _context.Safety.FindAsync(id);

            if (Safety != null)
            {
                _context.Safety.Remove(Safety);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Safetys"));
        }
Exemplo n.º 18
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            GradeHistory = await _context.GradeHistory.FindAsync(id);

            if (GradeHistory != null)
            {
                _context.GradeHistory.Remove(GradeHistory);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
Exemplo n.º 19
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            EmployeeType = await _context.EmployeeType.FindAsync(id);

            if (EmployeeType != null)
            {
                _context.EmployeeType.Remove(EmployeeType);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
Exemplo n.º 20
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Project = await _context.Project.FindAsync(id);

            if (Project != null)
            {
                _context.Project.Remove(Project);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
Exemplo n.º 21
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Order = await _context.Order.FindAsync(id);

            if (Order != null)
            {
                _context.Order.Remove(Order);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./ViewOrder", new { id = Order.CustomerID }));
        }
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Product_Loss_Reduction = await _context.Product_Loss_Reduction.FindAsync(id);

            if (Product_Loss_Reduction != null)
            {
                _context.Product_Loss_Reduction.Remove(Product_Loss_Reduction);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./ProductLossReduction"));
        }
Exemplo n.º 23
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            SurveyOperators = await _context.SurveyOperators.FindAsync(id);

            if (SurveyOperators != null)
            {
                _context.SurveyOperators.Remove(SurveyOperators);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Surveys"));
        }
Exemplo n.º 24
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Manufacture = await _context.Manufacture.FindAsync(id);

            if (Manufacture != null)
            {
                _context.Manufacture.Remove(Manufacture);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./List"));
        }
Exemplo n.º 25
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Customer = await _context.Customer.FindAsync(id);

            if (Customer != null)
            {
                _context.Customer.Remove(Customer);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
Exemplo n.º 26
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Evaluation = await _context.Evaluation.FindAsync(id);

            if (Evaluation != null)
            {
                _context.Evaluation.Remove(Evaluation);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
Exemplo n.º 27
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Delivery_performance = await _context.Delivery_performance.FindAsync(id);

            if (Delivery_performance != null)
            {
                _context.Delivery_performance.Remove(Delivery_performance);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Deliverys"));
        }
Exemplo n.º 28
0
        public async Task <IActionResult> OnPostAsync()
        {
            Order1 = await _context.Order
                     .ToListAsync();

            StringBuilder a = new StringBuilder("INV-00");

            a.Append(Order1.Count().ToString());
            string b = a.ToString();

            Order.Invoice = b;

            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Order.Add(Order);
            await _context.SaveChangesAsync();



            return(RedirectToPage("./ViewOrder", new { id = Order.CustomerID }));
        }