Beispiel #1
0
        private void btnItemUpdate_Click(object sender, EventArgs e)
        {
            ItemUpdate frmItemUpdate = new ItemUpdate();

            frmItemUpdate.MdiParent = this;
            if (Application.OpenForms["ItemUpdate"] == null)
            {
                frmItemUpdate.Show();
            }
            else
            {
                Application.OpenForms["ItemUpdate"].Focus();
            }
        }
 private void btnUpdate_Click(object sender, EventArgs e)
 {
     if (tbItemName.Text.Length > 0)
     {
         if (tbItemPrice.Text.Length > 0)
         {
             if (tbItemDescription.Text.Length > 0)
             {
                 if (tbItemWeight.Text.Length > 0)
                 {
                     if (cbItemTax.Text != "")
                     {
                         if (PictureLocation[0] != null)
                         {
                             double Tax;
                             Item.Name        = tbItemName.Text;
                             Item.Price       = Convert.ToDouble(tbItemPrice.Text);
                             Item.Description = tbItemDescription.Text;
                             Item.Weight      = Convert.ToDouble(tbItemWeight.Text);
                             if (cbItemTax.SelectedIndex == 0)
                             {
                                 Tax = 0.01;
                             }
                             else if (cbItemTax.SelectedIndex == 1)
                             {
                                 Tax = 0.08;
                             }
                             else
                             {
                                 Tax = 0.18;
                             }
                             Item.Tax = Tax;
                             Item.ItemUpdate();
                             PictureSave();
                             MessageBox.Show("Ürün başarıyla güncellendi", "GÜNCELLENDİ", MessageBoxButtons.OK, MessageBoxIcon.Information);
                             ItemUpdate frmItemUpdate = (ItemUpdate)Application.OpenForms["ItemUpdate"];
                             frmItemUpdate.lists();
                             this.Close();
                         }
                         else
                         {
                             MessageBox.Show("1.Fotoğraf boş bırakılamaz.", "EKSİK GİRİŞ", MessageBoxButtons.OK, MessageBoxIcon.Error);
                         }
                     }
                     else
                     {
                         MessageBox.Show("Lütfen vergi seçiniz.", "EKSİK GİRİŞ", MessageBoxButtons.OK, MessageBoxIcon.Error);
                     }
                 }
                 else
                 {
                     MessageBox.Show("Ürün ağırlığı boş bırakılamaz.", "EKSİK GİRİŞ", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 }
             }
             else
             {
                 MessageBox.Show("Ürün açıklaması boş bırakılamaz.", "EKSİK GİRİŞ", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
         else
         {
             MessageBox.Show("Ürün fiyatı boş bırakılamaz.", "EKSİK GİRİŞ", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }