예제 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["Id_User"] == null)
            {
                Response.Redirect("Login.aspx");
            }
            else
            {
                if (Convert.ToInt32(Session["User_Type"].ToString()) != 2)
                {
                    Response.Redirect("DefaultAdmin.aspx");
                }
                else
                {
                    id_User = Convert.ToInt32(Session["Id_User"].ToString());

                    if (!IsPostBack)
                    {
                        if (Session["Id_User"] != null)
                        {
                            MercadoUDi_DataSetTableAdapters.UserTableAdapter tau =
                                new MercadoUDi_DataSetTableAdapters.UserTableAdapter();

                            res = tau.GetDataBy_IdUser(id_User);

                            txt_Username.Text        = res[0].UserName;
                            txt_Email.Text           = res[0].UserEmail;
                            txt_Password.Text        = res[0].UserPassword;
                            txt_ConfirmPassword.Text = res[0].UserPassword;

                            if (res[0].UserCard.ToString() != " ")
                            {
                                txt_UserCard.Text = res[0].UserCard.ToString();
                            }
                            else
                            {
                                txt_UserCard.Text = " ";
                            }

                            password = res[0].UserPassword;

                            Session["User_PasswordRegisterConfig"] = res[0].UserPassword;
                        }
                    }
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["Id_User"] == null)
            {
                Response.Redirect("Login.aspx");
            }
            else
            {
                if (Convert.ToInt32(Session["User_Type"].ToString()) != 1)
                {
                    Response.Redirect("Default_Client.aspx");
                }
                else
                {
                    id_User = Convert.ToInt32(Session["Id_User_Update"].ToString());

                    if (!IsPostBack)
                    {
                        if (Session["Id_User_Update"] != null)
                        {
                            MercadoUDi_DataSetTableAdapters.UserTableAdapter tau =
                                new MercadoUDi_DataSetTableAdapters.UserTableAdapter();

                            res = tau.GetDataBy_IdUser(id_User);

                            txt_Username.Text        = res[0].UserName;
                            txt_Email.Text           = res[0].UserEmail;
                            txt_Password.Text        = res[0].UserPassword;
                            txt_ConfirmPassword.Text = res[0].UserPassword;

                            if (res[0].UserCard.ToString() != " ")
                            {
                                txt_UserCard.Text = res[0].UserCard.ToString();
                            }
                            else
                            {
                                txt_UserCard.Text = " ";
                            }

                            password = res[0].UserPassword;

                            int id_User_Type = Convert.ToInt32(res[0].UserType.ToString());

                            resType = taut.GetDataBy_Id(id_User_Type);

                            string userType = resType[0].IdUserType.ToString();

                            /*
                             * DropDownList_Status.SelectedValue = res[0].UserStatus.ToString();
                             * DropDownList_UserType.SelectedValue = userType;
                             *
                             * DropDownList_UserType.DataValueField = resType[0].IdUserType.ToString();*/

                            DropDownList_Status.Text   = res[0].UserStatus.ToString();
                            DropDownList_UserType.Text = resType[0].IdUserType.ToString();

                            Session["User_PasswordRegister"] = res[0].UserPassword;
                        }
                    }
                }
            }
        }