Beispiel #1
0
        public async Task <IActionResult> Create(int tripDelegateId)
        {
            var emp = await _context.TripDelegates
                      .Include(t => t.TripBooking)
                      .Include(t => t.TripBooking.SchedulingTripDetail.EducationalBody)
                      .Include(t => t.TripBooking.SchedulingTripDetail.TripType)
                      .Include(t => t.TripBooking.SchedulingTripDetail)
                      .FirstOrDefaultAsync(d => d.Id == tripDelegateId);

            string bodyName = emp.IsFromEducationBody == false ? "عمادة شؤون الطلاب" : emp.TripBooking.SchedulingTripDetail.EducationalBody.Name;
            int    duration = emp.TripBooking.TripQtyDays;

            if (emp.TripBooking.SchedulingTripDetail.TripType.Name == "عمرة")
            {
                duration += 2;
            }
            var finishWork = new FinishWorkCreateModelView()
            {
                EmployeeName      = emp.EmployeeName,
                EmployeeNumber    = emp.EmployeeNumber,
                JopName           = emp.JopName,
                DelegationBudy    = bodyName,
                EndWorkDuration   = duration,
                FromDateDelgation = emp.TripBooking.SchedulingTripDetail.TripDate,
                TripBookingId     = emp.TripBookingId,
                TripDelegateId    = emp.Id
            };

            return(View(finishWork));
        }
Beispiel #2
0
        // GET: Sociologist/FinishWorks/Delete/5
        public async Task <IActionResult> Delete(int id)
        {
            var finish = await _context.FinishWorks.FindAsync(id);

            var emp = await _context.TripDelegates
                      .Include(t => t.TripBooking)
                      .Include(t => t.TripBooking.SchedulingTripDetail.EducationalBody)
                      .Include(t => t.TripBooking.SchedulingTripDetail.TripType)
                      .Include(t => t.TripBooking.SchedulingTripDetail)
                      .FirstOrDefaultAsync(d => d.Id == finish.TripDelegateId);

            var finishWork = new FinishWorkCreateModelView()
            {
                Id                   = finish.Id,
                TripDelegateId       = finish.TripDelegateId,
                TripBookingId        = finish.TripBookingId,
                DelegationBudy       = finish.DelegationBudy,
                CashAdvance          = finish.CashAdvance,
                CashAdvanceAmont     = finish.CashAdvanceAmont,
                DateDelgation        = finish.DateDelgation,
                DelegationNumber     = finish.DelegationNumber,
                EmployeeName         = emp.EmployeeName,
                EmployeeNumber       = emp.EmployeeNumber,
                EndWorkDuration      = finish.EndWorkDuration,
                FoodsBuy             = finish.FoodsBuy,
                FromDateDelgation    = emp.TripBooking.SchedulingTripDetail.TripDate,
                JopDegree            = finish.JopDegree,
                JopName              = emp.JopName,
                LivingBuy            = finish.LivingBuy,
                TransportBuy         = finish.TransportBuy,
                TransportToToWorkBuy = finish.TransportToToWorkBuy
            };

            return(View(finishWork));
        }
Beispiel #3
0
        public async Task <IActionResult> Edit(int id, FinishWorkCreateModelView finishWork)
        {
            if (ModelState.IsValid)
            {
                var finish = new FinishWork()
                {
                    CashAdvance          = finishWork.CashAdvance,
                    CashAdvanceAmont     = finishWork.CashAdvanceAmont,
                    DateDelgation        = finishWork.DateDelgation,
                    DelegationBudy       = finishWork.DelegationBudy,
                    DelegationNumber     = finishWork.DelegationNumber,
                    FoodsBuy             = finishWork.FoodsBuy,
                    JopDegree            = finishWork.JopDegree,
                    LivingBuy            = finishWork.LivingBuy,
                    TransportBuy         = finishWork.TransportBuy,
                    TransportToToWorkBuy = finishWork.TransportToToWorkBuy,
                    TripBookingId        = finishWork.TripBookingId,
                    TripDelegateId       = finishWork.TripDelegateId,
                    Id = finishWork.Id, EndWorkDuration = finishWork.EndWorkDuration
                };
                _context.Update(finish);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(IndexByBoking), new { bokingId = finish.TripBookingId }));
            }
            return(View(finishWork));
        }
Beispiel #4
0
        // GET: Sociologist/FinishWorks/Details/5
        public async Task <IActionResult> Details(int id)
        {
            var finish = await _context.FinishWorks.FindAsync(id);

            var emp = await _context.TripDelegates
                      .Include(t => t.TripBooking)
                      .Include(t => t.TripBooking.SchedulingTripDetail.EducationalBody)
                      .Include(t => t.TripBooking.SchedulingTripDetail.TripType)
                      .Include(t => t.TripBooking.SchedulingTripDetail)
                      .FirstOrDefaultAsync(d => d.Id == finish.TripDelegateId);

            var finishWork = new FinishWorkCreateModelView()
            {
                Id                   = finish.Id,
                TripDelegateId       = finish.TripDelegateId,
                TripBookingId        = finish.TripBookingId,
                DelegationBudy       = finish.DelegationBudy,
                CashAdvance          = finish.CashAdvance,
                CashAdvanceAmont     = finish.CashAdvanceAmont,
                DateDelgation        = finish.DateDelgation,
                DelegationNumber     = finish.DelegationNumber,
                EmployeeName         = emp.EmployeeName,
                EmployeeNumber       = emp.EmployeeNumber,
                EndWorkDuration      = finish.EndWorkDuration,
                FoodsBuy             = finish.FoodsBuy,
                FromDateDelgation    = emp.TripBooking.SchedulingTripDetail.TripDate,
                JopDegree            = finish.JopDegree,
                JopName              = emp.JopName,
                LivingBuy            = finish.LivingBuy,
                TransportBuy         = finish.TransportBuy,
                TransportToToWorkBuy = finish.TransportToToWorkBuy
            };
            var sig = await _context.Signatures
                      // .Where(e => e.SignatureRole == "عميد شؤون الطلاب" && e.Status==true)
                      .Include(u => u.User)
                      .FirstOrDefaultAsync();

            ViewBag.amaidSignutre = sig != null ? sig.User.FullName : "";
            return(View(finishWork));
        }