public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                ViewData["FldEmployeeRequestJobTitleFromId"]  = new SelectList(_context.TblEmployeeRequestJobTitleFroms, "TblEmployeeRequestJobTitleFromId", "TblEmployeeRequestJobTitleFromTitle");
                ViewData["FldEmployeeRequestUserApplicantId"] = new SelectList(_context.TblEmployeeRequestUsers, "FldEmployeeRequestUserId", "FldEmployeeRequestUserUsername");
                ViewData["FldEmployeeRequestUserSubmitterId"] = new SelectList(_context.TblEmployeeRequestUsers, "FldEmployeeRequestUserId", "FldEmployeeRequestUserUsername");
                ViewData["startdate"] = TblEmployeeRequestEmployeeRequest.FldEmployeeRequestEmployeeRequestStartDate.toPersianDate();
                ViewData["enddate"]   = TblEmployeeRequestEmployeeRequest.FldEmployeeRequestEmployeeRequestEndDate.toPersianDate();

                if (TblEmployeeRequestEmployeeRequest.FldEmployeeRequestJobTaminId != null)
                {
                    ViewData["taminjobtitle"] = TblEmployeeRequestEmployeeRequest.FldEmployeeRequestJobTamin.FldTaminJobName;
                }

                if (TblEmployeeRequestEmployeeRequest.FldEmployeeRequestJobOnetId != null)
                {
                    ViewData["onetjobtitle"] = TblEmployeeRequestEmployeeRequest.FldEmployeeRequestJobOnet.FldJobName;
                }

                if (TblEmployeeRequestEmployeeRequest.FldEmployeeRequestJobsId != null)
                {
                    ViewData["jobtitle"] = TblEmployeeRequestEmployeeRequest.FldEmployeeRequestJobs.JobsName;
                }
                return(Page());
            }

            if (!string.IsNullOrEmpty(Request.Form["taminjobdropdown"].ToString()))
            {
                TblEmployeeRequestEmployeeRequest.FldEmployeeRequestJobTaminId = int.Parse(Request.Form["taminjobdropdown"].ToString());
            }
            if (!string.IsNullOrEmpty(Request.Form["jobdropdown"].ToString()))
            {
                TblEmployeeRequestEmployeeRequest.FldEmployeeRequestJobsId = int.Parse(Request.Form["jobdropdown"].ToString());
            }
            if (!string.IsNullOrEmpty(Request.Form["onetjobdropdown"].ToString()))
            {
                TblEmployeeRequestEmployeeRequest.FldEmployeeRequestJobOnetId = int.Parse(Request.Form["onetjobdropdown"].ToString());
            }

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

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!TblEmployeeRequestEmployeeRequestExists(TblEmployeeRequestEmployeeRequest.FldEmployeeRequestEmployeeRequestId))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(RedirectToPage("./Index"));
        }
        public async Task <IActionResult> OnPostAsync()
        {
            string uid = HttpContext.Session.GetString("uid");

            if (uid == null)
            {
                return(RedirectToPage("../../Index"));
            }

            if (!ModelState.IsValid)
            {
                ViewData["DiplomaId"]   = new SelectList(_context.PayDiplomas, "DiplomaId", "DiplomaName");
                ViewData["EducationId"] = new SelectList(_context.PayEducations, "EducationId", "EducationName");
                ViewData["startdate"]   = TblCustomerDegree.FldStartDate.toPersianDate();
                ViewData["enddate"]     = TblCustomerDegree.FldEndDate.toPersianDate();
                ViewData["exdate"]      = TblCustomerDegree.FldExportDate.toPersianDate();
                return(Page());
            }

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

            TblEmployeeRequestEmployeeEditLog t = new TblEmployeeRequestEmployeeEditLog()
            {
                FldEmployeeRequestEmployeeEditLogDate = DateTime.Now,
                FldEmployeeRequestUserId                 = Int64.Parse(uid),
                FldEmployeeRequestEmployeeId             = TblCustomerDegree.UserId,
                FldEmployeeRequestEmployeeEditLogSection = "Education-Edit"
            };

            _context.TblEmployeeRequestEmployeeEditLogs.Add(t);

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!TblCustomerDegreeExists(TblCustomerDegree.FldCustomerDegreeId))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(RedirectToPage("Index", new { id = TblCustomerDegree.UserId }));
        }
        public async Task <IActionResult> OnPostAsync()
        {
            string uid = HttpContext.Session.GetString("uid");

            if (uid == null)
            {
                return(RedirectToPage("../../Index"));
            }

            if (!ModelState.IsValid)
            {
                ViewData["birthdate"] = TblEmployeeRequestPrimaryInformation.FldEmployeeRequestPrimaryInformationBirthDate.toPersianDate();

                return(Page());
            }

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

            TblEmployeeRequestEmployeeEditLog t = new TblEmployeeRequestEmployeeEditLog()
            {
                FldEmployeeRequestEmployeeEditLogDate = DateTime.Now,
                FldEmployeeRequestUserId                 = Int64.Parse(uid),
                FldEmployeeRequestEmployeeId             = TblEmployeeRequestPrimaryInformation.FldEmployeeRequestEmployeeId,
                FldEmployeeRequestEmployeeEditLogSection = "Primary-Edit"
            };

            _context.TblEmployeeRequestEmployeeEditLogs.Add(t);

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!TblEmployeeRequestPrimaryInformationExists(TblEmployeeRequestPrimaryInformation.FldEmployeeRequestPrimaryInformationId))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(RedirectToPage("Index", new { id = TblEmployeeRequestPrimaryInformation.FldEmployeeRequestEmployeeId }));
        }
Exemple #4
0
        OnPostAsync()
        {
            string uid = HttpContext.Session.GetString("uid");

            if (uid == null)
            {
                return(RedirectToPage("../../Index"));
            }

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

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

            TblEmployeeRequestEmployeeEditLog t = new TblEmployeeRequestEmployeeEditLog()
            {
                FldEmployeeRequestEmployeeEditLogDate = DateTime.Now,
                FldEmployeeRequestUserId                 = Int64.Parse(uid),
                FldEmployeeRequestEmployeeId             = TblEmployeeRequestGeneralRecord.FldEmployeeRequestEmployeeId,
                FldEmployeeRequestEmployeeEditLogSection = "General-Edit"
            };

            _context.TblEmployeeRequestEmployeeEditLogs.Add(t);

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!TblEmployeeRequestGeneralRecordExists(TblEmployeeRequestGeneralRecord.FldEmployeeRequestGeneralRecordId))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(RedirectToPage("Index", new { id = TblEmployeeRequestGeneralRecord.FldEmployeeRequestEmployeeId }));
        }