Quantcast
Channel: ADO.NET, Entity Framework, LINQ to SQL, NHibernate
Viewing all articles
Browse latest Browse all 1698

How to fetch details.

$
0
0

Hi All,

Nowadays I am working on a web application to extend some features. Thsi web application is already developed by someone.

Here I want to update the user profile. I already have a class name userinfo where I have defined the properties of user. I found the method to validate login in the application's data access layer. See the code below.

 public Result<UserInfo> ValidateUserLogin(UserCredentials userCredentials)
        {
            Result<UserInfo> UserInfo = new Result<UserInfo>();
            try
            {
                using (SqlConnection conn = new SqlConnection(ConnectionDataContext.SetConnection()))
                {
                   // some code goes here

                    SqlDataReader dataReader = cmd.ExecuteReader();

                    if (dataReader.HasRows)
                    {
                        while (dataReader.Read())
                        {
                            UserInfo.ResultObject.UserId = dataReader["User_Id"].ToString().ToInt64();
                            UserInfo.ResultObject.UserloginId = dataReader["UserLod_Id"].ToString().ToInt64();
                            UserInfo.ResultObject.UserStatus = dataReader["Status"].ToString().ToInt32();
                            UserInfo.ResultObject.UserRole = (EUserRole)dataReader["User_Type"].ToString().ToInt32();
                            UserInfo.ResultObject.UserName = dataReader["User_Name"].ToString().ScriptRemovel();

                        }
                    }
                    dataReader.Close();
                    UserInfo.Status.ReturnMessage = cmd.Parameters["@p_UserStatus"].Value.ToString();
                    UserInfo.Status.ProcedureStatus = true;
                    dataReader.Dispose();
                    dataReader = null;
                    conn.Close();
                    cmd.Dispose();
                }
            }
            catch (Exception ex)
            {
                UserInfo.Status.CallStatus = false;
                ex.FillandWriteError(System.Reflection.MethodBase.GetCurrentMethod());
            }
            return UserInfo;
        }

If user validate the login method, then how can I access the user's properties in my code file. Please let me know. Suppose I want to access User_Name data field in my code file to fill the text box so how I should to

txtUser_Name.Text = ??


Viewing all articles
Browse latest Browse all 1698

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>