Exemple #1
0
        private void btnSaveTara_Click(object sender, EventArgs e)
        {
            if (CheckFields() == true)
            {
                if (MODO == Modo.Nuevo)
                {
                    Clases.MyItem MI = new Clases.MyItem(treeView1, txtPatente.Text, cmbProducto.Text);

                    MI.setTara(int.Parse(lblRTara.Text));
                    SetAllData(MI);
                    MI.SelectedImageIndex = 0;
                    ClearAll();
                }
                else if (MODO == Modo.Modificar)
                {
                    if (treeView1.SelectedNode != null && treeView1.SelectedNode.Name.StartsWith("record") == true)
                    {
                        Clases.MyItem MI = treeView1.SelectedNode as Clases.MyItem;
                        MI.setTara(int.Parse(lblBascula.Text.Substring(1)));
                        ClearAll();
                        grpBoxRegistro.Visible = false;
                    }
                }
            }
        }
Exemple #2
0
 private void SetAllData(Clases.MyItem p_MI)
 {
     p_MI.setData(txtCliente.Text,
                  int.Parse(cmbProducto.SelectedItem.ToString().Split(new string[] { "-" }, StringSplitOptions.None)[0]),
                  txtPatente.Text,
                  txtHumedad.Text,
                  txtChofer.Text, DateTime.Now);
 }
Exemple #3
0
        private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
        {
            if (e.Node.Name.StartsWith("record") == true)
            {
                Clases.MyItem   MI = e.Node as Clases.MyItem;
                Clases.Registro R  = MI.REG;
                if (R != null)
                {
                    txtChofer.Text       = R.Chofer;
                    txtCliente.Text      = R.Cliente;
                    txtHumedad.Text      = R.Humedad.ToString();
                    txtPatente.Text      = R.Patente;
                    lblRBruto.Text       = R.Peso.ToString();
                    lblRTara.Text        = R.Tara.ToString();
                    btnSaveBruto.Visible = false;
                    btnSaveTara.Visible  = false;
                    txtCliente.Enabled   = false;
                    txtChofer.Enabled    = false;
                    txtHumedad.Enabled   = false;
                    txtPatente.Enabled   = false;
                    cmbProducto.Enabled  = false;



                    for (int a = 0; a < cmbProducto.Items.Count; a++)
                    {
                        if (int.Parse(cmbProducto.Items[a].ToString().Split(new string[] { "-" }, StringSplitOptions.None)[0]) == R.IdProducto)
                        {
                            cmbProducto.SelectedIndex = a;
                            break;
                        }
                    }
                    MODO = Modo.Modificar;
                    if (R.Peso == 0)
                    {
                        lblRBruto.Text          = lblBascula.Text.Substring(1);
                        grpBoxRegistro.Visible  = true;
                        btnSaveBruto.Visible    = true;
                        btnSaveBruto.Enabled    = true;
                        txtPorcentajeBruto.Text = "0";
                        grpCalculoBruto.Visible = true;
                        RecalculoBruto();
                    }
                    if (R.Tara == 0)
                    {
                        grpCalculoBruto.Visible = false;
                        grpBoxRegistro.Visible  = true;
                        btnSaveTara.Visible     = true;
                        btnSaveTara.Enabled     = true;
                    }
                }
            }
            else
            {
                ClearAll();
                grpBoxRegistro.Visible = false;
            }
        }