コード例 #1
0
        protected void saveFavouriteLockerClick(object sender, EventArgs e)
        {
            ClientFactory          clientFactory = new ClientFactory();
            ClientGateway <Client> cg            = (ClientGateway <Client>)clientFactory.GetClient();

            client.Favourite_locker = lockers[lockerDropdown.SelectedIndex].RecordId;
            cg.Update(client);
            Response.Redirect("~/ChangeProfile.aspx");
        }
コード例 #2
0
        protected void profileConfirmButton_Click1(object sender, EventArgs e)
        {
            ClientFactory          clientFactory = new ClientFactory();
            ClientGateway <Client> cg            = (ClientGateway <Client>)clientFactory.GetClient();

            bool   toInsert     = true;
            string errorMessage = "";

            if (!string.IsNullOrWhiteSpace(nameElement.Text))
            {
                newClient.Name = nameElement.Text;
            }
            if (!string.IsNullOrWhiteSpace(surnameElement.Text))
            {
                newClient.Surname = surnameElement.Text;
            }
            if (!string.IsNullOrWhiteSpace(mailElement.Text))
            {
                if (Functions.IsValidEmail(mailElement.Text))
                {
                    newClient.Mail = mailElement.Text;
                }
                else
                {
                    toInsert     = false;
                    errorMessage = "Entered Mail is invalid.";
                }
            }
            if (!string.IsNullOrWhiteSpace(password1.Text) && !string.IsNullOrWhiteSpace(password2.Text))
            {
                if (password1.Text == password2.Text && password1.Text.Length > 7 && oldPassword.Text == client.Password)
                {
                    newClient.Password = password1.Text;
                }
                else
                {
                    errorMessage = "An error occured, password is too short or does not match.";
                    toInsert     = false;
                }
            }

            if (toInsert)
            {
                cg.Update(newClient);
                Response.Redirect("~/ChangeProfile.aspx");
            }
            else
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "alert('" + errorMessage + "');window.location ='ChangeProfile.aspx';", true);
            }
        }
コード例 #3
0
        protected override bool SaveRecord()
        {
            ClientFactory          clientFactory = new ClientFactory();
            ClientGateway <Client> cg            = (ClientGateway <Client>)clientFactory.GetClient();

            if (GetData())
            {
                if (newRecord)
                {
                    cg.Insert(client);
                }
                else
                {
                    cg.Update(client);
                }
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #4
0
ファイル: ShopClientService.cs プロジェクト: synweb/rocms
        public void UpdateClient(Client client)
        {
            var dataRec = Mapper.Map <Data.Models.Client>(client);

            _clientGateway.Update(dataRec);
        }