Ejemplo n.º 1
0
 private void addToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (tableNameLable.Text.Equals("Goods"))
     {
         Model.Good  good        = new Model.Good();
         GoodSubForm goodSubForm = new GoodSubForm(ref dbContext, ref good, true);
         goodSubForm.Show();
     }
     else if (tableNameLable.Text.Equals("Dimensions"))
     {
         Model.Dimension  dimension        = new Model.Dimension();
         DimensionSubForm dimensionSubForm = new DimensionSubForm(ref dbContext, ref dimension, true);
         dimensionSubForm.Show();
     }
     else if (tableNameLable.Text.Equals("Vendor codes"))
     {
         Good_DimensionAddSubForm good_DimensionAddSubForm = new Good_DimensionAddSubForm(ref dbContext);
         good_DimensionAddSubForm.Show();
     }
     else if (tableNameLable.Text.Equals("Shops"))
     {
         Model.Shop     shop        = new Model.Shop();
         ShopAddSubForm shopSubForm = new ShopAddSubForm(ref dbContext, ref shop, ref instaApi);
         shopSubForm.Show();
     }
     else if (tableNameLable.Text.Equals("Deliveries"))
     {
         Model.Delivery  delivery        = new Model.Delivery();
         DeliverySubForm deliverySubForm = new DeliverySubForm(ref dbContext, ref delivery, true);
         deliverySubForm.Show();
     }
     else if (tableNameLable.Text.Equals("Orders"))
     {
         Model.Order order = new Model.Order {
             Receipts = new List <Model.Receipt>(), Date = DateTime.Now
         };
         OrderSubForm orderSubForm = new OrderSubForm(ref dbContext, ref order, true);
         orderSubForm.Show();
     }
 }
Ejemplo n.º 2
0
 private void editToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (tableNameLable.Text.Equals("Goods"))
     {
         Model.Good good = mainFormGridView.SelectedRows.Count == 0 ? null : (Model.Good)mainFormGridView.SelectedRows[0].DataBoundItem;
         if (good == null)
         {
             MessageBox.Show("You should to select at least one row");
         }
         else
         {
             GoodSubForm goodSubForm = new GoodSubForm(ref dbContext, ref good, false);
             goodSubForm.Show();
         }
     }
     else if (tableNameLable.Text.Equals("Dimensions"))
     {
         Model.Dimension dimension = mainFormGridView.SelectedRows.Count == 0 ? null : (Model.Dimension)mainFormGridView.SelectedRows[0].DataBoundItem;
         if (dimension == null)
         {
             MessageBox.Show("You should to select at least one row");
         }
         else
         {
             DimensionSubForm dimensionSubForm = new DimensionSubForm(ref dbContext, ref dimension, false);
             dimensionSubForm.Show();
         }
     }
     else if (tableNameLable.Text.Equals("Vendor codes"))
     {
         Model.Good_Dimension good_dimension = mainFormGridView.SelectedRows.Count == 0 ? null : (Model.Good_Dimension)mainFormGridView.SelectedRows[0].DataBoundItem;
         if (good_dimension == null)
         {
             MessageBox.Show("You should to select at least one row");
         }
         else
         {
             GoodDimensionEditSubForm good_dimensionSubForm = new GoodDimensionEditSubForm(ref dbContext, ref good_dimension);
             good_dimensionSubForm.Show();
         }
     }
     else if (tableNameLable.Text.Equals("Publications"))
     {
         Model.Publication publication = mainFormGridView.SelectedRows.Count == 0 ? null : (Model.Publication)mainFormGridView.SelectedRows[0].DataBoundItem;
         if (publication == null)
         {
             MessageBox.Show("You should to select at least one row");
         }
         else
         {
             PublicationSubForm publicationSubForm = new PublicationSubForm(ref dbContext, ref publication);
             publicationSubForm.Show();
         }
     }
     else if (tableNameLable.Text.Equals("Deliveries"))
     {
         Model.Delivery delivery = mainFormGridView.SelectedRows.Count == 0 ? null : (Model.Delivery)mainFormGridView.SelectedRows[0].DataBoundItem;
         if (delivery == null)
         {
             MessageBox.Show("You should to select at least one row");
         }
         else
         {
             DeliverySubForm deliverySubForm = new DeliverySubForm(ref dbContext, ref delivery, false);
             deliverySubForm.Show();
         }
     }
     else if (tableNameLable.Text.Equals("Orders"))
     {
         Model.Order order = mainFormGridView.SelectedRows.Count == 0 ? null : (Model.Order)mainFormGridView.SelectedRows[0].DataBoundItem;
         if (order == null)
         {
             MessageBox.Show("You should to select at least one row");
         }
         else
         {
             OrderSubForm orderSubForm = new OrderSubForm(ref dbContext, ref order, false);
             orderSubForm.Show();
         }
     }
 }
Ejemplo n.º 3
0
 public override string ToString()
 {
     return((Good == null ? "" : Good.ToString()) + " " + (Dimension == null ? "" : Dimension.ToString()));
 }