示例#1
0
 public ClientForm(Client clnt)
 {
     InitializeComponent();
       client = clnt;
 }
示例#2
0
        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
        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);
        }