Example #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;
            }
        }
Example #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;
            }
        }
Example #3
0
        void Button_Save_Click(object sender, EventArgs e)
        {
            UserInfo userInfo = new UserInfo();

            if (ProfileControl1.DropDownList_Language.SelectedIndex == 0)
	        {
        	    userInfo.LanguageIsEnglish = true;
            }
            else
            {
                userInfo.LanguageIsEnglish = false;
            }

            userInfo.Code = ProfileControl1.TextBox_Code.Text;
            userInfo.Phone = ProfileControl1.TextBox_Number.Text;
            userInfo.Name = ProfileControl1.TextBox_Name.Text;
            userInfo.SurName = ProfileControl1.TextBox_SurName.Text;
            userInfo.Address = ProfileControl1.TextBox_Address.Text;

            ProfileActions profileActions = new ProfileActions();
            profileActions.AddInfo(userID, userInfo);
        }