コード例 #1
0
ファイル: ADBRunner.cs プロジェクト: vaginessa/NetworkADB
 private void ThreadProcOperation()
 {
     if (of != null)
     {
         of.Visible = false;
         of.ShowDialog();
     }
 }
コード例 #2
0
ファイル: MainFormRub.cs プロジェクト: ccharlier/orionbanque
 private void OuvreFormOperation(Operation o, string mode)
 {
     if (TestPasDeCompte())
     {
         OperationForm om = new OperationForm(o, GetCompteCourant(), mode);
         om.ShowDialog();
         if (om.Cont)
         {
             ChargeOperations(GetCompteCourant());
             ChargesIndicateurs(GetCompteCourant());
             ActiveSauvegarde();
         }
         RemplisCb();
     }
 }
コード例 #3
0
ファイル: Main.cs プロジェクト: Delictum/SchoolAccounting
        private void addToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var operationForm = new OperationForm(tabControl.SelectedIndex, TypeOfTransaction.Добавление);

            operationForm.ShowDialog(this);

            switch (tabControl.SelectedIndex)
            {
            case 0:
                LoadDataGridViewAccounting();
                break;

            case 1:
                LoadDataGridViewService();
                LoadDataGridViewAccounting();
                break;
            }
        }
コード例 #4
0
ファイル: Main.cs プロジェクト: Delictum/SchoolAccounting
        private void editToolStripMenuItem_Click(object sender, EventArgs e)
        {
            object classObject = null;

            switch (tabControl.SelectedIndex)
            {
            case 1:
                try
                {
                    classObject = new Service
                    {
                        Id            = Convert.ToInt32(dataGridViewService.CurrentRow.Cells[0].Value.ToString()),
                        Access        = dataGridViewService.CurrentRow.Cells[5].Value.ToString(),
                        Description   = dataGridViewService.CurrentRow.Cells[4].Value.ToString(),
                        Price         = Convert.ToDouble(dataGridViewService.CurrentRow.Cells[3].Value.ToString()),
                        TypeOfService = (TypeOfService)Enum.Parse(typeof(TypeOfService),
                                                                  dataGridViewService.CurrentRow.Cells[2].Value.ToString()),
                        Name = dataGridViewService.CurrentRow.Cells[1].Value.ToString()
                    };
                }
                catch (NullReferenceException)
                {
                    MessageBox.Show("Не выбрана запись для редактирования");
                    return;
                }

                break;

            case 0:
                using (var db = new ModelsContext())
                {
                    try
                    {
                        var currentId =
                            Convert.ToInt32(dataGridViewAccounting.CurrentRow.Cells[0].Value.ToString());

                        var current = db.Accountings.First(x => currentId == x.Id);

                        var currentFullName   = dataGridViewAccounting.CurrentRow.Cells[1].Value.ToString();
                        var currentTypeClient = (TypeClient)Enum.Parse(typeof(TypeClient),
                                                                       dataGridViewAccounting.CurrentRow.Cells[2].Value.ToString());

                        var accountingClient = db.Clients.First(x =>
                                                                x.FullName == currentFullName && x.TypeClient == currentTypeClient);

                        var currentServiceName  = dataGridViewAccounting.CurrentRow.Cells[3].Value.ToString();
                        var currentServicePrice = double.Parse(dataGridViewAccounting.CurrentRow.Cells[4].Value.ToString());

                        var accountingService = db.Services.First(x =>
                                                                  x.Name == currentServiceName && x.Price == currentServicePrice);

                        var payment = db.Payments.First(x => x.Id == current.PaymentId);

                        classObject = new Accounting
                        {
                            Id        = currentId,
                            Client    = accountingClient,
                            ClientId  = accountingClient.Id,
                            Date      = DateTime.Parse(dataGridViewAccounting.CurrentRow.Cells[5].Value.ToString()),
                            Service   = accountingService,
                            ServiceId = accountingService.Id,
                            PaymentId = payment.Id
                        };
                    }
                    catch (NullReferenceException)
                    {
                        MessageBox.Show("Не выбрана запись для редактирования");
                        return;
                    }
                }

                break;
            }


            var operationForm = new OperationForm(tabControl.SelectedIndex, TypeOfTransaction.едактирование, classObject);

            operationForm.ShowDialog(this);

            switch (tabControl.SelectedIndex)
            {
            case 0:
                LoadDataGridViewAccounting();
                break;

            case 1:
                LoadDataGridViewService();
                LoadDataGridViewAccounting();
                break;
            }
        }