Beispiel #1
0
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            SaleSet saleSet = new SaleSet();

            saleSet.Prise         = Convert.ToInt64(textBoxPrise.Text);
            saleSet.Data          = dateTimePickerDate.Value;
            saleSet.IDStaff       = Convert.ToInt32(comboBoxStaff.SelectedItem.ToString().Split('.')[0]);
            saleSet.IDClientsYour = Convert.ToInt32(comboBoxClient.SelectedItem.ToString().Split('.')[0]);
            Program.asdf.SaleSet.Add(saleSet);
            Program.asdf.SaveChanges();
            ShowSale();
        }
Beispiel #2
0
        private void buttonEdit_Click(object sender, EventArgs e)
        {
            if (listViewSale.SelectedItems.Count == 1)
            {
                SaleSet saleSet = listViewSale.SelectedItems[0].Tag as SaleSet;

                saleSet.Data.ToString().Substring(0, saleSet.Data.ToString().Length - 8);
                saleSet.IDStaff.ToString();
                saleSet.IDClientsYour.ToString();
                saleSet.Prise.ToString();
                Program.asdf.SaveChanges();
                ShowSale();
            }
        }
Beispiel #3
0
 private void listViewSale_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (listViewSale.SelectedItems.Count == 1)
     {
         SaleSet saleSet = listViewSale.SelectedItems[0].Tag as SaleSet;
         saleSet.ID.ToString();
         saleSet.Data.ToString().Substring(0, saleSet.Data.ToString().Length - 8);
         saleSet.IDStaff.ToString();
         saleSet.IDClientsYour.ToString();
         saleSet.Prise.ToString();
     }
     else
     {
         dateTimePickerDate.Text = "";
         comboBoxClient.Text     = "";
         textBoxPrise.Text       = "";
         comboBoxClient.Text     = "";
     }
 }
Beispiel #4
0
        private void buttonDel_Click(object sender, EventArgs e)
        {
            try
            {
                if (listViewSale.SelectedItems.Count == 1)
                {
                    SaleSet saleSet = listViewSale.SelectedItems[0].Tag as SaleSet;
                    Program.asdf.SaleSet.Remove(saleSet);
                    Program.asdf.SaveChanges();
                    ShowSale();

                    dateTimePickerDate.Text = "";
                    comboBoxClient.Text     = "";
                    textBoxPrise.Text       = "";
                    comboBoxClient.Text     = "";
                }
            }
            catch
            {
                MessageBox.Show("Невозможно удалить, запись используется!", "Ошибка!",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }