示例#1
0
        private void btnSubmit_Click(object sender, RoutedEventArgs e)
        {
            prp.Address      = txtAddress.Text;
            prp.PropertyName = txtPropName.Text;
            prp.SellerId     = sellerId;

            string prpOpt = "";

            if (radRent.IsChecked == true)
            {
                prpOpt = "Rent";
            }
            else if (radSell.IsChecked == true)
            {
                prpOpt = "Sell";
            }


            prp.PropertyOption = prpOpt;


            string prpType = "";

            if (radFlat.IsChecked == true)
            {
                prpType = "Flat";
            }
            else if (radOffice.IsChecked == true)
            {
                prpType = "Office";
            }
            else if (radHouse.IsChecked == true)
            {
                prpType = "Villa";
            }

            prp.PropertyType = prpType;

            prp.PriceRange = decimal.Parse(txtPrice.Text);
            if (txtDeposit.Text == "")
            {
                prp.InitialDeposit = 0;
            }
            else
            {
                prp.InitialDeposit = decimal.Parse(txtDeposit.Text);
            }
            prp.Landmark = txtLandMark.Text;

            sv.UpdateProperty(prp);

            MessageBox.Show("Property updated successfully");
            SellerPage sp = new SellerPage(sellerId);

            this.NavigationService.Navigate(sp);
        }
        private void btnLogin_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                User              login     = new User();
                UsersValidations  userObj   = new UsersValidations();
                SellerValidations sellerObj = new SellerValidations();
                BuyerValidations  buyerObj  = new BuyerValidations();

                login.UserName = txtUserName.Text;
                login.Password = txtPass.Password;



                login = userObj.LoginUser(login);

                if (login != null)
                {
                    if (login.UserType.ToLower() == "admin")
                    {
                        Admin sp = new Admin();
                        this.NavigationService.Navigate(sp);
                    }
                    else if (login.UserType.ToLower() == "seller")
                    {
                        int        sellerId = sellerObj.SellerId(login.UserName);
                        SellerPage sp       = new SellerPage(sellerId);
                        this.NavigationService.Navigate(sp);
                    }
                    else if (login.UserType.ToLower() == "buyer")
                    {
                        int buyerId = buyerObj.BuyerId(login.UserName);
                        ShowAllProperties_Buyer sp = new ShowAllProperties_Buyer(buyerId);
                        this.NavigationService.Navigate(sp);
                    }
                    MessageBox.Show("Login Successful!!");
                }
                else
                {
                    txtUserName.Text = "";
                    txtPass.Password = "";
                    throw new UserException("UserName/Password is required");
                }
            }
            catch (UserException ex)
            {
                MessageBox.Show(ex.Message, "Alert");
            }
        }
示例#3
0
        private void btnSubmit_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Property newProp = new Property();
                newProp.Address      = txtAddress.Text;
                newProp.PropertyName = txtPropName.Text;
                newProp.SellerId     = sellerId;

                string prpOpt = "";
                if (radRent.IsChecked == true)
                {
                    prpOpt = "Rent";
                }
                else if (radSell.IsChecked == true)
                {
                    prpOpt = "Sell";
                }


                newProp.PropertyOption = prpOpt;


                string prpType = "";
                if (radFlat.IsChecked == true)
                {
                    prpType = "Flat";
                }
                else if (radOffice.IsChecked == true)
                {
                    prpType = "Office";
                }
                else
                {
                    prpType = "Villa";
                }

                newProp.PropertyType = prpType;

                newProp.PriceRange     = decimal.Parse(txtPrice.Text);
                newProp.InitialDeposit = decimal.Parse(txtDeposit.Text);
                newProp.Landmark       = txtLandMark.Text;

                City city = (City)cmbCity.SelectedItem;
                newProp.CityId = city.CityId;
                State state = (State)cmbState.SelectedItem;
                newProp.StateId = state.StateId;

                sellerObj.AddProperty(newProp);

                MessageBox.Show("Property added successfully");
                SellerPage sp = new SellerPage(sellerId);
                this.NavigationService.Navigate(sp);
            }
            catch (SellerException ex)
            {
                MessageBox.Show(ex.Message, "Alert");
            }
            catch (Exception)
            {
                MessageBox.Show("Enter all details ", "Alert");
            }
        }