root/Baza Reklam 2 - Faktury/PaymentForm.cs @ 680

Wersja 65, 2.5 KB (wprowadzona przez dorota, 17 years temu)
Line 
1using System;
2using System.Collections.Generic;
3using System.ComponentModel;
4using System.Data;
5using System.Drawing;
6using System.Text;
7using System.Windows.Forms;
8
9namespace Baza_Reklam
10{
11    public partial class PaymentForm : Form
12    {
13       
14        private int reklamaId;
15
16        public PaymentForm(int rekId)
17        {
18            InitializeComponent();
19            reklamaId = rekId;
20        }
21
22        private void PaymentForm_Load(object sender, EventArgs e)
23        {
24            rEKLAMATableAdapter.Connection.ConnectionString = ConnString.getConnString().Value;
25            fAKTURYTableAdapter.Connection.ConnectionString = ConnString.getConnString().Value;
26
27            this.rEKLAMATableAdapter.FillByReklamaId(this.rEKLAMADataSet.REKLAMA, reklamaId);
28
29
30            if (rEKLAMABindingSource.Current != null)
31            {
32                DataRowView row = (DataRowView)rEKLAMABindingSource.Current;
33
34                if (row["DATA ZAP£ATY"] == DBNull.Value)
35                {
36                    dATA_ZAP£ATYDateTimePicker.Value = DateTime.Today;
37                }
38
39                if ((row["FAKTURA WYSTAWIONO"] != DBNull.Value) && (Convert.ToBoolean(row["FAKTURA WYSTAWIONO"]) == true))
40                {
41                    int id_faktury = Convert.ToInt32(row["ID_FAKTURY"]);
42
43                    this.fAKTURYTableAdapter.FillByIdFaktury(this.rEKLAMADataSet.FAKTURY, id_faktury);
44                }
45            }
46        }
47
48        private void dodajButton_Click(object sender, EventArgs e)
49        {
50            if (zAP£ACONOCheckBox.Checked)
51            {
52                if ((sYMBOL_POTWIERDZENIATextBox.Text == "") | (rODZAJ_POTWIERDZENIAComboBox.SelectedIndex == -1))
53                {
54                    MessageBox.Show("Uzupe³nij wszystkie pola");
55                    return;
56                }
57            }
58            else
59            {
60                DataRowView row = (DataRowView)rEKLAMABindingSource.Current;
61                row["DATA ZAP£ATY"] = DBNull.Value;
62                row["sYMBOL POTWIERDZENIA"] = DBNull.Value;
63                row["rODZAJ POTWIERDZENIA"] = DBNull.Value;               
64            }
65
66            this.Validate();
67            this.rEKLAMABindingSource.EndEdit();
68            this.rEKLAMATableAdapter.Update(this.rEKLAMADataSet.REKLAMA);
69            this.DialogResult = DialogResult.OK;
70     
71        }
72
73        private void anulujButton_Click(object sender, EventArgs e)
74        {
75            rEKLAMABindingSource.CancelEdit();
76        }
77       
78    }
79}
Notatka: Zobacz TracBrowser aby uzyskać więcej informacji.