예제 #1
0
        public async Task <IActionResult> AddStandardTitleType(StandardTitleType item)
        {
            int cnt = await _context.StandardTitleTypes.CountAsync();

            item.SortOrder = (cnt + 1) * 10;
            _context.StandardTitleTypes.Add(item);
            await _context.SaveChangesAsync();

            _lookup.Refresh <StandardTitleType>();

            return(RedirectToAction("StandardTitleTypesList"));
        }
예제 #2
0
        public IActionResult EditDictionary(string typeName, int id, bool status)
        {
            switch (typeName)
            {
            case "OrgUnitType":
                _context.OrgUnitTypes.SingleOrDefault(b => b.Id == id).IsActive = status;
                _context.SaveChanges();
                _lookup.Refresh <OrgUnitType>();
                break;

            case "EmploymentType":
                _context.EmploymentTypes.SingleOrDefault(b => b.Id == id).IsActive = status;
                _context.SaveChanges();
                _lookup.Refresh <EmploymentType>();
                break;

            case "AllowanceType":
                _context.AllowanceTypes.SingleOrDefault(b => b.Id == id).IsActive = status;
                _context.SaveChanges();
                _lookup.Refresh <AllowanceType>();
                break;

            case "CompetencyAreaType":
                _context.CompetencyAreaTypes.SingleOrDefault(b => b.Id == id).IsActive = status;
                _context.SaveChanges();
                _lookup.Refresh <CompetencyAreaType>();
                break;

            case "LeaveType":
                _context.LeaveTypes.SingleOrDefault(b => b.Id == id).IsActive = status;
                _context.SaveChanges();
                _lookup.Refresh <LeaveType>();
                break;

            case "SalaryScaleType":
                _context.SalaryScaleTypes.SingleOrDefault(b => b.Id == id).IsActive = status;
                _context.SaveChanges();
                _lookup.Refresh <SalaryScaleType>();
                break;

            case "StandardTitleType":
                _context.StandardTitleTypes.SingleOrDefault(b => b.Id == id).IsActive = status;
                _context.SaveChanges();
                _lookup.Refresh <StandardTitleType>();
                break;

            case "DocumentType":
                _context.DocumentTypes.SingleOrDefault(b => b.Id == id).IsActive = status;
                _context.SaveChanges();
                _lookup.Refresh <DocumentType>();
                break;

            case "FamilyMemberType":
                _context.FamilyMemberTypes.SingleOrDefault(b => b.Id == id).IsActive = status;
                _context.SaveChanges();
                _lookup.Refresh <FamilyMemberType>();
                break;

            case "QualificationType":
                _context.QualificationTypes.SingleOrDefault(b => b.Id == id).IsActive = status;
                _context.SaveChanges();
                _lookup.Refresh <QualificationType>();
                break;

            case "LanguageType":
                _context.LanguageTypes.SingleOrDefault(b => b.Id == id).IsActive = status;
                _context.SaveChanges();
                _lookup.Refresh <LanguageType>();
                break;

            case "PromotionType":
                _context.PromotionTypes.SingleOrDefault(b => b.Id == id).IsActive = status;
                _context.SaveChanges();
                _lookup.Refresh <PromotionType>();
                break;

            case "PayrollComponentType":
                _context.PayrollComponentTypes.SingleOrDefault(b => b.Id == id).IsActive = status;
                _context.SaveChanges();
                _lookup.Refresh <PayrollComponentType>();
                break;

            case "AttendanceActionType":
                _context.AttendanceActionTypes.SingleOrDefault(b => b.Id == id).IsActive = status;
                _context.SaveChanges();
                _lookup.Refresh <AttendanceActionType>();
                break;

            case "Governorate":
                _context.Governorates.SingleOrDefault(b => b.Id == id).IsActive = status;
                _context.SaveChanges();
                break;

            case "Bank":
                _context.Banks.SingleOrDefault(b => b.Id == id).IsActive = status;
                _context.SaveChanges();
                _lookup.Refresh <Bank>();
                break;

            case "Nationality":
                _context.Nationalities.SingleOrDefault(b => b.Id == id).IsActive = status;
                _context.SaveChanges();
                break;
            }
            return(RedirectToAction("DictionaryList", new { typeName = typeName }));
        }