Exemplo n.º 1
0
        void BtnImportar_Click(object sender, EventArgs e)
        {
            String    Mensaje = String.Empty;
            var       excel   = new ImportarExcel();
            DataTable dt      = excel.Excel();

            if (dt != null)
            {
Found:
                foreach (DataRow dr in dt.Rows)
                {
                    if (String.IsNullOrEmpty(dr["DNI/RUC CLIENTE"].ToString()) && String.IsNullOrEmpty(dr["RUC DEP TEMP"].ToString()) && String.IsNullOrEmpty(dr["MONEDA"].ToString()) &&
                        String.IsNullOrEmpty(dr["CONTENEDOR"].ToString()) && String.IsNullOrEmpty(dr["NRO CONTENEDOR"].ToString()) && String.IsNullOrEmpty(dr["ESTADO"].ToString()))
                    {
                        dt.Rows.Remove(dr);
                        goto Found;
                    }
                }
                Presenter.ValidarExcel(ref Mensaje, dt);
                if (!String.IsNullOrEmpty(Mensaje))
                {
                    Dialogos.MostrarMensajeInformacion(Presenter.Title, "Faltan ingresar datos obligatorios: ", Mensaje, Dialogos.Boton.Detalles);
                    DialogResult dr2 = MessageBox.Show(@"Deseas corregir el archivo excel?", @"Importación", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (dr2 == DialogResult.Yes)
                    {
                        try
                        {
                            Process.Start(excel.RutaExcel);
                        }
                        catch (Exception ex)
                        {
                            string message = String.Format("El archivo no puede ser abierto.\n Error : {0}", ex.Message);
                            MessageBox.Show(message, @"Abrir Archivo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                    Presenter.ItemsDet_Tarjas = new ObservableCollection <Det_Tarjas>();
                }
                else
                {
                    if (Presenter.ItemCab_Tarjas.ENTC_Cliente != null)
                    {
                        AyudaEntidadCliente.SetValue(Presenter.ItemCab_Tarjas.ENTC_Cliente.Value);
                    }

                    if (Presenter.ItemCab_Tarjas.ENTC_DepTemporal != null)
                    {
                        AyudaEntidadDepTemporal.SetValue(Presenter.ItemCab_Tarjas.ENTC_DepTemporal.Value);
                    }

                    if (Presenter.ItemCab_Tarjas.TIPO_CodMND != null)
                    {
                        CbTIPO_CodMND.SelectedValue = Presenter.ItemCab_Tarjas.TIPO_CodMND;
                    }
                    txtTARJ_Valor.Value = Presenter.ItemCab_Tarjas.TARJ_Valor;
                    txtTARJ_Valor.Text  = Presenter.ItemCab_Tarjas.TARJ_Valor.ToString(CultureInfo.InvariantCulture);
                    ShowItemsDetalleTarjas();
                }
            }
        }
Exemplo n.º 2
0
 public void ClearItem()
 {
     try
     {
         AyudaEntidadCliente.ClearValue();
         AyudaEntidadDepTemporal.ClearValue();
         txtTARJ_Valor.Value         = 0;
         txtTARJ_Valor.Text          = @"0";
         CbTIPO_CodMND.SelectedIndex = 0;
     }
     catch (Exception ex)
     { Dialogos.MostrarMensajeError(Presenter.Title, Mensajes.ClearItem, ex); }
 }
Exemplo n.º 3
0
 public void SetItem()
 {
     try
     {
         if (Presenter.ItemCab_Tarjas.ENTC_Cliente != null)
         {
             AyudaEntidadCliente.SetValue(Presenter.ItemCab_Tarjas.ENTC_Cliente.Value);
         }
         if (Presenter.ItemCab_Tarjas.ENTC_DepTemporal != null)
         {
             AyudaEntidadDepTemporal.SetValue(Presenter.ItemCab_Tarjas.ENTC_DepTemporal.Value);
         }
         CbTIPO_CodMND.SelectedValue = Presenter.ItemCab_Tarjas.TIPO_CodMND;
         txtTARJ_Valor.Value         = Presenter.ItemCab_Tarjas.TARJ_Valor;
         txtTARJ_Valor.Text          = Presenter.ItemCab_Tarjas.TARJ_Valor.ToString(CultureInfo.InvariantCulture);
     }
     catch (Exception ex)
     { Dialogos.MostrarMensajeError(Presenter.Title, Mensajes.SetItem, ex); }
 }