// To protect from overposting attacks, please enable the specific properties you want to bind to, for
        // more details see https://aka.ms/RazorPagesCRUD.
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

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

            return(RedirectToPage("./../listOTs/manageOT", new { id = a }));
        }
Beispiel #2
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

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

            return(RedirectToPage("./../listOTs/listOT", new { id = DetailOT.Employee_EmpID }));
        }
Beispiel #3
0
        // To protect from overposting attacks, please enable the specific properties you want to bind to, for
        // more details see https://aka.ms/RazorPagesCRUD.
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

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

            return(RedirectToPage("./Index"));
        }
Beispiel #4
0
        // To protect from overposting attacks, please enable the specific properties you want to bind to, for
        // more details see https://aka.ms/RazorPagesCRUD.
        public async Task <IActionResult> OnPostAsync()
        {
            Debug = 0;
            var check = 0;

            if (CompanyCar.NameCompanyCar == null)
            {
                check = 1;
                ModelState.AddModelError("CompanyCar.NameCompanyCar", "The NameCompanyCar field is required.");
            }
            if (CompanyCar.Email == null)
            {
                check = 1;
                ModelState.AddModelError("CompanyCar.Email", "The Email field is required.");
            }
            if (CompanyCar.Call == null)
            {
                check = 1;
                ModelState.AddModelError("CompanyCar.Call", "The Call field is required.");
            }
            if (CompanyCar.Line == null)
            {
                check = 1;
                ModelState.AddModelError("CompanyCar.Line", "The Line field is required.");
            }
            if (check == 1)
            {
                Debug = 1;
                await OnLode();

                return(Page());
            }



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

            return(RedirectToPage("./CompanyCar"));
        }
Beispiel #5
0
        // To protect from overposting attacks, please enable the specific properties you want to bind to, for
        // more details see https://aka.ms/RazorPagesCRUD.
        public async Task <IActionResult> OnPostAsync()
        {
            Employee = HttpContext.Session.GetLogin(_context.Employee);
            if (!ModelState.IsValid)
            {
                return(Page());
            }

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

            return(RedirectToPage("./Index"));
        }
Beispiel #6
0
        public async Task <IActionResult> OnPostRemoveAsync(int id)
        {
            var DetailOTs = await _context.DetailOT
                            .FirstOrDefaultAsync(e => e.DetailOTID == id);

            DetailOTs.Status = "Disallow";
            _context.Attach(DetailOTs).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!DetailOTExists(DetailOTs.DetailOTID))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            try
            {
                await OnLoad(DetailOTs.OT_OTID);
            }
            catch (Exception)
            {
                return(RedirectToPage("./index"));
            }



            return(Page());
        }
Beispiel #7
0
        // To protect from overposting attacks, please enable the specific properties you want to bind to, for
        // more details see https://aka.ms/RazorPagesCRUD.
        public async Task <IActionResult> OnPostAsync()
        {
            Debug = 0;
            var check = 0;

            if (Point.NamePoint == null)
            {
                check = 1;
                ModelState.AddModelError("Point.NamePoint", "The NamePoint field is required.");
            }

            if (check == 1)
            {
                Debug = 1;
                await OnLode(Point.Point_PartID);

                return(Page());
            }

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

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

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

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

            return RedirectToPage("./Index");
        }
Beispiel #9
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }
            Employee = HttpContext.Session.GetLogin(_context.Employee);
            Canteen  = await _context.Canteen.FindAsync(id);

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

            return(RedirectToPage("./Index"));
        }
Beispiel #10
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

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

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

            return(RedirectToPage("./Index"));
        }
Beispiel #11
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

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

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

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

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

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

            return(RedirectToPage("./Index"));
        }
Beispiel #13
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

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

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

            return(RedirectToPage("./Index"));
        }
Beispiel #14
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            Employee = HttpContext.Session.GetLogin(_context.Employee);
            if (id == null)
            {
                return(NotFound());
            }

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

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

            return(RedirectToPage("./Index"));
        }
Beispiel #15
0
        // To protect from overposting attacks, please enable the specific properties you want to bind to, for
        // more details see https://aka.ms/RazorPagesCRUD.
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }
            DateTime datenew = OT.date;
            int      newyear = OT.date.Year + 543;

            OT.date = new DateTime(newyear, datenew.Month, datenew.Day);
            string date = OT.date.ToString("dddd");

            OT.TypeOT = date;



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

            return(RedirectToPage("./../listOTs/manageOT", new { id = id }));
        }
