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(); }
private void AddServices() { List <Cotization_serviceFK> cotization_ServiceFKs = cotizationServiceLog.Read_ServicesOfCotization(txtCotizationId.Text); foreach (var cs in cotization_ServiceFKs) { Service service = serviceLog.Read_once(cs.Service_code); //Console.WriteLine("Code: {0} | Actividad: {1}",service.Service_code,service.Service_activity); row = dtsr.NewRow(); row[0] = "Servicio"; row[1] = service.Service_code; row[2] = service.Service_activity; row[3] = cs.Service_quantity; row[4] = decimal.Parse(service.Service_cost, culture).ToString("C2"); row[5] = decimal.Parse(cs.Service_amount, culture).ToString("C2"); dtsr.Rows.Add(row); } }