Exemple #1
0
        public async Task <IActionResult> OnPostAsync()
        {
            string uid = HttpContext.Session.GetString("uid");

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

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

            long lastid = _context.TblEmployeeRequestUserCreativities.OrderByDescending(a => a.FldEmployeeRequestUserCreativityId).FirstOrDefault().FldEmployeeRequestUserCreativityId;

            TblEmployeeRequestUserCreativity.FldEmployeeRequestUserCreativityId = lastid + 1;
            _context.TblEmployeeRequestUserCreativities.Add(TblEmployeeRequestUserCreativity);

            TblEmployeeRequestEmployeeEditLog t = new TblEmployeeRequestEmployeeEditLog()
            {
                FldEmployeeRequestEmployeeEditLogDate = DateTime.Now,
                FldEmployeeRequestUserId                 = Int64.Parse(uid),
                FldEmployeeRequestEmployeeId             = TblEmployeeRequestUserCreativity.FldEmployeeRequestEmployeeId,
                FldEmployeeRequestEmployeeEditLogSection = "Creative-Create"
            };

            _context.TblEmployeeRequestEmployeeEditLogs.Add(t);

            await _context.SaveChangesAsync();

            return(RedirectToPage("Index", new { id = TblEmployeeRequestUserCreativity.FldEmployeeRequestEmployeeId }));
        }
Exemple #2
0
        public async Task <IActionResult> OnPostAsync(long?id)
        {
            string uid = HttpContext.Session.GetString("uid");

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

            if (id == null)
            {
                return(NotFound());
            }

            TblEmployeeRequestUserCreativity = await _context.TblEmployeeRequestUserCreativities.FindAsync(id);

            if (TblEmployeeRequestUserCreativity != null)
            {
                _context.TblEmployeeRequestUserCreativities.Remove(TblEmployeeRequestUserCreativity);
                TblEmployeeRequestEmployeeEditLog t = new TblEmployeeRequestEmployeeEditLog()
                {
                    FldEmployeeRequestEmployeeEditLogDate = DateTime.Now,
                    FldEmployeeRequestUserId                 = Int64.Parse(uid),
                    FldEmployeeRequestEmployeeId             = TblEmployeeRequestUserCreativity.FldEmployeeRequestEmployeeId,
                    FldEmployeeRequestEmployeeEditLogSection = "Creative-Delete"
                };

                _context.TblEmployeeRequestEmployeeEditLogs.Add(t);
                await _context.SaveChangesAsync();
            }

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

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

            if (id == null)
            {
                return(NotFound());
            }

            TblEmployeeRequestGeneralRecord = await _context.TblEmployeeRequestGeneralRecords.FindAsync(id);

            if (TblEmployeeRequestGeneralRecord != null)
            {
                _context.TblEmployeeRequestGeneralRecords.Remove(TblEmployeeRequestGeneralRecord);

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

                _context.TblEmployeeRequestEmployeeEditLogs.Add(t);

                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("Index", new { id = TblEmployeeRequestGeneralRecord.FldEmployeeRequestEmployeeId }));
        }
        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 #6
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 }));
        }