public int ExpenseTypeInsUpd(ExpenseType expenseType, int StaffId) { int SupplierId = 0; try { var param = new DbParam[6]; param[0] = new DbParam("@ExpenseTypeId", expenseType.ExpenseTypeId, SqlDbType.Int); param[1] = new DbParam("@TypeName", expenseType.TypeName, SqlDbType.VarChar); param[2] = new DbParam("@TypeDescription", expenseType.TypeDescription, SqlDbType.VarChar); param[3] = new DbParam("@IsActive", expenseType.IsActive, SqlDbType.Bit); param[4] = new DbParam("@CreatedBy", StaffId, SqlDbType.Int); param[5] = new DbParam("@BranchId", expenseType.BranchId, SqlDbType.Int); SupplierId = Db.Insert("SP_EXPENSETYPE_INSUPD", param, true); } catch (Exception ex) { //CommonFunctions.LogError(ex, ErrorLog.LogSeverity.Error); } return(SupplierId); }
public int MealTimeInsUpd(MealTime mealTime, int StaffId) { int mealTimeId = 0; try { var param = new DbParam[6]; param[0] = new DbParam("@MealTimeId", mealTime.MealTimeId, SqlDbType.Int); param[1] = new DbParam("@MealTime", mealTime.MTime, SqlDbType.DateTime); param[2] = new DbParam("@Description", mealTime.Description, SqlDbType.VarChar); param[3] = new DbParam("@IsActive", mealTime.IsActive, SqlDbType.Bit); param[4] = new DbParam("@CreatedBy", StaffId, SqlDbType.Int); param[5] = new DbParam("@BranchId", mealTime.BranchId, SqlDbType.Int); mealTimeId = Db.Insert("SP_MEALTIME_INSUPD", param, true); } catch (Exception ex) { //CommonFunctions.LogError(ex, ErrorLog.LogSeverity.Error); } return(mealTimeId); }
public Expenses ExpenseById(int expenseId) { Expenses expenses = null; try { var param = new DbParam[1]; param[0] = new DbParam("@ExpenseId", expenseId, SqlDbType.Int); DataRow row = Db.GetDataRow("SP_EXPENSE_BY_ID", param); if (row != null) { expenses = new Expenses(); expenses.ExpenseId = Db.ToInteger(row["ExpenseId"]); expenses.ExpenseType = new ExpenseType(); expenses.ExpenseType.TypeName = Db.ToString(row["TypeName"]); expenses.ExpenseType.ExpenseTypeId = Db.ToInteger(row["ExpenseTypeId"]); expenses.ExpenseAmount = Db.ToString(row["ExpenseAmount"]); expenses.ExpenseDate = Db.ToDateTime(row["ExpenseDate"]); expenses.ExpenseDescription = Db.ToString(row["ExpenseDescription"]); expenses.ReferenceNumber = Db.ToString(row["ReferenceNumber"]); expenses.ExpenseMode = new ExpenseMode(); expenses.ExpenseMode.ExpenseMod = Db.ToString(row["ExpenseMode"]); expenses.ExpenseMode.ExpenseModeId = Db.ToInteger(row["ExpenseModeId"]); expenses.IsActive = Db.ToBoolean(row["IsActive"]); } } catch (Exception ex) { //CommonFunctions.LogError(ex, ErrorLog.LogSeverity.Error); } return(expenses); }
public Staff StaffById(int staffId) { Staff staff = null; try { var param = new DbParam[1]; param[0] = new DbParam("@UserId", staffId, SqlDbType.Int); DataSet dataSet = Db.GetDataSet("SP_USER_BY_ID", param); if (dataSet != null && dataSet.Tables.Count > 0 && dataSet.Tables[0].Rows.Count > 0) { staff = new Staff(); foreach (DataRow dr in dataSet.Tables[0].Rows) { staff.UserId = Db.ToInteger(dr["UserId"]); staff.UserName = Db.ToString(dr["UserName"]); staff.FirstName = Db.ToString(dr["FirstName"]); staff.LastName = Db.ToString(dr["LastName"]); staff.DOB = Db.ToDateTime(dr["DOB"]); staff.PhoneNo = Db.ToString(dr["PhoneNo"]); staff.Email = Db.ToString(dr["Email"]); staff.Address = Db.ToString(dr["Address"]); staff.DailySalary = Db.ToDecimal(dr["DailySalary"]); staff.IsActive = Db.ToBoolean(dr["IsActive"]); staff.Role = new Role(); staff.Role.RoleId = Db.ToInteger(dr["RoleId"]); staff.Role.RoleName = Db.ToString(dr["RoleName"]); } if (dataSet.Tables.Count > 1 && dataSet.Tables[1].Rows.Count > 0) { foreach (DataRow dr in dataSet.Tables[1].Rows) { staff.SelectedBranches.Add(new Node() { Id = Db.ToInteger(dr["BranchId"]), Name = Db.ToString(dr["BranchName"]) }); } } if (dataSet.Tables.Count > 2 && dataSet.Tables[2].Rows.Count > 0) { foreach (DataRow dr in dataSet.Tables[2].Rows) { staff.SelectedShifts.Add(new Node() { Id = Db.ToInteger(dr["ShiftId"]), Name = Db.ToString(dr["Name"]) }); } } } } catch (Exception ex) { //CommonFunctions.LogError(ex, ErrorLog.LogSeverity.Error); } return(staff); }