Ejemplo n.º 1
0
        protected void BtnLogin_Click(object sender, EventArgs e)
        {
            try
            {
                UserInfoDAL UMobject = new UserInfoDAL();

                dynamic result = UMobject.CheckIfUserExistsInDB(email.Value, UtilityFunctions.DecryptPassword(password.Value));
                HttpContext.Current.Session["LoggedIn_User"] = (UserInfo)result.GetType().GetProperty("UserInfo").GetValue(result, null);

                if ((string)result.GetType().GetProperty("FailureMessage").GetValue(result, null) == string.Empty)
                {
                    Response.Redirect("~/Application_Code/Views/frmReservations.aspx");
                }
            }
            catch (Exception ex)
            {
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Used for Get Specific User details
        /// </summary>
        /// <param name="Record_ID"></param>
        /// <returns></returns>
        public UserInfo GetLoginUserDetails()
        {
            ///Declare and Set paramiterized query
            String   queryString = "[SP_GetAllUserInfo] @Page,@RecsPerPage,@Record_ID,@Record_SearchText,@UserTypeID";
            UserInfo md          = new UserInfo();

            ///Establish SQL Connection
            using (SqlConnection connection = new SqlConnection(Connection_String))
            {
                ///Set SQL Command
                SqlCommand command = new SqlCommand(queryString, connection);
                ///Set parameters for paramiterized query
                command.Parameters.Add("@Page", System.Data.SqlDbType.Int).Value        = 1;
                command.Parameters.Add("@RecsPerPage", System.Data.SqlDbType.Int).Value = 10000;
                command.Parameters.Add("@Record_ID", System.Data.SqlDbType.Int).Value   = -1;

                try
                {
                    ///Open SQL Established connection
                    connection.Open();
                    ///Execute SQL Command and store return result in a SQL Reader
                    SqlDataReader dr = command.ExecuteReader();
                    while (dr.Read())
                    {
                        ///Set Record details in Employee Object
                        md.Id          = dr.IsDBNull(dr.GetOrdinal("Id")) ? 0 : dr.GetInt64(dr.GetOrdinal("Id"));
                        md.Username    = dr.IsDBNull(dr.GetOrdinal("Username")) ? null : dr.GetString(dr.GetOrdinal("Username"));
                        md.Email       = dr.IsDBNull(dr.GetOrdinal("Email")) ? null : dr.GetString(dr.GetOrdinal("Email"));
                        md.Password    = dr.IsDBNull(dr.GetOrdinal("Password")) ? null : dr.GetString(dr.GetOrdinal("Password"));
                        md.Password    = UtilityFunctions.DecryptPassword(md.Password);
                        md.UpdatedDate = dr.IsDBNull(dr.GetOrdinal("UpdatedDate")) ? new DateTime() : dr.GetDateTime(dr.GetOrdinal("UpdatedDate"));
                        break;
                    }
                }
                catch (Exception e)
                {
                }
            }
            return(md);
        }