public static DepartmentViewModel GetById(int id) { DepartmentViewModel result = new DepartmentViewModel(); using (var db = new PayrollContext()) { result = (from d in db.Department //join div in db.Division on //d.DivisionId equals div.Id where d.Id == id select new DepartmentViewModel { Id = d.Id, Code = d.Code, DivisionId = d.DivisionId, //DivisionCode = div.Code, //DivisionName = div.Description, Description = d.Description, IsActivated = d.IsActivated }).FirstOrDefault(); } return(result); }
public static Responses Delete(int Id) { Responses result = new Responses(); try { using (var db = new PayrollContext()) { SalaryDefaultValue division = db.SalaryDefaultValue.Where(o => o.Id == Id).FirstOrDefault(); if (division != null) { db.SalaryDefaultValue.Remove(division); db.SaveChanges(); } } } catch (Exception ex) { result.Message = ex.Message; result.Success = false; } return(result); }
public static Responses Delete(int id) { Responses result = new Responses(); try { using (var db = new PayrollContext()) { JobPosition jobposition = db.JobPosition.Where(o => o.Id == id).FirstOrDefault(); if (jobposition != null) { db.JobPosition.Remove(jobposition); db.SaveChanges(); } } } catch (Exception ex) { result.Message = ex.Message; result.Success = false; } return(result); }
public static List <JobPositionViewModel> GetDepId(int depId) { List <JobPositionViewModel> result = new List <JobPositionViewModel>(); using (var db = new PayrollContext()) { result = (from dep in db.Department join job in db.JobPosition on dep.Id equals job.DepartmentId where dep.Id == depId select new JobPositionViewModel { Id = job.Id, Code = job.Code, Description = job.Description, DepartmentId = dep.Id, DepartmentCode = dep.Code, DepartmentName = dep.Description, IsActivated = job.IsActivated }).ToList(); } return(result); }
public static Responses Delete(int id) { Responses result = new Responses(); try { using (var db = new PayrollContext()) { SellingHeader sh = db.SellingHeader.Where(o => o.Id == id).FirstOrDefault(); if (sh != null) { db.SellingHeader.Remove(sh); db.SaveChanges(); } } } catch (Exception ex) { result.Message = ex.Message; result.Success = false; } return(result); }
public static List <DepartmentViewModel> GetByDivId(int divId) { List <DepartmentViewModel> result = new List <DepartmentViewModel>(); using (var db = new PayrollContext()) { result = (from div in db.Division join dep in db.Department on div.Id equals dep.DivisionId where div.Id == divId select new DepartmentViewModel { Id = dep.Id, Code = dep.Code, Description = dep.Description, DivisionId = div.Id, DivisionCode = div.Code, DivisionName = div.Description, IsActivated = dep.IsActivated }).ToList(); } return(result); }
public static Responses Delete(int id) { Responses result = new Responses(); try { using (var db = new PayrollContext()) { Attendance attendance = db.Attendance.Where(o => o.Id == id).FirstOrDefault(); if (attendance != null) { db.Attendance.Remove(attendance); db.SaveChanges(); } } } catch (Exception ex) { result.Message = ex.Message; result.Success = false; } return(result); }
public static Responses Update(UserViewModel entity) { Responses result = new Responses(); try { using (var db = new PayrollContext()) { Users usr = new Users(); usr.Username = entity.Username; usr.Password = entity.Password; db.Users.Add(usr); db.SaveChanges(); } } catch (Exception ex) { result.Message = ex.Message; result.Success = false; } return(result); }
public static Responses Delete(int Id) { Responses result = new Responses(); try { using (var db = new PayrollContext()) { PayrollPeriod period = db.PayrollPeriod.Where(o => o.Id == Id).FirstOrDefault(); if (period != null) { db.PayrollPeriod.Remove(period); db.SaveChanges(); } } } catch (Exception ex) { result.Message = ex.Message; result.Success = false; } return(result); }
public static string GetNewReference() { string newRef = string.Format("SLS-{0}{1}-", DateTime.Now.ToString("yy"), DateTime.Now.Month.ToString("D2")); //00 int newIncrement = 1; using (var db = new PayrollContext()) { var result = (from sh in db.SellingHeader where sh.Reference.Contains(newRef) select new { reference = sh.Reference }) .OrderByDescending(o => o.reference) .FirstOrDefault(); if (result != null) { string[] oldRef = result.reference.Split('-'); newIncrement = int.Parse(oldRef[2]) + 1; } } newRef += newIncrement.ToString("D4"); //0000 return(newRef); }
public static List <PrivilegeFormsViewModel> GetPrivilegeFormsByUserName(string username) { List <PrivilegeFormsViewModel> result = new List <PrivilegeFormsViewModel>(); using (var db = new PayrollContext()) { result = (from ua in db.TrUserAccess join ac in db.AccessControl on ua.AccessControlId equals ac.Id join u in db.Users on ua.UserId equals u.Id where u.Username == username select new PrivilegeFormsViewModel { Id = ac.Id, Controller = ac.Controller, Icon = ac.Icon, Menu = ac.Menu }).ToList(); } return(result); }
public static JobPositionViewModel GetById(int id) { JobPositionViewModel result = new JobPositionViewModel(); using (var db = new PayrollContext()) { result = (from d in db.JobPosition join dep in db.Department on d.DepartmentId equals dep.Id where d.Id == id select new JobPositionViewModel { Id = d.Id, Code = d.Code, DepartmentId = d.DepartmentId, DepartmentCode = dep.Code, DepartmentName = dep.Description, Description = d.Description, IsActivated = d.IsActivated }).FirstOrDefault(); } return(result); }
public static Responses Delete(int id) { Responses result = new Responses(); try { using (var db = new PayrollContext()) { EmployeeSalary employeesalary = db.EmployeeSalary.Where(o => o.Id == id).FirstOrDefault(); if (employeesalary != null) { db.EmployeeSalary.Remove(employeesalary); db.SaveChanges(); } } } catch (Exception ex) { result.Message = ex.Message; result.Success = false; } return(result); }
public static bool SelectPeriod(int id) { bool result = true; try { using (var db = new PayrollContext()) { PayrollPeriodViewModel period = new PayrollPeriodViewModel(); period = (from d in db.PayrollPeriod where d.Id == id select new PayrollPeriodViewModel { Id = d.Id, PeriodYear = d.PeriodYear, PeriodMonth = d.PeriodMonth, BeginDate = d.BeginDate, EndDate = d.EndDate, IsCurentPeriod = d.IsCurrentPeriod, IsActivated = d.IsActivated, }).FirstOrDefault(); if (result != null) { SelectedPeriod = period; } else { result = false; } } } catch (Exception) { result = false; } return(result); }
public static List <SalaryDefaultValueViewModel> Get() { List <SalaryDefaultValueViewModel> result = new List <SalaryDefaultValueViewModel>(); using (var db = new PayrollContext()) { result = (from d in db.SalaryDefaultValue join div in db.JobPosition on d.JobPositionId equals div.Id join com in db.SalaryComponent on d.SalaryComponentId equals com.Id select new SalaryDefaultValueViewModel { Id = d.Id, JobPositionId = d.JobPositionId, JobPositionName = div.Description, SalaryComponentId = d.SalaryComponentId, SalaryComponentName = com.Description, Value = d.Value, IsActivated = d.IsActivated }).ToList(); } return(result); }
public static List <EmployeeSalaryViewModel> Get() { List <EmployeeSalaryViewModel> result = new List <EmployeeSalaryViewModel>(); using (var db = new PayrollContext()) { result = (from d in db.EmployeeSalary join pp in db.PayrollPeriod on d.PayrollPeriodId equals pp.Id join sc in db.SalaryComponent on d.SalaryComponentId equals sc.Id select new EmployeeSalaryViewModel { Id = d.Id, BadgeId = d.BadgeId, PayrollPeriodId = d.PayrollPeriodId, SalaryComponentId = d.SalaryComponentId, BasicValue = d.BasicValue, FinalValue = d.FinalValue, IsActivated = d.IsActivated }).ToList(); } return(result); }
public PayrollReportModel(PayrollContext context) { _context = context; PayrollReport = new List <PayrollReport>(); }
public DatabaseFactory(PayrollContext context) { _context = context; }
public IndexModel(PayrollContext context) { _context = context; }
public OrganisationRepository(PayrollContext context) : base(context) { }
public UifRepository(PayrollContext context) : base(context) { }
public PayrollReleaseController(PayrollContext context, IConfiguration config) { _context = context; _config = config; _data = new DataAccess(_config); }
public IncomeTaxRepository(PayrollContext context) : base(context) { }
public TimesheetsController(PayrollContext context, UserManager <ApplicationUser> userManager) { _context = context; _userManager = userManager; }
public Repository(IDatabaseFactory databaseFactory) { _context = databaseFactory.GetContext(); _sharedContext = true; }
public AllowanceRepository(PayrollContext context) : base(context) { }
public UserController(PayrollContext context) { _context = context; }
public ContractsController(PayrollContext context) { _context = context; }
public MoviesRepository(PayrollContext context) { _context = context; }
public BusinessBase() { context = new PayrollContext(Properties.Settings.Default); }