private void button2_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(this.IpLocal)) { this.IpLocal = DireccionIP.Local(); } if (string.IsNullOrEmpty(this.IpPublica)) { this.IpPublica = DireccionIP.Publica(); } if (string.IsNullOrEmpty(this.SerialHDD)) { this.SerialHDD = DireccionIP.SerialNumberDisk(); } if (string.IsNullOrEmpty(this.Usuario)) { this.Usuario = DireccionIP.SerialNumberDisk(); } if (!string.IsNullOrEmpty(this.ValorPeriodo)) { Frm_Reporte_Liquidacion frm_Reporte_Liquidacion = new Frm_Reporte_Liquidacion(); LlenarLog.Registro(DateTime.Now, this.Usuario, this.IpLocal, this.IpPublica, this.SerialHDD, Environment.MachineName, "Impresión reporte Onzas Entergadas", "Impresión Reporte"); object[] argument = new object[] { 5, this.ValorPeriodo }; frm_Reporte_Liquidacion.EjecucionReportes(argument); frm_Reporte_Liquidacion.Show(); } else { MessageBox.Show("Seleccione un periodo a imprimir"); } }
private void btnGuardar_Click(object sender, EventArgs e) { try { if (string.IsNullOrEmpty(this.IpLocal)) { this.IpLocal = DireccionIP.Local(); } if (string.IsNullOrEmpty(this.IpPublica)) { this.IpPublica = DireccionIP.Publica(); } if (string.IsNullOrEmpty(this.SerialHDD)) { this.SerialHDD = DireccionIP.SerialNumberDisk(); } if (string.IsNullOrEmpty(this.Usuario)) { this.Usuario = DireccionIP.SerialNumberDisk(); } bool indicateSave = false; foreach (DataGridViewRow row in dataGridView3.Rows) { if (Convert.ToBoolean(row.Cells[0].Value)) { break; } } GuardarDatos Guardar = new GuardarDatos(); SqlParameter[] ParamSQl = GuardarDatos.Parametros_OrdenesMuestreoPM("", cmbShipment.Text, dtpEvent.Value, !String.IsNullOrEmpty(/*label4.Text*/ string.Empty) ? int.Parse(/*label4.Text*/ string.Empty) : 0, cbmLabo.SelectedIndex, (true /*rbtAnalisys.Checked*/) ? /*rbtAnalisys.Checked */ true: false, 1); if (ParamSQl[0].Value.ToString() == "I") { Guardar.Numerico("Sp_Guardar_OrdenMuestraPM", ParamSQl).ToString(); MessageBox.Show("Muestreo almacenado con Exito"); loadHistory(); //LlenarLog.Registro(DateTime.Now, this.Usuario, this.IpLocal, this.IpPublica, this.SerialHDD, Environment.MachineName, "Se creo Registro de Muestreo " + TxbConsecutivo.Text.Trim(), "Movimiento Muestreo creado"); //Limpiar(1); } else { MessageBox.Show("Personal de Muestreo actualizado con Exito"); //LlenarLog.Registro(DateTime.Now, this.Usuario, this.IpLocal, this.IpPublica, this.SerialHDD, Environment.MachineName, "Se modifico Personal de Muestreo " + TxbConsecutivo.Text.Trim(), "Movimiento Muestreo Modificar"); } } catch (Exception Ex) { MessageBox.Show(Ex.Message); } }
private void btnSave_Click(object sender, EventArgs e) { if (!String.IsNullOrEmpty(TxbIdentificacion.Text.Trim()) && !String.IsNullOrEmpty(TxbNombre.Text.Trim())) { try { if (string.IsNullOrEmpty(this.IpLocal)) { this.IpLocal = DireccionIP.Local(); } if (string.IsNullOrEmpty(this.IpPublica)) { this.IpPublica = DireccionIP.Publica(); } if (string.IsNullOrEmpty(this.SerialHDD)) { this.SerialHDD = DireccionIP.SerialNumberDisk(); } GuardarDatos Guardar = new GuardarDatos(); SqlParameter[] ParamSQl = GuardarDatos.Parametros_Localizacion("", TxbIdentificacion.Text.Trim(), TxbNombre.Text.Trim(), ChbEstado.Checked, txtDetail.Text); if (Guardar.booleano("Sp_Guardar_Localizacion", ParamSQl)) { if (ParamSQl[0].Value.ToString() == "I") { MessageBox.Show("La localización se almacenado con Exito"); LlenarLog.Registro(DateTime.Now, this.Usuario, this.IpLocal, this.IpPublica, this.SerialHDD, Environment.MachineName, "Se creo localización " + TxbIdentificacion.Text.Trim() + " " + TxbNombre.Text.Trim(), "Maestro Localización - Crear"); } else { MessageBox.Show("La localización se ha actualizado con Exito"); LlenarLog.Registro(DateTime.Now, this.Usuario, this.IpLocal, this.IpPublica, this.SerialHDD, Environment.MachineName, "Se modifico la localización" + TxbIdentificacion.Text.Trim() + " " + TxbNombre.Text.Trim(), "Maestro Localización - Modificar"); } } Limpiar(1); } catch (Exception Ex) { MessageBox.Show(Ex.Message); } } else if (String.IsNullOrEmpty(TxbIdentificacion.Text.Trim())) { MessageBox.Show("Debe de ingresar un código"); } else { MessageBox.Show("Debe de ingresar un nombre"); } }
private void CmdExaminar_Click(object sender, EventArgs e) { if (this.Txtruta.Text == string.Empty) { MessageBox.Show("Debe seleccionar un archivo para cargar.", "Carga de Análisis", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { if (this.CmbTipoIngreso.Text == string.Empty) { MessageBox.Show("Debe seleccionar un tipo de ingreso para el carge del archivo de carga.", "Carga de Análisis", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { if (this.Txtruta.Text != string.Empty) { try { Cargar(); if (string.IsNullOrEmpty(this.IpLocal)) { this.IpLocal = DireccionIP.Local(); } if (string.IsNullOrEmpty(this.IpPublica)) { this.IpPublica = DireccionIP.Publica(); } if (string.IsNullOrEmpty(this.SerialHDD)) { this.SerialHDD = DireccionIP.SerialNumberDisk(); } if (string.IsNullOrEmpty(this.Usuario)) { this.Usuario = DireccionIP.SerialNumberDisk(); } LlenarLog.Registro(DateTime.Now, this.Usuario, this.IpLocal, this.IpPublica, this.SerialHDD, Environment.MachineName, "Carga Analisis Laboratorio, Archivo " + this.descripcionArchivo, "Movimiento Muestreo creado"); } catch (OleDbException ex) { MessageBox.Show(ex.Message); } } } } }
private void BtnImprimir_Click(object sender, EventArgs e) { string wProyecto = string.Empty; string wPeriodo = string.Empty; if (cmbProyecto.SelectedIndex != 0) { wProyecto = cmbProyecto.Text; } if (cmbPeriodo.SelectedIndex != 0) { wPeriodo = cmbPeriodo.Text; } FrmRptDiarioMuestreo frmReporte = new FrmRptDiarioMuestreo(Convert.ToDateTime(dtpEventInitial.Text).ToString("yyyy-MM-dd"), Convert.ToDateTime(dtpEventEnd.Text).ToString("yyyy-MM-dd"), wProyecto, wPeriodo, txtNumOrden.Text); frmReporte.Show(); string nameReport = "Reporte Diario Muestreo planta Maria Dama"; if (string.IsNullOrEmpty(this.IpLocal)) { this.IpLocal = DireccionIP.Local(); } if (string.IsNullOrEmpty(this.IpPublica)) { this.IpPublica = DireccionIP.Publica(); } if (string.IsNullOrEmpty(this.SerialHDD)) { this.SerialHDD = DireccionIP.SerialNumberDisk(); } if (string.IsNullOrEmpty(this.Usuario)) { this.Usuario = DireccionIP.SerialNumberDisk(); } LlenarLog.Registro(DateTime.Now, this.Usuario, this.IpLocal, this.IpPublica, this.SerialHDD, Environment.MachineName, "Se genera el reporte de " + nameReport, "Generación de Reportes"); }
private void CmdExaminar_Click(object sender, EventArgs e) { OpenFileDialog openFD = new OpenFileDialog(); openFD.Title = "Seleccionar archivos"; openFD.Filter = "Todos los archivos (*.xls) | *.xlsx;*.xls"; openFD.Multiselect = false; openFD.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyComputer); if (openFD.ShowDialog() == DialogResult.OK) { Txtruta.Text = openFD.FileName; } if (Txtruta.Text == "") { } else { try { Cargar(dtgExcel, Txtruta.Text); if (string.IsNullOrEmpty(this.IpLocal)) this.IpLocal = DireccionIP.Local(); if (string.IsNullOrEmpty(this.IpPublica)) this.IpPublica = DireccionIP.Publica(); if (string.IsNullOrEmpty(this.SerialHDD)) this.SerialHDD = DireccionIP.SerialNumberDisk(); if (string.IsNullOrEmpty(this.Usuario)) this.Usuario = DireccionIP.SerialNumberDisk(); LlenarLog.Registro(DateTime.Now, this.Usuario, this.IpLocal, this.IpPublica, this.SerialHDD, Environment.MachineName, "Carga Analisis Laboratorio, Archivo " + openFD.FileName, "Movimiento Muestreo creado"); } catch (OleDbException ex) { MessageBox.Show(ex.Message); } } }
public ManagePermissions(string User) { InitializeComponent(); this.Usuario = User; comboBox1.Items.Insert(0, "Muestreo"); comboBox1.Items.Insert(1, "Control de calidad"); comboBox1.Items.Insert(2, "Periodo"); comboBox1.Items.Insert(3, "Carga de resultados"); comboBox1.Items.Insert(4, "Formulario contenedor"); if (workingForm == null) { checkBox1.Visible = false; checkBox2.Visible = false; checkBox4.Visible = false; } if (string.IsNullOrEmpty(this.IpLocal)) { this.IpLocal = DireccionIP.Local(); } if (string.IsNullOrEmpty(this.IpPublica)) { this.IpPublica = DireccionIP.Publica(); } if (string.IsNullOrEmpty(this.SerialHDD)) { this.SerialHDD = DireccionIP.SerialNumberDisk(); } if (string.IsNullOrEmpty(this.Usuario)) { this.Usuario = DireccionIP.SerialNumberDisk(); } }
private void button1_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(this.IpLocal)) { this.IpLocal = DireccionIP.Local(); } if (string.IsNullOrEmpty(this.IpPublica)) { this.IpPublica = DireccionIP.Publica(); } if (string.IsNullOrEmpty(this.SerialHDD)) { this.SerialHDD = DireccionIP.SerialNumberDisk(); } if (string.IsNullOrEmpty(this.Usuario)) { this.Usuario = DireccionIP.SerialNumberDisk(); } string validar = ValidarRequeridos(); if (string.IsNullOrEmpty(validar)) { if (dtpEventInitial.Value.Date > dtpDatenEnd.Value.Date) { dtpDatenEnd.Value = DateTime.Now; MessageBox.Show("La fecha final debe ser mayor a la inicial!"); return; } string mensaje = string.Empty; if (dataHistoryPeriodo.Rows.Count > 0) { if (!selccionValor) { DateTime valorAnterior = Convert.ToDateTime(dataHistoryPeriodo.Rows[0].Cells[3].Value); int resultado = DateTime.Compare(valorAnterior, Convert.ToDateTime(dtpEventInitial.Text)); if (resultado < 0) { resultado = DateTime.Compare(valorAnterior.AddDays(1), Convert.ToDateTime(dtpEventInitial.Text)); if (resultado != 0) { mensaje = "El nuevo periodo debe de ser un día posterior al final del anterior periodo"; } } else if (resultado == 0) { mensaje = "La fecha inicial del nuevo periodo conincide con la fecha final del anterior periodo"; } else { mensaje = "El nuevo periodo esta en el rango de fechas del anterior periodo"; } if (dataHistoryPeriodo.Rows[0].Cells[1].Value.ToString().Trim().Contains(string.Concat(cboAno.Text.Trim(), "-", cboMes.Text.Trim(), "-", cboPeriodo.Text.Trim()))) { MessageBox.Show("El periodo a crear ya existe en historial, verificar coposición del periodo"); return; } } } if (!String.IsNullOrEmpty(mensaje)) { MessageBox.Show(mensaje); return; } GuardarDatos Guardar = new GuardarDatos(); SqlParameter[] ParamSQl = GuardarDatos.Parametros_Insertar_PeriodoPM("", Convert.ToDateTime(dtpEventInitial.Text), Convert.ToDateTime(dtpDatenEnd.Text), Convert.ToInt32(cboAno.Text), Convert.ToInt32(cboMes.Text), cboPeriodo.Text, string.IsNullOrEmpty(txtOnzasFundidas.Text.Trim().TrimEnd(',')) ? Convert.ToDecimal(0.00) : Convert.ToDecimal(txtOnzasFundidas.Text.Trim()) , string.IsNullOrEmpty(txtRecuperacion.Text.Trim().TrimEnd(',')) ? Convert.ToDecimal(0.00) : Convert.ToDecimal(txtRecuperacion.Text.Trim()) , string.IsNullOrEmpty(txtOnzasRecuperadas.Text.Trim().TrimEnd(',')) ? Convert.ToDecimal(0.00) : Convert.ToDecimal(txtOnzasRecuperadas.Text.Trim()), 1); if (ParamSQl[0].Value.ToString() == "I") { Guardar.booleano("Sp_Guardar_PeriodoLiquidacion", ParamSQl); MessageBox.Show("Periodo almacenado con Exito"); LlenarLog.Registro(DateTime.Now, this.Usuario, this.IpLocal, this.IpPublica, this.SerialHDD, Environment.MachineName, "Se creo Registro de Periodo " + string.Concat(cboAno.Text.Trim(), "-", cboMes.Text.Trim(), "-", cboPeriodo.Text.Trim()), "Movimiento Periodo creado"); } else { Guardar.booleano("Sp_Modicar_PeriodoLiquidacion", ParamSQl); MessageBox.Show("Periodo actualizado con Exito"); LlenarLog.Registro(DateTime.Now, this.Usuario, this.IpLocal, this.IpPublica, this.SerialHDD, Environment.MachineName, "Se modifico Periodo" + string.Concat(cboAno.Text.Trim(), "-", cboMes.Text.Trim(), "-", cboPeriodo.Text.Trim()), "Movimiento Periodo Modificar"); } LimpiarCampos(); loadPeriodo(Convert.ToInt32(cboAno.Text)); } else { MessageBox.Show(validar); } }
private void btnSave_Click(object sender, EventArgs e) { int rol = 0; int Error = 0; if (!ChbCuartea.Checked && !ChbEncargado.Checked && !ChbSeguridad.Checked && !ChbTercero.Checked) { Error = 1; } else if (ChbEncargado.Checked) { rol = 1; } else { if (ChbSeguridad.Checked) { rol = 2; } else { if (ChbTercero.Checked) { rol = 3; } else { rol = 4; } } } if (TxbIdentificacion.Text.Trim().Length == 0) { Error = 2; } if (Error == 0) { try { if (string.IsNullOrEmpty(this.IpLocal)) { this.IpLocal = DireccionIP.Local(); } if (string.IsNullOrEmpty(this.IpPublica)) { this.IpPublica = DireccionIP.Publica(); } if (string.IsNullOrEmpty(this.SerialHDD)) { this.SerialHDD = DireccionIP.SerialNumberDisk(); } GuardarDatos Guardar = new GuardarDatos(); SqlParameter[] ParamSQl = GuardarDatos.Parametros_PersonalMuestreo("", TxbIdentificacion.Text.Trim(), TxbNombre.Text.Trim(), TxbApellido.Text.Trim(), TxbDireccion.Text.Trim(), TxbTelFijo.Text.Trim(), TxbCelular.Text.Trim(), TxbEmail.Text.Trim(), rol, Convertir.ImagenEnByte(PtbPersonal.Image), ChbEstado.Checked, DtpCreado.Value); if (Guardar.booleano("Sp_Guardar_PersonalMuestreo", ParamSQl)) { Limpiar(1); if (ParamSQl[0].Value.ToString() == "I") { MessageBox.Show("Personal de Muestreo almacenado con Exito"); LlenarLog.Registro(DateTime.Now, this.Usuario, this.IpLocal, this.IpPublica, this.SerialHDD, Environment.MachineName, "Se creo Personal de Muestreo " + TxbIdentificacion.Text.Trim() + " " + TxbNombre.Text.Trim() + " " + TxbApellido.Text.Trim(), "Maestros - Crear"); } else { MessageBox.Show("Personal de Muestreo actualizado con Exito"); LlenarLog.Registro(DateTime.Now, this.Usuario, this.IpLocal, this.IpPublica, this.SerialHDD, Environment.MachineName, "Se modifico Personal de Muestreo " + TxbIdentificacion.Text.Trim() + " " + TxbNombre.Text.Trim() + " " + TxbApellido.Text.Trim(), "Maestros - Modificar"); } } } catch (Exception Ex) { MessageBox.Show(Ex.Message); } } if (Error == 1) { MessageBox.Show("Debe Seleccionar un tipo de Rol del Personal. ( Encargado / Seguridad / Tercero / Cuarte)"); } if (Error == 2) { MessageBox.Show("Debe reportar una identificacion"); } }
private void BtnImprimir_Click(object sender, EventArgs e) { Frm_Reporte_Liquidacion frmReporte = null; object[] argument = null; string nameReport = string.Empty; //comboBox1 switch (comboBox1.SelectedIndex) { case 0: if (dtpEventInitial.Value > dtpEventEnd.Value) { MessageBox.Show("La fecha inicial no debe de ser superior a la final"); return; } else if (dtpEventEnd.Value < dtpEventInitial.Value) { MessageBox.Show("La fecha final no debe de ser inferior a la inicial"); return; } string mina = string.Empty; if (!comboMina.SelectedIndex.Equals(comboMina.Items.Count - 1)) { mina = comboMina.Text.Trim(); } nameReport = "Detalle Mina Día"; frmReporte = new Frm_Reporte_Liquidacion(); argument = new object[] { 1, dtpEventInitial.Value, dtpEventEnd.Value, checkBox1.Checked, mina }; frmReporte.EjecucionReportes(argument); frmReporte.Show(); break; case 1: if (dtpEventInitial.Value == null) { MessageBox.Show("La fecha inicial no puede ser Nula"); return; } nameReport = "Resumen Mina Día"; mina = string.Empty; if (!comboMina.SelectedIndex.Equals(comboMina.Items.Count - 1)) { mina = comboMina.Text.Trim(); } frmReporte = new Frm_Reporte_Liquidacion(); argument = new object[] { 2, dtpEventInitial.Value, dtpEventEnd.Value, checkBox1.Checked, mina }; frmReporte.EjecucionReportes(argument); frmReporte.Show(); break; case 2: if (dtpEventInitial.Value == null) { MessageBox.Show("La fecha inicial no puede ser Nula"); return; } nameReport = "Detalle Muestreo"; mina = string.Empty; if (!comboMina.SelectedIndex.Equals(comboMina.Items.Count - 1)) { mina = comboMina.Text.Trim(); } frmReporte = new Frm_Reporte_Liquidacion(); argument = new object[] { 3, dtpEventInitial.Value, dtpEventEnd.Value, checkBox1.Checked, mina }; frmReporte.EjecucionReportes(argument); frmReporte.Show(); break; case -1: MessageBox.Show("Selcciona el Reporte a generar"); break; default: break; } if (string.IsNullOrEmpty(this.IpLocal)) { this.IpLocal = DireccionIP.Local(); } if (string.IsNullOrEmpty(this.IpPublica)) { this.IpPublica = DireccionIP.Publica(); } if (string.IsNullOrEmpty(this.SerialHDD)) { this.SerialHDD = DireccionIP.SerialNumberDisk(); } if (string.IsNullOrEmpty(this.Usuario)) { this.Usuario = DireccionIP.SerialNumberDisk(); } LlenarLog.Registro(DateTime.Now, this.Usuario, this.IpLocal, this.IpPublica, this.SerialHDD, Environment.MachineName, "Se genera el reporte de " + nameReport, "Generación de Reportes"); }
private void Save_Click(object sender, EventArgs e) { SqlConnection conn = Conexion.OpenConexion(); SqlParameter param; foreach (String controlID in PageControls.SelectedItems) { foreach (DataRowView roleRow in PermissionRoles.SelectedItems) { int roleID = Convert.ToInt32(roleRow["RoleID"]); try { SqlCommand cmd = new SqlCommand(); cmd.Connection = conn; cmd.CommandText = "spInsertNewControlToRole"; cmd.CommandType = CommandType.StoredProcedure; param = cmd.Parameters.Add("@RoleID", SqlDbType.Int); param.Value = roleID; param.Direction = ParameterDirection.Input; param = cmd.Parameters.Add("@PageName", SqlDbType.VarChar, 50); param.Value = workingForm.Name.ToString(); param.Direction = ParameterDirection.Input; param = cmd.Parameters.Add("@ControlID", SqlDbType.VarChar, 50); param.Value = controlID; param.Direction = ParameterDirection.Input; param = cmd.Parameters.Add("@invisible", SqlDbType.Int); param.Value = InVisible.Checked ? 1 : 0; param.Direction = ParameterDirection.Input; param = cmd.Parameters.Add("@disabled", SqlDbType.Int); param.Value = Disabled.Checked ? 1 : 0; param.Direction = ParameterDirection.Input; param = cmd.Parameters.Add("@ContenedorPeqMineria", SqlDbType.Int); param.Value = checkBox1.Checked ? 1 : 0; param.Direction = ParameterDirection.Input; param = cmd.Parameters.Add("@ContenedorZandor", SqlDbType.Int); param.Value = checkBox2.Checked ? 1 : 0; param.Direction = ParameterDirection.Input; param = cmd.Parameters.Add("@ContenedorOtros", SqlDbType.Int); param.Value = checkBox4.Checked ? 1 : 0; param.Direction = ParameterDirection.Input; //} int rowsInserted = cmd.ExecuteNonQuery(); if (rowsInserted < 1 || rowsInserted > 2) { DisplayError(controlID, roleID, "Registros insertados= " + rowsInserted.ToString()); } if (string.IsNullOrEmpty(this.IpLocal)) { this.IpLocal = DireccionIP.Local(); } if (string.IsNullOrEmpty(this.IpPublica)) { this.IpPublica = DireccionIP.Publica(); } if (string.IsNullOrEmpty(this.SerialHDD)) { this.SerialHDD = DireccionIP.SerialNumberDisk(); } if (string.IsNullOrEmpty(this.Usuario)) { this.Usuario = DireccionIP.SerialNumberDisk(); } LlenarLog.Registro(DateTime.Now, this.Usuario, this.IpLocal, this.IpPublica, this.SerialHDD, Environment.MachineName, "Creación de permisos", "Asignación de permisos"); } catch (Exception ex) { DisplayError(controlID, roleID, ex.Message); } } } conn.Close(); PopulatePermissionTree(); }