private void btnNew_Click(object sender, EventArgs e)
 {
     FormControls.ShowFields(true, txtProductId, txtName, txtPrice, txtStock, txtDiscount, cbBrand, cbColor, cbSize, rbClothing, rbFemale, rbFootwear, rbKids, rbMale, gb_Subtype, gb_Type, btnCancel, btnSave, label1, label2, label3, label4, label5, label6, label7, label8, label9, label11);
     FormControls.ResetFields(txtProductId, txtName, txtPrice, txtStock, txtDiscount, cbBrand, cbColor, cbSize, rbClothing, rbFemale, rbFootwear, rbKids, rbMale);
     isNew = true;
     txtProductId.Focus();
 }
Ejemplo n.º 2
0
 private void btnNew_Click(object sender, EventArgs e)
 {
     FormControls.ShowFields(true, txtName, txtSurname, txtAddress, txtPhoneNum, txtEmail, cBoxType, btnSave, btnCancel, label1, label2, label3, label4, label5, label6);
     FormControls.ResetFields(txtName, txtSurname, txtAddress, txtPhoneNum, txtEmail, cBoxType);
     isNew = true;
     txtName.Focus();
 }
 private void BindFields()
 {
     try
     {
         if (dgv_Product.CurrentRow.Index < dgv_Product.Rows.Count - 1)
         {
             txtProductId.Text    = (string)dgv_Product.CurrentRow.Cells[1].Value;
             txtName.Text         = (string)dgv_Product.CurrentRow.Cells[2].Value;
             cbBrand.SelectedItem = (string)dgv_Product.CurrentRow.Cells[3].Value;
             cbColor.SelectedItem = (string)dgv_Product.CurrentRow.Cells[6].Value;
             cbSize.SelectedItem  = dgv_Product.CurrentRow.Cells[7].Value.ToString();
             txtPrice.Text        = dgv_Product.CurrentRow.Cells[8].Value.ToString();
             txtDiscount.Text     = dgv_Product.CurrentRow.Cells[9].Value.ToString();
             gb_Type.Controls.OfType <RadioButton>().Where(r => r.Text == (string)dgv_Product.CurrentRow.Cells[4].Value).FirstOrDefault().Checked    = true;
             gb_Subtype.Controls.OfType <RadioButton>().Where(r => r.Text == (string)dgv_Product.CurrentRow.Cells[5].Value).FirstOrDefault().Checked = true;
             txtStock.Text = dgv_Product.CurrentRow.Cells[10].Value.ToString();
         }
         else
         {
             FormControls.ResetFields(txtProductId, txtName, txtPrice, txtStock, txtDiscount, cbBrand, cbColor, cbSize, rbClothing, rbFemale, rbFootwear, rbKids, rbMale);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Ejemplo n.º 4
0
 private void BindFields()
 {
     try
     {
         if (dgv_Customer.CurrentRow.Index < dgv_Customer.Rows.Count - 1)
         {
             txtName.Text          = (string)dgv_Customer.CurrentRow.Cells[1].Value;
             txtSurname.Text       = (string)dgv_Customer.CurrentRow.Cells[2].Value;
             txtAddress.Text       = (string)dgv_Customer.CurrentRow.Cells[3].Value;
             txtPhoneNum.Text      = (string)dgv_Customer.CurrentRow.Cells[4].Value;
             txtEmail.Text         = (string)dgv_Customer.CurrentRow.Cells[5].Value;
             cBoxType.SelectedItem = (string)dgv_Customer.CurrentRow.Cells[6].Value;
         }
         else
         {
             FormControls.ResetFields(txtName, txtSurname, txtAddress, txtPhoneNum, txtEmail, cBoxType);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }