コード例 #1
0
ファイル: ClientForm.cs プロジェクト: dvpashnev/Store_Pashnev
 public ClientForm(Client clnt)
 {
     InitializeComponent();
       client = clnt;
 }
コード例 #2
0
ファイル: Form1.cs プロジェクト: dvpashnev/Store_Pashnev
        private void NewClientBtn_Click(object sender, EventArgs e)
        {
            Client clnt = new Client();

              clnt.SetId(client.GetCurIdentity("Client") + 1);

              ClientForm cf = new ClientForm(clnt);
              cf.ShowDialog();

              clnt = cf.client;

              if (clnt.Id != 0)
              {
            client.SetClient(clnt);
            //_waitForResponse.WaitOne();
              }
        }
コード例 #3
0
ファイル: Form1.cs プロジェクト: dvpashnev/Store_Pashnev
        private void dataGridViewClients_DoubleClick(object sender, EventArgs e)
        {
            if (dataGridViewClients.CurrentCell != null)
              {
            int clientID =
              Convert.ToInt32(_db._ds.Tables["Client"].Rows[dataGridViewClients.CurrentCell.RowIndex].ItemArray[0]);

            Client clnt = new Client();

            clnt.SetValues(clientID,
              _db._ds.Tables["Client"].Rows[dataGridViewClients.CurrentCell.RowIndex]["LastName"].ToString(),
              _db._ds.Tables["Client"].Rows[dataGridViewClients.CurrentCell.RowIndex]["FirstName"].ToString(),
              _db._ds.Tables["Client"].Rows[dataGridViewClients.CurrentCell.RowIndex]["MiddleName"].ToString(),
              _db._ds.Tables["Client"].Rows[dataGridViewClients.CurrentCell.RowIndex]["Sex"].ToString(),
              Convert.ToDateTime(_db._ds.Tables["Client"].Rows[dataGridViewClients.CurrentCell.RowIndex]["BirthDay"]),
              _db._ds.Tables["Client"].Rows[dataGridViewClients.CurrentCell.RowIndex]["Phone1"].ToString(),
              _db._ds.Tables["Client"].Rows[dataGridViewClients.CurrentCell.RowIndex]["Phone2"].ToString(),
              _db._ds.Tables["Client"].Rows[dataGridViewClients.CurrentCell.RowIndex]["Phone3"].ToString(),
              _db._ds.Tables["Client"].Rows[dataGridViewClients.CurrentCell.RowIndex]["Adress"].ToString(),
              Convert.ToDouble(_db._ds.Tables["Client"].Rows[dataGridViewClients.CurrentCell.RowIndex]["SumOrders"]),
              Convert.ToInt32(_db._ds.Tables["Client"].Rows[dataGridViewClients.CurrentCell.RowIndex]["Discount"]),
              _db._ds.Tables["Client"].Rows[dataGridViewClients.CurrentCell.RowIndex]["FirmName"].ToString()
              );

            ClientForm cf = new ClientForm(clnt);
            cf.ShowDialog();

            clnt = cf.client;

            if (clnt.Id != 0)
            {
              client.SetClient(clnt);
              //_waitForResponse.WaitOne();
            }
              }
              else
              {
            MessageBox.Show(@"Нажмите в строке, чтобы выделить клиента", @"Error" );
              }
        }
コード例 #4
0
        public void SetClient(Client client)
        {
            DataRow row = _db._ds.Tables["Client"].Rows.Find(client.Id);

              if (row == null)
              {
            row = _db._ds.Tables["Client"].NewRow();

            row["Id"] = client.Id;
            row["Adress"] = client.Adress;
            row["BirthDay"] = client.BirthDay;
            row["Discount"] = client.Discount;
            row["FirstName"] = client.FirstName;
            row["LastName"] = client.LastName;
            row["MiddleName"] = client.MiddleName;
            row["Phone1"] = client.Phone1;
            row["Phone2"] = client.Phone2;
            row["Phone3"] = client.Phone3;
            row["Sex"] = client.Sex;
            row["SumOrders"] = client.SumOrders;
            row["FirmName"] = client.FirmName;

            _db._ds.Tables["Client"].Rows.Add(row);
              }
              else
              {
            row["Id"] = client.Id;
            row["Adress"] = client.Adress;
            row["BirthDay"] = client.BirthDay;
            row["Discount"] = client.Discount;
            row["FirstName"] = client.FirstName;
            row["LastName"] = client.LastName;
            row["MiddleName"] = client.MiddleName;
            row["Phone1"] = client.Phone1;
            row["Phone2"] = client.Phone2;
            row["Phone3"] = client.Phone3;
            row["Sex"] = client.Sex;
            row["SumOrders"] = client.SumOrders;
            row["FirmName"] = client.FirmName;
              }

              _db._adapterClient.Update(_db._ds.Tables["Client"]);

              OnDBChanged(_db);
        }