Ejemplo n.º 1
0
        /// <summary>
        /// Metodo criado para Salvar os dados do cliente
        /// </summary>
        /// <param name="conex">ADODB.Connection</param>
        /// <returns>Boolean </returns>
        public Boolean salvar()
        {
            RSDados = new Recordset();

            if (this.cnpj != null && this.razao != null)
            {
                if (this.ID == 0)
                {
                    SQL = "SELECT loja_venda.* FROM loja_venda;";
                    RSDados.Open(SQL, new Conexao().getContas(), CursorTypeEnum.adOpenDynamic, LockTypeEnum.adLockOptimistic);
                    RSDados.AddNew();
                }
                else
                {
                    SQL = "SELECT loja_venda.* FROM loja_venda WHERE(((loja_venda.CNPJ)='" + cnpj + "'));";
                    RSDados.Open(SQL, new Conexao().getContas(), CursorTypeEnum.adOpenDynamic, LockTypeEnum.adLockOptimistic);
                }

                RSDados.Fields["CNPJ"].Value  = this.cnpj;
                RSDados.Fields["Razão"].Value = this.razao;
                RSDados.Update();
                this.ID = Convert.ToInt16(RSDados.Fields["ID"].Value);

                RSDados.Close();
                return(true);
            }
            return(false);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Clone Job Validation Error Recordset
        /// </summary>
        /// <param name="rs"></param>
        /// <returns></returns>
        private Recordset CloneValidationRS(Recordset rs)
        {
            int       cnt          = 1;
            Recordset rsValidation = new Recordset();

            rsValidation.CursorLocation = CursorLocationEnum.adUseClient;
            rs.MoveFirst();

            foreach (Field fld in rs.Fields)
            {
                rsValidation.Fields.Append(fld.Name, fld.Type, fld.DefinedSize, (FieldAttributeEnum)fld.Attributes, null);
            }
            // Add column ID to recordset to access each row in record set with  primary key
            rsValidation.Fields.Append("ID", DataTypeEnum.adInteger, 10, FieldAttributeEnum.adFldUpdatable);
            rsValidation.Fields.Append("OVERRIDE_COMMENTS", DataTypeEnum.adVarChar, 400, FieldAttributeEnum.adFldUpdatable);
            rsValidation.Open();
            while (!rs.EOF)
            {
                rsValidation.AddNew();
                foreach (Field fld in rs.Fields)
                {
                    rsValidation.Fields[fld.Name].Value = fld.Value;
                }

                rsValidation.Fields["ID"].Value = cnt;
                cnt += 1;
                rs.MoveNext();
            }

            return(rsValidation);
        }
Ejemplo n.º 3
0
 public void AddNew()
 {
     Update();
     Recordset.AddNew();
     _isEdit = true;
     _isMove = true;
 }
Ejemplo n.º 4
0
        //处理后的数据 存储在新建要素集
        private void CopyToNewDataset(List <Vehicle> vehicleList)
        {
            this.MyLog(vehicleList.Count.ToString());

            DatasetVector dataset = DatasetVectorInfoSample(this.currentDatasource, this.currentDataset.Name);

            if (!dataset.IsOpen)
            {
                dataset.Open();
                this.MyLog(dataset.FieldCount.ToString());
            }

            Recordset rd = dataset.GetRecordset(false, CursorType.Dynamic);

            foreach (Vehicle v in vehicleList)
            {
                Dictionary <string, object> dic = new Dictionary <string, object>();
                dic.Add("ID", v.Id);
                dic.Add("NAME", v.Name);
                dic.Add("XBH", v.Xbh);
                dic.Add("X", v.X);
                dic.Add("Y", v.Y);
                GeoPoint point = new GeoPoint(v.X, v.Y);

                rd.AddNew(point, dic);

                rd.Update();
            }


            rd.Close();
            rd.Dispose();
        }
Ejemplo n.º 5
0
        private void SaveToCacheRs(string Key, string FullPathToSave)
        {
            CreateCacheFolder();

            string FullPathCache = GetFullPathCacheRs(Key);

            if (!File.Exists(FullPathCache))
            {
                CreateRs(FullPathCache, false);
            }

            Recordset Rs = new Recordset();

            Rs.Open(FullPathCache, Missing.Value, CursorTypeEnum.adOpenStatic, LockTypeEnum.adLockPessimistic, -1);

            string Criteria = "Key = '" + Key.Replace("'", "''") + "'";

            Rs.Find(Criteria, 0, SearchDirectionEnum.adSearchForward, Missing.Value);

            if (!Rs.EOF)
            {
                Rs.Fields["Content"].AppendChunk(CFile.GetByteFromFile(FullPathToSave));
            }
            else
            {
                Rs.AddNew(Missing.Value, Missing.Value);
                Rs.Fields["Key"].Value = Key;
                Rs.Fields["Content"].AppendChunk(CFile.GetByteFromFile(FullPathToSave));
            }

            Rs.Save(FullPathCache, PersistFormatEnum.adPersistXML);
            Rs.Close();
            Rs = null;
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Show Dialog containing Job Validation Errors
        /// return recordset with user added justification comments for each error
        /// </summary>
        /// <param name="rsValidation"></param>
        /// <returns></returns>
        public Recordset ShowValidationComments(Recordset rsValidation)
        {
            List <WRValidationOverride> wrValidationUsrComments = null;

            Recordset rsJobValidation     = CopyStructure(rsValidation);
            Recordset rsJobValidationErrs = CloneValidationRS(rsValidation);

            wrValidationUsrComments = FormatValidationErrors(rsJobValidationErrs);

            validationRuleOvr = new ValidationRuleOverrides(wrValidationUsrComments);
            if (validationRuleOvr.ShowDialog(gtApp.ApplicationWindow) == DialogResult.Cancel)
            {
                rsJobValidation = null;
            }
            else
            {
                wrValidationUsrComments = validationRuleOvr.WRValidationComments;
                rsJobValidationErrs.MoveFirst();
                rsJobValidation.Open();
                //Update Job Validation Recordset with justification comments
                while (!rsJobValidationErrs.EOF)
                {
                    rsJobValidation.AddNew();
                    foreach (Field fld in rsJobValidation.Fields)
                    {
                        rsJobValidation.Fields[fld.Name].Value = rsJobValidationErrs.Fields[fld.Name].Value;
                    }
                    rsJobValidation.Fields["OVERRIDE_COMMENTS"].Value = wrValidationUsrComments.FirstOrDefault(a => a.ID == Convert.ToInt32(rsJobValidationErrs.Fields["ID"].Value)).Override_Comments;
                    rsJobValidationErrs.MoveNext();
                }
            }

            return(rsJobValidation);
        }
Ejemplo n.º 7
0
        public Recordset ToRecordSet()
        {
            var recordSet = new Recordset();

            foreach (var field in _metaData.Fields)
            {
                recordSet.Fields.Append(field.Name, field.AdodbDataType, field.DefinedSize, field.Attribute, null);
            }

            recordSet.Open(Missing.Value, Missing.Value, CursorTypeEnum.adOpenUnspecified, LockTypeEnum.adLockUnspecified, 0);

            for (var i = 0; i < _records.Count; i++)
            {
                recordSet.AddNew(Missing.Value, Missing.Value);

                for (var j = 0; j < _metaData.Fields.Length; j++)
                {
                    recordSet.Fields[j].Value = _records[i][j];
                }

                if (i == _records.Count - 1)
                    recordSet.MoveFirst();
                else
                    recordSet.MoveNext();
            }

            return recordSet;
        }
Ejemplo n.º 8
0
        private Recordset CreateADODBRecordSet(object[] objs, string[] schema)
        {
            Recordset oRS = new Recordset();

            try
            {
                //oDataTable = CreateDataTable();
                //Loop through each column in the Dataset
                foreach (string memberName in schema)
                {
                    MemberInfo[] infos = objs[0].GetType().GetMember(memberName);

                    if (infos == null)
                    {
                        continue;
                    }

                    Attribute attr = System.Attribute.GetCustomAttribute(infos[0], typeof(FieldMapAttribute));

                    oRS.Fields.Append(memberName
                                      , GetADOType(((FieldMapAttribute)attr).DataType.ToString())
                                      //,oColumn.MaxLength
                                      , ((FieldMapAttribute)attr).Size
//						,GetADOTypeSize(oColumn.DataType.ToString())
                                      , ((FieldMapAttribute)attr).AllowNull ? FieldAttributeEnum.adFldMayBeNull : FieldAttributeEnum.adFldIsNullable
                                      , System.Reflection.Missing.Value);
                }

                //Open the recordset
                oRS.Open(System.Reflection.Missing.Value,
                         System.Reflection.Missing.Value, CursorTypeEnum.adOpenKeyset,
                         LockTypeEnum.adLockOptimistic, 1);
                //Loop through the table and fill the ADO Recordset

                for (int i = 0; i < objs.Length; i++)
                {
                    oRS.AddNew(System.Reflection.Missing.Value,
                               System.Reflection.Missing.Value);
                    //Loop through each column
                    for (int j = 0; j < schema.Length; j++)
                    {
                        oRS.Fields[j].Value = DomainObjectUtility.GetValue(objs[i], schema[j], null);
                    }
                    oRS.Update(System.Reflection.Missing.Value,
                               System.Reflection.Missing.Value);
                }
                //Move to the first record
                oRS.MoveFirst();
            }
            catch
            {
                return(null);
            }
            finally
            {
            }

            return(oRS);
        }
Ejemplo n.º 9
0
        private string GetFullPathCacheRs(string Key)
        {
            string FullPathIndex = mCacheFolder + "\\CacheIndex.rs";

            if (!File.Exists(FullPathIndex))
            {
                CreateRs(FullPathIndex, true);
            }

            Recordset RsIndex = new Recordset();

            RsIndex.Open(FullPathIndex, Missing.Value, CursorTypeEnum.adOpenStatic, LockTypeEnum.adLockPessimistic, -1);

            string FileName = "";
            int    Seq      = 0;

            string Criteria = "Key = '" + Key.Replace("'", "''") + "'";

            RsIndex.Find(Criteria, 0, SearchDirectionEnum.adSearchForward, Missing.Value);
            if (!RsIndex.EOF)
            {
                FileName = (string)RsIndex.Fields["FileName"].Value;
            }
            else
            {
                if (RsIndex.RecordCount > 0)
                {
                    RsIndex.MoveLast();

                    Seq = ((int)RsIndex.Fields["Seq"].Value + 1);

                    FileName = (string)RsIndex.Fields["FileName"].Value;
                    if (((Seq - 1) % drUnitForFile100) == 0)
                    {
                        FileName = GetNextFileName(FileName);
                    }
                }
                else
                {
                    Seq      = 1;
                    FileName = "Cache.rs";
                }

                RsIndex.AddNew(Missing.Value, Missing.Value);
                RsIndex.Fields["Seq"].Value      = Seq;
                RsIndex.Fields["Key"].Value      = Key;
                RsIndex.Fields["FileName"].Value = FileName;

                RsIndex.Save(FullPathIndex, PersistFormatEnum.adPersistXML);
                RsIndex.Close();
                RsIndex = null;
            }

            return(mCacheFolder + "\\" + FileName);
        }
Ejemplo n.º 10
0
 public void AddNew()
 {
     if (_isEdit)
     {
         _isEdit = false;
         Recordset.Update();
     }
     Recordset.AddNew();
     _isEdit = true;
     _isMove = true;
 }
Ejemplo n.º 11
0
        /// <summary>
        /// Metodo para adição dos itens no orçamento do small
        /// </summary>
        /// <param name="ID_loja">ID da loja a ser vendida, paramentro 0 para todas as lojas</param>
        private void salvaSmall(Int32 ID_loja)
        {
            String pedidoZero = "0000000000";
            String lancamentoZero = "0000000000";
            bool   gravado = false;
            Int32  pedido, lancamento;

            ///Processo do banco de dados
            Recordset  rsdados = new Recordset();
            Connection conex   = new Conexao().getSmall();
            String     SQL     = "SELECT ORCAMENT.* FROM ORCAMENT ORDER BY ORCAMENT.REGISTRO;";

            rsdados.Open(SQL, conex, CursorTypeEnum.adOpenDynamic, LockTypeEnum.adLockOptimistic);
            rsdados.MoveLast();

            ///Processo de coleta de numeração de registro
            pedido = Convert.ToInt32(rsdados.Fields["PEDIDO"].Value.ToString());
            pedido++;
            lancamento = Convert.ToInt32(rsdados.Fields["REGISTRO"].Value.ToString());
            lancamento++;
            pedidoZero     += pedido.ToString();
            lancamentoZero += lancamento.ToString();
            pedidoZero      = new SIME.Class.Uteis().direita(pedidoZero, 9);
            lancamentoZero  = new SIME.Class.Uteis().direita(lancamentoZero, 9);

            ///Adição de registro
            foreach (var item in itens)
            {
                if (item.getID_loja() == ID_loja || item.getID_loja() == 0)
                {
                    rsdados.AddNew();
                    rsdados.Fields["CODIGO"].Value    = item.getID_produto().ToString();
                    rsdados.Fields["DESCRICAO"].Value = ((item.getDescricao().Length > 45) ?
                                                         new SIME.Class.Uteis().esquerda(item.getDescricao().ToString(), 44) : item.getDescricao());
                    rsdados.Fields["QUANTIDADE"].Value = item.getQuantidade().ToString();
                    rsdados.Fields["UNITARIO"].Value   = item.getUnitario().ToString("N");
                    rsdados.Fields["TOTAL"].Value      = (item.getQuantidade() * item.getUnitario()).ToString("N");
                    rsdados.Fields["DATA"].Value       = DateTime.Now.ToShortDateString();
                    rsdados.Fields["TIPO"].Value       = "ORCAME";
                    rsdados.Fields["PEDIDO"].Value     = pedidoZero;
                    rsdados.Fields["CLIFOR"].Value     = "MOVIMENTAÇÃO DIÁRIA";//Modificar futuramente para procurar o cliente em small
                    rsdados.Fields["REGISTRO"].Value   = lancamentoZero;
                    rsdados.Update();
                    if (gravado == false)
                    {
                        this.orcamentoSmall = pedidoZero;
                        this.Salvar();
                        gravado = true;
                    }
                }
                rsdados.Close();
                conex.Close();
            }
        }
Ejemplo n.º 12
0
        private DatasetVector DatasetConvertRegionToLine(DatasetVector dtVector2)
        {
            DatasetVector dtVector = null;

            if (dtVector2 != null)
            {
                DatasetVectorInfo dvi = new DatasetVectorInfo();
                dvi.Name = m_selLayer.Dataset.Datasource.Datasets.GetAvailableDatasetName("C_geoLine");
                dvi.Type = DatasetType.Line;

                //DatasetVector
                dtVector = m_selLayer.Dataset.Datasource.Datasets.Create(dvi);
                foreach (FieldInfo fi in dtVector2.FieldInfos)
                {
                    if (dtVector.FieldInfos.IndexOf(fi.Name) < 0 && !fi.IsSystemField)
                    {
                        dtVector.FieldInfos.Add(fi.Clone());
                    }
                }

                Recordset recdst = dtVector.GetRecordset(true, CursorType.Dynamic);

                recdst.Batch.Begin();
                try
                {
                    Recordset recdst2 = dtVector2.GetRecordset(false, CursorType.Static);
                    while (!recdst2.IsEOF)
                    {
                        GeoRegion geoR = recdst2.GetGeometry() as GeoRegion;

                        if (geoR != null)
                        {
                            GeoLine geoLine = geoR.ConvertToLine();
                            recdst.AddNew(geoLine);
                            foreach (FieldInfo fi in dtVector2.FieldInfos)
                            {
                                if (dtVector.FieldInfos.IndexOf(fi.Name) > -1 && !fi.IsSystemField)
                                {
                                    recdst.SetFieldValue(fi.Name, recdst2.GetFieldValue(fi.Name));
                                }
                            }
                            geoR.Dispose();
                        }
                        recdst2.MoveNext();
                    }
                    recdst2.Dispose();
                }
                catch { }
                recdst.Batch.Update();
                recdst.Dispose();
            }
            return(dtVector);
        }
Ejemplo n.º 13
0
        private void btn_Save_Click(object sender, EventArgs e)
        {
            Recordset objRt = null;

            try
            {
                btn_Draw.Enabled = true;
                objRt            = (m_Application.Workspace.Datasources["Resource"].Datasets["ArtCraftTable"] as DatasetVector).GetRecordset(false, CursorType.Dynamic);
                switch (m_Type)
                {
                case WorkflowEditType.New:
                    Dictionary <string, object> dic = new Dictionary <string, object>();
                    dic.Add("CraftName", txt_Name.Text.Trim());
                    dic.Add("Note", rtb_Description.Text.Equals(m_Tip) ? "" : rtb_Description.Text);
                    dic.Add("CraftID", (objRt.RecordCount + 1).ToString());
                    dic.Add("PlaySpeed", txt_PlaySpeed.Text);
                    dic.Add("Symbol", btn_SelectColor.Text + ',' + btn_SelectColor.Tag);
                    objRt.AddNew(null, dic);
                    objRt.Update();
                    break;

                case WorkflowEditType.Edit:
                    objRt.Edit();
                    objRt.SetFieldValue("CraftName", txt_Name.Text.Trim());
                    objRt.SetFieldValue("Note", rtb_Description.Text.Equals(m_Tip) ? "" : rtb_Description.Text);
                    objRt.SetFieldValue("CraftID", objRt.RecordCount + 1);
                    objRt.SetFieldValue("PlaySpeed", txt_PlaySpeed.Text);
                    objRt.SetFieldValue("Symbol", btn_SelectColor.Text + ',' + btn_SelectColor.Tag);
                    objRt.Update();
                    break;
                }

                Layer3DDataset layer = m_SceneControl.Scene.Layers[txt_Name.Text + "@SpaceData"] as Layer3DDataset;
                for (int i = 0; i < (layer.Theme as Theme3DUnique).Count; i++)
                {
                    Theme3DUniqueItem item = (layer.Theme as Theme3DUnique)[i];
                    item.IsVisible = false;
                }
                m_Application.MessageBox.Show("保存成功!");
            }
            catch (Exception ex)
            {
                Log.OutputBox(ex);
            }
            finally
            {
                if (objRt != null)
                {
                    objRt.Close();
                    objRt.Dispose();
                }
            }
        }
Ejemplo n.º 14
0
 //Add Data from the GridView to the recordset
 private void AddDataGridToRec(DataGridView db, Recordset myrec)
 {
     for (int i = 0; i < db.Rows.Count - 1; i++)
     {
         myrec.AddNew();
         for (int j = 0; j < db.Rows[i].Cells.Count; j++)
         {
             myrec.Fields[j].Value = db.Rows[i].Cells[j].Value.ToString();
         }
         myrec.Update();
     }
 }
Ejemplo n.º 15
0
        public void AddModel_Click(Point3D Point3D, int ModelIndex, string strID, string strNOID)
        {
            AddPointToDatasets(Point3D, ModelIndex, strID, strNOID);

            Datasource    datasource   = m_workspace.Datasources[0];
            DatasetVector pointDataset = datasource.Datasets["Point3D"] as DatasetVector;
            Recordset     recordset    = pointDataset.GetRecordset(false, CursorType.Dynamic);

            GeoPoint3D geopoint3D = new GeoPoint3D(Point3D);
            GeoStyle3D geoStyle   = new GeoStyle3D();

            geoStyle.MarkerSymbolID    = UserHelper.Marker3DSymbolID[ModelIndex];
            geoStyle.IsMarkerSizeFixed = false;
            geoStyle.MarkerSize        = 1;
            geoStyle.Marker3DScaleX    = 0.03;
            geoStyle.Marker3DScaleY    = 0.03;
            geoStyle.Marker3DScaleZ    = 0.08;
            geoStyle.IsMarker3D        = true;
            geoStyle.AltitudeMode      = AltitudeMode.RelativeToGround;
            geopoint3D.Style3D         = geoStyle;

            recordset.MoveLast();
            recordset.AddNew(geopoint3D);
            recordset.SetFieldValue(m_filedName, strID);
            recordset.Update();
            recordset.Dispose();

            m_layer3DPoint.IsSelectable = false;
            m_layer3DPoint.UpdateData();
            m_SceneControl.Scene.Refresh();

            //AddKmlLayer();

            //GeoPlacemark geoPlacemark = new GeoPlacemark();
            //m_geoModel = new GeoModel();
            //m_geoModel.FromFile(UserHelper.sModelName[ModelIndex]);
            ////人物模型朝向前进方向,如果原始方向一致则不需要旋转。
            //m_geoModel.Style3D = m_style3D;
            //m_geoModel.RotationZ = 180;
            //m_geoModel.ScaleX = 0.3;
            //m_geoModel.ScaleY = 0.3;
            //m_geoModel.ScaleZ = 0.3;
            //m_geoModel.Position = new Point3D(Point3D.X, Point3D.Y, Point3D.Z);
            //geoPlacemark.Geometry = m_geoModel;
            //Feature3Ds feture3Ds = m_LayerKML.Features;
            //Feature3D feature = new Feature3D();
            //feature.Geometry = geoPlacemark;
            //feature.Description = strID;
            //feature.Name = feature.Description;
            //feture3Ds.Add(feature);
            //feture3Ds.ToKMLFile(m_LayerKML.DataName);
            //m_LayerKML.UpdateData();
        }
Ejemplo n.º 16
0
        public static void InsertAccount(string username, string password)
        {
            _dbRs.Open("select * from players where login = '******'", _dbConn, CursorTypeEnum.adOpenStatic, LockTypeEnum.adLockOptimistic);

            _dbRs.AddNew();
            _dbRs.Fields[1].Value = username;
            _dbRs.Fields[2].Value = password;
            _dbRs.Fields[3].Value = 0;
            _dbRs.Fields[4].Value = 0;
            _dbRs.Update();

            _dbRs.Close();
        }
Ejemplo n.º 17
0
        /// <summary>
        /// Method to Export the given plot window to PDF
        /// </summary>
        /// <param name="pw"></param>
        private void ExportToPDF(IGTPlotWindow pw)
        {
            IGTExportService        svcExport  = null;
            IGTPDFPrinterProperties printProps = null;

            try
            {
                // Construct printer properties
                PageOrientationType orientation =
                    (pw.NamedPlot.PaperWidth > pw.NamedPlot.PaperHeight)
                    ? PageOrientationType.Portrait : PageOrientationType.Landscape;

                printProps             = GTClassFactory.Create <IGTPDFPrinterProperties>();
                printProps.PageWidth   = pw.NamedPlot.PaperWidth;
                printProps.PageHeight  = pw.NamedPlot.PaperHeight;
                printProps.Orientation = orientation;
                printProps.PageSize    = PageSizeValue.Auto;
                printProps.Resolution  = ResolutionValue.DPI600;

                // Perform export
                svcExport = GTClassFactory.Create <IGTExportService>();
                svcExport.PDFLayersEnabled = false;
                svcExport.SaveAsPDF(m_strDoumentsPath, printProps, pw, true);

                m_oGTTransactionManager.Begin("Attach Street Light Supplemental Agreement Plot");

                IGTKeyObject gTTempKeyObject = m_gTDataContext.OpenFeature(m_gTDesignAreaKeyObject.FNO, m_gTDesignAreaKeyObject.FID);
                Recordset    rs = gTTempKeyObject.Components.GetComponent(8130).Recordset;

                rs.AddNew("G3E_FID", gTTempKeyObject.FID);
                rs.Fields["HYPERLINK_T"].Value   = m_strDoumentsPath;
                rs.Fields["DESCRIPTION_T"].Value = "Street Supplemental Plot";
                rs.Fields["TYPE_C"].Value        = "SUPPLEPLOT";
                rs.Fields["G3E_FNO"].Value       = 8100;
                rs.Update();
                if (m_oGTTransactionManager.TransactionInProgress)
                {
                    m_oGTTransactionManager.Commit();
                }
            }
            catch
            {
                throw;
            }
            finally
            {
                svcExport  = null;
                printProps = null;
                pw         = null;
            }
        }
Ejemplo n.º 18
0
        /// <summary>
        /// 批量执行
        /// </summary>
        /// <param name="batchSize"></param>
        /// <param name="timeout"></param>
        public override void Execute(int batchSize = 10000, int timeout = 10 * 1000)
        {
            DBEngine dbEngine = new DBEngine();

            Database db = null;

            try
            {
                db = dbEngine.OpenDatabase(_database.DbProvider.ConnectionString);

                _dataTable = ToDataTable(_list);

                if (_dataTable == null || _dataTable.Rows.Count == 0)
                {
                    return;
                }

                Recordset rs = db.OpenRecordset(_dataTable.TableName);

                var columns = _dataTable.Columns;

                Field[] myFields = new Field[columns.Count];

                for (int i = 0; i < columns.Count; i++)
                {
                    myFields[i] = rs.Fields[columns[i].ColumnName];
                }

                for (int i = 0; i < _dataTable.Rows.Count; i++)
                {
                    rs.AddNew();

                    for (int j = 0; j < columns.Count; j++)
                    {
                        myFields[0].Value = _dataTable.Rows[i][j];
                    }
                    rs.Update();
                }
                rs.Close();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                db?.Close();
                _list.Clear();
            }
        }
Ejemplo n.º 19
0
        /// <summary>
        /// Method to build the Work Point features Account Recordset.
        /// </summary>
        /// <param name="p_workPointRS">Workpoint Recordsets Contained by placed TreeTrimming feature</param>
        /// <returns></returns>
        public Recordset GetWorkPtAccountRecordset(Recordset p_workPointRS)
        {
            Recordset accountsRS = null;
            int wpFid = 0;
            try
            {
                p_workPointRS.MoveFirst();

                accountsRS = new Recordset();
                accountsRS.Fields.Append("Prime Account", DataTypeEnum.adInteger, 4, FieldAttributeEnum.adFldIsNullable);
                accountsRS.Fields.Append("Sub Account", DataTypeEnum.adInteger, 4, FieldAttributeEnum.adFldIsNullable);
                accountsRS.Open(System.Reflection.Missing.Value, System.Reflection.Missing.Value, CursorTypeEnum.adOpenDynamic, LockTypeEnum.adLockOptimistic, -1);

                while (!p_workPointRS.EOF)
                {
                    wpFid = Convert.ToInt32(p_workPointRS.Fields["G3E_FID"].Value.ToString());

                    Recordset workpointAttributeRS = m_oGTApp.DataContext.OpenRecordset(String.Format("SELECT DISTINCT PRIME_ACCT_ID,SUB_ACCT FROM WORKPOINT_CU_N CU,WORKPOINT_N WP,REFWMIS_FERC_ACCOUNT REF WHERE CU.G3E_FID=WP.G3E_FID AND WP.WR_NBR='{0}' AND REF.PRIME_ACCT=CU.PRIME_ACCT_ID AND REF.ACTIVITY_C=CU.ACTIVITY_C AND WP.G3E_FID={1}", m_oGTApp.DataContext.ActiveJob, wpFid), CursorTypeEnum.adOpenStatic,
                               LockTypeEnum.adLockReadOnly, (int)CommandTypeEnum.adCmdText);

                    if (workpointAttributeRS != null && workpointAttributeRS.RecordCount > 0)
                    {
                        workpointAttributeRS.MoveFirst();

                        while (!workpointAttributeRS.EOF)
                        {

                            if (workpointAttributeRS.Fields["PRIME_ACCT_ID"].Value != DBNull.Value || workpointAttributeRS.Fields["SUB_ACCT"].Value != DBNull.Value)
                            {
                                accountsRS.AddNew();

                                accountsRS.Fields["Prime Account"].Value = workpointAttributeRS.Fields["PRIME_ACCT_ID"].Value;
                                accountsRS.Fields["Sub Account"].Value = workpointAttributeRS.Fields["SUB_ACCT"].Value;

                                accountsRS.Update(System.Reflection.Missing.Value, System.Reflection.Missing.Value);

                            }

                            workpointAttributeRS.MoveNext();
                        }
                    }
                    p_workPointRS.MoveNext();
                }          
            }
            catch
            {
                throw;
            }
            return accountsRS;
        }
Ejemplo n.º 20
0
        private Recordset CreateADODBRecordSet(DataSet ds)
        {
            Recordset oRS = new Recordset();

            try
            {
                //oDataTable = CreateDataTable();
                //Loop through each column in the Dataset
                foreach (DataColumn oColumn in ds.Tables[0].Columns)
                {
                    //Create the Field Types for the recordset

                    oRS.Fields.Append(oColumn.ColumnName
                                      , GetADOType(oColumn.DataType.ToString())
                                      //,oColumn.MaxLength
                                      , GetADOTypeSize(oColumn.DataType.ToString())
                                      , FieldAttributeEnum.adFldIsNullable
                                      , System.Reflection.Missing.Value);
                }

                //Open the recordset
                oRS.Open(System.Reflection.Missing.Value,
                         System.Reflection.Missing.Value, CursorTypeEnum.adOpenKeyset,
                         LockTypeEnum.adLockOptimistic, 1);
                //Loop through the table and fill the ADO Recordset
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    oRS.AddNew(System.Reflection.Missing.Value,
                               System.Reflection.Missing.Value);
                    //Loop through each column
                    for (int j = 0; j < ds.Tables[0].Columns.Count; j++)
                    {
                        oRS.Fields[j].Value = ds.Tables[0].Rows[i][j];
                    }
                    oRS.Update(System.Reflection.Missing.Value,
                               System.Reflection.Missing.Value);
                }
                //Move to the first record
                oRS.MoveFirst();
            }
            catch
            {
                oRS.MoveFirst();
            }
            finally
            {
            }

            return(oRS);
        }
Ejemplo n.º 21
0
        private void AddPointToDatasets(Point3D Point3D, int ModelIndex, string strID, string strNOID)
        {
            CreateDatasets();
            try
            {
                Datasource    datasource   = m_workspace.Datasources[0];
                DatasetVector pointDataset = datasource.Datasets[UserHelper.sDeviceName[ModelIndex]] as DatasetVector;

                if (pointDataset != null)
                {
                    GeoPoint  geoPoint  = new GeoPoint(Point3D.X, Point3D.Y);
                    Recordset recordset = pointDataset.GetRecordset(false, CursorType.Dynamic);
                    recordset.MoveLast();
                    recordset.AddNew(geoPoint);
                    recordset.SetFieldValue(m_filedName, strID);
                    recordset.Update();
                    recordset.Close();
                    recordset.Dispose();
                }

                m_MapControl.Map.Refresh();

                DatasetVector textDataset = datasource.Datasets[UserHelper.sTextName] as DatasetVector;
                if (textDataset != null)
                {
                    Recordset textRecordset = textDataset.GetRecordset(false, CursorType.Dynamic);

                    TextPart part = new TextPart();
                    part.Text = strNOID;
                    Point2D point2D = new Point2D(Point3D.X, Point3D.Y);
                    part.AnchorPoint = point2D;
                    GeoText geoText = new GeoText(part);
                    geoText.TextStyle.ForeColor  = Color.Green;
                    geoText.TextStyle.FontHeight = 8;

                    textRecordset.MoveLast();
                    textRecordset.AddNew(geoText);
                    textRecordset.Update();
                    textRecordset.Close();
                    textRecordset.Dispose();
                }

                m_MapControl.Map.Refresh();
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
            }
        }
Ejemplo n.º 22
0
        public bool AddInvoice(Invoice invoice)
        {
            try
            {
                Recordset rs = DB.OpenTable("Invoices");
                rs.AddNew();
                rs.Fields["Name"].Value          = invoice.Name;
                rs.Fields["Date"].Value          = invoice.Date;
                rs.Fields["Address"].Value       = invoice.Address;
                rs.Fields["OurReference"].Value  = invoice.OurReference;
                rs.Fields["YourReference"].Value = invoice.YourReference;
                rs.Update();

                foreach (InvoiceLine line in invoice.Lines)
                {
                    rs = DB.OpenTable("Lines");
                    rs.AddNew();
                    int lineID = rs.Fields["ID"].Value;
                    rs.Fields["Description"].Value = line.Description;
                    rs.Fields["Date"].Value        = line.Date;
                    rs.Fields["Amount"].Value      = line.Amount;
                    rs.Update();
                    rs = DB.OpenTable("InvoiceLines");
                    rs.AddNew();
                    rs.Fields["InvoiceID"].Value = invoice.Number;
                    rs.Fields["LineID"].Value    = lineID;
                    rs.Update();
                }
                return(true);
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
                return(false);
            }
        }
Ejemplo n.º 23
0
        /// <summary>
        /// Adds a Hyperlink component to each of the selected fids
        /// </summary>
        /// <param name="filePath">The absolute path to the file</param>
        /// <returns>Boolean indicating status</returns>
        public bool AddHyperlinkComponent(string filePath)
        {
            bool returnValue = false;

            try
            {
                IGTKeyObject tmpKeyObj = GTClassFactory.Create <IGTKeyObject>();

                for (int i = 0; i < m_SelectedFIDs.Count; i++)
                {
                    tmpKeyObj = m_Application.DataContext.OpenFeature(m_SelectedFNO, m_SelectedFIDs[i]);
                    Recordset tmpHypLnk = tmpKeyObj.Components["HYPERLINK_N"].Recordset;
                    tmpHypLnk.AddNew(Type.Missing, Type.Missing);
                    tmpHypLnk.Fields["G3E_FNO"].Value = m_SelectedFNO;
                    tmpHypLnk.Fields["G3E_FID"].Value = m_SelectedFIDs[i];
                    switch (m_CommandName)
                    {
                    case ConstantsDT.COMMAND_NAME_GUYING:
                        tmpHypLnk.Fields["TYPE_C"].Value        = "Guying Scenario";
                        tmpHypLnk.Fields["DESCRIPTION_T"].Value = m_WrNumber + "-" + m_GuyScenarioCount.ToString().PadLeft(2, '0');
                        break;

                    case ConstantsDT.COMMAND_NAME_SAG_CLEARANCE:
                        tmpHypLnk.Fields["TYPE_C"].Value = "Sag Clearance";
                        break;

                    default:
                        tmpHypLnk.Fields["TYPE_C"].Value = "";
                        break;
                    }
                    tmpHypLnk.Fields["HYPERLINK_T"].Value = filePath;
                    tmpHypLnk.Fields["FILENAME_T"].Value  = filePath.Substring(filePath.LastIndexOf("/") + 1);
                    m_Application.DataContext.UpdateBatch(tmpHypLnk);
                    tmpHypLnk.Update();
                    tmpKeyObj = null;
                }

                returnValue = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(m_Application.ApplicationWindow, ConstantsDT.ERROR_ADDING_HYPERLINK + ": " + ex.Message, ConstantsDT.APPLICATION_NAME, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                returnValue = false;
            }

            return(returnValue);
        }
Ejemplo n.º 24
0
        /// <summary>
        /// Método salva o item da venda.
        /// </summary>
        /// <returns></returns>
        public Boolean Salvar()
        {
            String     SQL;
            Recordset  rs_dados = new Recordset();
            Connection conex    = new SIME.Conexao().getDb4();

            try
            {
                //Processo de dedução do estoque
                SQL = "SELECT PRODUTOS.* FROM PRODUTOS WHERE (((PRODUTOS.Cod)=" + this.ID_produto + "));";
                rs_dados.Open(SQL, conex, CursorTypeEnum.adOpenDynamic, LockTypeEnum.adLockOptimistic);
                if (Convert.ToInt32(rs_dados.Fields["Estoque"].Value) < this.Quantidade)
                {
                    throw new ArgumentException("Quantidade maior que a disponível em estoque.");
                }
                rs_dados.Fields["Estoque"].Value = Convert.ToInt32(rs_dados.Fields["Estoque"].Value) - this.Quantidade;
                rs_dados.Update();
                rs_dados.Close();

                SQL = (this.ID == 0) ? "SELECT Saída.* FROM Saída;" : "SELECT Saída.* FROM Saída WHERE (((Saída.cod_sai)=" + this.ID + "));";
                rs_dados.Open(SQL, conex, CursorTypeEnum.adOpenDynamic, LockTypeEnum.adLockOptimistic);
                if (this.ID == 0)
                {
                    rs_dados.AddNew();
                }
                rs_dados.Fields["Fornecedor"].Value = this.ID_fornecedor;
                rs_dados.Fields["Loja"].Value       = this.ID_loja;
                rs_dados.Fields["cod do cd"].Value  = this.ID_produto;
                rs_dados.Fields["NF"].Value         = this.NF;
                rs_dados.Fields["Quantidade"].Value = this.Quantidade;
                rs_dados.Fields["Desconto"].Value   = this.Unitario.ToString();
                rs_dados.Fields["Custo"].Value      = this.Custo.ToString();
                rs_dados.Update();
                Thread.Sleep(500);
                this.ID = Convert.ToInt32(rs_dados.Fields["cont"].Value);
                rs_dados.Close();
                conex.Close();
            }
            catch (Exception e)
            {
                throw new ArgumentException(e.Message);
            }


            return(true);
        }
Ejemplo n.º 25
0
        //获取天际线
        private void btn_GetSkyline_Click(object sender, EventArgs e)
        {
            try
            {
                if (m_skyline != null)
                {
                    GeoLine3D line3D = m_skyline.GetSkyline();

                    if (m_workspace.Datasources.Count == 0)
                    {
                        MessageBox.Show("请先打开一个数据源");
                        return;
                    }
                    Datasource datasource = m_workspace.Datasources[0];
                    Datasets   datasets   = datasource.Datasets;

                    String datasetName = "NewLine3D";
                    if (datasource.Datasets.Contains(datasetName))
                    {
                        datasource.Datasets.Delete(datasetName);
                    }
                    DatasetVectorInfo datasetInfo = new DatasetVectorInfo();
                    datasetInfo.Type       = DatasetType.Line3D;
                    datasetInfo.Name       = datasetName;
                    datasetInfo.EncodeType = EncodeType.None;

                    DatasetVector newDataset = datasource.Datasets.Create(datasetInfo);
                    if (newDataset == null)
                    {
                        MessageBox.Show("创建三维面数据集失败!");
                    }
                    if (m_sceneControl.Scene.Type == SceneType.Globe)
                    {
                        newDataset.PrjCoordSys = new PrjCoordSys(PrjCoordSysType.EarthLongitudeLatitude);
                    }
                    Recordset recordset = newDataset.GetRecordset(false, CursorType.Dynamic);
                    recordset.AddNew(line3D);
                    recordset.Update();
                    recordset.Dispose();
                }
            }
            catch (System.Exception ex)
            {
                Console.Write(ex.Message);
            }
        }
Ejemplo n.º 26
0
        /// <summary>
        /// Adds a Hyperlink component to each of the selected fids
        /// </summary>
        /// <param name="fid">The G3E_FID to add a hyperlink component</param>
        /// <param name="fno">The G3E_FNO of the feature to add a hyperlink component</param>
        /// <param name="url">The url to the file</param>
        /// <param name="fileType">The file type</param>
        /// <param name="fileDescription">The file description</param>
        /// <returns>Boolean indicating status</returns>
        public bool AddHyperlinkComponent(int fid, short fno, string url, string fileType, string fileDescription)
        {
            bool returnValue = false;

            try
            {
                m_Application.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, ConstantsDT.MESSAGE_CREATING_HYPERLINK);
                m_Application.BeginWaitCursor();

                IGTKeyObject tmpKeyObj = GTClassFactory.Create <IGTKeyObject>();
                tmpKeyObj = m_Application.DataContext.OpenFeature(fno, fid);
                Recordset tmpHypLnk = null;
                if (fno == ConstantsDT.FNO_DESIGN_AREA)
                {
                    tmpHypLnk = tmpKeyObj.Components["JOB_HYPERLINK_N"].Recordset;
                }
                else
                {
                    tmpHypLnk = tmpKeyObj.Components["HYPERLINK_N"].Recordset;
                }

                tmpHypLnk.AddNew(Type.Missing, Type.Missing);
                tmpHypLnk.Fields["G3E_FNO"].Value       = fno;
                tmpHypLnk.Fields["G3E_FID"].Value       = fid;
                tmpHypLnk.Fields["TYPE_C"].Value        = fileType;
                tmpHypLnk.Fields["DESCRIPTION_T"].Value = fileDescription;
                tmpHypLnk.Fields["HYPERLINK_T"].Value   = url;
                tmpHypLnk.Fields["FILENAME_T"].Value    = url.Substring(url.LastIndexOf("/") + 1);
                m_Application.DataContext.UpdateBatch(tmpHypLnk);
                tmpHypLnk.Update();
                tmpKeyObj = null;

                returnValue = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(m_Application.ApplicationWindow, ConstantsDT.ERROR_ADDING_HYPERLINK + ": " + ex.Message, ConstantsDT.APPLICATION_NAME, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                returnValue = false;
            }

            m_Application.EndWaitCursor();
            m_Application.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "");

            return(returnValue);
        }
Ejemplo n.º 27
0
        /// <summary>
        /// 鼠标单击事件来实现画点的功能
        /// </summary>
        /// <param routestopName="sender"></param>
        /// <param routestopName="e"></param>
        private void m_sceneControl_MouseClick(object sender, MouseEventArgs e)
        {
            try
            {
                if (e.Button == MouseButtons.Left && isDraw)
                {
                    //画点
                    if (!flag)
                    {
                        Datasource    datasource   = m_workspace.Datasources[0];
                        DatasetVector pointDataset = datasource.Datasets["Point3D"] as DatasetVector;
                        Recordset     recordset    = pointDataset.GetRecordset(false, CursorType.Dynamic);

                        Point3D pt3d = new Point3D();
                        pt3d = m_sceneControl.Scene.PixelToGlobe(e.Location, PixelToGlobeMode.TerrainAndModel);
                        GeoPoint3D geopoint3D = new GeoPoint3D(pt3d);

                        GeoStyle3D geoStyle = new GeoStyle3D();
                        geoStyle.MarkerSymbolID    = m_marker3DIndex;
                        geoStyle.IsMarkerSizeFixed = false;
                        geoStyle.MarkerSize        = 1;
                        geoStyle.Marker3DScaleX    = 1;
                        geoStyle.Marker3DScaleY    = 1;
                        geoStyle.Marker3DScaleZ    = 1;
                        geoStyle.IsMarker3D        = true;
                        geoStyle.AltitudeMode      = AltitudeMode.RelativeToGround;
                        geopoint3D.Style3D         = geoStyle;

                        recordset.MoveLast();
                        recordset.AddNew(geopoint3D);
                        recordset.Update();
                        recordset.Dispose();

                        m_layer3DPoint.IsSelectable = false;
                        m_layer3DPoint.UpdateData();
                        m_sceneControl.Scene.Refresh();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Ejemplo n.º 28
0
        /// <summary>
        /// Attach html file to the active job.
        /// </summary>
        /// <param name="strJobDoumentsPath">Document Path</param>
        /// <param name="gTDesignAreaKeyObject">Document Path</param>
        /// <param name="strContent">Content of the html document</param>
        /// <param name="strFileName">File name of the html document</param>
        private void AttachFile(string strJobDoumentsPath, IGTKeyObject gTDesignAreaKeyObject, string strContent, string strFileName, bool overRide)
        {
            try
            {
                if (!Directory.Exists(strJobDoumentsPath))
                {
                    Directory.CreateDirectory(strJobDoumentsPath);
                }
                File.WriteAllText(strJobDoumentsPath + "\\" + strFileName, strContent);
            }
            catch
            {
            }

            string strDescription = ActiveWR + "-" + Customer + "-" + "HTML DOCUMENT";

            if (overRide)
            {
                m_oGTTransactionManager.Begin("Supplemental Agreement Forms");
                m_model.DeleteExistingAttachment(strJobDoumentsPath + "\\" + strFileName);
                if (m_oGTTransactionManager.TransactionInProgress)
                {
                    m_oGTTransactionManager.Commit();
                }
            }

            m_oGTTransactionManager.Begin("Supplemental Agreement Forms");
            IGTKeyObject gTTempKeyObject = m_view.GTDataContext.OpenFeature(gTDesignAreaKeyObject.FNO, gTDesignAreaKeyObject.FID);
            Recordset    rs = gTTempKeyObject.Components.GetComponent(8130).Recordset;

            rs.AddNew("G3E_FID", gTTempKeyObject.FID);
            rs.Fields["HYPERLINK_T"].Value   = strJobDoumentsPath + "\\" + strFileName;
            rs.Fields["DESCRIPTION_T"].Value = strDescription;
            rs.Fields["TYPE_C"].Value        = "SUPPLEMENT";
            rs.Fields["G3E_FNO"].Value       = 8100;
            rs.Update();
            if (m_oGTTransactionManager.TransactionInProgress)
            {
                m_oGTTransactionManager.Commit();
            }

            MessageBox.Show("The Street Light Supplemental Agreement Form was generated and attached to the WR.", "G/Technology",
                            MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
Ejemplo n.º 29
0
        private void btnCommit_Click(object sender, EventArgs e)
        {
            Recordset objRt = null;

            try
            {
                if (chkFlyRoute.CheckedItems.Count == 0)
                {
                    m_Application.MessageBox.Show("请选择要提交的路线!");
                    return;
                }
                objRt = (m_Application.Workspace.Datasources["CommonData"].Datasets["FlyRouteTable"] as DatasetVector).GetRecordset(false, CursorType.Dynamic);
                Recordset.BatchEditor editor = objRt.Batch;
                editor.MaxRecordCount = 10;
                editor.Begin();
                int index = 1;
                foreach (object obj in chkFlyRoute.CheckedItems)
                {
                    Label label = obj as Label;
                    Route route = label.Tag as Route;
                    Dictionary <string, object> dic = new Dictionary <string, object>();
                    dic.Add("RouteID", index++.ToString());
                    dic.Add("RouteName", route.Name);
                    dic.Add("Content", Encoding.Default.GetBytes(route.ToXML()));
                    objRt.AddNew(null, dic);
                }
                editor.Update();
                m_Application.MessageBox.Show("路线入库成功!");
            }
            catch (Exception ex)
            {
                Log.OutputBox(ex);
                m_Application.MessageBox.Show("路线入库失败!");
            }
            finally
            {
                if (objRt != null)
                {
                    objRt.Close();
                    objRt.Dispose();
                }
            }
        }
Ejemplo n.º 30
0
        //Registers a new character into the database under a username
        public void RegisterNewCharacter(string AccountName, string CharacterName, bool IsMale)
        {
            //Register this character into the database
            string Query = "SELECT * FROM characters WHERE 0=1";

            recorder.Open(Query, connection, cursorType, lockType);
            recorder.AddNew();
            recorder.Fields["OwnerAccountName"].Value  = AccountName;
            recorder.Fields["XPosition"].Value         = 0f;
            recorder.Fields["YPosition"].Value         = 0f;
            recorder.Fields["ZPosition"].Value         = 0f;
            recorder.Fields["CharacterName"].Value     = CharacterName;
            recorder.Fields["ExperiencePoints"].Value  = 0;
            recorder.Fields["ExperienceToLevel"].Value = 100;
            recorder.Fields["Level"].Value             = 1;
            recorder.Fields["IsMale"].Value            = (IsMale ? 1 : 0);
            recorder.Update();
            recorder.Close();

            //Update the users account to note that this character belongs to them, and they have used up on of their character slots
            Query = "SELECT * FROM accounts WHERE Username='******'";
            recorder.Open(Query, connection, cursorType, lockType);
            int CharacterCount = recorder.Fields["CharactersCreated"].Value;

            switch (CharacterCount)
            {
            case (0):
                recorder.Fields["FirstCharacterName"].Value = CharacterName;
                break;

            case (1):
                recorder.Fields["SecondCharacterName"].Value = CharacterName;
                break;

            case (2):
                recorder.Fields["ThirdCharacterName"].Value = CharacterName;
                break;
            }
            CharacterCount++;
            recorder.Fields["CharactersCreated"].Value = CharacterCount;
            recorder.Update();
            recorder.Close();
        }
Ejemplo n.º 31
0
 /// <summary>
 /// Metódo que eferua a entrega do aparelho
 /// </summary>
 public void entregar(Int32 ID_op)
 {
     this.dataEntrega   = DateTime.Now;
     this.id_OpEntregue = ID_op;
     if (RSdados.State != 0)
     {
         RSdados.Close();
     }
     SQL = "SELECT OS_Entregas.* FROM OS_Entregas WHERE (((Entredas.OS) = " + ID + "));";
     RSdados.Open(SQL, new Conexao().getContas(), CursorTypeEnum.adOpenDynamic, LockTypeEnum.adLockOptimistic);
     if (RSdados.RecordCount == 1)
     {
         RSdados.AddNew();
         RSdados.Fields["OS"].Value   = this.ID;
         RSdados.Fields["DATA"].Value = this.DataEntrega;
         RSdados.Fields["OP"].Value   = this.Id_OpEntregue;
         RSdados.Update();
         RSdados.Close();
     }
 }
		virtual public ADODB.Recordset ExecuteSql(string sql)
		{
			Recordset oRS = new Recordset();
			OleDbConnection cn = null;
			OleDbDataReader reader = null;

			try 
			{
				cn = new OleDbConnection(dbRoot.ConnectionString);
				cn.Open();
                try
                {
                    cn.ChangeDatabase(this.Name);
                }
                catch { } // some databases don't have the concept of catalogs. Catch this and throw it out
                
				OleDbCommand command = new OleDbCommand(sql, cn);
				command.CommandType = CommandType.Text;

				reader = command.ExecuteReader();

				DataTable schema;
				string dataType, fieldname;
				int length;
				bool firstTime = true;

				while (reader.Read()) 
				{
					if (firstTime) 
					{
						schema = reader.GetSchemaTable();

						foreach (DataRow row in schema.Rows) 
						{
							fieldname = row["ColumnName"].ToString();
							dataType = row["DataType"].ToString();
							length = Convert.ToInt32(row["ColumnSize"]);

							oRS.Fields.Append(fieldname, GetADOType(dataType), length, 
								FieldAttributeEnum.adFldIsNullable, System.Reflection.Missing.Value);
						}

						oRS.Open(System.Reflection.Missing.Value, System.Reflection.Missing.Value, 
							CursorTypeEnum.adOpenStatic, LockTypeEnum.adLockOptimistic, 1);

						firstTime = false;
					}
					oRS.AddNew(System.Reflection.Missing.Value,	System.Reflection.Missing.Value);

					for(int i = 0; i < reader.FieldCount; i++)
					{

						if (reader[i] is System.Guid)
						{
							oRS.Fields[i].Value = "{" + reader[i].ToString() + "}";
						}
						else
						{
							oRS.Fields[i].Value = reader[i];
						}
					}
				}

				cn.Close();
				//Move to the first record
				if (!firstTime) 
				{
					oRS.MoveFirst();
				}
				else 
				{
					oRS = null;
				}
			}
			catch (Exception ex) 
			{
				if ((reader != null) && (!reader.IsClosed)) 
				{
					reader.Close();
					reader = null;
				}
				if ((cn != null) && (cn.State == ConnectionState.Open)) 
				{
					cn.Close();
					cn = null;
				}
				throw ex;
			}

			return oRS;
		}
		protected ADODB.Recordset ExecuteIntoRecordset(string sql, IDbConnection cn)
		{
			Recordset oRS = new Recordset();
			IDataReader reader = null;

			try 
			{
				IDbCommand command = cn.CreateCommand();
				command.CommandText = sql;
				command.CommandType = CommandType.Text;

				reader = command.ExecuteReader();

				DataTable schema;
				string dataType, fieldname;
				int length;
				bool firstTime = true;

				// Skip columns contains the index of any columns that we cannot handle, array types and such ...
				Hashtable skipColumns = null;

				while (reader.Read()) 
				{
					if (firstTime) 
					{
						skipColumns = new Hashtable();
						schema = reader.GetSchemaTable();

						int colID = 0;
						foreach (DataRow row in schema.Rows) 
						{
							fieldname = row["ColumnName"].ToString();
							dataType  = row["DataType"].ToString();
							length = Convert.ToInt32(row["ColumnSize"]);

							try
							{
								oRS.Fields.Append(fieldname, GetADOType(dataType), length, 
									FieldAttributeEnum.adFldIsNullable, System.Reflection.Missing.Value);
							} 
							catch
							{
								// We can't handle this column type, ie, Firebird array types
								skipColumns[colID] = colID;
							}

							colID++;
						}

						oRS.Open(System.Reflection.Missing.Value, System.Reflection.Missing.Value, 
							CursorTypeEnum.adOpenStatic, LockTypeEnum.adLockOptimistic, 1);

						firstTime = false;
					}

					oRS.AddNew(System.Reflection.Missing.Value,	System.Reflection.Missing.Value);

					for(int i = 0, j = 0; i < reader.FieldCount; i++)
					{
						// Skip columns that we cannot handle
						if(!skipColumns.ContainsKey(i))
						{
							if (reader[j] is System.Guid)
							{
								oRS.Fields[j].Value = "{" + reader[j].ToString() + "}";
							}
							else
							{
								try
								{
									oRS.Fields[j].Value = reader[j];
								}
								catch
								{ 
									// For some reason it wouldn't accept this value?
									oRS.Fields[j].Value = DBNull.Value;
								}
							}

							j++;
						}
					}
				}

				cn.Close();

				//Move to the first record
				if (!firstTime) 
				{
					oRS.MoveFirst();
				}
				else 
				{
					oRS = null;
				}
				
			}
			catch (Exception ex) 
			{
				if ((reader != null) && (!reader.IsClosed)) 
				{
					reader.Close();
					reader = null;
				}
				if ((cn != null) && (cn.State == ConnectionState.Open)) 
				{
					cn.Close();
					cn = null;
				}
				throw ex;
			}

			return oRS;
		}