コード例 #1
0
        private void ProgressbBarEventos()
        {
            oProgBar = oApplication.StatusBar.CreateProgressBar("Minha primeira barra de progresso", 50, true);

            oApplication.SetStatusBarMessage("Barra de Progresso Criada!!!",
                                             BoMessageTime.bmt_Short
                                             , false);
            oApplication.SetStatusBarMessage("Barra de progresso em frente...",
                                             BoMessageTime.bmt_Short
                                             , false);



            for (int i = 0; i < 49; i++)
            {
                oProgBar.Value += 1;
                Thread.Sleep(500);
            }
            oApplication.SetStatusBarMessage("Barra de progresso para tras...",
                                             BoMessageTime.bmt_Short
                                             , false);

            for (int i = 49; 1 > 0; i--)
            {
                oProgBar.Value -= 1;
                Thread.Sleep(500);
            }
            oProgBar.Stop();
            oApplication.SetStatusBarMessage("Barra de progresso Parada!!!",
                                             BoMessageTime.bmt_Short
                                             , false);
        }
コード例 #2
0
 private void btnStart_Click(object sender, EventArgs e)
 {
     oProgressBar      = oApplication.StatusBar.CreateProgressBar("Exemplode ProgressBar", 27, true);
     btnFrente.Enabled = true;
     btnTras.Enabled   = true;
     btnStop.Enabled   = true;
     btnStart.Enabled  = false;
 }
コード例 #3
0
        private void Guardar_Registros()
        {
            String CardCode;
            String CardName;
            String Activado;
            Int32  DocEntry;
            Int32  lRetCode;

            SAPbouiCOM.ProgressBar oProgressBar = null;

            oForm.Freeze(true);
            try
            {
                FSBOApp.StatusBar.SetText("Inicio de actualización lista negra", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Success);
                oProgressBar = FSBOApp.StatusBar.CreateProgressBar("Actualizando lista negra...", odt.Rows.Count, false);

                for (Int32 iCont_1 = 0; iCont_1 < odt.Rows.Count; iCont_1++)
                {
                    if (((System.String)odt.GetValue("U_CardCode", iCont_1)).Trim().Length > 0)
                    {
                        oDBDSHeader.Clear();
                        oDBDSHeader.InsertRecord(0);

                        DocEntry = ((System.Int32)odt.GetValue("DocEntry", iCont_1));
                        CardCode = ((System.String)odt.GetValue("U_CardCode", iCont_1)).Trim();
                        CardName = ((System.String)odt.GetValue("U_CardName", iCont_1)).Trim();
                        s        = ((System.String)odt.GetValue("U_Activado", iCont_1)).Trim();
                        if (s == "")
                        {
                            Activado = "N";
                        }
                        else
                        {
                            Activado = s;
                        }
                        oDBDSHeader.SetValue("U_CardCode", 0, CardCode);
                        oDBDSHeader.SetValue("U_CardName", 0, CardName);
                        oDBDSHeader.SetValue("U_Activado", 0, Activado);

                        if (DocEntry != 0)
                        {
                            oDBDSHeader.SetValue("DocEntry", 0, DocEntry.ToString());
                            lRetCode = Funciones.UpdDataSourceInt1("VID_FELISTANE", oDBDSHeader, "", null, "", null, "", null);
                        }
                        else
                        {
                            lRetCode = Funciones.AddDataSourceInt1("VID_FELISTANE", oDBDSHeader, "", null, "", null, "", null);
                        }

                        if (lRetCode == 0)
                        {
                            FSBOApp.StatusBar.SetText("No se ha actualizado proveedor " + CardCode, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                        }
                        else
                        {
                            FSBOApp.StatusBar.SetText("Se ha actualizado proveedor " + CardCode, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Success);
                        }
                    }
                    oProgressBar.Value = iCont_1 + 1;
                }
                oProgressBar.Value = oProgressBar.Maximum;

                oForm.Mode = SAPbouiCOM.BoFormMode.fm_OK_MODE;
                CargarGrid();
            }
            catch (Exception e)
            {
                FSBOApp.StatusBar.SetText(e.Message, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                OutLog("Guardar_Registros: " + e.Message + " ** Trace: " + e.StackTrace);
            }
            finally
            {
                oForm.Freeze(false);
                oProgressBar.Stop();
                FSBOf._ReleaseCOMObject(oProgressBar);
            }
        }
コード例 #4
0
        private void CargarCtaSII()
        {
            SAPbouiCOM.ProgressBar oProgressBar = null;
            Int32 NroLineas;

            System.Data.DataTable dtConceptos;
            Boolean bRegistroOk;
            String  sHojaExcel;
            String  sCuenta;
            String  sRegistro;
            String  Padre;
            //String Hijo;
            String           sPeriodoActual;
            String           strConn;
            Boolean          bIngresaConceptos = false;
            DataSet          ADOQueryExcel;
            Int32            Entry;
            OleDbDataAdapter adapter;
            String           sPathArchivo = "";

            try
            {
                sPathArchivo = Directory.GetCurrentDirectory() + "\\SQLs\\CL\\Carga\\DiccionarioSII.xls";
                sHojaExcel   = "[CTASII$]";
                strConn      = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Extended Properties=Excel 8.0;Mode=ReadWrite";
                strConn      = String.Format(strConn, sPathArchivo);

                adapter       = new OleDbDataAdapter("Select * from [CTASII$]", strConn);
                ADOQueryExcel = new DataSet();
                try
                {
                    adapter.Fill(ADOQueryExcel, "CTASII");
                    dtConceptos = new System.Data.DataTable();
                    dtConceptos = ADOQueryExcel.Tables["CTASII"];
                }
                catch //(Exception y)
                {
                    FSBOApp.StatusBar.SetText("Error leyendo archivo excel...", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                    return;
                }

                if (dtConceptos.Rows.Count == 0)
                {
                    FSBOApp.StatusBar.SetText("No existen Cuentas SII para importar...", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                    return;
                }

                oProgressBar = FSBOApp.StatusBar.CreateProgressBar("Importando Cuentas SII...", dtConceptos.Rows.Count + 2, false);
                NroLineas    = 1;
                foreach (DataRow oRow in dtConceptos.Rows)
                {
                    bIngresaConceptos = false;
                    sCuenta           = oRow.Field <String>("Cuenta");
                    if (sCuenta != null)
                    {
                        sRegistro = Convert.ToString(oRow.Field <Double>("Registro"));

                        if (Convert.ToString(oRow.Field <String>("Glosa")).Trim() == "")
                        {
                            s = @"UPDATE {0} SET validacion = 'Debe ingresar Glosa' where [Registro] = {1}";
                            s = String.Format(s, sHojaExcel, sRegistro);
                            Funciones.EjecutarSQLOleDb(s, strConn);
                        }
                        else
                        {
                            bIngresaConceptos = true;
                        }


                        if (bIngresaConceptos)
                        {
                            oDBDSHeader.Clear();

                            oDBDSHeader.InsertRecord(0);
                            oDBDSHeader.SetValue("U_Cuenta", 0, Convert.ToString(oRow.Field <String>("Cuenta")).Trim());
                            oDBDSHeader.SetValue("U_Desc", 0, Convert.ToString(oRow.Field <String>("Glosa")).Trim());
                            oDBDSHeader.SetValue("U_Clasif", 0, Convert.ToString(oRow.Field <String>("Clasificacion")).Trim());

                            Entry = Funciones.AddDataSourceInt1("VID_FEPLANCTA", oDBDSHeader, "", null, "", null, "", null);


                            if (Entry > 0)
                            {
                                var ss = FCmpny.GetNewObjectKey();
                                s = @"UPDATE {0} SET validacion = 'OK' WHERE [Registro] = {1}";
                                s = String.Format(s, sHojaExcel, sRegistro);
                            }
                            else
                            {
                                var err = FCmpny.GetLastErrorDescription();
                                s = @"UPDATE {0} SET validacion = 'Error al crear {1}' WHERE [Registro] = {2}";
                                s = String.Format(s, sHojaExcel, err, sRegistro);
                            }
                            Funciones.EjecutarSQLOleDb(s, strConn);
                        }
                    }
                    else
                    {
                        oProgressBar.Value = oProgressBar.Maximum;
                        break;
                    }

                    oProgressBar.Value = NroLineas;
                    NroLineas          = NroLineas + 1;
                }

                FSBOApp.StatusBar.SetText("Fin de la importación", BoMessageTime.bmt_Long, BoStatusBarMessageType.smt_Success);
                FSBOApp.MessageBox("Fin de la importación", 1, "Ok", "", "");
            }
            catch (Exception e)
            {
                FSBOApp.MessageBox(e.Message + " ** Trace: " + e.StackTrace, 1, "Ok", "", "");
                OutLog("Error importando Conceptos desde: " + sPathArchivo + ". Error: " + e.Message + " ** Trace: " + e.StackTrace);
            }
            finally
            {
                if (oProgressBar != null)
                {
                    oProgressBar.Stop();
                }
                FSBOf._ReleaseCOMObject(oProgressBar);
            }
        }