private void btnok_Click(object sender, EventArgs e)
        {
            if (passtxt.Text.Trim() == "")
            {
                MessageBox.Show("Please fill up the password field.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                passtxt.Focus();
                passtxt.Text = "";
            }
            else if (passtxt.Text.Trim() != password)
            {
                MessageBox.Show("Invalid System Password.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                passtxt.Text = "";
                passtxt.Focus();
            }
            else
            {
                if (catans != 1)
                {
                    BalloonKingdomDataSetTableAdapters.CategoryTableAdapter addNewCat = new WindowsApplication1.BalloonKingdomDataSetTableAdapters.CategoryTableAdapter();
                    addNewCat.AddNewCategory(ItemCatCombo, SubCatCombo, SpecCatCombo);
                }
                BalloonKingdomDataSetTableAdapters.InventoryTableAdapter updateInv = new WindowsApplication1.BalloonKingdomDataSetTableAdapters.InventoryTableAdapter();
                updateInv.UpdateInventoryRecord(ItemCatCombo, SubCatCombo, SpecCatCombo, AdItemNametxt, AdType, AdSizeStand, InvUnitcombo, AdColorExist, Convert.ToDecimal(AdCusWidtxt), Convert.ToDecimal(AdInvHeighttxt), AdSuppExist, Convert.ToInt32(InvItemIDtxt), Convert.ToInt32(InvItemIDtxt));
                BalloonKingdomDataSetTableAdapters.ItemTableAdapter updateItem = new WindowsApplication1.BalloonKingdomDataSetTableAdapters.ItemTableAdapter();
                updateItem.UpdateCartItems(ItemCatCombo, SubCatCombo, SpecCatCombo, AdItemNametxt, AdSuppExist, Convert.ToDecimal(AdCusWidtxt), Convert.ToDecimal(AdInvHeighttxt), AdSizeStand, AdColorExist, AdType, InvUnitcombo, Convert.ToInt32(InvItemIDtxt));

                MessageBox.Show("Record has been successfully updated.", "Update Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.Close();
            }
        }
Beispiel #2
0
        private void frmDeliverRental_Load(object sender, EventArgs e)
        {
            try
            {
                conn = new SqlConnection();
                conn.ConnectionString = str_conn;
                conn.Open();
                if (conn.State != ConnectionState.Open)
                {
                    MessageBox.Show("Unable to connect to database", "Connection Status");
                }
            }
            catch (Exception x)
            { MessageBox.Show(x.GetBaseException().ToString(), "Connection status"); }

            renta *= 3;

            RentSecurityAmt.Text = Convert.ToString(renta);
            BalloonKingdomDataSetTableAdapters.ItemTableAdapter viewrent = new WindowsApplication1.BalloonKingdomDataSetTableAdapters.ItemTableAdapter();
            RentDataGrid.DataSource = viewrent.ViewRentItem(Convert.ToInt32(COFNumLbl.Text));


            int           totquanti = 0;
            SqlCommand    extract   = new SqlCommand("Select * from Item where [COF Number]=" + "'" + COFNumLbl.Text + "'" + "And Type='Rental'", conn);
            SqlDataReader drex      = extract.ExecuteReader();

            while (drex.Read())
            {
                unit[c]    = drex["Unit"].ToString();
                itemid[c]  = drex["Item ID"].ToString();
                itemnme[c] = drex["Item Name"].ToString();
                cat[c]     = drex["Category Name"].ToString();
                subcat[c]  = drex["Sub Category"].ToString();
                speccat[c] = drex["Specific Category"].ToString();
                quanti[c]  = drex["Quantity"].ToString();
                totquanti += Convert.ToInt32(drex["Quantity"].ToString());
                c++;
            }
            drex.Close();
            OverallQtyTxt.Text = Convert.ToString(totquanti);
        }