public static void ValidateUser(string Username, string Password) { try { _UserInfo = null; DataTable dt = new DataTable(); using (SqlConnection connection = new SqlConnection(CWConfiguration.ConnectionString)) { connection.Open(); using (SqlCommand cmd = new SqlCommand("sp_ValidatioCWUser", connection)) { cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Username", Username); cmd.Parameters.AddWithValue("@Password", Encryptor.EncryptStringRijndaelToHexString(Password)); using (var adap = new SqlDataAdapter(cmd)) { adap.Fill(dt); } cmd.ExecuteNonQuery(); if (dt.Rows.Count > 0) { CWUserDTO dto = dt.DataTableToObject <CWUserDTO>(); _UserInfo = new CWUserReadDTO(dto.UserId, dto.EmployeeId, dto.Username, dto.Password, dto.UsergroupId, dto.ExpireDate, dto.IsActive, dto.CreateDate, dto.CreateBy, dto.LastModifiedDate, dto.LastModifiedBy); //_UserGroupRoles = SFISUserGroup.RetrieveAllUserGroupRoles(dto.UserId); } } } } catch (Exception ex) { throw ex; } }
public static void AddCWUser(CWUserDTO _obj) { try { using (SqlConnection connection = new SqlConnection(CWConfiguration.ConnectionString)) { connection.Open(); using (SqlCommand cmd = new SqlCommand("sp_CRUD_CWUser", connection)) { cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@EmployeeId", _obj.EmployeeId); cmd.Parameters.AddWithValue("@Username", _obj.Username); cmd.Parameters.AddWithValue("@Password", Encryptor.EncryptStringRijndaelToHexString(_obj.Password)); cmd.Parameters.AddWithValue("@UsergroupId", _obj.UsergroupId); cmd.Parameters.AddWithValue("@CWUser", "User"); cmd.Parameters.AddWithValue("@Mode", "ADD"); cmd.ExecuteNonQuery(); } } }catch (Exception ex) { throw ex; } }