Esempio n. 1
0
        private void IbtnAddService_Click(object sender, EventArgs e)
        {
            string text = txtServiceCode.Text;

            string[] words = text.Split(' ');
            if (serviceLog.Read_once_exist(words[0]))
            {
                Service service = serviceLog.Read_once(words[0]);
                //Validar que no exista codigo en la tabla
                if (SearchDtCode(dts, words[0]))
                {
                    row    = dts.NewRow();
                    row[0] = service.Service_code;
                    row[1] = service.Service_activity;
                    row[2] = Convert.ToInt32(nupQuantity.Value);
                    row[3] = service.Service_type;
                    dts.Rows.Add(row);
                }
                else
                {
                    MessageBox.Show("El servicio ya se agregó al equipo");
                }
            }
            txtServiceCode.Clear();
            txtServiceCode.Focus();
        }
Esempio n. 2
0
 private void IBtnCreate_Click(object sender, EventArgs e)
 {
     if (IBtnCreate.Text.Equals("Crear"))
     {
         if (ValidateFields())
         {
             if (!serviceLog.Read_once_exist(txtCode.Text))
             {
                 Service service = new Service(txtCode.Text, txtActivity.Text, nupDuration.Value.ToString(),
                                               txtCost.Text, char.Parse(cboType.Text));
                 CleanFields();
                 serviceLog.Create(service);
                 IbtnRefresh_Click(null, e);
             }
             else
             {
                 MessageBox.Show("El servicio ya existe en el sistema", "Aviso",
                                 MessageBoxButtons.OK, MessageBoxIcon.Warning);
             }
         }
     }
     else if (IBtnCreate.Text.Equals("Guardar"))
     {
         if (ValidateFields())
         {
             Service service = new Service(txtCode.Text, txtActivity.Text, nupDuration.Value.ToString(),
                                           txtCost.Text, char.Parse(cboType.Text));
             CleanFields();
             serviceLog.Update(service);
             IbtnRefresh_Click(null, e);
             txtCode.Enabled = true;
             txtCode.Focus();
             IBtnCreate.Text = "Crear";
         }
     }
 }