public bool CompleteDayProcess(int user) { DBEgine objDbAccess = new DBEgine(); bool result = false; try { objDbAccess.DBOpen(); SqlParameter[] parms = new SqlParameter[1]; SqlParameter parmUserID = new SqlParameter(); parmUserID.Value = user; parmUserID.SqlDbType = SqlDbType.Int; parmUserID.Direction = ParameterDirection.Input; parmUserID.ParameterName = "@User"; parms[0] = parmUserID; objDbAccess.ExecNonQueryStoredProc("[admin].CompleteDayProcess ", parms); result = true; return result; } catch (Exception ex) { throw ex; } finally { objDbAccess.DBClose(); } }
public void DeactivateUsersessionByInterval(int interval) { DBEgine dbEngine = new DBEgine(); try { dbEngine.DBOpen(); SqlParameter[] parms = new SqlParameter[1]; SqlParameter p1 = new SqlParameter(); p1.ParameterName = "intervalSecond"; p1.SqlDbType = SqlDbType.Int; p1.Value = interval; parms[0] = p1; dbEngine.ExecNonQueryStoredProc("UM_DeactivateUsersessionByInterval", parms); } catch { throw; } finally { dbEngine.DBClose(); } }
public bool DeleteSubItemByID(int id) { DBEgine objDbAccess = new DBEgine(); bool result = false; try { SqlParameter[] parms = new SqlParameter[1]; SqlParameter parmItemID = new SqlParameter(); parmItemID.Value = id; parmItemID.SqlDbType = SqlDbType.Int; parmItemID.Direction = ParameterDirection.Input; parmItemID.ParameterName = "@SubItemID"; parms[0] = parmItemID; objDbAccess.DBOpen(); int count = objDbAccess.ExecNonQueryStoredProc("Inventory.DeleteSubItem", parms); if (count > 0) { result = true; } return result; } catch (Exception ex) { throw ex; } finally { objDbAccess.DBClose(); } }
public int AddUserBranchDetails(DBEgine dbEgine,int userId,UserBranchesDetailsBO obj) { try { SqlParameter[] paramArray = new SqlParameter[3]; SqlParameter branchIDParam = new SqlParameter(); branchIDParam.ParameterName = "@BranchID"; branchIDParam.SqlDbType = SqlDbType.Int; branchIDParam.Direction = ParameterDirection.Input; branchIDParam.Value = obj.BranchID; paramArray[0] = branchIDParam; SqlParameter userIDParam = new SqlParameter(); userIDParam.ParameterName = "@UserID"; userIDParam.SqlDbType = SqlDbType.Int; userIDParam.Direction = ParameterDirection.Input; userIDParam.Value = obj.UserID; paramArray[1] = userIDParam; SqlParameter isPrimaryParam = new SqlParameter(); isPrimaryParam.ParameterName = "@IsPrimary"; isPrimaryParam.SqlDbType = SqlDbType.Bit; isPrimaryParam.Direction = ParameterDirection.Input; isPrimaryParam.Value = obj.IsPrimary; paramArray[2] = isPrimaryParam; dbEgine.ExecNonQueryStoredProc("UserManagement.UM_AddUserBranchesDetails", paramArray); return obj.BranchID; } catch { throw; } }
public bool AddMeasurementUnit(MeasurementUnitBO measurementUnit) { DBEgine objDbAccess = new DBEgine(); bool result = false; try { SqlParameter[] parms = new SqlParameter[4]; SqlParameter parmUnitID = new SqlParameter(); parmUnitID.Value = measurementUnit.UnitID; parmUnitID.SqlDbType = SqlDbType.Int; parmUnitID.Direction = ParameterDirection.Input; parmUnitID.ParameterName = "@UnitID"; parms[0] = parmUnitID; SqlParameter parmUnitDescription = new SqlParameter(); parmUnitDescription.Value = measurementUnit.UnitDescription; parmUnitDescription.SqlDbType = SqlDbType.VarChar; parmUnitDescription.Direction = ParameterDirection.Input; parmUnitDescription.ParameterName = "@UnitDescription"; parms[1] = parmUnitDescription; SqlParameter parmIsActive = new SqlParameter(); parmIsActive.Value = measurementUnit.IsActive; parmIsActive.SqlDbType = SqlDbType.Bit; parmIsActive.Direction = ParameterDirection.Input; parmIsActive.ParameterName = "@IsActive"; parms[2] = parmIsActive; SqlParameter parmCreatedUser = new SqlParameter(); parmCreatedUser.Value = measurementUnit.CreatedUser; parmCreatedUser.SqlDbType = SqlDbType.Int; parmCreatedUser.Direction = ParameterDirection.Input; parmCreatedUser.ParameterName = "@CreatedUser"; parms[3] = parmCreatedUser; objDbAccess.DBOpen(); if (objDbAccess.ExecNonQueryStoredProc("Inventory.SaveMeasurementUnit", parms) > 0) { result = true; } return result; } catch (Exception ex) { throw ex; } finally { objDbAccess.DBClose(); } }
public int DeleteUserBranchesDetails(DBEgine dbEgine, int userID) { try { SqlParameter[] paramArray = new SqlParameter[1]; SqlParameter userIDParam = new SqlParameter(); userIDParam.ParameterName = "@UserID"; userIDParam.SqlDbType = SqlDbType.Int; userIDParam.Direction = ParameterDirection.Input; userIDParam.Value = userID; paramArray[0] = userIDParam; dbEgine.ExecNonQueryStoredProc("UserManagement.UM_DeleteUserBranchesDetails", paramArray); return new UserBranchesDetailsBO().BranchID; } catch { throw; } }
public Guid CreateSession(UserSessionBO obj) { DBEgine dbEngine = new DBEgine(); try { dbEngine.DBOpen(); SqlParameter[] parms = new SqlParameter[3]; SqlParameter p1 = new SqlParameter(); p1.ParameterName = "UserId"; p1.SqlDbType = SqlDbType.Int; p1.Value = obj.UserID; parms[0] = p1; SqlParameter p2 = new SqlParameter(); p2.ParameterName = "LanguageID"; p2.SqlDbType = SqlDbType.Int; p2.Value = obj.LanguageID; parms[1] = p2; SqlParameter p3 = new SqlParameter(); p3.ParameterName = "UserSessionID"; p3.SqlDbType = SqlDbType.UniqueIdentifier; p3.Direction = ParameterDirection.Output; parms[2] = p3; dbEngine.ExecNonQueryStoredProc("UM_CreateUserSession", parms); return (Guid)p3.Value; } catch { throw; } finally { dbEngine.DBClose(); } }
public bool DeleteSubItemDetailByID(DBEgine objDbAccess, int id) { try { SqlParameter[] parms = new SqlParameter[1]; SqlParameter parmItemID = new SqlParameter(); parmItemID.Value = id; parmItemID.SqlDbType = SqlDbType.Int; parmItemID.Direction = ParameterDirection.Input; parmItemID.ParameterName = "@SubItemID"; parms[0] = parmItemID; objDbAccess.ExecNonQueryStoredProc("Inventory.DeleteSubItemDetail", parms); return true; } catch (Exception ex) { throw ex; } }
public bool EditGroup(UserGroupBO obj) { bool isUpdate = false; DBEgine dbEgine = new DBEgine(); dbEgine.DBOpen(); SqlParameter[] parms = new SqlParameter[3]; SqlParameter p1 = new SqlParameter(); p1.ParameterName = "in_groupId"; p1.SqlDbType = SqlDbType.Int; p1.Direction = ParameterDirection.Input; p1.Value = obj.GroupId; parms[0] = p1; SqlParameter p2 = new SqlParameter(); p2.ParameterName = "in_groupName"; p2.SqlDbType = SqlDbType.NVarChar; p2.Size = 50; p2.Direction = ParameterDirection.Input; p2.Value = obj.GroupName; parms[1] = p2; SqlParameter p3 = new SqlParameter(); p3.ParameterName = "in_modifiedUser"; p3.SqlDbType = SqlDbType.Int; p3.Direction = ParameterDirection.Input; p3.Value = obj.ModifiedUser; parms[2] = p3; dbEgine.ExecNonQueryStoredProc("UM_EditGroup", parms); isUpdate = true; dbEgine.DBClose(); return isUpdate; }
public bool DeleteInvoice(InvoiceHeaderBO invoiceHeader) { DBEgine objDbAccess = new DBEgine(); bool result = false; SqlTransaction tran = null; try { SqlParameter[] parms = new SqlParameter[1]; SqlParameter parmInvoiceID = new SqlParameter(); parmInvoiceID.Value = invoiceHeader.InvoiceID; parmInvoiceID.SqlDbType = SqlDbType.Int; parmInvoiceID.Direction = ParameterDirection.Input; parmInvoiceID.ParameterName = "@InvoiceID"; parms[0] = parmInvoiceID; objDbAccess.DBOpen(tran); if (objDbAccess.ExecNonQueryStoredProc("Sales.DeleteInvoices", parms) > 0) { result = true; } objDbAccess.DBTransAction.Commit(); return result; } catch { objDbAccess.DBTransAction.Rollback(); throw; } finally { objDbAccess.DBClose(); } }
public bool SaveSubItemWithTransaction(SubItemDetailBO subItemDetail, DBEgine objDbAccess) { bool result = false; try { SqlParameter[] parms = new SqlParameter[4]; SqlParameter parmSubItemID = new SqlParameter(); parmSubItemID.Value = subItemDetail.SubItemID; parmSubItemID.SqlDbType = SqlDbType.Int; parmSubItemID.Direction = ParameterDirection.Input; parmSubItemID.ParameterName = "@SubItemID"; parms[0] = parmSubItemID; SqlParameter parmItemID = new SqlParameter(); parmItemID.Value = subItemDetail.ItemID; parmItemID.SqlDbType = SqlDbType.Int; parmItemID.Direction = ParameterDirection.Input; parmItemID.ParameterName = "@ItemID"; parms[1] = parmItemID; SqlParameter parmQtyForUnit = new SqlParameter(); parmQtyForUnit.Value = subItemDetail.QtyForUnit; parmQtyForUnit.SqlDbType = SqlDbType.Decimal; parmQtyForUnit.Direction = ParameterDirection.Input; parmQtyForUnit.ParameterName = "@QtyForUnit"; parms[2] = parmQtyForUnit; SqlParameter parmMeasuringUnit = new SqlParameter(); parmMeasuringUnit.Value = subItemDetail.UnitOfMeasureID; parmMeasuringUnit.SqlDbType = SqlDbType.Int; parmMeasuringUnit.Direction = ParameterDirection.Input; parmMeasuringUnit.ParameterName = "@UnitOfMeasureID"; parms[3] = parmMeasuringUnit; if (objDbAccess.ExecNonQueryStoredProc("Inventory.SaveSubItemDetail", parms) > 0) { result = true; } return result; } catch (Exception ex) { throw ex; } }
public int AddUser(UserBO obj) { //sAdd = false; DBEgine dbEgine = new DBEgine(); SqlTransaction trnx = null; var userBranchDetail = new UserBranchesDetailsDAL(); var userLevelDetail = new UserLevelsDetailsDAL(); try { SqlParameter[] parms = new SqlParameter[27]; SqlParameter p1 = new SqlParameter(); p1.ParameterName = "in_userid"; p1.SqlDbType = SqlDbType.Int; p1.Direction = ParameterDirection.InputOutput; p1.Value = obj.UserId; parms[0] = p1; SqlParameter p2 = new SqlParameter(); p2.ParameterName = "in_UserName"; p2.SqlDbType = SqlDbType.NVarChar; p2.Direction = ParameterDirection.Input; p2.Value = obj.UserName; parms[1] = p2; SqlParameter p3 = new SqlParameter(); p3.ParameterName = "in_Password"; p3.SqlDbType = SqlDbType.NVarChar; p3.Direction = ParameterDirection.Input; p3.Value = obj.UserPassword; parms[2] = p3; SqlParameter p4 = new SqlParameter(); p4.ParameterName = "in_FirstName"; p4.SqlDbType = SqlDbType.NVarChar; p4.Direction = ParameterDirection.Input; p4.Value = obj.FirstName; parms[3] = p4; SqlParameter p5 = new SqlParameter(); p5.ParameterName = "in_LastName"; p5.SqlDbType = SqlDbType.NVarChar; p5.Direction = ParameterDirection.Input; p5.Value = obj.LastName; parms[4] = p5; SqlParameter p6 = new SqlParameter(); p6.ParameterName = "in_Initials"; p6.SqlDbType = SqlDbType.NVarChar; p6.Direction = ParameterDirection.Input; p6.Value = obj.Initials; parms[5] = p6; SqlParameter p7 = new SqlParameter(); p7.ParameterName = "in_Address"; p7.SqlDbType = SqlDbType.NVarChar; p7.Direction = ParameterDirection.Input; p7.Value = obj.Address; parms[6] = p7; SqlParameter p8 = new SqlParameter(); p8.ParameterName = "in_Nic"; p8.SqlDbType = SqlDbType.NVarChar; p8.Direction = ParameterDirection.Input; p8.Value = obj.Nic; parms[7] = p8; SqlParameter p9 = new SqlParameter(); p9.ParameterName = "in_PassportNo"; p9.SqlDbType = SqlDbType.NVarChar; p9.Direction = ParameterDirection.Input; p9.Value = obj.PassportNo; parms[8] = p9; SqlParameter p10 = new SqlParameter(); p10.ParameterName = "in_EmployeeNo"; p10.SqlDbType = SqlDbType.NVarChar; p10.Direction = ParameterDirection.Input; p10.Value = obj.EmpNo; parms[9] = p10; SqlParameter p11 = new SqlParameter(); p11.ParameterName = "in_TelHome"; p11.SqlDbType = SqlDbType.NVarChar; p11.Direction = ParameterDirection.Input; p11.Value = obj.TelHome; parms[10] = p11; SqlParameter p12 = new SqlParameter(); p12.ParameterName = "in_TelMobile"; p12.SqlDbType = SqlDbType.NVarChar; p12.Direction = ParameterDirection.Input; p12.Value = obj.TelMobile; parms[11] = p12; SqlParameter p13 = new SqlParameter(); p13.ParameterName = "in_Email"; p13.SqlDbType = SqlDbType.NVarChar; p13.Direction = ParameterDirection.Input; p13.Value = obj.Email; parms[12] = p13; SqlParameter p14 = new SqlParameter(); p14.ParameterName = "in_DesignationId"; p14.SqlDbType = SqlDbType.Int; p14.Direction = ParameterDirection.Input; p14.Value = obj.UserDesignation.DesignationId; parms[13] = p14; SqlParameter p15 = new SqlParameter(); p15.ParameterName = "in_UserType"; p15.SqlDbType = SqlDbType.Int; p15.Direction = ParameterDirection.Input; p15.Value = Convert.ToInt32(obj.UserType); parms[14] = p15; SqlParameter p16 = new SqlParameter(); p16.ParameterName = "in_BranchIdPrimary"; p16.SqlDbType = SqlDbType.Int; p16.Direction = ParameterDirection.Input; p16.Value = 100; parms[15] = p16; SqlParameter p17 = new SqlParameter(); p17.ParameterName = "in_UserLevelIdPrimary"; p17.SqlDbType = SqlDbType.Int; p17.Direction = ParameterDirection.Input; p17.Value = obj.UserLevelPrimary.UserLevelId; parms[16] = p17; SqlParameter p18 = new SqlParameter(); p18.ParameterName = "in_GroupId"; p18.SqlDbType = SqlDbType.Int; p18.Direction = ParameterDirection.Input; p18.Value = obj.UserGroup.GroupId; parms[17] = p18; SqlParameter p19 = new SqlParameter(); p19.ParameterName = "in_CreatedUser"; p19.SqlDbType = SqlDbType.Int; p19.Direction = ParameterDirection.Input; p19.Value = obj.CreatedUser; parms[18] = p19; SqlParameter p20 = new SqlParameter(); p20.ParameterName = "in_IsEnable"; p20.SqlDbType = SqlDbType.Bit; p20.Direction = ParameterDirection.Input; p20.Value = obj.IsEnable; parms[19] = p20; SqlParameter p21 = new SqlParameter(); p21.ParameterName = "in_IsLock"; p21.SqlDbType = SqlDbType.Int; p21.Direction = ParameterDirection.Input; p21.Value = (int)obj.IsLock; parms[20] = p21; SqlParameter p22 = new SqlParameter(); p22.ParameterName = "in_IsClientManager"; p22.SqlDbType = SqlDbType.Bit; p22.Direction = ParameterDirection.Input; p22.Value = obj.IsClientManager; parms[21] = p22; SqlParameter p23 = new SqlParameter(); p23.ParameterName = "in_IsAccountManager"; p23.SqlDbType = SqlDbType.Bit; p23.Direction = ParameterDirection.Input; p23.Value = obj.IsAccountManager; parms[22] = p23; SqlParameter p24 = new SqlParameter(); p24.ParameterName = "IsPasswordExpire"; p24.SqlDbType = SqlDbType.Bit; p24.Direction = ParameterDirection.Input; p24.Value = obj.IsPasswordExpire; parms[23] = p24; SqlParameter p25 = new SqlParameter(); p25.ParameterName = "PasswordExpirePeriod"; p25.SqlDbType = SqlDbType.Int; p25.Direction = ParameterDirection.Input; p25.Value = obj.PasswordExpirePeriod; parms[24] = p25; SqlParameter p26 = new SqlParameter(); p26.ParameterName = "IsUserChangePasswordFirstLogin"; p26.SqlDbType = SqlDbType.Bit; p26.Direction = ParameterDirection.Input; p26.Value = obj.IsUserChangePasswordFirstLogin; parms[25] = p26; SqlParameter p27 = new SqlParameter(); p27.ParameterName = "IsAllowConcurrentConnection"; p27.SqlDbType = SqlDbType.Bit; p27.Direction = ParameterDirection.Input; p27.Value = obj.IsAllowConcurrentConnection; parms[26] = p27; dbEgine.DBOpen(trnx); dbEgine.ExecNonQueryStoredProc("UserManagement.UM_AddUser", parms); obj.UserId = Convert.ToInt32(p1.Value); if (obj.UserId > 0) { userBranchDetail.DeleteUserBranchesDetails(dbEgine, obj.UserId); userLevelDetail.DeleteUserLevelsDetails(dbEgine, obj.UserId,obj.UserLevelPrimary); foreach (UserLevelsDetailsBO userLevel in obj.UserLevelDeatailList) { new UserLevelsDetailsDAL().AddUserLevelsDetails(dbEgine, obj.UserId,userLevel); } foreach (UserBranchesDetailsBO userBranch in obj.UserBranchDetailList) { new UserBranchesDetailsDAL().AddUserBranchDetails(dbEgine, obj.UserId, userBranch); } foreach (RoleBO userRoles in obj.UserRoles) { AssignRoleToUser(obj,dbEgine); } } dbEgine.DBTransAction.Commit(); return obj.UserId; } catch { dbEgine.DBTransAction.Rollback(); throw; } finally { dbEgine.DBClose(); } }
public bool ChangePasswordByUserId(int userId, string userPassword, int createdBy) { bool isChange = false; DBEgine dbEgine = new DBEgine(); SqlTransaction trnx = null; try { dbEgine.DBOpen(trnx); SqlParameter[] parms = new SqlParameter[2]; SqlParameter p1 = new SqlParameter(); p1.ParameterName = "UserId"; p1.SqlDbType = SqlDbType.Int; p1.Direction = ParameterDirection.Input; p1.Value = userId; parms[0] = p1; SqlParameter p2 = new SqlParameter(); p2.ParameterName = "password"; p2.SqlDbType = SqlDbType.NVarChar; p2.Size = 500; p2.Direction = ParameterDirection.Input; p2.Value = userPassword; parms[1] = p2; dbEgine.ExecNonQueryStoredProc("UserManagement.UM_changePasswordByUserId", parms); isChange = true; UserPaswordHistoryBO histry = new UserPaswordHistoryBO(); histry.UserID = userId; histry.Password = userPassword; histry.CreatedBy = createdBy; new UserPaswordHistoryDAL().SaveUserPaswordHistory(dbEgine, histry); dbEgine.DBTransAction.Commit(); } catch { throw; } finally { dbEgine.DBClose(); } return isChange; }
public bool SaveSubItem(SubItemBO subItem,List<SubItemDetailBO> subItemDetailList) { DBEgine objDbAccess = new DBEgine(); bool result = false; SqlTransaction tran = null; try { SqlParameter[] parms = new SqlParameter[6]; SqlParameter parmItemID = new SqlParameter(); parmItemID.Value = subItem.SubItemID; parmItemID.SqlDbType = SqlDbType.Int; parmItemID.Direction = ParameterDirection.InputOutput; parmItemID.ParameterName = "@SubItemID"; parms[0] = parmItemID; SqlParameter parmItemSerial = new SqlParameter(); parmItemSerial.Value = subItem.SubItemSerial; parmItemSerial.SqlDbType = SqlDbType.VarChar; parmItemSerial.Direction = ParameterDirection.Input; parmItemSerial.ParameterName = "@SubItemSerial"; parms[1] = parmItemSerial; SqlParameter parmDescription = new SqlParameter(); parmDescription.Value = subItem.SubItemDescription; parmDescription.SqlDbType = SqlDbType.VarChar; parmDescription.Direction = ParameterDirection.Input; parmDescription.ParameterName = "@SubItemDescription"; parms[2] = parmDescription; SqlParameter parmMeasuringUnit = new SqlParameter(); parmMeasuringUnit.Value = subItem.SubItemMeasureUnit; parmMeasuringUnit.SqlDbType = SqlDbType.Int; parmMeasuringUnit.Direction = ParameterDirection.Input; parmMeasuringUnit.ParameterName = "@SubItemMeasureUnit"; parms[3] = parmMeasuringUnit; SqlParameter parmCreatedUser = new SqlParameter(); parmCreatedUser.Value = subItem.CreatedUser; parmCreatedUser.SqlDbType = SqlDbType.Int; parmCreatedUser.Direction = ParameterDirection.Input; parmCreatedUser.ParameterName = "@CreatedUser"; parms[4] = parmCreatedUser; SqlParameter parmSubItemUnitPrice = new SqlParameter(); parmSubItemUnitPrice.Value = subItem.SubItemUnitPrice; parmSubItemUnitPrice.SqlDbType = SqlDbType.Decimal; parmSubItemUnitPrice.Direction = ParameterDirection.Input; parmSubItemUnitPrice.ParameterName = "@SubItemUnitPrice"; parms[5] = parmSubItemUnitPrice; objDbAccess.DBOpen(tran); if (objDbAccess.ExecNonQueryStoredProc("Inventory.SaveSubItem", parms) > 0) { new SubItemDetailDAL().DeleteSubItemDetailByID(objDbAccess,int.Parse(parmItemID.Value.ToString())); subItemDetailList.ForEach(delegate(SubItemDetailBO obj) { obj.SubItemID = int.Parse(parmItemID.Value.ToString()); new SubItemDetailDAL().SaveSubItemWithTransaction(obj, objDbAccess); }); result = true; } objDbAccess.DBTransAction.Commit(); return result; } catch (Exception ex) { objDbAccess.DBTransAction.Rollback(); throw ex; } finally { objDbAccess.DBClose(); } }
public bool UpdateQuantityInHand(ItemBO item) { DBEgine objDbAccess = new DBEgine(); bool result = false; try { SqlParameter[] parms = new SqlParameter[2]; SqlParameter parmItemID = new SqlParameter(); parmItemID.Value = item.ItemID; parmItemID.SqlDbType = SqlDbType.Int; parmItemID.Direction = ParameterDirection.Input; parmItemID.ParameterName = "@ItemID"; parms[0] = parmItemID; SqlParameter parmBreakEven = new SqlParameter(); parmBreakEven.Value = item.QtyInHand; parmBreakEven.SqlDbType = SqlDbType.Decimal; parmBreakEven.Direction = ParameterDirection.Input; parmBreakEven.ParameterName = "@QtyInHand"; parms[1] = parmBreakEven; objDbAccess.DBOpen(); if (objDbAccess.ExecNonQueryStoredProc("Inventory.UpdateQtyInhandByItemId", parms) > 0) { result = true; } return result; } catch (Exception ex) { throw ex; } finally { objDbAccess.DBClose(); } }
public bool AddItem(ItemBO item) { DBEgine objDbAccess = new DBEgine(); bool result = false; try { SqlParameter[] parms = new SqlParameter[8]; SqlParameter parmItemID = new SqlParameter(); parmItemID.Value = item.ItemID; parmItemID.SqlDbType = SqlDbType.Int; parmItemID.Direction = ParameterDirection.Input; parmItemID.ParameterName = "@ItemID"; parms[0] = parmItemID; SqlParameter parmItemSerial = new SqlParameter(); parmItemSerial.Value = item.ItemSerial; parmItemSerial.SqlDbType = SqlDbType.NVarChar; parmItemSerial.Direction = ParameterDirection.Input; parmItemSerial.ParameterName = "@ItemSerial"; parms[1] = parmItemSerial; SqlParameter parmDescription = new SqlParameter(); parmDescription.Value = item.Description; parmDescription.SqlDbType = SqlDbType.NVarChar; parmDescription.Direction = ParameterDirection.Input; parmDescription.ParameterName = "@Description"; parms[2] = parmDescription; SqlParameter parmMeasuringUnit = new SqlParameter(); parmMeasuringUnit.Value = item.MeasuringUnit; parmMeasuringUnit.SqlDbType = SqlDbType.Int; parmMeasuringUnit.Direction = ParameterDirection.Input; parmMeasuringUnit.ParameterName = "@MeasuringUnit"; parms[3] = parmMeasuringUnit; SqlParameter parmCreatedUser = new SqlParameter(); parmCreatedUser.Value = item.CreatedUser; parmCreatedUser.SqlDbType = SqlDbType.Int; parmCreatedUser.Direction = ParameterDirection.Input; parmCreatedUser.ParameterName = "@CreatedUser"; parms[4] = parmCreatedUser; SqlParameter parmQtyInHand = new SqlParameter(); parmQtyInHand.Value = item.QtyInHand; parmQtyInHand.SqlDbType = SqlDbType.Decimal; parmQtyInHand.Direction = ParameterDirection.Input; parmQtyInHand.ParameterName = "@QtyInHand"; parms[5] = parmQtyInHand; SqlParameter parmUnitPrice = new SqlParameter(); parmUnitPrice.Value = item.UnitPrice; parmUnitPrice.SqlDbType = SqlDbType.Decimal; parmUnitPrice.Direction = ParameterDirection.Input; parmUnitPrice.ParameterName = "@UnitPrice"; parms[6] = parmUnitPrice; SqlParameter parmBreakEven = new SqlParameter(); parmBreakEven.Value = item.BreakEven; parmBreakEven.SqlDbType = SqlDbType.Decimal; parmBreakEven.Direction = ParameterDirection.Input; parmBreakEven.ParameterName = "@BreakEven"; parms[7] = parmBreakEven; objDbAccess.DBOpen(); if (objDbAccess.ExecNonQueryStoredProc("Inventory.AddItems", parms) > 0) { result = true; } return result; } catch (Exception ex) { throw ex; } finally { objDbAccess.DBClose(); } }
public int SaveUserPaswordHistory(DBEgine dbEngine, UserPaswordHistoryBO upHistry) { int ID = -1; try { SqlParameter[] arrSqlParam = GetFDUpLiftmentParameters(upHistry); dbEngine.ExecNonQueryStoredProc("UserManagement.UM_SaveUserPasswordHistory", arrSqlParam); } catch { throw; } return ID; }
public string CreateUserLoginLog(int userId) { try { DBEgine dbEngine = new DBEgine(); dbEngine.DBOpen(); SqlParameter[] parms = new SqlParameter[2]; SqlParameter p1 = new SqlParameter(); p1.ParameterName = "UserId"; p1.SqlDbType = SqlDbType.Int; p1.Direction = ParameterDirection.Input; p1.Value = userId; parms[0] = p1; SqlParameter p2 = new SqlParameter(); p2.ParameterName = "@LoginId"; p2.SqlDbType = SqlDbType.UniqueIdentifier; p2.Direction = ParameterDirection.Output; //p2.Value = ""; parms[1] = p2; dbEngine.ExecNonQueryStoredProc("UM_CreateUserLoginLog", parms); return p2.Value.ToString(); } catch { throw; } }
private void AssignRoleToUser(int userId, int roleId, string userName, bool isactive, DBEgine dbEgine) { try { // dbEgine.DBOpen(); SqlParameter[] parms = new SqlParameter[4]; SqlParameter p1 = new SqlParameter(); p1.ParameterName = "UserId"; p1.SqlDbType = SqlDbType.Int; p1.Direction = ParameterDirection.Input; p1.Value = userId; parms[0] = p1; SqlParameter p2 = new SqlParameter(); p2.ParameterName = "RoleId"; p2.SqlDbType = SqlDbType.Int; p2.Direction = ParameterDirection.Input; p2.Value = roleId; parms[1] = p2; SqlParameter p3 = new SqlParameter(); p3.ParameterName = "UserName"; p3.SqlDbType = SqlDbType.VarChar; p3.Direction = ParameterDirection.Input; p3.Value = userName; parms[2] = p3; SqlParameter p4 = new SqlParameter(); p4.ParameterName = "IsActive"; p4.SqlDbType = SqlDbType.Bit; p4.Direction = ParameterDirection.Input; p4.Value = isactive; parms[3] = p4; dbEgine.ExecNonQueryStoredProc("UserManagement.UM_AssignRoleToUser", parms); } catch { throw; } finally { //dbEgine.DBClose(); } }
private bool SaveInvoiceDetail(DBEgine objDbAccess, InvoiceDetailBO invoiceDetail) { bool result = false; try { SqlParameter[] parms = new SqlParameter[4]; SqlParameter parmInvoiceId = new SqlParameter(); parmInvoiceId.Value = invoiceDetail.InvoiceId; parmInvoiceId.SqlDbType = SqlDbType.Int; parmInvoiceId.Direction = ParameterDirection.Input; parmInvoiceId.ParameterName = "@InvoiceID"; parms[0] = parmInvoiceId; SqlParameter parmItemId = new SqlParameter(); parmItemId.Value = invoiceDetail.ItemId; parmItemId.SqlDbType = SqlDbType.Int; parmItemId.Direction = ParameterDirection.Input; parmItemId.ParameterName = "@ItemID"; parms[1] = parmItemId; SqlParameter parmQuantity = new SqlParameter(); parmQuantity.Value = invoiceDetail.Quantity; parmQuantity.SqlDbType = SqlDbType.Decimal; parmQuantity.Direction = ParameterDirection.Input; parmQuantity.ParameterName = "@Qty"; parms[2] = parmQuantity; SqlParameter parmCSubTotal = new SqlParameter(); parmCSubTotal.Value = invoiceDetail.SubTotal; parmCSubTotal.SqlDbType = SqlDbType.Decimal; parmCSubTotal.Direction = ParameterDirection.Input; parmCSubTotal.ParameterName = "@SubTotal"; parms[3] = parmCSubTotal; if (objDbAccess.ExecNonQueryStoredProc("Sales.SaveInvoiceDetail", parms) > 0) { result = true; } return result; } catch { throw ; } }
public void CreateUserLogOutLog(string @LoginId) { try { DBEgine dbEngine = new DBEgine(); dbEngine.DBOpen(); SqlParameter[] parms = new SqlParameter[1]; SqlParameter p1 = new SqlParameter(); p1.ParameterName = "LoginId"; p1.SqlDbType = SqlDbType.VarChar; p1.Size = 4000; p1.Direction = ParameterDirection.Input; p1.Value = @LoginId; parms[0] = p1; dbEngine.ExecNonQueryStoredProc("UM_CreateUserLogOutLog", parms); } catch { throw; } }
public bool IsOldPasswordExist(int userId, string userPassword) { bool exist = false; DBEgine dbEgine = new DBEgine(); try { dbEgine.DBOpen(); SqlParameter[] parms = new SqlParameter[3]; SqlParameter p1 = new SqlParameter(); p1.ParameterName = "UserId"; p1.SqlDbType = SqlDbType.Int; p1.Direction = ParameterDirection.Input; p1.Value = userId; parms[0] = p1; SqlParameter p2 = new SqlParameter(); p2.ParameterName = "oldpassword"; p2.SqlDbType = SqlDbType.NVarChar; p2.Size = 500; p2.Direction = ParameterDirection.Input; p2.Value = userPassword; parms[1] = p2; SqlParameter p3 = new SqlParameter(); p3.ParameterName = "found"; p3.SqlDbType = SqlDbType.Int; p3.Direction = ParameterDirection.InputOutput; p3.Value = 0; parms[2] = p3; dbEgine.ExecNonQueryStoredProc("UserManagement.UM_SeracholdPasswordByUserId", parms); if (int.Parse(p3.Value.ToString()) == 1) { exist = true; } dbEgine.DBClose(); } catch { throw; } finally { dbEgine.DBClose(); } return exist; }
public bool ChangePassword(UserBO obj) { bool isAdd = false; DBEgine dbEgine = new DBEgine(); try { dbEgine.DBOpen(); SqlParameter[] parms = new SqlParameter[2]; SqlParameter p1 = new SqlParameter(); p1.ParameterName = "in_UserName"; p1.SqlDbType = SqlDbType.NVarChar; p1.Direction = ParameterDirection.Input; p1.Value = obj.UserName; parms[0] = p1; SqlParameter p2 = new SqlParameter(); p2.ParameterName = "in_Password"; p2.SqlDbType = SqlDbType.NVarChar; p2.Direction = ParameterDirection.Input; p2.Value = obj.UserPassword; parms[0] = p2; dbEgine.ExecNonQueryStoredProc("UserManagement.UM_ChangePassword", parms); isAdd = true; dbEgine.DBClose(); return isAdd; } catch { throw; } finally { dbEgine.DBClose(); } }
public int UnlockUser(UserUnlockBO obj) { DBEgine dbEgine = new DBEgine(); try { dbEgine.DBOpen(); SqlParameter[] parms = new SqlParameter[5]; SqlParameter p1 = new SqlParameter(); p1.ParameterName = "@UserId"; p1.SqlDbType = SqlDbType.Int; p1.Direction = ParameterDirection.Input; p1.Value = obj.User.UserId; parms[0] = p1; SqlParameter p2 = new SqlParameter(); p2.ParameterName = "@IsLock"; p2.SqlDbType = SqlDbType.Int; p2.Direction = ParameterDirection.Input; p2.Value = obj.IsLock; parms[1] = p2; SqlParameter p3 = new SqlParameter(); p3.ParameterName = "@UnLockRemark"; p3.SqlDbType = SqlDbType.VarChar; p3.Direction = ParameterDirection.Input; p3.Value = obj.UnlockRemark; parms[2] = p3; SqlParameter p4 = new SqlParameter(); p4.ParameterName = "@CreatedBy"; p4.SqlDbType = SqlDbType.Int; p4.Direction = ParameterDirection.Input; p4.Value = obj.CreatedBy; parms[3] = p4; SqlParameter p5 = new SqlParameter(); p5.ParameterName = "@ReturnStatus"; p5.SqlDbType = SqlDbType.Int; p5.Direction = ParameterDirection.Output; p5.Value = 0; parms[4] = p5; dbEgine.ExecNonQueryStoredProc("UM_UnlockUser", parms); return int.Parse(p5.Value.ToString()); } catch { throw; } finally { dbEgine.DBClose(); } }
public void UserSessionLastAccessUpdate(UserSessionBO obj) { DBEgine dbEngine = new DBEgine(); try { dbEngine.DBOpen(); SqlParameter[] parms = new SqlParameter[1]; SqlParameter p1 = new SqlParameter(); p1.ParameterName = "UserSessionID"; p1.SqlDbType = SqlDbType.UniqueIdentifier; p1.Value = obj.UserSessionID; parms[0] = p1; dbEngine.ExecNonQueryStoredProc("UM_UserSessionLastAccessUpdate", parms); } catch { throw; } finally { dbEngine.DBClose(); } }
public bool SaveUserLevel(UserLevelsBO obj) { DBEgine dbEgine = new DBEgine(); try { UserLevelsBO userLevelsObj = new UserLevelsBO(); SqlParameter[] parms = new SqlParameter[8]; dbEgine.DBOpen(); SqlParameter userLevelIdNewParm = new SqlParameter(); userLevelIdNewParm.ParameterName = "@UserLevelIdNew"; userLevelIdNewParm.SqlDbType = SqlDbType.Int; userLevelIdNewParm.Direction = ParameterDirection.InputOutput; userLevelIdNewParm.Value = obj.UserLevelId; parms[0] = userLevelIdNewParm; SqlParameter userLevelIdOldParm = new SqlParameter(); userLevelIdOldParm.ParameterName = "@UserLevelIdOld"; userLevelIdOldParm.SqlDbType = SqlDbType.Int; userLevelIdOldParm.Direction = ParameterDirection.InputOutput; userLevelIdOldParm.Value = obj.UserLevelIdOld; parms[1] = userLevelIdOldParm; SqlParameter userLevelParm = new SqlParameter(); userLevelParm.ParameterName = "@UserLevel"; userLevelParm.SqlDbType = SqlDbType.NVarChar; userLevelParm.Direction = ParameterDirection.Input; userLevelParm.Value = obj.UserLevel; parms[2] = userLevelParm; SqlParameter isActiveParm = new SqlParameter(); isActiveParm.ParameterName = "@IsActive"; isActiveParm.SqlDbType = SqlDbType.Bit; isActiveParm.Direction = ParameterDirection.Input; isActiveParm.Value = obj.IsActive; parms[3] = isActiveParm; SqlParameter createdByParm = new SqlParameter(); createdByParm.ParameterName = "@CreatedBy"; createdByParm.SqlDbType = SqlDbType.Int; createdByParm.Direction = ParameterDirection.Input; createdByParm.Value = obj.UserId; parms[4] = createdByParm; SqlParameter modifiedByParm = new SqlParameter(); modifiedByParm.ParameterName = "@ModifiedBy"; modifiedByParm.SqlDbType = SqlDbType.Int; modifiedByParm.Direction = ParameterDirection.Input; modifiedByParm.Value = obj.UserId; parms[5] = modifiedByParm; SqlParameter stateParm = new SqlParameter(); stateParm.ParameterName = "@State"; stateParm.SqlDbType = SqlDbType.Bit; stateParm.Direction = ParameterDirection.InputOutput; stateParm.Value = 0; parms[6] = stateParm; SqlParameter rateParm = new SqlParameter(); rateParm.ParameterName = "@Rate"; rateParm.SqlDbType = SqlDbType.Int; rateParm.Direction = ParameterDirection.Input; rateParm.Value = obj.Rate; parms[7] = rateParm; dbEgine.ExecNonQueryStoredProc("UserManagement.UM_SaveUserLevel", parms); bool state = Boolean.Parse(stateParm.Value.ToString()); dbEgine.DBClose(); return state; } catch { throw; } finally { dbEgine.DBClose(); } }
public bool SaveInvoice(InvoiceHeaderBO invoiceHeader, List<InvoiceDetailBO> invoiceDetail,ref string invoiceNumber,ref int invoiceID) { DBEgine objDbAccess = new DBEgine(); bool result = false; SqlTransaction tran = null; try { SqlParameter[] parms = new SqlParameter[8]; SqlParameter parmInvoiceID = new SqlParameter(); parmInvoiceID.Value = invoiceHeader.InvoiceID; parmInvoiceID.SqlDbType = SqlDbType.Int; parmInvoiceID.Direction = ParameterDirection.InputOutput; parmInvoiceID.ParameterName = "@InvoiceID"; parms[0] = parmInvoiceID; SqlParameter parmInvoiceNumber = new SqlParameter(); parmInvoiceNumber.Value = invoiceHeader.InvoiceNumber; parmInvoiceNumber.SqlDbType = SqlDbType.VarChar; parmInvoiceNumber.Direction = ParameterDirection.InputOutput; parmInvoiceNumber.ParameterName = "@InvoiceNumber"; parms[1] = parmInvoiceNumber; SqlParameter parmIsInvalied = new SqlParameter(); parmIsInvalied.Value = invoiceHeader.StatusID; parmIsInvalied.SqlDbType = SqlDbType.Int; parmIsInvalied.Direction = ParameterDirection.Input; parmIsInvalied.ParameterName = "@StatusID"; parms[2] = parmIsInvalied; SqlParameter parmTotal = new SqlParameter(); parmTotal.Value = invoiceHeader.Total; parmTotal.SqlDbType = SqlDbType.Decimal; parmTotal.Direction = ParameterDirection.Input; parmTotal.ParameterName = "@Total"; parms[3] = parmTotal; SqlParameter parmCreatedUser = new SqlParameter(); parmCreatedUser.Value = invoiceHeader.CreatedUser; parmCreatedUser.SqlDbType = SqlDbType.Int; parmCreatedUser.Direction = ParameterDirection.Input; parmCreatedUser.ParameterName = "@CreatedUser"; parms[4] = parmCreatedUser; SqlParameter parmCustomerID = new SqlParameter(); parmCustomerID.Value = invoiceHeader.CustomerID; parmCustomerID.SqlDbType = SqlDbType.Int; parmCustomerID.Direction = ParameterDirection.Input; parmCustomerID.ParameterName = "@CustomerID"; parms[5] = parmCustomerID; SqlParameter parmReceivedAmount = new SqlParameter(); parmReceivedAmount.Value = invoiceHeader.ReceivedAmount; parmReceivedAmount.SqlDbType = SqlDbType.Decimal; parmReceivedAmount.Direction = ParameterDirection.Input; parmReceivedAmount.ParameterName = "@ReceivedAmount"; parms[6] = parmReceivedAmount; SqlParameter parmBalance = new SqlParameter(); parmBalance.Value = invoiceHeader.Balance; parmBalance.SqlDbType = SqlDbType.Int; parmBalance.Direction = ParameterDirection.Input; parmBalance.ParameterName = "@Balance"; parms[7] = parmBalance; objDbAccess.DBOpen(tran); if (objDbAccess.ExecNonQueryStoredProc("Sales.SaveInvoice", parms) > 0) { foreach (InvoiceDetailBO obj in invoiceDetail) { obj.InvoiceId = int.Parse(parms[0].Value.ToString()); bool success = SaveInvoiceDetail(objDbAccess, obj); if (!success) { objDbAccess.DBTransAction.Rollback(); return false; } } invoiceNumber = parms[1].Value.ToString(); invoiceID = int.Parse(parms[0].Value.ToString()); result = true; } objDbAccess.DBTransAction.Commit(); return result; } catch (SqlException ex) { throw ex; } catch (Exception ex) { throw ex; } finally { objDbAccess.DBClose(); } }
public void UsersessionLogoutByUserID(UserSessionBO obj) { DBEgine dbEngine = new DBEgine(); try { dbEngine.DBOpen(); SqlParameter[] parms = new SqlParameter[3]; SqlParameter p1 = new SqlParameter(); p1.ParameterName = "UserSessionID"; p1.SqlDbType = SqlDbType.UniqueIdentifier; p1.Value = obj.UserSessionID; parms[0] = p1; SqlParameter p2 = new SqlParameter(); p2.ParameterName = "UserID"; p2.SqlDbType = SqlDbType.Int; p2.Value = obj.UserID; parms[1] = p2; SqlParameter p3 = new SqlParameter(); p3.ParameterName = "Remark"; p3.SqlDbType = SqlDbType.VarChar; p3.Value = obj.Remark; parms[2] = p3; dbEngine.ExecNonQueryStoredProc("UM_UsersessionLogoutByUserID", parms); } catch { throw; } finally { dbEngine.DBClose(); } }
public int SaveDesignation(out int Id, DesignationBO obj) { DBEgine dbEgine = new DBEgine(); try { dbEgine.DBOpen(); SqlParameter[] parms = new SqlParameter[4]; SqlParameter designationIdParm = new SqlParameter(); designationIdParm.ParameterName = "DesignationId"; designationIdParm.SqlDbType = SqlDbType.Int; designationIdParm.Direction = ParameterDirection.InputOutput; designationIdParm.Value = obj.DesignationId; parms[0] = designationIdParm; SqlParameter designationParm = new SqlParameter(); designationParm.ParameterName = "Designation"; designationParm.SqlDbType = SqlDbType.NVarChar; designationParm.Direction = ParameterDirection.Input; designationParm.Value = obj.DesignationName; parms[1] = designationParm; SqlParameter descriptionParm = new SqlParameter(); descriptionParm.ParameterName = "Description"; descriptionParm.SqlDbType = SqlDbType.NVarChar; descriptionParm.Direction = ParameterDirection.Input; descriptionParm.Value = obj.Desciption; parms[2] = descriptionParm; SqlParameter IsActiveParm = new SqlParameter(); IsActiveParm.ParameterName = "IsActive"; IsActiveParm.SqlDbType = SqlDbType.Bit; IsActiveParm.Direction = ParameterDirection.Input; IsActiveParm.Value = obj.IsActive; parms[3] = IsActiveParm; dbEgine.ExecNonQueryStoredProc("UM_AddDesignations", parms); Id = Int32.Parse(designationIdParm.Value.ToString()); return Id; } catch { throw; } finally { dbEgine.DBClose(); } }
public void UsersessionLogoutByUserID(DBEgine dbEngine, UserSessionBO userSession) { try { SqlParameter[] parms = new SqlParameter[3]; SqlParameter p1 = new SqlParameter(); p1.ParameterName = "UserSessionID"; p1.SqlDbType = SqlDbType.UniqueIdentifier; p1.Value = userSession.UserSessionID; parms[0] = p1; SqlParameter p2 = new SqlParameter(); p2.ParameterName = "UserID"; p2.SqlDbType = SqlDbType.Int; p2.Value = userSession.UserID; parms[1] = p2; SqlParameter p3 = new SqlParameter(); p3.ParameterName = "Remark"; p3.SqlDbType = SqlDbType.VarChar; p3.Value = userSession.Remark; parms[2] = p3; dbEngine.ExecNonQueryStoredProc("UM_UsersessionLogoutByUserID", parms); } catch { throw; } }