private void buttonUserLookUp_Click(object sender, EventArgs e) { List<ItemLookUp> listItem = new List<ItemLookUp>(); FormLookUp objLookUp = new FormLookUp("User Look Up", CommonEnums.LookUps.user, this); try { objLookUp.ShowDialog(); if (objLookUp.SelectedID != null) { var user = new UserBO(); user.UserName = objLookUp.SelectedValue; userID = int.Parse(objLookUp.SelectedID); GetUserInfo(user); } } catch { MessageBoxClass.ShowMessage(CommonMethods.GetError("U_007"), true); } finally { objLookUp.Dispose(); } }
public UserBO LoadUserByUserName(UserBO obj) { DBEgine dbEgine = new DBEgine(); try { dbEgine.DBOpen(); SqlParameter[] parms = new SqlParameter[1]; SqlParameter p1 = new SqlParameter(); p1.ParameterName = "@UserName"; p1.SqlDbType = SqlDbType.NVarChar; p1.Size = 256; p1.Direction = ParameterDirection.Input; p1.Value = obj.UserName; parms[0] = p1; SqlDataReader drUser = dbEgine.ExecuteReader("UserManagement.UM_LoadUserByUserName", parms); if (drUser != null && drUser.HasRows) { while (drUser.Read()) { obj= FillUser(drUser); } obj.ScreenList = LoadUserPermissionByUserId(obj); } } catch { throw; } finally { dbEgine.DBClose(); } return obj; }
public List<UserBO> LoadUserByDesignationID(int designationId) { DBEgine dbEgine = new DBEgine(); List<UserBO> userList = new List<UserBO>(); try { dbEgine.DBOpen(); SqlParameter[] parms = new SqlParameter[1]; SqlParameter p1 = new SqlParameter(); p1.ParameterName = "@DesignationID"; p1.SqlDbType = SqlDbType.Int; p1.Direction = ParameterDirection.Input; p1.Value = designationId; parms[0] = p1; SqlDataReader userReader = dbEgine.ExecuteReader("UM_LoadUsersByDesignationID", parms); while (userReader.Read()) { UserBO user = new UserBO(); user.FirstName = userReader.GetValue(userReader.GetOrdinal("FirstName")).ToString(); user.LastName = userReader.GetValue(userReader.GetOrdinal("LastName")).ToString(); user.Initials = userReader.GetValue(userReader.GetOrdinal("Initials")).ToString(); user.UserDesignation = new DesignationBO(); user.UserDesignation.DesignationId = designationId; user.UserDesignation = new DesignationDAL().GetDesignation(user.UserDesignation.DesignationId); //user.UserDesignation.GetDesignation(user.UserDesignation.DesignationId); user.IsEnable = userReader.GetBoolean(userReader.GetOrdinal("IsEnable")); user.UserId = userReader.GetInt32(userReader.GetOrdinal("UserId")); userList.Add(user); } return userList; } catch { throw; } finally { dbEgine.DBClose(); } }
public List<UserBO> LoadParticipantsBycampaignBranchId(int CampaignBranchAssignId) { DBEgine dbEgine = new DBEgine(); List<UserBO> userList = new List<UserBO>(); try { dbEgine.DBOpen(); SqlParameter[] parms = new SqlParameter[1]; SqlParameter p1 = new SqlParameter(); p1.ParameterName = "in_CampaignBranchAssignId"; p1.SqlDbType = SqlDbType.Int; p1.Direction = ParameterDirection.Input; p1.Value = CampaignBranchAssignId; parms[0] = p1; SqlDataReader userReader = dbEgine.ExecuteReader("CM_LoadParticipantsBycampaignParticipantId", parms); while (userReader.Read()) { UserBO user = new UserBO(); //campaign.CampaignId = campaignReader.GetInt32(campaignReader.GetOrdinal("CampaignId")); user.FirstName = userReader.GetValue(userReader.GetOrdinal("FirstName")).ToString(); user.LastName = userReader.GetValue(userReader.GetOrdinal("LastName")).ToString(); user.Initials = userReader.GetValue(userReader.GetOrdinal("Initials")).ToString(); user.Nic = userReader.GetValue(userReader.GetOrdinal("Nic")).ToString(); user.UserDesignation = new DesignationBO(); user.UserDesignation.DesignationId = userReader.GetInt32(userReader.GetOrdinal("DesignationId")); user.UserDesignation = new DesignationDAL().GetDesignation(user.UserDesignation.DesignationId); //user.UserDesignation.GetDesignation(user.UserDesignation.DesignationId); user.Email = userReader.GetValue(userReader.GetOrdinal("Email")).ToString(); user.IsParticipate = userReader.GetBoolean(userReader.GetOrdinal("IsParticipate")); //AD //user.BranchPrimary = new Branch(); //user.BranchPrimary.BranchName = userReader.GetValue(userReader.GetOrdinal("BranchName")).ToString(); user.UserId = userReader.GetInt32(userReader.GetOrdinal("userId")); user.CampaignParticipantsId = userReader.GetInt32(userReader.GetOrdinal("CampaignParticipantsId")); user.IsEnable = userReader.GetBoolean(userReader.GetOrdinal("IsEnable")); userList.Add(user); } return userList; } catch { throw; } finally { dbEgine.DBClose(); } }
public List<UserBO> LoadBranchMobileUsers(int branchId) { DBEgine dbEngin = new DBEgine(); try { SqlParameter branchIdParam = new SqlParameter("@BranchId", SqlDbType.Int); branchIdParam.Value = branchId; SqlParameter[] paramList = { branchIdParam }; dbEngin.DBOpen(); SqlDataReader reader = dbEngin.ExecuteReader("CB_LoadBranchMobileUsers", paramList); List<UserBO> userList = new List<UserBO>(); while (reader.Read()) { UserBO user = new UserBO(); user.UserId = reader.GetInt32(reader.GetOrdinal("UserId")); user.FirstName = reader.GetValue(reader.GetOrdinal("FirstName")).ToString(); user.LastName = reader.GetValue(reader.GetOrdinal("LastName")).ToString(); userList.Add(user); } return userList; } catch { throw; } finally { dbEngin.DBClose(); } }
public List<UserBO> LoadAllActiveUserByBranchID(int branchID) { DBEgine dbEgine = new DBEgine(); List<UserBO> userList = new List<UserBO>(); try { dbEgine.DBOpen(); SqlParameter[] parms = new SqlParameter[1]; SqlParameter p1 = new SqlParameter(); p1.ParameterName = "@BranchID"; p1.SqlDbType = SqlDbType.Int; p1.Direction = ParameterDirection.Input; p1.Value = branchID; parms[0] = p1; SqlDataReader userReader = dbEgine.ExecuteReader("UM_LoadAllActiveUserByBranchID", parms); while (userReader.Read()) { UserBO user = new UserBO(); user.FirstName = userReader.GetValue(userReader.GetOrdinal("FirstName")).ToString(); user.LastName = userReader.GetValue(userReader.GetOrdinal("LastName")).ToString(); user.UserId = userReader.GetInt32(userReader.GetOrdinal("UserId")); userList.Add(user); } return userList; } catch { throw; } finally { dbEgine.DBClose(); } }
public List<UserBO> LoadUsersForAssignPackage(int branchId, int packageId) { DBEgine dbEgine = new DBEgine(); UserBO user = new UserBO(); List<UserBO> userList = new List<UserBO>(); try { dbEgine.DBOpen(); SqlParameter[] parms = new SqlParameter[2]; SqlParameter p1 = new SqlParameter(); p1.ParameterName = "@BranchId"; p1.SqlDbType = SqlDbType.Int; p1.Direction = ParameterDirection.Input; p1.Value = branchId; parms[0] = p1; SqlParameter p2 = new SqlParameter(); p2.ParameterName = "@PackageId"; p2.SqlDbType = SqlDbType.Int; p2.Direction = ParameterDirection.Input; p2.Value = packageId; parms[1] = p2; SqlDataReader drUser = dbEgine.ExecuteReader("UM_LoadUsersForAssignPackage", parms); if (drUser != null && drUser.HasRows) { while (drUser.Read()) { user = FillUser1(drUser); userList.Add(user); } } else { userList = null; } } catch { throw; } finally { dbEgine.DBClose(); } return userList; }
public bool AssignRoleToUser(UserBO obj, DBEgine dbEgine) { bool isAssign = false; try { foreach (RoleBO role in obj.UserRoles) { AssignRoleToUser(obj.UserId, role.RoleId, obj.UserName, role.IsActive, dbEgine); } isAssign = true; } catch { throw; } return isAssign; }
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(); } }
private UserBO FillUser1(SqlDataReader dr) { UserBO user = new UserBO(); try { user.UserId = dr.GetInt32(dr.GetOrdinal("UserId")); user.UserName = dr.GetValue(dr.GetOrdinal("UserName")).ToString(); user.UserPassword = dr.GetValue(dr.GetOrdinal("Password")).ToString(); user.FirstName = dr.GetValue(dr.GetOrdinal("FirstName")).ToString(); user.LastName = dr.GetValue(dr.GetOrdinal("LastName")).ToString(); user.Initials = dr.GetValue(dr.GetOrdinal("Initials")).ToString(); user.Address = dr.GetValue(dr.GetOrdinal("Address")).ToString(); user.Nic = dr.GetValue(dr.GetOrdinal("Nic")).ToString(); user.PassportNo = dr.GetValue(dr.GetOrdinal("PassportNo")).ToString(); user.EmpNo = dr.GetValue(dr.GetOrdinal("EmployeeNo")).ToString(); user.TelHome = dr.GetValue(dr.GetOrdinal("TelHome")).ToString(); user.TelMobile = dr.GetValue(dr.GetOrdinal("TelMobile")).ToString(); user.Email = dr.GetValue(dr.GetOrdinal("Email")).ToString(); user.UserDesignation = new DesignationBO(); user.UserDesignation.DesignationId = dr.GetInt32(dr.GetOrdinal("DesignationId")); user.UserDesignation =new DesignationDAL().GetDesignation(user.UserDesignation.DesignationId); //user.UserType = Convert.tdr.(dr.GetOrdinal("UserType")); int userTypeId = Convert.ToInt32(dr["UserType"]); user.UserType = (UserTypes)userTypeId; //user._branch = new Branch(); //user._branch.BranchID = Convert.ToInt32(dr["BranchId"]); ////user._branch = new Branch().LoadBranchByBranchID(user._branch.BranchID); //user._userGroup = new UserGroup(); //user._userGroup.GroupId = Convert.ToInt32(dr["GroupId"]); //user._userGroup.GetUserGroupByGroupId(); user.CreatedUser = dr.GetInt32(dr.GetOrdinal("CreatedUser")); user.CreatedDate = dr.GetDateTime(dr.GetOrdinal("CreatedDate")); try { user.ModifiedDate = dr.GetDateTime(dr.GetOrdinal("ModifiedDate")); } catch { } try { user.ModifiedUser = dr.GetInt32(dr.GetOrdinal("ModifiedUser")); } catch { } user.IsEnable = dr.GetBoolean(dr.GetOrdinal("IsEnable")); int isLock = Convert.ToInt32(dr["IsLock"]); user.PasswordRemainDateCount = Convert.ToInt32(dr["RemainDays"]); user.PasswordExpireReminder = Convert.ToInt32(dr["PasswordExpireReminder"]); user.IsAllowConcurrentConnection = Convert.ToBoolean(dr["IsAllowConcurrentConnection"]); user.IsLock = (UserLock)isLock; user.UserRoles = new RoleDAL().LoadRolesbyUserId(user.UserId); int userLevelId = dr.GetInt32(dr.GetOrdinal("UserLevelId")); user.UserLevelPrimary = new UserLevelsDAL().LoadUserLevelByUserLevelId(userLevelId); } catch { throw; } return user; }
private UserBO FillUserForMobile(SqlDataReader dr) { UserBO user = new UserBO(); try { user.UserId = dr.GetInt32(dr.GetOrdinal("UserId")); user.UserName = dr.GetValue(dr.GetOrdinal("UserName")).ToString(); //user.UserPassword = dr.GetValue(dr.GetOrdinal("Password")).ToString(); user.FirstName = dr.GetValue(dr.GetOrdinal("FirstName")).ToString(); user.LastName = dr.GetValue(dr.GetOrdinal("LastName")).ToString(); //user.Initials = dr.GetValue(dr.GetOrdinal("Initials")).ToString(); //user.Address = dr.GetValue(dr.GetOrdinal("Address")).ToString(); //user.Nic = dr.GetValue(dr.GetOrdinal("Nic")).ToString(); //user.PassportNo = dr.GetValue(dr.GetOrdinal("PassportNo")).ToString(); //user.EmpNo = dr.GetValue(dr.GetOrdinal("EmployeeNo")).ToString(); //user.TelHome = dr.GetValue(dr.GetOrdinal("TelHome")).ToString(); //user.TelMobile = dr.GetValue(dr.GetOrdinal("TelMobile")).ToString(); //user.Email = dr.GetValue(dr.GetOrdinal("Email")).ToString(); //user.Designation = new Designation(); //user.Designation.DesignationId = dr.GetInt32(dr.GetOrdinal("DesignationId")); //user.Designation.GetDesignation(user.Designation.DesignationId); //user.UserType = Convert.tdr.(dr.GetOrdinal("UserType")); int userTypeId = Convert.ToInt32(dr["UserType"]); user.UserType = (UserTypes)userTypeId; //user._branch = new Branch(); //user._branch.BranchID = Convert.ToInt32(dr["BranchId"]); //user._branch.LoadBranchByBranchID(user._branch.BranchID); //user._userGroup = new UserGroup(); //user._userGroup.GroupId = Convert.ToInt32(dr["GroupId"]); //user._userGroup.GetUserGroupByGroupId(); //user.CreatedUser = dr.GetInt32(dr.GetOrdinal("CreatedUser")); //user.CreatedDate = dr.GetDateTime(dr.GetOrdinal("CreatedDate")); //try //{ // user.ModifiedDate = dr.GetDateTime(dr.GetOrdinal("ModifiedDate")); //} //catch //{ //} //try //{ // user.ModifiedUser = dr.GetInt32(dr.GetOrdinal("ModifiedUser")); //} //catch //{ //} user.IsEnable = dr.GetBoolean(dr.GetOrdinal("IsEnable")); int isLock = Convert.ToInt32(dr["IsLock"]); user.IsLock = (UserLock)isLock; user.UserRoles = new RoleDAL().LoadRolesbyMobileUserId(user.UserId); // user.Constraints = new UserConstraints().LoadUserConstratintsByUserId(user.UserId); // user.TransactionConstraints = new UserMobileTransactionConstraints().LoadUserMobiletransactionConstraintsByUserID(user.UserId); } catch { throw; } return user; }
private UserBO FillUser(SqlDataReader dr) { UserBO userBO = new UserBO(); userBO.UserId = dr.GetInt32(dr.GetOrdinal("UserId")); userBO.UserName = dr.GetValue(dr.GetOrdinal("UserName")).ToString(); userBO.UserPassword = dr.GetValue(dr.GetOrdinal("Password")).ToString(); userBO.FirstName = dr.GetValue(dr.GetOrdinal("FirstName")).ToString(); userBO.LastName = dr.GetValue(dr.GetOrdinal("LastName")).ToString(); userBO.Initials = dr.GetValue(dr.GetOrdinal("Initials")).ToString(); userBO.Address = dr.GetValue(dr.GetOrdinal("Address")).ToString(); userBO.Nic = dr.GetValue(dr.GetOrdinal("Nic")).ToString(); userBO.PassportNo = dr.GetValue(dr.GetOrdinal("PassportNo")).ToString(); userBO.EmpNo = dr.GetValue(dr.GetOrdinal("EmployeeNo")).ToString(); userBO.TelHome = dr.GetValue(dr.GetOrdinal("TelHome")).ToString(); userBO.TelMobile = dr.GetValue(dr.GetOrdinal("TelMobile")).ToString(); userBO.Email = dr.GetValue(dr.GetOrdinal("Email")).ToString(); userBO.UserDesignation = new DesignationBO(); userBO.UserDesignation.DesignationId = dr.GetInt32(dr.GetOrdinal("DesignationId")); userBO.IsPasswordExpire = dr.GetBoolean(dr.GetOrdinal("IsPasswordExpire")); userBO.PasswordExpirePeriod = dr.GetInt32(dr.GetOrdinal("PasswordExpirePeriod")); userBO.IsUserChangePasswordFirstLogin = dr.GetBoolean(dr.GetOrdinal("IsUserChangePasswordFirstLogin")); userBO.IsAllowConcurrentConnection = dr.GetBoolean(dr.GetOrdinal("IsAllowConcurrentConnection")); userBO.UserDesignation = new DesignationDAL().GetDesignation(userBO.UserDesignation.DesignationId); int userTypeId = Convert.ToInt32(dr["UserType"]); userBO.UserType = (UserTypes)userTypeId; //AD //userBO.branch = new Branch(); ////userBO._branch.BranchID = Convert.ToInt32(dr["BranchId"]); //userBO._branch = userBO._branch.LoadBranchByBranchID(Convert.ToInt32(dr["BranchId"])); //userBO._userGroup = new UserGroup(); //userBO._userGroup.GroupId = Convert.ToInt32(dr["GroupId"]); //userBO._userGroup.GetUserGroupByGroupId(); userBO.CreatedUser = dr.GetInt32(dr.GetOrdinal("CreatedUser")); userBO.CreatedDate = dr.GetDateTime(dr.GetOrdinal("CreatedDate")); try { userBO.ModifiedDate = dr.GetDateTime(dr.GetOrdinal("ModifiedDate")); } catch { } try { userBO.ModifiedUser = dr.GetInt32(dr.GetOrdinal("ModifiedUser")); } catch { } userBO.IsEnable = dr.GetBoolean(dr.GetOrdinal("IsEnable")); userBO.IsAccountManager = dr.GetBoolean(dr.GetOrdinal("IsAccountManager")); userBO.IsClientManager = dr.GetBoolean(dr.GetOrdinal("IsClientManager")); int isLock = Convert.ToInt32(dr["IsLock"]); userBO.IsLock = (UserLock)isLock; userBO.UserRoles = new RoleDAL().LoadRolesbyUserId(userBO.UserId); int userLevelId = dr.GetInt32(dr.GetOrdinal("UserLevelId")); userBO.UserLevelPrimary = new UserLevelsDAL().LoadUserLevelByUserLevelId(userLevelId); return userBO; }
private UserBO FillLightUser(SqlDataReader dr) { UserBO user = new UserBO(); try { user.UserId = dr.GetInt32(dr.GetOrdinal("UserId")); user.UserName = dr.GetValue(dr.GetOrdinal("UserName")).ToString(); user.UserPassword = dr.GetValue(dr.GetOrdinal("Password")).ToString(); user.FirstName = dr.GetValue(dr.GetOrdinal("FirstName")).ToString(); user.LastName = dr.GetValue(dr.GetOrdinal("LastName")).ToString(); user.Initials = dr.GetValue(dr.GetOrdinal("Initials")).ToString(); return user; } catch { throw; } }
public UserBO UserLoginForExternalDevices(string userName, string passWord) { DBEgine dbEgine = new DBEgine(); UserBO user = new UserBO(); try { dbEgine.DBOpen(); SqlParameter[] parms = new SqlParameter[2]; SqlParameter p1 = new SqlParameter(); p1.ParameterName = "@UserName"; p1.SqlDbType = SqlDbType.NVarChar; p1.Size = 256; p1.Direction = ParameterDirection.Input; p1.Value = userName; parms[0] = p1; SqlParameter p2 = new SqlParameter(); p2.ParameterName = "@password"; p2.SqlDbType = SqlDbType.NVarChar; p2.Size = 500; p2.Direction = ParameterDirection.Input; p2.Value = passWord; parms[1] = p2; SqlDataReader drUser = dbEgine.ExecuteReader("UserManagement.UM_LoadUserByUserNameandPassword", parms); if (drUser != null && drUser.HasRows) { while (drUser.Read()) { user = FillUser1(drUser); } //user.ScreenList = LoadUserPermissionByUserId(); } else { user = null; } } catch { throw; } finally { dbEgine.DBClose(); } return user; }
private void ChangePass() { UserBO user = new UserBO(); var userDal = new UserDAL(); try { bool passwordExists = userDal.IsOldPasswordExist(SelectedUserId, textBoxOldPassword.Text.Trim()); if (passwordExists) { bool passwordChanged = userDal.ChangePasswordByUserId(SelectedUserId, textBoxConfirmPassword.Text.Trim(), Common.User.UserId); if (passwordChanged) { MessageBoxClass.ShowMessage(CommonMethods.GetError("U_016"), false); } else { MessageBoxClass.ShowMessage(CommonMethods.GetError("U_015"), false); } } else { MessageBoxClass.ShowMessage(CommonMethods.GetError("U_014"), false); } } catch { MessageBoxClass.ShowMessage(CommonMethods.GetError("U_015"), true); } }
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(); } }
private void SaveUser() { UserBO user = new UserBO(); //if (!ValidateData(user)) return; try { //if (user.UserId == -1) //{ if (!Common.IsValidPassword(textBoxPassword.Text.ToString().Trim())) { MessageBoxClass.ShowMessage(ErrorMessagesClass.InvaliedPasswordLength, true); return; } if (textBoxPassword.Text.Contains(' ')) { MessageBoxClass.ShowMessage(ErrorMessagesClass.InvaliedPasswordCharacter, true); return; } //} user.UserId = userID; user.UserName = textBoxUserName.Text.ToString(); user.UserPassword = textBoxPassword.Text.ToString(); user.FirstName = textBoxFirstName.Text.ToString().ToUpper(); user.LastName = textBoxLastName.Text.ToString().ToUpper(); user.Initials = "A.B.C"; user.Address = textBoxAddress.Text.ToString().ToUpper(); user.Nic = "NIC"; user.PassportNo = "Passport"; user.EmpNo = "EmpNo"; user.TelHome = "Telephone"; user.TelMobile = "Mobile"; user.Email = textBoxEmail.Text.ToString().ToUpper(); user.UserDesignation = new DesignationBO(); user.UserDesignation.DesignationId = 1; user.UserLevelPrimary = new UserLevelsBO(); var level = new UserLevelsBO(); level.UserLevelId = 1;//int.Parse(comboBoxUserLevel.SelectedValue.ToString()); user.UserLevelPrimary = level; user.UserLevelDeatailList = new List<UserLevelsDetailsBO>(); user.UserLevelDeatailList = LoadUserLevelDetailsList(-1); user.UserBranchDetailList = new List<UserBranchesDetailsBO>(); user.UserBranchDetailList = LoadUserBranchesDetailsList(-1); user.UserGroup = new UserGroupBO(); user.UserGroup.GroupId = 1; user.UserRoles = new List<RoleBO>(); var role=new RoleBO(); role.RoleId = int.Parse(comboBoxUserLevel.SelectedValue.ToString()); role.IsActive = true; user.UserRoles.Add(role); /*User Type, Group Id , lock*/ user.UserType = 0; user.IsLock = 0; user.IsClientManager = false; user.IsAccountManager = false; user.IsEnable = checkBoxStatus.Checked; user.CreatedUser = Common.User.UserId; user.PasswordExpirePeriod = 0;//Convert.ToInt32(txtPasswordExpirePeriod.Text); user.IsUserChangePasswordFirstLogin = false;//ChkUserPasswordChange.Checked; user.IsPasswordExpire = false;//ChkPasswordExpire.Checked; user.IsAllowConcurrentConnection = false;//ChkConcurrentConnection.Checked; user.CreatedUser = Common.User.UserId; user.CreatedDate = DateTime.Now; user.UserId = new UserDAL().AddUser(user); if (user.UserId > 0) { MessageBoxClass.ShowMessage(ErrorMessagesClass.UserSaveSucess, false); GetUserInfo(user); //HidePassWordPannel(); } else if (user.UserId == -1) { MessageBoxClass.ShowMessage(ErrorMessagesClass.UserNameAlreadyExists , true); } else { MessageBoxClass.ShowMessage(ErrorMessagesClass.UserSaveFail, true); } } catch { //lblErrorMsg.Text = Common.GerErrorMessage("UM-16"); } }
public List<UserBO> LoadActiveAccountManagers() { List<UserBO> listActiveAccountManagers = new List<UserBO>(); DBEgine dbEngine = new DBEgine(); try { dbEngine.DBOpen(); SqlDataReader sqlDataReader = dbEngine.ExecuteReader("UM_LoadActiveAccountManagers", null); while (sqlDataReader.Read()) { UserBO user = new UserBO(); if (!sqlDataReader.IsDBNull(sqlDataReader.GetOrdinal("UserName"))) { user.UserName = sqlDataReader.GetString(sqlDataReader.GetOrdinal("UserName")); } if (!sqlDataReader.IsDBNull(sqlDataReader.GetOrdinal("FirstName"))) { user.FirstName = sqlDataReader.GetString(sqlDataReader.GetOrdinal("FirstName")); } if (!sqlDataReader.IsDBNull(sqlDataReader.GetOrdinal("LastName"))) { user.LastName = sqlDataReader.GetString(sqlDataReader.GetOrdinal("LastName")); } if (!sqlDataReader.IsDBNull(sqlDataReader.GetOrdinal("Nic"))) { user.Nic = sqlDataReader.GetString(sqlDataReader.GetOrdinal("Nic")); } if (!sqlDataReader.IsDBNull(sqlDataReader.GetOrdinal("PassportNo"))) { user.PassportNo = sqlDataReader.GetString(sqlDataReader.GetOrdinal("PassportNo")); } if (!sqlDataReader.IsDBNull(sqlDataReader.GetOrdinal("EmployeeNo"))) { user.EmpNo = sqlDataReader.GetString(sqlDataReader.GetOrdinal("EmployeeNo")); } if (!sqlDataReader.IsDBNull(sqlDataReader.GetOrdinal("DesignationId"))) { user.UserDesignation = new DesignationBO(); user.UserDesignation.DesignationId = sqlDataReader.GetInt32(sqlDataReader.GetOrdinal("DesignationId")); } if (!sqlDataReader.IsDBNull(sqlDataReader.GetOrdinal("UserId"))) { user.UserId = sqlDataReader.GetInt32(sqlDataReader.GetOrdinal("UserId")); } if (!sqlDataReader.IsDBNull(sqlDataReader.GetOrdinal("IsEnable"))) { user.IsEnable = sqlDataReader.GetBoolean(sqlDataReader.GetOrdinal("IsEnable")); } listActiveAccountManagers.Add(user); } } catch { throw; } finally { dbEngine.DBClose(); } return listActiveAccountManagers; }
private void GetUserInfo(UserBO user) { user = new UserDAL().LoadUserByUserName(user); textBoxUserName.Text = user.UserName; textBoxEmail.Text = user.Email; //txtInitials.Text = user.Initials; textBoxFirstName.Text = user.FirstName; textBoxLastName.Text = user.LastName; textBoxAddress.Text = user.Address; userID = user.UserId; checkBoxStatus.Checked = user.IsEnable; //txtTelephone.Text = user.TelHome; //txtMobile.Text = user.TelMobile; //txtNIC.Text = user.Nic; //txtPassport.Text = user.PassportNo; //ddlBranchs.SelectedValue = user.UserBranchIdPrimary.ToString(); //ddlBranchs.DataBind(); //txtEmpNo.Text = user.EmpNo; //BindOldDesignations(user.Designation); //ChkAccountManager.Checked = user.IsAccountManager; //ChkClientManager.Checked = user.IsClientManager; //ChkActive.Checked = user.IsEnable; //lbluserName.Text = user.UserName; //lbluserName.Visible = true; //UserName.Visible = false; //lblPassword.Visible = true; //Password.Visible = false; //lblPassword.Text = "xxxxxxxxxx"; //ConfirmPassword.Visible = false; //lblConfirmpassword.Visible = true; //lblConfirmpassword.Text = "xxxxxxxxxx"; //lblUserId.Text = user.UserId.ToString(); //ddlUserLevel.SelectedValue = user.UserLevelPrimary.UserLevelId.ToString(); //txtPasswordExpirePeriod.Text = user.PasswordExpirePeriod.ToString(); //ChkPasswordExpire.Checked = user.IsPasswordExpire; //ChkUserPasswordChange.Checked = user.IsUserChangePasswordFirstLogin; //ChkConcurrentConnection.Checked = user.IsAllowConcurrentConnection; //if (user.IsPasswordExpire) //{ // txtPasswordExpirePeriod.Enabled = true; //} //else //{ // txtPasswordExpirePeriod.Enabled = false; //} }
public List<ScreenBO> LoadUserPermissionByUserId(UserBO obj) { DBEgine dbEgine = new DBEgine(); List<ScreenBO> screenList = new List<ScreenBO>(); try { dbEgine.DBOpen(); SqlParameter[] parms = new SqlParameter[1]; SqlParameter p1 = new SqlParameter(); p1.ParameterName = "in_userId"; p1.SqlDbType = SqlDbType.Int; p1.Direction = ParameterDirection.Input; p1.Value = obj.UserId; parms[0] = p1; SqlDataReader drUserPermission = dbEgine.ExecuteReader("UserManagement.UM_LoadUserPermissionByUserId", parms); while (drUserPermission.Read()) { ScreenBO objscreen = new ScreenBO(); objscreen.ScreenId = drUserPermission.GetInt32(drUserPermission.GetOrdinal("ScreenId")); objscreen.ScreenName = drUserPermission.GetValue(drUserPermission.GetOrdinal("Screen")).ToString(); objscreen.Url = drUserPermission.GetValue(drUserPermission.GetOrdinal("Url")).ToString(); objscreen.IsEnable = drUserPermission.GetBoolean(drUserPermission.GetOrdinal("IsEnable")); objscreen.ScreenOrderId = drUserPermission.GetInt32(drUserPermission.GetOrdinal("ScreenOrderId")); objscreen.TotalPerType = drUserPermission.GetInt32(drUserPermission.GetOrdinal("TotalPerType")); List<PermisionTypeBO> perTypeList = new List<PermisionTypeBO>(); // for(int i=0; i< objscreen.TotalPerType; i++) // { int i = 0; do { i = i + 1; PermisionTypeBO objPerType = new PermisionTypeBO(); objPerType.ScreenPermissionId = drUserPermission.GetInt32(drUserPermission.GetOrdinal("ScreenPermissionId")); objPerType.IsActive = drUserPermission.GetBoolean(drUserPermission.GetOrdinal("IsActive")); perTypeList.Add(objPerType); } while ((i < objscreen.TotalPerType) && drUserPermission.Read()); // } objscreen.PermissionType = perTypeList; perTypeList = null; screenList.Add(objscreen); } dbEgine.DBClose(); return screenList; } catch { throw; } finally { dbEgine.DBClose(); } }