Пример #1
0
        public bool InsertEmployeeLeaveDetails(int leaveType, string fromDate, string toDate, string comments, int workingDays)
        {
            var result = false;

            try
            {
                using (var ctx = new LeaveManagementSystemEntities1())
                {
                    var employeeLeaveDetails = new EmployeeLeaveTransaction
                    {
                        EmployeeComment     = comments,
                        FromDate            = Convert.ToDateTime(fromDate),
                        ToDate              = Convert.ToDateTime(toDate),
                        CreatedDate         = DateTime.Now,
                        NumberOfWorkingDays = workingDays,
                        RefLeaveType        = leaveType,
                        RefStatus           = (int)LeaveStatus.Planned,
                        RefEmployeeId       = 1,
                        CreatedBy           = "Alekya"
                    };
                    ctx.EmployeeLeaveTransactions.Add(employeeLeaveDetails);
                    ctx.SaveChanges();
                }
                result = true;
            }
            catch (Exception ex)
            {
                throw;
            }
            return(result);
        }
Пример #2
0
        public bool DeleteLeaveRequest(int id)
        {
            var result = false;

            try
            {
                using (var ctx = new LeaveManagementSystemEntities1())
                {
                    var leaveDetails = ctx.EmployeeLeaveTransactions.FirstOrDefault(x => x.Id == id);
                    ctx.EmployeeLeaveTransactions.Remove(leaveDetails);
                    ctx.SaveChanges();
                }
                result = true;
            }
            catch (Exception ex)
            {
                throw;
            }
            return(result);
        }
Пример #3
0
        public bool SubmitLeaveForApproval(int id)
        {
            var result = false;

            try
            {
                using (var ctx = new LeaveManagementSystemEntities1())
                {
                    var leaveDetails = ctx.EmployeeLeaveTransactions.FirstOrDefault(x => x.Id == id);
                    leaveDetails.RefStatus = (int)LeaveStatus.Submitted;
                    ctx.SaveChanges();
                }
                result = true;
            }
            catch (Exception ex)
            {
                throw;
            }
            return(result);
        }