Esempio n. 1
0
        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();
            }
        }
Esempio n. 2
0
        private List<UserUnlockBO> FillUserUnlockInformation(SqlDataReader dr)
        {
            List<UserUnlockBO> userUnLockList = new List<UserUnlockBO>();
            UserUnlockBO userUnLock;
            try
            {
                while (dr.Read())
                {
                    userUnLock = new UserUnlockBO();

                    userUnLock.CreatedBy = dr.GetInt32(dr.GetOrdinal("CreatedBy"));
                    userUnLock.CreatedDate = dr.GetDateTime(dr.GetOrdinal("CreatedDate"));
                    userUnLock.UnlockRemark = dr.GetValue(dr.GetOrdinal("UnlockRemark")).ToString();
                    userUnLock.UserUnlockHistoryId = dr.GetInt32(dr.GetOrdinal("UserUnlockHistoryId"));

                    int userId = dr.GetInt32(dr.GetOrdinal("UserId"));

                    userUnLock.User = new UserBO();
                    userUnLock.User.UserId = userId;
                    //userUnLock.User.LoadUserByUserId();

                    userUnLock.User = new UserDAL().LoadUserByUserId(userUnLock.User);

                    userUnLockList.Add(userUnLock);

                }
            }

            catch
            {
                throw;
            }

            return userUnLockList;
        }