private void btnGuardarMedidor_Click(object sender, EventArgs e) { Conector_DataBase conector = new Conector_DataBase(); Clientee cliente = new Clientee(); cliente.Nombre = txt_m_Nombre.Text; cliente.Apellido = txt_m_Apellido.Text; cliente.Nombre_Empresa = txt_m_NomEmpresa.Text; cliente.Responsable_Medicion = txt_m_ResMedicion.Text; cliente.DirigirReporte_A = txt_m_DirigirReporte.Text; cliente.RazonSocial = txt_m_RazonSocial.Text; cliente.Ruc = txt_m_Ruc.Text; cliente.NisCliente = txt_m_NisCliente.Text; // Mandar los datos del usuario ala base de datos en mongo conector.insertar_Cliete(cliente.Nombre, cliente.Apellido, cliente.Nombre_Empresa, cliente.Responsable_Medicion, cliente.DirigirReporte_A, cliente.RazonSocial, cliente.Ruc, cliente.NisCliente); pnlAlertaVerde.Visible = true; lbl_verde.Text = "Usuario Agregado"; txt_m_Nombre.Text = ""; txt_m_Apellido.Text = ""; txt_m_NomEmpresa.Text = ""; txt_m_ResMedicion.Text = ""; txt_m_DirigirReporte.Text = ""; txt_m_RazonSocial.Text = ""; txt_m_Ruc.Text = ""; txt_m_NisCliente.Text = ""; seAgregoUno = true; }
private void btnGuardarMedidor_Click(object sender, EventArgs e) { pnlAlertaVerde.Visible = false; pnlAlertaRojo.Visible = false; DatosMedidor datosTxt = new DatosMedidor(); Conector_DataBase conector = new Conector_DataBase(); try { //Ternarios Para Validar Y rellenar los datos del Medidor datosTxt.Nis = txtNIS.Text; datosTxt.Nombre_Propietario = txtNom_Propietario.Text; datosTxt.Area = (string.IsNullOrEmpty(txtArea.Text)) ? "" : txtArea.Text; datosTxt.Modo_Uso = (string.IsNullOrEmpty(txtModo_Uso.Text)) ? "" : txtModo_Uso.Text; datosTxt.Ubicacion = (string.IsNullOrEmpty(txtUbicacionMedidor.Text)) ? "" : txtUbicacionMedidor.Text; datosTxt.KWH_Punto_dia = (string.IsNullOrEmpty(txtKWH_punto_dia.Text)) ? 0 : Convert.ToSingle(txtKWH_punto_dia.Text); datosTxt.Grupo = (string.IsNullOrEmpty(txtNumero_Grupo.Text)) ? "" : txtNumero_Grupo.Text; datosTxt.Potencia_Punto_dia = (string.IsNullOrEmpty(txtPotencia_Punto_dia.Text)) ? 0 : Convert.ToSingle(txtPotencia_Punto_dia.Text); datosTxt.Marca = (string.IsNullOrEmpty(txtMarca.Text)) ? "" : txtMarca.Text; datosTxt.Modelo = (string.IsNullOrEmpty(txtModelo.Text)) ? "" : txtModelo.Text; datosTxt.Tipo = (string.IsNullOrEmpty(txtTipo.Text)) ? "" : txtTipo.Text; datosTxt.Presicion = (string.IsNullOrEmpty(txtPresicion.Text)) ? 0 : Convert.ToSingle(txtPresicion.Text); datosTxt.Codigo_fabricante = (string.IsNullOrEmpty(txtCodigo_Fabricante.Text)) ? "" : txtCodigo_Fabricante.Text; datosTxt.TC_Primario = (string.IsNullOrEmpty(txtTc_primaria.Text)) ? 0 : Convert.ToSingle(txtTc_primaria.Text); datosTxt.TC_secundario = (string.IsNullOrEmpty(txtTc_secundaria.Text)) ? 0 : Convert.ToSingle(txtTc_secundaria.Text); datosTxt.TP_Primario = (string.IsNullOrEmpty(txtTP_primaria.Text)) ? 0 : Convert.ToSingle(txtTP_primaria.Text); datosTxt.TP_secundario = (string.IsNullOrEmpty(txtTP_secundario.Text)) ? 0 : Convert.ToSingle(txtTP_secundario.Text); datosTxt.Numero_Cerie = (string.IsNullOrEmpty(txtNumero_Serie.Text)) ? "" : txtNumero_Serie.Text; datosTxt.Ia_punto = (string.IsNullOrEmpty(txt_Ia_punto.Text)) ? 0 : Convert.ToSingle(txt_Ia_punto.Text); datosTxt.Ib_punto = (string.IsNullOrEmpty(txt_Ib_punto.Text)) ? 0 : Convert.ToSingle(txt_Ib_punto.Text); datosTxt.Ic_punto = (string.IsNullOrEmpty(txt_Ic_punto.Text)) ? 0 : Convert.ToSingle(txt_Ic_punto.Text); datosTxt.Va_punto = (string.IsNullOrEmpty(txt_Va_punto.Text)) ? 0 : Convert.ToSingle(txt_Va_punto.Text); datosTxt.Vb_punto = (string.IsNullOrEmpty(txt_Vb_punto.Text)) ? 0 : Convert.ToSingle(txt_Vb_punto.Text); datosTxt.Vc_punto = (string.IsNullOrEmpty(txt_Vc_punto.Text)) ? 0 : Convert.ToSingle(txt_Vc_punto.Text); datosTxt.Relacion_TC = (datosTxt.TC_secundario == 0) ? 0 : datosTxt.TC_Primario / datosTxt.TC_secundario; datosTxt.Relacion_TP = (datosTxt.TP_secundario == 0) ? 0 : datosTxt.TP_Primario / datosTxt.TP_secundario; //Comunicacion //Eternet datosTxt.Eternet = check_Eternet.Checked; datosTxt.Eternet_NumeroIp = (string.IsNullOrEmpty(txtNumeroIp_Eternet.Text)) ? "" : txtNumeroIp_Eternet.Text; datosTxt.Eternet_Operativo = (radio_Eternet_si.Checked) ? true : false; //Modem datosTxt.Modem = check_Modem.Checked; datosTxt.Modem_Telefono = (string.IsNullOrEmpty(txtNumTelefono_modem.Text)) ? "" : txtNumTelefono_modem.Text; datosTxt.Modem_Operativo = (radio_Modem_si.Checked) ? true : false; //RS232 datosTxt.RS232 = checkRS_232.Checked; datosTxt.RS232_Id = (string.IsNullOrEmpty(txtId_RS232.Text)) ? "" : txtId_RS232.Text; datosTxt.RS232_Operativo = (radio_RS232_si.Checked) ? true : false; // RS 485 datosTxt.RS485 = check_RS_485.Checked; datosTxt.RS485_Numero_Id = (string.IsNullOrEmpty(txtRS485_Id.Text)) ? "" : txtRS485_Id.Text; datosTxt.RS485_Operativo = (radio_RS485_si.Checked) ? true : false; //Puerto Optico datosTxt.PuertoOptico = checkPuerto_optico.Checked; datosTxt.PuertoOptico_Operativo = (radio_PuertoOptico_si.Checked) ? true : false; //Infrarrojo datosTxt.infrarrojo = check_infrarrojo.Checked; datosTxt.infrarrojo_Operativo = (radio_Infrarrojo_si.Checked) ? true : false; //Radio frecuencia datosTxt.RadioFrecuencia = check_radio_frecuencia.Checked; datosTxt.RadioFrecuencia_Operativo = (radio_RadiFrecuencia_si.Checked) ? true : false; if (txtNumero_Medidor.Text != "" && txtNombreMedidor.Text != "" && txtClase.Text != "") { datosTxt.Numero_Medidor = txtNumero_Medidor.Text; datosTxt.clase = Convert.ToInt16(txtClase.Text); datosTxt.Nombre_Medidor = txtNombreMedidor.Text; epError.Clear(); epNombreMedidor.Clear(); epClase.Clear(); conector.insertar_Medidor(datosTxt); pnlAlertaVerde.Visible = true; lbl_verde.Text = "Medidor Guardado"; } else { pnlAlertaRojo.Visible = true; lblRojo.Text = "Rellene los campos Obligatorios"; epError.SetError(txtNumero_Medidor, "Introduzca EL Numero Del Medidor "); epNombreMedidor.SetError(txtNombreMedidor, "Introduzca EL Nombre Del Medidor "); epClase.SetError(txtClase, "Introduzca La Clase Del Medidor "); //txtNumero_Medidor.Focus(); } } catch (Exception ex) { pnlAlertaRojo.Visible = true; lblRojo.Text = "Error Al Guardar Los Datos Del Medidor" + ex; } // pnlAlertaRojo.Visible = true; // lblRojo.Text = "Por Favor Rellene Todos Los Campos "; }
public void btnAnlizarRangoFecha_Click(object sender, EventArgs e) { //Llano txtKwhLlano.Text = ""; txtKvahrLlano.Text = ""; txtKwdLlano.Text = ""; txtFactorPotenciaLlano.Text = ""; //punta txtKwhPunta.Text = ""; txtKvahrPunta.Text = ""; txtKwdPunta.Text = ""; txtFactorPotenciaPunta.Text = ""; //valle txtKwhValle.Text = ""; txtKvahrValle.Text = ""; txtKwdValle.Text = ""; txtFactorPotenciaValle.Text = ""; //Voltaje txtMaxL1.Text = ""; txtFechaMaxL1.Text = ""; //Valores de Fecha para la consulta //Fecha Inicial DateTime fechaInicial = dtFechaInicalRegistro.Value.Date; DateTime horaInicial = Convert.ToDateTime(CbHoraInicialRegistro.Text + ":" + CbMinutoInicialRegistro.Text + ":" + "00"); DateTime FechaInicialRegistro = fechaInicial.AddHours(horaInicial.Hour).AddMinutes(horaInicial.Minute).AddSeconds(horaInicial.Second); //Fecha Final DateTime fechaFinal = dtFechaFinalRegistro.Value.Date; DateTime horaFinal = Convert.ToDateTime(CbHoraFinalRegistro.Text + ":" + CbMinutoFinalRegistro.Text + ":" + "00"); DateTime FechaFinalRegistro = fechaFinal.AddHours(horaFinal.Hour).AddMinutes(horaFinal.Minute).AddSeconds(horaFinal.Second); CantidadDias = 0; for (DateTime i = FechaInicialRegistro; i <= FechaFinalRegistro; i = i.AddDays(1)) { CantidadDias++; } txtCantidadDias.Text = "" + CantidadDias; Conector_DataBase conector = new Conector_DataBase(); var DocumentoRegistro = MongoConexion.DataBase.GetCollection <DatosPilot>("pilot"); ////Linq var resutado = (from d in DocumentoRegistro.FindAll() where (d.NumeroMedidor == txtNumeroMedidor.Text) && (d.Time >= FechaInicialRegistro && d.Time <= FechaFinalRegistro) orderby d.Time ascending select d).ToList(); //var PRUEBA = (from d in DocumentoRegistro.FindAll() // where (d.NumeroMedidor == txtNumeroMedidor.Text) // orderby d.Time ascending // select d).ToList(); // PilotDB pilot = new PilotDB(); DatosPilot dpilot = new DatosPilot(); DatosPilot dpilotValle = new DatosPilot(); DatosPilot dpilotPunta = new DatosPilot(); //deliveri DatosPilot dpilotDelivey = new DatosPilot(); DatosPilot dpilotValleDelivey = new DatosPilot(); DatosPilot dpilotPuntaDelivey = new DatosPilot(); //recibido DatosPilot dpilotRecibido = new DatosPilot(); DatosPilot dpilotValleRecibido = new DatosPilot(); DatosRegistro DatosNeto = new DatosRegistro(); DatosRegistro DatosValle = new DatosRegistro(); DatosRegistro DatosPunta = new DatosRegistro(); if (resutado == null || resutado.Count() < 1) { //HACER ALGO POR QUE NO HAY DATA pnlAlertaRojo.Visible = true; lblR.Text = "Rango de fecha invalido"; } else { //FUMADAS CON DATA foreach (var Datos in resutado) { //neto => Total de la sumatoria en valle y punta de los registros DatosNeto.Kwh = DatosNeto.Kwh + Datos.Blo_TotalkWh_del_Rec; DatosNeto.Kvarh = DatosNeto.Kvarh + Datos.Blo_TotalkVARh; DatosNeto.Kwd = DatosNeto.Kwd + Datos.TotalkW; // Total de los delivery DatosNeto.D_Kwh = DatosNeto.D_Kwh + Datos.Blo_kVARhDel; DatosNeto.D_Kvarh = DatosNeto.D_Kvarh + Datos.Blo_kVARhDel; // total de los dados recibidos DatosNeto.R_Kwh = DatosNeto.R_Kwh + Datos.Blo_KwhRec; DatosNeto.R_Kvarh = DatosNeto.R_Kvarh + Datos.Blo_kVARhRec; if (Datos.Time.Hour > 18 && Datos.Time.Hour < 20) { //punta //neto dpilotPunta.TotalkWh_del_Rec = dpilotPunta.TotalkWh_del_Rec + Datos.TotalkWh_del_Rec; dpilotPunta.TotalkVARh = dpilotPunta.TotalkVARh + Datos.TotalkVARh; dpilotPunta.TotalkW = dpilotPunta.TotalkW + Datos.TotalkW; //delivey dpilotPuntaDelivey.KwhDel = dpilotPuntaDelivey.KwhDel + Datos.KwhDel; dpilotPuntaDelivey.kVARhDel = dpilotPuntaDelivey.kVARhDel + Datos.kVARhDel; dpilotPuntaDelivey.Del_kW = dpilotPuntaDelivey.Del_kW + Datos.Del_kW; //Resibido } else { //Valle //Neto dpilotValle.TotalkWh_del_Rec = dpilotValle.TotalkWh_del_Rec + Datos.TotalkWh_del_Rec; dpilotValle.TotalkVARh = dpilotValle.TotalkVARh + Datos.TotalkVARh; dpilotValle.TotalkW = dpilotValle.TotalkW + Datos.TotalkW; //delivey dpilotValleDelivey.KwhDel = dpilotValleDelivey.KwhDel + Datos.KwhDel; dpilotValleDelivey.kVARhDel = dpilotValleDelivey.kVARhDel + Datos.kVARhDel; dpilotValleDelivey.Del_kW = dpilotValleDelivey.Del_kW + Datos.Del_kW; //Recibido dpilotValleRecibido.KwhRec = dpilotValleRecibido.KwhRec + Datos.KwhRec; dpilotValleRecibido.kVARhRec = dpilotValleRecibido.kVARhRec + Datos.kVARhRec; dpilotValleRecibido.kVARhRec = dpilotValleRecibido.kVARhRec + Datos.kVARhRec; } //Enviado //dpilot. if (DatosNeto.L1Max < Convert.ToSingle(Datos.Va)) { DatosNeto.L1Max = Convert.ToSingle(Datos.Va); DatosNeto.L1MAxdate = Datos.Time; } if (DatosNeto.L2Max < Convert.ToSingle(Datos.Vb)) { DatosNeto.L2Max = Convert.ToSingle(Datos.Vb); DatosNeto.L2Maxdate = Datos.Time; } if (DatosNeto.L3Max < Convert.ToSingle(Datos.Vc)) { DatosNeto.L3Max = Convert.ToSingle(Datos.Vc); DatosNeto.L3Maxdate = Datos.Time; } } DatosNeto.PF = (DatosNeto.Kwh == 0) ? 0 : Convert.ToDecimal(Math.Cos(Math.Atan(Convert.ToSingle(DatosNeto.Kvarh / DatosNeto.Kwh)))); //Agregar los datos de la consulta a una tabla var bindingList = new BindingList <DatosPilot>(resutado); var source = new BindingSource(bindingList, null); gridDatosConsulta.Rows.Clear(); gridDatosConsulta.DataSource = source; gridDatosConsulta.Refresh(); ////Llano//////////////////////// //dpilot.Pftot = //txtKwhLlano.Text = dpilot.TotalkWh_del_Rec.ToString(); //txtKvahrLlano.Text = dpilot.TotalkVARh.ToString(); //txtKwdLlano.Text = dpilot.TotalkW.ToString(); //txtFactorPotenciaLlano.Text = dpilot.Pftot.ToString(); ////Lano delivery //dpilotDelivey.Pftot = (dpilotDelivey.KwhDel == 0) ? 0 : Convert.ToDecimal(Math.Cos(Math.Atan(Convert.ToSingle(dpilotDelivey.kVARhDel / dpilotDelivey.KwhDel)))); //txtKwhLlanoD.Text = dpilotDelivey.KwhDel.ToString(); //txtKvarhLlanoD.Text = dpilotDelivey.kVARhDel.ToString(); //txtKwdLlanoD.Text = dpilotDelivey.Del_kW.ToString(); //txtPfLlanoD.Text = dpilotDelivey.Pftot.ToString(); ////Llano Recibido //dpilotRecibido.Pftot = (dpilotRecibido.KwhRec == 0) ? 0 : Convert.ToDecimal(Math.Cos(Math.Atan(Convert.ToSingle(dpilotRecibido.kVARhRec / dpilotRecibido.KwhRec)))); //txtKwhLlanoR.Text = dpilotRecibido.KwhRec.ToString(); //txtKvarhLlanoR.Text = dpilotRecibido.kVARhRec.ToString(); //txtKwdLlanoR.Text = dpilotRecibido.Rec_kW.ToString(); //txtPfLlanoR.Text = dpilotRecibido.Pftot.ToString(); ////punta///////////////// //dpilotPunta.Pftot = (dpilotPunta.TotalkWh_del_Rec == 0) ? 0 : Convert.ToDecimal(Math.Cos(Math.Atan(Convert.ToSingle(dpilotPunta.TotalkVARh / dpilotPunta.TotalkWh_del_Rec)))); //txtKwhPunta.Text = dpilotPunta.TotalkWh_del_Rec.ToString(); //txtKvahrPunta.Text = dpilotPunta.TotalkVARh.ToString(); //txtKwdPunta.Text = dpilotPunta.TotalkW.ToString(); //txtFactorPotenciaPunta.Text = dpilotPunta.Pftot.ToString(); ////Delivery //dpilotPuntaDelivey.Pftot = (dpilotPuntaDelivey.KwhDel == 0) ? 0 : Convert.ToDecimal(Math.Cos(Math.Atan(Convert.ToSingle(dpilotPuntaDelivey.kVARhDel / dpilotPuntaDelivey.KwhDel)))); //txtKwhPuntaD.Text = dpilotPuntaDelivey.KwhDel.ToString(); //txtKvarhPuntaD.Text = dpilotPuntaDelivey.kVARhDel.ToString(); //txtKwdPuntaD.Text = dpilotPuntaDelivey.Del_kW.ToString(); //txtPfPuntaD.Text = dpilotPuntaDelivey.Pftot.ToString(); ////valle//////////// ////netos/////// //dpilotValle.Pftot = (dpilotValle.TotalkWh_del_Rec == 0) ? 0 : Convert.ToDecimal(Math.Cos(Math.Atan(Convert.ToSingle(dpilotValle.TotalkVARh / dpilotValle.TotalkWh_del_Rec)))); //txtKwhValle.Text = dpilotValle.TotalkWh_del_Rec.ToString(); //txtKvahrValle.Text = dpilotValle.TotalkVARh.ToString(); //txtKwdValle.Text = dpilotValle.TotalkW.ToString(); //txtFactorPotenciaValle.Text = dpilotValle.Pftot.ToString(); ////Delivery //dpilotValleDelivey.Pftot = (dpilotValleDelivey.KwhDel == 0) ? 0 : Convert.ToDecimal(Math.Cos(Math.Atan(Convert.ToSingle(dpilotValleDelivey.kVARhDel / dpilotValleDelivey.KwhDel)))); //txtKwhValleD.Text = dpilotValleDelivey.KwhDel.ToString(); //txtKvarhValleD.Text = dpilotValleDelivey.kVARhDel.ToString(); //txtKwdValleD.Text = dpilotValleDelivey.Del_kW.ToString(); //txtPfValleD.Text = dpilotValleDelivey.Pftot.ToString(); ////Recibido //txtKwhValleR.Text = dpilotValleRecibido.KwhRec.ToString(); ////Voltaje //txtMaxL1.Text = L1Max.ToString(); //txtFechaMaxL1.Text = L1MAxdate.ToString(); //txtMaxL2.Text = L2Max.ToString(); //txtFechaMaxL2.Text = L2Maxdate.ToString(); //txtMaxL3.Text = L3Max.ToString(); //txtFechaMaxL3.Text = L3Maxdate.ToString(); } }
private void btnAbrirDB_Click(object sender, EventArgs e) { try { if (ComboMedidores.Text != "") { pnlAlertaVerde.Visible = false; pnlAlertaRojo.Visible = false; Conector_DataBase conector = new Conector_DataBase(); List <DatosPilot> Regitros = new List <DatosPilot>(); //OpenFileDialog openFileDialog1 = new OpenFileDialog(); //openFileDialog1.RestoreDirectory = true; //openFileDialog1.CheckFileExists = true; //openFileDialog1.CheckPathExists = true; //openFileDialog1.Title = "Buscar medición en formato csv"; //openFileDialog1.DefaultExt = ".csv"; //openFileDialog1.Filter = "archivos csv (*.csv)|*.csv"; string ScvMedidor = txtNumeroMedidor.Text + ".csv"; string url = "C:\\Data Origen Report One\\DBPILOT\\" + ScvMedidor; if (File.Exists(url).ToString() != "") { if (File.Exists(url)) { string line = ""; //string linea = ""; int counter = 0; // Read the file and display it line by line. System.IO.StreamReader file = new System.IO.StreamReader(@"" + url); //se crear un clon de la lectura del archivon para saber la cantidad de lineas System.IO.StreamReader fileCantidad = new System.IO.StreamReader(@"" + url); PilotDB filaData = new PilotDB(); filaData.Nombre = txtNombreMedidor.Text; filaData.NombrePropietadio = txtNombreCliente.Text; filaData.Marca = txtMarcaMedidor.Text; filaData.NumeroMedidor = txtNumeroMedidor.Text; //Bloque decimal Blo_KwhDel_a = 0; decimal Blo_KwhRec_a = 0; decimal Blo_kVARhDel_a = 0; decimal Blo_Blo_kVARhRec_a = 0; while ((line = file.ReadLine()) != null) { counter++; int cantidadColumnas = line.Split(',').Count(); string[] columnasCsv = new string[cantidadColumnas]; int[] columnasUsar = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 15, 17, 18, 19, 20, 21 }; columnasCsv = line.Split(','); DatosPilot Dato = new DatosPilot(); if (counter > 1) { // this.gridDatos.Rows.Add(1); Random rnd = new Random(); for (var i = 0; i < cantidadColumnas; i++) { var texto = SacarTexto(line, i + 1); switch (i) { case 1: Dato.Time = Convert.ToDateTime(texto); break; case 2: Dato.Va = Convert.ToDecimal(texto); break; case 3: Dato.Vb = Convert.ToDecimal(texto); break; case 4: Dato.Vc = Convert.ToDecimal(texto); break; case 5: Dato.Ia = Convert.ToDecimal(texto); break; case 6: Dato.Ib = Convert.ToDecimal(texto); break; case 7: Dato.Ic = Convert.ToDecimal(texto); break; case 8: Dato.Frequency = Convert.ToDecimal(texto); break; case 9: Dato.Pa = Convert.ToDecimal(texto); break; case 10: Dato.Pb = Convert.ToDecimal(texto); break; case 11: Dato.Pc = Convert.ToDecimal(texto); break; case 15: Dato.TotalkW = Convert.ToDecimal(texto); break; case 18: Dato.Pftot = Convert.ToDecimal(texto); break; //Datos generados en bloque case 19: Dato.KwhRec = Convert.ToDecimal(texto); if (counter >= 3) { if (Dato.KwhRec < Blo_KwhRec_a) { Dato.Blo_KwhRec = Blo_KwhRec_a - Convert.ToDecimal(texto); } else { Dato.Blo_KwhRec = 0; } Blo_KwhRec_a = Dato.KwhRec; } else { Blo_KwhRec_a = Dato.KwhRec; } break; case 20: Dato.KwhDel = Convert.ToDecimal(texto); if (counter >= 3) { Dato.Blo_KwhDel = Blo_KwhDel_a - Convert.ToDecimal(texto); Blo_KwhDel_a = Dato.KwhDel; } else { Blo_KwhDel_a = Dato.KwhDel; } break; case 21: Dato.kVARhDel = Convert.ToDecimal(texto); if (counter >= 3) { if (Dato.kVARhDel < Blo_kVARhDel_a) { Dato.Blo_kVARhDel = 0; } else { Dato.Blo_kVARhDel = Blo_kVARhDel_a - Convert.ToDecimal(texto); } Blo_kVARhDel_a = Dato.kVARhDel; } else { Blo_kVARhDel_a = Dato.kVARhDel; } break; case 22: Dato.kVARhRec = Convert.ToDecimal(texto); if (counter >= 3) { Dato.Blo_kVARhRec = Blo_Blo_kVARhRec_a - Convert.ToDecimal(texto); Blo_Blo_kVARhRec_a = Dato.kVARhRec; } else { Blo_Blo_kVARhRec_a = Dato.kVARhRec; } break; case 23: Dato.TotalkWh_del_Rec = Dato.KwhRec - Dato.KwhDel; Dato.Blo_TotalkWh_del_Rec = Dato.Blo_KwhRec - Dato.Blo_KwhDel; Dato.TotalkVARh = Dato.kVARhRec - Dato.kVARhDel; Dato.Blo_TotalkVARh = Dato.Blo_kVARhRec - Dato.Blo_kVARhDel; ////datos Calculado a partir de lo registros Dato.Rec_kW = (Dato.KwhRec * 4); Dato.Del_kW = (Dato.KwhDel * 4); double a = Convert.ToDouble(Dato.TotalkVARh); Dato.kVAh_rms = Convert.ToDecimal(a * 0.8); double b = Convert.ToDouble(Dato.KwhRec); Dato.Rec_kVAh = Convert.ToDecimal(b * 0.8); double c = Convert.ToDouble(Dato.KwhDel); Dato.Del_kVAh = Convert.ToDecimal(c * 0.8); break; } } Regitros.Add(Dato); } } //Pasar Los Datos Leidos Ala Base de datos conector.insertarDatosPilot(Regitros, filaData); pnlAlertaVerde.Visible = true; lblverde.Text = "Registros Agregados"; } else { pnlAlertaRojo.Visible = true; lblR.Text = "El archivo scv no se encuentra"; } } else { pnlAlertaRojo.Visible = true; lblR.Text = "El archivo scv esta Vacio "; } } else { pnlAlertaRojo.Visible = true; lblR.Text = "Seleccione Un Medidor"; } } catch (Exception ex) { pnlAlertaRojo.Visible = true; lblR.Text = "Erro AL Guardar Los Registro : " + ex.ToString(); } }