Beispiel #16
0
        public async Task <IActionResult> OnPostAsync(int?Did)
        {
            OTs = await _context.OT.FirstOrDefaultAsync(o => o.OTID == Did);

            OTs.TypStatus = "Manage Car";
            _context.Attach(OTs).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!OTExists(OTs.OTID))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }
            return(RedirectToPage("./../listOTs/ConfirmShuttle", new { Did = Did }));
        }
Beispiel #17
0
        public async Task <IActionResult> OnPostEditAsync()
        {
            var check = 0;

            if (EditDetailOT.Employee_EmpID == 0)
            {
                check = 1;
                ModelState.AddModelError("EditDetailOT.Employee_EmpID", "The Employee field is required.");
            }
            if (EditDetailOT.Point_PointID == 0)
            {
                check = 1;
                ModelState.AddModelError("EditDetailOT.Point_PointID", "The Point field is required.");
            }
            if (EditDetailOT.FoodSet_FoodSetID == 0)
            {
                check = 1;
                ModelState.AddModelError("EditDetailOT.FoodSet_FoodSetID", "The Food Set field is required.");
            }
            if (EditDetailOT.Type == null)
            {
                check = 1;
                ModelState.AddModelError("EditDetailOT.Type", "The Travel Type field is required.");
            }



            if (check == 1)
            {
                try
                {
                    await OnLoad();
                }
                catch (Exception)
                {
                    return(RedirectToPage("./index"));
                }
                Defal = 2;
                return(Page());
            }



            Employee = HttpContext.Session.GetLogin(_context.Employee);

            var OTcheck = await _context.OT.FirstOrDefaultAsync(e => e.OTID == EditDetailOT.OT_OTID);

            DateTime TimeS = OTcheck.date;

            EditDetailOT.TimeStart = new DateTime(TimeS.Year, TimeS.Month, TimeS.Day, EditDetailOT.TimeStart.Hour, EditDetailOT.TimeStart.Minute, EditDetailOT.TimeStart.Second);
            EditDetailOT.TimeEnd   = new DateTime(TimeS.Year, TimeS.Month, TimeS.Day, EditDetailOT.TimeEnd.Hour, EditDetailOT.TimeEnd.Minute, EditDetailOT.TimeEnd.Second);
            TimeSpan hour = EditDetailOT.TimeEnd - EditDetailOT.TimeStart;

            EditDetailOT.Hour = hour;


            check = await CheckTimeEditAsync(OTcheck);

            if (check == 1)
            {
                Defal = 2;
                try
                {
                    await OnLoad();
                }
                catch (Exception)
                {
                    return(RedirectToPage("./index"));
                }
                return(Page());
            }

            Defal = 0;


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

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!DetailOTExists(EditDetailOT.DetailOTID))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(RedirectToPage("./../listOTs/addOT"));
        }
Beispiel #18
0
        public async Task <ActionResult> OnPostAsync(int id, int Did)
        {
            OT = await _context.OT.FirstOrDefaultAsync(m => m.OTID == Did);



            if (Round_8.Any())
            {
                int              time         = 8;
                string           type         = "Go";
                IList <CarsPart> managecarNEW = Round_8;

                await createDetailCarQ(Did, time, type, managecarNEW);
            }
            else
            {
                Debug.WriteLine("Round_8 Null");
            }


            if (Round_17.Any())
            {
                int              time         = 17;
                string           type         = "Back";
                IList <CarsPart> managecarNEW = Round_17;

                await createDetailCarQ(Did, time, type, managecarNEW);
            }
            else
            {
                Debug.WriteLine("Round_17 Null");
            }

            if (Round_20.Any())
            {
                int              time         = 20;
                string           type         = "Back";
                IList <CarsPart> managecarNEW = Round_20;

                await createDetailCarQ(Did, time, type, managecarNEW);
            }
            else
            {
                Debug.WriteLine("Round_20 Null");
            }


            //_context.CarsPart.Add(Round_8);


            //Your logic here using Products and statusId

            OT.TypStatus = "Close";
            _context.Attach(OT).State = EntityState.Modified;
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!OTExists(OT.OTID))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }


            return(RedirectToPage("./../listOTs/ContactCarFood", new { id = id, Did = Did }));
        }