コード例 #1
0
        public void Update()
        {
            //create an instance of the Inventory Collection
            clsSellerShopCollection AllSellerShops = new clsSellerShopCollection();
            //validate the data on the Windows Form
            string Error = AllSellerShops.ThisSellerShop.Valid(txtNewShopName.Text, txtNewSellerName.Text, txtEmail.Text, txtRating.Text);

            //if the data is OK then add it to the object
            if (Error == "")
            {
                //find the record to UPDATE
                AllSellerShops.ThisSellerShop.Find(mShopId);
                //get the data entered by the user

                AllSellerShops.ThisSellerShop.ShopName   = Convert.ToString(txtNewShopName);
                AllSellerShops.ThisSellerShop.SellerName = txtNewSellerName.Text;
                AllSellerShops.ThisSellerShop.Email      = txtEmail.Text;
                AllSellerShops.ThisSellerShop.Rating     = Convert.ToInt32(txtRating.Text);
                AllSellerShops.ThisSellerShop.DateOpened = Convert.ToDateTime(txtDateOpened.Text);


                //UPDATE the record
                AllSellerShops.Update();
                //All Done so Redirect to the previous Form
            }
            else
            {
                lblError.Text = "There were problems with the data entered: " + Error;
            }
        }
コード例 #2
0
        public void Update()
        {
            //create an instance of the Seller Shop Collection
            clsSellerShopCollection AllSellerShops = new clsSellerShopCollection();
            //validate the data on the Windows Form
            string Error = AllSellerShops.ThisSellerShop.Valid(txtShopName.Text, txtSellerName.Text, txtEmail.Text, Convert.ToString(comboBoxRating.SelectedItem));

            //if the data is OK then add it to the object
            if (Error == "")
            {
                //find the record to UPDATE
                AllSellerShops.ThisSellerShop.Find(mShopId);
                //get the data entered by the user

                AllSellerShops.ThisSellerShop.ShopName   = txtShopName.Text;
                AllSellerShops.ThisSellerShop.SellerName = txtSellerName.Text;
                AllSellerShops.ThisSellerShop.Email      = txtEmail.Text;
                AllSellerShops.ThisSellerShop.Rating     = Convert.ToInt32(comboBoxRating.SelectedItem);
                AllSellerShops.ThisSellerShop.DateOpened = Convert.ToDateTime(txtDateOpened.Text);


                //UPDATE the record
                AllSellerShops.Update();
                //all done so redirect back to the main page
                SellerShopManageForm SSM = new SellerShopManageForm();
                this.Hide();
                SSM.ShowDialog();
                this.Close();
            }
            else
            {
                lblError.Text = "There were problems with the data entered: " + Error;
            }
        }