Beispiel #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;
            }
        }
Beispiel #2
0
 public void AddInfo(Guid userID, UserInfo userInfo)
 {
     var entity = Sessions.NewSession.Get<UserInfo>(FindID(userID));
     entity.Code = userInfo.Code;
     entity.Phone = userInfo.Phone;
     entity.Name = userInfo.Name;
     entity.SurName = userInfo.SurName;
     entity.Address = userInfo.Address;
     entity.aspnet_Users = Sessions.NewSession.Get<aspnet_Users>(userID);
     
     Sessions.NewSession.SaveOrUpdate(entity);
     Sessions.NewSession.Flush();
 }
Beispiel #3
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;
            }
        }
Beispiel #4
0
        public void CreateUser(string userName, string pass, string email,
            string question, string answer, UserInfo userInfo)
        {
            MembershipCreateStatus status;

            Membership.CreateUser(userName, pass, email, question, answer,
                    false, out status);

            if (status == MembershipCreateStatus.Success)
            {
                userInfo.aspnet_Users = Sessions.NewSession.Get<aspnet_Users>(FindUserGuid(userName));

                Sessions.NewSession.SaveOrUpdate(userInfo);
                Sessions.NewSession.Flush();
            }
        }
Beispiel #5
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);
        }
        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");
            }
        }
Beispiel #7
0
 public void CreateUser(string userName, string pass, string email,
     string question, string answer, UserInfo userInfo)
 {
     UsersCRUD usersCRUD = new UsersCRUD();
     usersCRUD.CreateUser(userName, pass, email, question, answer, userInfo);
 }
Beispiel #8
0
 public void AddInfo(Guid usersID, UserInfo userInfo)
 {
     ProfileCRUD profileCRUD = new ProfileCRUD();
     profileCRUD.AddInfo(usersID, userInfo);
 }
Beispiel #9
0
        protected void LinkButtonEdit_Click(object sender, EventArgs e)
        {
            PanelProfile.Visible = false;
            PanelEdit.Visible = true;

            if (ViewState["userInfo"] != null)
            {
                var userInfo = new UserInfo();
                userInfo = (UserInfo)ViewState["userInfo"];

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