Esempio n. 1
0
        private void Update_button_Click_1(object sender, RoutedEventArgs e)
        {
            dataAdapter.Update(dataSet.Tables[0]);
            switch (Singleton.getInstance().Filtr)
            {
            case 1:
            {
                dataAdapter = new SqlDataAdapter("Select * from ViewAll", connect); break;
            }

            case 2:
            {
                dataAdapter = new SqlDataAdapter("Select * from ViewMain", connect); break;
            }

            case 3:
            {
                dataAdapter = new SqlDataAdapter("Select * from ViewNoAcc", connect); break;
            }

            default:
            {
                dataAdapter = new SqlDataAdapter("Select * from ViewMain", connect); break;
            }
            }
            dataSet = new DataSet();
            dataAdapter.Fill(dataSet);
            dataGridAccount.ItemsSource = dataSet.Tables[0].DefaultView;
        }
Esempio n. 2
0
        private void ButtonAdd_Click(object sender, RoutedEventArgs e)
        {
            if (ButtonAdd.Content.ToString() == "Добавить" && DateOff.Visibility == Visibility.Hidden)
            {
                //dataAd.Update(DSet.Tables[0]);
                string Query = String.Format("INSERT INTO Accounts (Service_Id, Instrument_Id, Srvicemn_Id, " +
                                             "AccountingDate, DecisionOprtn, " +
                                             "SerialNumber,InventoryNumber,Condition,AddirionalInf) " +
                                             "values ({0},{1},{2},'{3}',N'{4}',N'{5}',N'{6}',N'{7}',N'{8}')",
                                             this.servicesRepository.GetServiceId(Services.Text),
                                             this.InstrumentRepository.GetInstrumentId(Instrument.Text),
                                             Singleton.getInstance().IdServicemen, DateOn.DisplayDate,
                                             decisionOprtn.Text, serialN.Text, inventoryN.Text, condition.Text,
                                             AddInf.Text);



                dataAd = new SqlDataAdapter(Query, con);
                DSet   = new DataSet();
                dataAd.Fill(DSet);

                /* instruments.Description = Descript.ToString();
                 * instruments.YearIssue = yearissue.ToString();
                 * account.AccountingDate = DateOn.DisplayDate;
                 * account.Date_ofderegistration = DateOff.DisplayDate;
                 * account.DecisionOprtn = decisionOprtn.Text;
                 * account.SerialNumber = serialN.Text;
                 * account.InventoryNumber = inventoryN.Text;
                 * account.Condition = condition.Text;
                 * account.AddirionalInf = AddInf.Text;*/
            }
            else
            {
                string Query = String.Format("INSERT INTO Accounts (Service_Id, Instrument_Id, Srvicemn_Id, " +
                                             "AccountingDate, Date_ofderegistration, DecisionOprtn, " +
                                             "SerialNumber,InventoryNumber,Condition,AddirionalInf) " +
                                             "values ({0},{1},{2},'{3}','{4}',N'{5}',N'{6}',N'{7}',N'{8}',N'{9}')",
                                             this.servicesRepository.GetServiceId(Services.Text),
                                             this.InstrumentRepository.GetInstrumentId(Instrument.Text),
                                             Singleton.getInstance().IdServicemen, DateOn.DisplayDate, DateOff.DisplayDate,
                                             decisionOprtn.Text, serialN.Text, inventoryN.Text, condition.Text,
                                             AddInf.Text);
                dataAd = new SqlDataAdapter(Query, con);
                DSet   = new DataSet();
                dataAd.Fill(DSet);
                // var a=mainWindow.dataGridAccount.Cells
            }
            //accountsRepository.SaveAccount(account);
            Close();
        }
Esempio n. 3
0
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     Singleton.getInstance().Filtr = N;
     Close();
 }
Esempio n. 4
0
 private void SaveButton_Click_1(object sender, RoutedEventArgs e)
 {
     temp = srvicemnRepository.GetServicemen(comboBoxServicemen.Text);
     Singleton.getInstance().IdServicemen = temp;
     Close();
 }