/// <summary> /// Insert a piece of record in database. /// </summary> /// <param name="LeaveDetails"></param> /// <returns></returns> public Response InsertLeaveDetails(LeaveDetails leaveDetails) { Response response = new Response(); using (_dataAccess.Connection = new OleDbConnection(ConnectionString)) { _dataAccess.Open(); string sql = "INSERT INTO [LeaveDetails] ([StaffId],[LeaveTypeId],[StartDate],[EndDate],[Duration],[Remark]) VALUES (@StaffId,@LeaveTypeId,@StartDate,@EndDate,@Duration,@Remark)"; QueryParameter[] list = new QueryParameter[6]; list[0] = new QueryParameter("@StaffId", leaveDetails.StaffId, DbType.Int32); list[1] = new QueryParameter("@LeaveTypeId", leaveDetails.LeaveTypeId, DbType.Int32); list[2] = new QueryParameter("@StartDate", leaveDetails.StartDate, DbType.DateTime); list[3] = new QueryParameter("@EndDate", leaveDetails.EndDate, DbType.DateTime); list[4] = new QueryParameter("@Duration", leaveDetails.Duration, DbType.Single); list[5] = new QueryParameter("@Remark", leaveDetails.Remark, DbType.String); response.IsFailed = !Convert.ToBoolean(_dataAccess.ExecuteNonQuery(sql, list)); } return(response); }
/// <summary> /// Insert a piece of record in database. /// </summary> /// <param name="SystemConstant"></param> /// <returns></returns> public Response InsertSystemConstant(SystemConstant systemConstant) { Response response = new Response(); using (_dataAccess.Connection = new OleDbConnection(ConnectionString)) { _dataAccess.Open(); string sql = "INSERT INTO [SystemConstant] ([ConstantName],[ConstantValue],[Description]) VALUES (@ConstantName,@ConstantValue,@Description)"; QueryParameter[] list = new QueryParameter[3]; list[0] = new QueryParameter("@ConstantName", systemConstant.ConstantName, DbType.String); list[1] = new QueryParameter("@ConstantValue", systemConstant.ConstantValue, DbType.String); list[2] = new QueryParameter("@Description", systemConstant.Description, DbType.String); response.IsFailed = !Convert.ToBoolean(_dataAccess.ExecuteNonQuery(sql, list)); } return(response); }
/// <summary> /// Insert a piece of record in database. /// </summary> /// <param name="Department"></param> /// <returns></returns> public Response InsertDepartment(Department department) { Response response = new Response(); using (_dataAccess.Connection = new OleDbConnection(ConnectionString)) { _dataAccess.Open(); string sql = "INSERT INTO [Department] ([DepartmentName],[Description],[DepartmentManagerId],[ParentDepartmentId]) VALUES (@DepartmentName,@Description,@DepartmentManagerId,@ParentDepartmentId)"; QueryParameter[] list = new QueryParameter[4]; list[0] = new QueryParameter("@DepartmentName", department.DepartmentName, DbType.String); list[1] = new QueryParameter("@Description", department.Description, DbType.String); list[2] = new QueryParameter("@DepartmentManagerId", department.DepartmentManagerId, DbType.Int32); list[3] = new QueryParameter("@ParentDepartmentId", department.ParentDepartmentId, DbType.Int32); response.IsFailed = !Convert.ToBoolean(_dataAccess.ExecuteNonQuery(sql, list)); } return(response); }