Пример #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ProfileControl1.Button_Save.Click += new EventHandler(Button_Save_Click);
            ProfileControl1.Button_Cancel.Click += new EventHandler(Button_Cancel_Click);

            RolesUser rolesUser = new RolesUser();
           
            var userInfo = new UserInfo();
            ProfileActions profileActions = new ProfileActions();
            UsersActions usersActions = new UsersActions();
            userID = usersActions.FindUserGuid(User.Identity.Name);
            userInfo = profileActions.GetUserInfo(userID);
            ProfileControl1.UserID = userID;
                
            if (userInfo != null)
            {
                ViewState.Add("userInfo", userInfo);

                if (userInfo.LanguageIsEnglish)
                {
                    DropDownListView.SelectedIndex = 0;
                }
                else
                {
                    DropDownListView.SelectedIndex = 1;
                }
                
                TextBoxPhone.Text = userInfo.Code + " - " + userInfo.Phone;
                TextBoxName.Text = userInfo.Name;
                TextBoxSurName.Text = userInfo.SurName;
                TextBoxAddress.Text = userInfo.Address;
                ProfileControl1.DataSource = userInfo;
            }
        }
Пример #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                ProfileControl1.TableRow_Pay.Visible = true;
                ProfileControl1.Button_Save.Text = "To order";
                ProfileControl1.TableRow_Language.Visible = false;

                var userInfo = new UserInfo();
                ProfileActions profileActions = new ProfileActions();
                UsersActions usersActions = new UsersActions();
                userID = usersActions.FindUserGuid(User.Identity.Name);
                userInfo = profileActions.GetUserInfo(userID);
                ProfileControl1.DataSource = userInfo;
            }

            ProfileControl1.Button_Save.Click += new EventHandler(Button_Save_Click);

            if (Session["OrderList"] != null)
            {
                
                Label1.Visible = false;
                List<Goods> orderList = new List<Goods>();
                orderList = (List<Goods>)Session["OrderList"];
                
                if (Roles.IsUserInRole(User.Identity.Name, premiumUser))
	            {
            		 discount = 10;
	            }
                else
	            {
                    if (Roles.IsUserInRole(User.Identity.Name, registerUser))
                    {
            		    discount = 5;
                    }
	                else
	                {
                        discount = 0;
	                }
	            }
                
                DataSourceAdapterBinding dataSourceAdapterBinding = new DataSourceAdapterBinding();
                OrderPreview1.DataSource = dataSourceAdapterBinding
                    .AdapterFillPriceCalculate(orderList, discount);
            }
            else
            {
                Label1.Visible = true;
            }
        }
Пример #3
0
        protected void ButtonSubmit_Click(object sender, EventArgs e)
        {
            msCaptcha1.ValidateCaptcha(TextBoxCaptcha.Text);

            if (msCaptcha1.UserValidated)
            {
                string userName = TextBoxUsername.Text;
                string password = TextBoxPassword.Text;
                string email = TextBoxEmail.Text;
                string question = TextBoxQuestion.Text;
                string answer = TextBoxAnswer.Text;

                var userInfo = new UserInfo();
                userInfo.Code = TextBoxCode.Text;
                userInfo.Phone = TextBoxNumber.Text;

                UsersActions usersActions = new UsersActions();
                usersActions.CreateUser(userName, password, email, question, 
                    answer, userInfo);

                Response.Redirect("Default.aspx");
            }
        }