public static bool AddLeavesDAL(Leave_Details leave) { bool isLeaveadded = false; try { SqlCommand command = new SqlCommand("Group3_Payroll.usp_LeaveDetails", connection); command.CommandType = CommandType.StoredProcedure; SqlParameter empid = new SqlParameter("@EmpId", leave.Employee_Id); SqlParameter sdate = new SqlParameter("@Startdate", leave.Leave_From); SqlParameter edate = new SqlParameter("@EndDate", leave.Leave_To); SqlParameter noofday = new SqlParameter("@NoOfDays", leave.No_Of_Days); SqlParameter applydate = new SqlParameter("@ApplyDate", leave.Apply_Date); SqlParameter reason = new SqlParameter("@Reason", leave.Leave_Reason); SqlParameter desc = new SqlParameter("@Description", leave.Leave_Description); command.Parameters.Add(empid); command.Parameters.Add(sdate); command.Parameters.Add(edate); command.Parameters.Add(noofday); command.Parameters.Add(applydate); command.Parameters.Add(reason); command.Parameters.Add(desc); if (connection.State != ConnectionState.Open) { connection.Open(); } command.ExecuteNonQuery(); isLeaveadded = true; if (connection.State == ConnectionState.Open) { connection.Close(); } return(isLeaveadded); } catch (PayrollException) { throw; } catch (System.Exception) { throw; } }
public static bool AddLeavesBLL(Leave_Details leave) { bool isLeaveAdded = false; try { isLeaveAdded = EmployeeOperations.AddLeavesDAL(leave); return(isLeaveAdded); } catch (PayrollException) { throw; } catch (System.Exception) { throw; } }