Exemplo n.º 1
0
        }//fin LimpiarGrid

        private Boolean CrearDatos()
        {
            Boolean    _result;
            Int32      i;
            TFunctions Functions;

            try
            {
                _result = true;
                i       = 0;
                oDBDSHeader.Clear();
                Functions       = new TFunctions();
                Functions.SBO_f = FSBOf;
                if (GlobalSettings.RunningUnderSQLServer)
                {
                    s = "select Code, U_CodImpto, U_Desc, U_Porc from [@VID_FEIMPADIC]";
                }
                else
                {
                    s = @"select ""Code"", ""U_CodImpto"", ""U_Desc"", ""U_Porc"" from ""@VID_FEIMPADIC"" ";
                }
                oRecordSet.DoQuery(s);
                if (oRecordSet.RecordCount > 0)
                {
                    Functions.ImpAdicDel(ref oRecordSet);
                }

                while (i < oDataTable.Rows.Count)
                {
                    oDBDSHeader.InsertRecord(0);
                    oDBDSHeader.SetValue("Code", 0, (System.String)(oDataTable.GetValue("Code", i)).ToString().Trim());
                    oDBDSHeader.SetValue("U_CodImpto", 0, (System.String)(oDataTable.GetValue("U_CodImpto", i)).ToString().Trim());
                    oDBDSHeader.SetValue("U_Desc", 0, (System.String)(oDataTable.GetValue("U_Desc", i)).ToString().Trim());
                    oDBDSHeader.SetValue("U_Porc", 0, FSBOf.DoubleToStr(((System.Double)oDataTable.GetValue("U_Porc", i))).Trim());

                    _result = Functions.ImpAdicAdd(oDBDSHeader);

                    i++;
                }

                oDataTable.Rows.Add(1);
                oDataTable.SetValue("Code", oDataTable.Rows.Count - 1, "");
                oDataTable.SetValue("U_CodImpto", oDataTable.Rows.Count - 1, "");
                oDataTable.SetValue("U_Desc", oDataTable.Rows.Count - 1, "");
                oDataTable.SetValue("U_Porc", oDataTable.Rows.Count - 1, 0);

                return(_result);
            }
            catch (Exception e)
            {
                FSBOApp.StatusBar.SetText(e.Message, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                OutLog("CrearDatos " + e.Message + " ** Trace: " + e.StackTrace);
                return(false);
            }
        } //fin CrearDatos