Ejemplo n.º 1
0
        private void ChangePositionBtn_Click(object sender, EventArgs e)
        {
            Position position = new Position();

              if (dataGridViewRoles.CurrentRow != null)
              {
            position.SetValues(
              Convert.ToInt32(dataGridViewRoles.CurrentRow.Cells["Id"].Value),
              dataGridViewRoles.CurrentRow.Cells["Title"].Value.ToString(),
              Convert.ToInt32(dataGridViewRoles.CurrentRow.Cells["Products"].Value) == 1,
              Convert.ToInt32(dataGridViewRoles.CurrentRow.Cells["Order"].Value) == 1,
              Convert.ToInt32(dataGridViewRoles.CurrentRow.Cells["Clients"].Value) == 1,
              Convert.ToInt32(dataGridViewRoles.CurrentRow.Cells["Reports"].Value) == 1,
              Convert.ToInt32(dataGridViewRoles.CurrentRow.Cells["Management"].Value) == 1,
              Convert.ToInt32(dataGridViewRoles.CurrentRow.Cells["Client_LN"].Value) == 1,
              Convert.ToInt32(dataGridViewRoles.CurrentRow.Cells["Client_FN"].Value) == 1,
              Convert.ToInt32(dataGridViewRoles.CurrentRow.Cells["Client_MN"].Value) == 1,
              Convert.ToInt32(dataGridViewRoles.CurrentRow.Cells["Client_Sex"].Value) == 1,
              Convert.ToInt32(dataGridViewRoles.CurrentRow.Cells["Client_BD"].Value) == 1,
              Convert.ToInt32(dataGridViewRoles.CurrentRow.Cells["Client_Phone1"].Value) == 1,
              Convert.ToInt32(dataGridViewRoles.CurrentRow.Cells["Client_Phone2"].Value) == 1,
              Convert.ToInt32(dataGridViewRoles.CurrentRow.Cells["Client_Phone3"].Value) == 1,
              Convert.ToInt32(dataGridViewRoles.CurrentRow.Cells["Client_Adress"].Value) == 1,
              Convert.ToInt32(dataGridViewRoles.CurrentRow.Cells["Client_SO"].Value) == 1,
              Convert.ToInt32(dataGridViewRoles.CurrentRow.Cells["Client_Discount"].Value) == 1,
              Convert.ToInt32(dataGridViewRoles.CurrentRow.Cells["Client_FirmName"].Value) == 1
              );

            PositionForm pf = new PositionForm(position);
            pf.ShowDialog();

            position = pf.position;

            client.SetPosition(position);
            //_waitForResponse.WaitOne();
              }
        }
Ejemplo n.º 2
0
        public void SetPosition(Position position)
        {
            DataRow row = _db._ds.Tables["Position"].Rows.Find(position.Id);

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

            row["Id"] = position.Id;
            row["Title"] = position.Title;
            row["Products"] = position.Products;
            row["Order"] = position.Order;
            row["Clients"] = position.Clients;
            row["Reports"] = position.Reports;
            row["Management"] = position.Management;
            row["Client_LN"] = position.Client_LN;
            row["Client_FN"] = position.Client_FN;
            row["Client_MN"] = position.Client_MN;
            row["Client_Sex"] = position.Client_Sex;
            row["Client_BD"] = position.Client_BD;
            row["Client_Phone1"] = position.Client_Phone1;
            row["Client_Phone2"] = position.Client_Phone2;
            row["Client_Phone3"] = position.Client_Phone3;
            row["Client_Adress"] = position.Client_Adress;
            row["Client_SO"] = position.Client_SO;
            row["Client_Discount"] = position.Client_Discount;

            _db._ds.Tables["Position"].Rows.Add(row);
              }
              else
              {
            row["Id"] = position.Id;
            row["Title"] = position.Title;
            row["Products"] = position.Products;
            row["Order"] = position.Order;
            row["Clients"] = position.Clients;
            row["Reports"] = position.Reports;
            row["Management"] = position.Management;
            row["Client_LN"] = position.Client_LN;
            row["Client_FN"] = position.Client_FN;
            row["Client_MN"] = position.Client_MN;
            row["Client_Sex"] = position.Client_Sex;
            row["Client_BD"] = position.Client_BD;
            row["Client_Phone1"] = position.Client_Phone1;
            row["Client_Phone2"] = position.Client_Phone2;
            row["Client_Phone3"] = position.Client_Phone3;
            row["Client_Adress"] = position.Client_Adress;
            row["Client_SO"] = position.Client_SO;
            row["Client_Discount"] = position.Client_Discount;
              }

              _db._adapterPosition.Update(_db._ds.Tables["Position"]);

              OnDBChanged(_db);
        }
Ejemplo n.º 3
0
        private void newPositionBtn_Click(object sender, EventArgs e)
        {
            Position position = new Position();

              position.SetId(client.GetCurIdentity("Position") + 1);

              PositionForm pf = new PositionForm(position);
              pf.ShowDialog();

              position = pf.position;

              if (position.Id != 0)
              {
            client.SetPosition(position);
            //_waitForResponse.WaitOne();
              }
        }
Ejemplo n.º 4
0
 public PositionForm(Position pos)
 {
     InitializeComponent();
       position = pos;
 }