Exemplo n.º 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;
            }
        }
Exemplo n.º 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;
            }
        }