예제 #1
0
        public static UserInfo[] GetAllUsers()
        {
            ArrayList al = new ArrayList();

            int retValue = -1;

            //Generated Code for query : dbo.GetAllVendors
            using (SqlDataReader dr = ProjManagementAdmin.GetAllUsers(out retValue)) //Initialize and retrieve code for Datareader goes here
            {

                while (dr.Read())
                {
                    UserInfo user = new UserInfo();

                    user.UserName = dr["user_name"].ToString();
                    user.UserId = Convert.ToInt32(dr["user_id"]);
                    user.UserEmail = dr["user_email"].ToString();
                    user.RoleId = Convert.ToInt32(dr["role_id"]);
                   // user.Password = Convert.ToChar(dr["password"]);
                    user.CreatedDate = Convert.ToDateTime(dr["created_date"]);
                    user.ChangedDate = Convert.ToDateTime(dr["changed_date"]);
                    user.ChangedBy = dr["changed_by"].ToString();

                    al.Add(user);
                }
                //dr.Close();
            }

            UserInfo[] allInfo = new UserInfo[al.Count];
            al.CopyTo(allInfo);
            return allInfo;
        }
예제 #2
0
        public static int AddNewUser(UserInfo user)
        {
            if (user == null)
                throw new ArgumentNullException("user");

            int retValue = -1;
            return ProjManagementAdmin.AddNewUser(user, out retValue);
        }
예제 #3
0
파일: UserBl.cs 프로젝트: nehason/PMA-ISecG
 public static HttpResponseMessage UpdateUser(UserInfo user)
 {
     try
     {
         int val = UserDal.UpdateUser(user);
         return new HttpResponseMessage(HttpStatusCode.OK);
     }
     catch (Exception ex)
     {
         Console.WriteLine("EXCEPTION: " + ex);
         return new HttpResponseMessage(HttpStatusCode.BadRequest);
     }
 }
예제 #4
0
        public static UserInfo GetUserById(int userId)
        {
            int retValue = -1;
            UserInfo user = new UserInfo();
            //Generated Code for query : dbo.GetAllVendors
            using (SqlDataReader dr = ProjManagementAdmin.GetUserById(userId, out retValue)) //Initialize and retrieve code for Datareader goes here
            {
                while (dr.Read())
                {
                    user.UserName = dr["user_name"].ToString();
                    user.UserId = Convert.ToInt32(dr["user_id"]);
                    user.UserEmail = dr["user_email"].ToString();
                    user.ChangedByName = dr["changed_by"].ToString();
                }
                //dr.Close();
            }

            return user;
        }
예제 #5
0
        public static UserInfo[] GetAllProjectLeads()
        {
            ArrayList al = new ArrayList();
            int retValue = -1;
            using (SqlDataReader dr = ProjManagementAdmin.GetAllProjectLeads(out retValue)) //Initialize and retrieve code for Datareader goes here
            {
                while (dr.Read())
                {
                    UserInfo user = new UserInfo();

                    user.UserName = dr["user_name"].ToString();
                    user.UserId = Convert.ToInt32(dr["user_id"]);
                    user.UserEmail = dr["user_email"].ToString();
                    user.ChangedByName = dr["changed_by"].ToString();

                    al.Add(user);
                }
                //dr.Close();
            }

            UserInfo[] allInfo = new UserInfo[al.Count];
            al.CopyTo(allInfo);
            return allInfo;
        }
예제 #6
0
        private static SqlParameter[] GetAddUserParams(UserInfo user)
        {
            SqlParameter[] sqlParms = new SqlParameter[100];
            sqlParms = SQLHelper.GetCachedParameters(PROC_ADDNEWUSER);
            if (sqlParms == null)
            {
                sqlParms = new SqlParameter[]
                            {
                                new SqlParameter(PARAM_RETURN, SqlDbType.Int),
                                new SqlParameter(PARAM_USER_NAME, SqlDbType.NVarChar, 100),
                                new SqlParameter(PARAM_USER_EMAIL, SqlDbType.NVarChar, 100),
                               new SqlParameter(PARAM_CHANGEDBY, SqlDbType.NVarChar, 100)

                            };

                sqlParms[0].Direction = ParameterDirection.ReturnValue;
                SQLHelper.CacheParameters(PROC_ADDNEWUSER, sqlParms);
            }

            //Assigning values to parameter
            sqlParms[0].Value = -1;
            sqlParms[1].Value = user.UserName;
            sqlParms[2].Value = user.UserEmail;
            sqlParms[3].Value = "sanyam";

            return sqlParms;
        }
예제 #7
0
 public static int UpdateUser(UserInfo user, out int retValue)
 {
     retValue = -1;
     SqlParameter[] parms = GetUpdateUserParams(user);
     return ExecuteNonQuery(PROC_UPDATEUSER, parms, out retValue);
 }
예제 #8
0
 public static int AddNewUser(UserInfo user, out int retValue)
 {
     retValue = -1;
     SqlParameter[] parms = GetAddUserParams(user);
     return ExecuteNonQuery(PROC_ADDNEWUSER, parms, out retValue);
 }
예제 #9
0
 public static int UpdateUser(UserInfo user)
 {
     int retValue = -1;
     return ProjManagementAdmin.UpdateUser(user, out retValue);
 }
예제 #10
0
 public HttpResponseMessage Post(UserInfo user)
 {
     return UserBl.UpdateUser(user);
 }
예제 #11
0
 public UserInfo Get(int id)
 {
     UserInfo user = new UserInfo();
     user = UserBl.GetUserById(id);
     return user;
 }
예제 #12
0
파일: UserBl.cs 프로젝트: nehason/PMA-ISecG
 public static int AddNewUser(UserInfo user)
 {
     return UserDal.AddNewUser(user);
 }