/// <summary>
        /// Locates a feature based on the structure ID in the record.
        /// </summary>
        /// <param name="structID"></param>
        public static void LocateByStructID(string structID)
        {
            string    selectStatement = "SELECT G3E_FID, G3E_FNO FROM COMMON_N WHERE STRUCTURE_ID = ?";
            Recordset featureID       = gtDataContext.OpenRecordset(selectStatement, CursorTypeEnum.adOpenDynamic, LockTypeEnum.adLockOptimistic, -1, structID);

            locateFeatures = null;
            if (featureID.EOF && featureID.BOF)
            {
                MessageBox.Show("No features found with a matching Structure ID.", "G/Technology");
            }
            else
            {
                featureID.MoveFirst();
                featureID.MoveLast();
                odaListMaker   = new OleDbDataAdapter();
                locateFeatures = new DataTable();
                odaListMaker.Fill(locateFeatures, featureID);
                if (!featureID.EOF && featureID.RecordCount > 0)
                {
                    short FNO = Int16.Parse(featureID.Fields["G3E_FNO"].Value.ToString());
                    int   FID = Int32.Parse(featureID.Fields["G3E_FID"].Value.ToString());
                    locate(FID, FNO);
                }
            }
        }
 /// <summary>
 /// Goes to the location of the error based on the Premise Number, not super testable atm.
 /// </summary>
 /// <param name="premiseNumber"></param>
 public static void LocateByPremiseNumber(string premiseNumber)
 {
     if (premiseNumber.Length > 0)
     {
         string    selectStatement = "SELECT G3E_FID, G3E_FNO FROM PREMISE_N WHERE PREMISE_NBR = ?";
         int       nullCheck       = selectStatement.Count();
         Recordset featureID       = gtDataContext.OpenRecordset(selectStatement, CursorTypeEnum.adOpenDynamic, LockTypeEnum.adLockOptimistic, -1, premiseNumber);
         locateFeatures = null;
         if (featureID.EOF && featureID.BOF)
         {
             MessageBox.Show("No features found with a matching Premise Number.", "G/Technology");
         }
         else
         {
             featureID.MoveFirst();
             featureID.MoveLast();
             odaListMaker   = new OleDbDataAdapter();
             locateFeatures = new DataTable();
             odaListMaker.Fill(locateFeatures, featureID);
             if (!featureID.EOF && featureID.RecordCount > 0)
             {
                 short FNO = Int16.Parse(featureID.Fields["G3E_FNO"].Value.ToString());
                 int   FID = Int32.Parse(featureID.Fields["G3E_FID"].Value.ToString());
                 locate(FID, FNO);
             }
         }
     }
     else
     {
         MessageBox.Show("Record has no Premise Number", "G/Technology");
     }
 }
        /// <summary>
        /// Locates feaures based on the Transformer Company Number value of the record.
        /// </summary>
        /// <param name="transID"></param>
        public static void LocateByTransformerID(string transID)
        {
            string selectStatement = "SELECT DISTINCT G3E_FID, G3E_FNO FROM XFMR_UG_UNIT_N WHERE COMPANY_ID = ? " +
                                     "union " +
                                     "SELECT DISTINCT G3E_FID, G3E_FNO FROM XFMR_OH_UNIT_N WHERE COMPANY_ID = ?";
            Recordset featureID = gtDataContext.OpenRecordset(selectStatement, CursorTypeEnum.adOpenDynamic, LockTypeEnum.adLockOptimistic, -1, transID, transID);

            locateFeatures = null;
            if (featureID.EOF && featureID.BOF)
            {
                MessageBox.Show("No Transformer found for Transformer Company ID", "G/Technology");
            }
            else
            {
                featureID.MoveFirst();
                featureID.MoveLast();
                odaListMaker   = new OleDbDataAdapter();
                locateFeatures = new DataTable();
                odaListMaker.Fill(locateFeatures, featureID);
                if (!featureID.EOF && featureID.RecordCount > 0)
                {
                    short FNO = Int16.Parse(featureID.Fields["G3E_FNO"].Value.ToString());
                    int   FID = Int32.Parse(featureID.Fields["G3E_FID"].Value.ToString());
                    locate(FID, FNO);
                }
            }
        }
示例#4
0
 internal void b_last_Click(Object eventSender, EventArgs eventArgs)
 {
     if (Recordset.RecordCount > 0)
     {
         Recordset.MoveComplete += Recordset_MoveComplete;
         Recordset.MoveLast();
     }
 }
示例#5
0
 public bool MoveLast()
 {
     if (HasRows)
     {
         Update();
         Recordset.MoveLast();
         _isMove = true;
     }
     return(HasRows);
 }
示例#6
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);
        }
示例#7
0
文件: Venda.cs 项目: Laerton2016/SIME
        /// <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();
            }
        }
示例#8
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();
        }
示例#9
0
 public bool MoveLast()
 {
     if (HasRows())
     {
         if (_isEdit)
         {
             _isEdit = false;
             Recordset.Update();
         }
         Recordset.MoveLast();
         _isMove = true;
     }
     return(HasRows());
 }
示例#10
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);
            }
        }
示例#11
0
        private void frmShowTable_Load(object sender, EventArgs e)
        {
            string tblName = Variables.ShowTableName;

            txtTableName.Text = tblName;
            this.Text         = "Database: " + dbPath;
            dbe = new DBEngine();
            try
            {
                myDB = dbe.OpenDatabase(dbPath);
                txtTableName.Enabled    = false;
                txtRecordsCount.Enabled = false;
                gridTable.Rows.Clear();
                int numFld = 0;
                //show table info
                TableDef myTable = myDB.TableDefs[tblName];
                foreach (Field fldExtItem in ((Fields)myTable.Fields))
                {
                    gridTable.Columns.Add(fldExtItem.Name.ToString(), fldExtItem.Name.ToString());
                    numFld++;
                }
                //recTblData = myDB.OpenRecordset("SELECT * FROM " + myTable.Name, DAO.RecordsetTypeEnum.dbOpenForwardOnly);
                recTblData = myDB.OpenRecordset("SELECT * FROM " + myTable.Name, DAO.RecordsetTypeEnum.dbOpenDynaset);
                recTblData.MoveLast();
                recTblData.MoveFirst();
                txtRecordsCount.Text = recTblData.RecordCount.ToString();
                for (int i = 0; i < recTblData.RecordCount; i++)
                {
                    gridTable.Rows.Add(1);
                    for (int j = 0; j < numFld; j++)
                    {
                        gridTable.Rows[i].Cells[j].Value = (recTblData.Fields[j].Value.ToString());
                    }
                    recTblData.MoveNext();
                }
                myDB.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error openning database! \n" + ex.Message
                                + "\n" + ex.HResult.ToString(),
                                "Failed to open data", MessageBoxButtons.OK, MessageBoxIcon.Error);

                this.Close();
                return;
            }
        }
示例#12
0
        /// <summary>
        /// Consulta los datos de la firma digital configurados para un usuario determinado.
        /// </summary>
        /// <param name="comp"></param>
        /// <param name="usuario"></param>
        /// <returns></returns>
        public Certificado Consultar()
        {
            Certificado certificado = null;
            Recordset   recSet      = null;
            string      consulta;

            try
            {
                //Obtener objeto estandar de record set
                recSet = ProcConexion.Comp.GetBusinessObject(BoObjectTypes.BoRecordset);

                //Establecer consulta
                consulta = "SELECT U_RutaCer, U_ClaveCer FROM [@TFECERT]";//  WHERE U_UsuarioCer = '" + comp.UserName + "'";

                //Ejecutar consulta
                recSet.DoQuery(consulta);

                //Ubicar el record set en la ultima posicion
                recSet.MoveLast();

                //Validar que se hayan obtenido registros
                if (recSet.RecordCount > 0)
                {
                    //Crea una instancia del objeto configuracion ftp
                    certificado = new Certificado();

                    //Establece las propiedaes al objeto configuracion ftp
                    certificado.RutaCertificado = recSet.Fields.Item("U_RutaCer").Value + "";
                    certificado.Clave           = recSet.Fields.Item("U_ClaveCer").Value + "";
                }
            }
            catch (Exception)
            {
                certificado = null;
            }
            finally
            {
                if (recSet != null)
                {
                    //Liberar memoria
                    System.Runtime.InteropServices.Marshal.ReleaseComObject(recSet);
                    System.GC.Collect();
                }
            }
            return(certificado);
        }
示例#13
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);
            }
        }
示例#14
0
        static void Main(string[] args)
        {
            var sw = new System.Diagnostics.Stopwatch();

            sw.Start();
            // This code requires the following COM reference in your project:
            //     Microsoft DAO 3.6 Object Library
            //
            var       dbe = new DBEngine();
            Database  db  = dbe.OpenDatabase(@"C:\Users\Gord\Desktop\speed.mdb");
            Recordset rst = db.OpenRecordset(
                "SELECT TOP 4001 ID FROM tblBooks ORDER BY ID",
                RecordsetTypeEnum.dbOpenSnapshot);

            rst.MoveLast();
            int startID = rst.Fields["ID"].Value;

            rst.Close();
            rst = db.OpenRecordset(
                String.Format(
                    "SELECT TOP 10000 Title FROM tblBooks WHERE ID >= {0} ORDER BY ID",
                    startID),
                RecordsetTypeEnum.dbOpenDynaset);
            int i = 1;

            while (!rst.EOF)
            {
                rst.Edit();
                rst.Fields["Title"].Value = String.Format("Book {0}", i++);
                rst.Update();
                rst.MoveNext();
            }
            rst.Close();
            sw.Stop();
            Console.WriteLine(String.Format("{0:0.0} seconds", sw.ElapsedMilliseconds / 1000.0));
        }
 /// <summary>
 /// Loads the data from the db.
 /// </summary>
 public static void LoadData()
 {
     try
     {
         string metaDataQuery = "SELECT COLUMN_NAME, DATA_TYPE, DATA_LENGTH, DATA_PRECISION, DATA_SCALE FROM ALL_TAB_COLUMNS  WHERE TABLE_NAME = 'SERVICE_ACTIVITY'";
         metaDataRecords = gtDataContext.OpenRecordset(metaDataQuery, CursorTypeEnum.adOpenDynamic, LockTypeEnum.adLockOptimistic, -1);
         metaDataRecords.MoveFirst();
         //set up dictionary to programatically restrict how our columns are allowed to handle data. Not as important with so few editables, but i may make a library of some
         //sort with this set up style. its useful for editable grids.
         while (!metaDataRecords.EOF && metaDataRecords.RecordCount > 0)
         {
             string[] values = { metaDataRecords.Fields["DATA_TYPE"].Value.ToString(),
                                 metaDataRecords.Fields["DATA_LENGTH"].Value.ToString(),
                                 metaDataRecords.Fields["DATA_PRECISION"].Value.ToString(),
                                 metaDataRecords.Fields["DATA_SCALE"].Value.ToString() };
             if (!ColumnRules.ContainsKey(metaDataRecords.Fields["COLUMN_NAME"].Value.ToString()))
             {
                 ColumnRules.Add(metaDataRecords.Fields["COLUMN_NAME"].Value.ToString(), new List <string>(values));
             }
             metaDataRecords.MoveNext();
         }
         string fieldActivityErrorQuery = @"SELECT ADDRESS,
                                                   ADDR_LEAD_DIR_IND,
                                                   ADDR_TRAIL_DIR_IND,
                                                   CORRECTION_COMMENTS,
                                                   CU_ID,
                                                   DELETED_BY_ID,
                                                   DELETED_DATE,
                                                   DWELL_TYPE_C,
                                                   EDIT_DATE,
                                                   ESI_LOCATION,
                                                   EXIST_PREM_GANGBASE,
                                                   FEATURE_TYPE_CODE,
                                                   GIS_LOCATE_METHOD,
                                                   HOUSE_NO,
                                                   HOUSE_NO_FRACTION,
                                                   INSTL_VINT_YEAR,
                                                   INVALID_METER_GEOCODE,
                                                   METER_LATITUDE,
                                                   METER_LONGITUDE,
                                                   MGMT_ACTIVITY_CODE,
                                                   MSG_T,
                                                   OVERRIDE_TOLERANCE,
                                                   NVL(O_OR_U_CODE, '*') O_OR_U_CODE,
                                                   REMARKS_MOBILE,
                                                   RMV_VINT_YEAR,
                                                   SERVICE_ACTIVITY_ID,
                                                   SERVICE_CENTER_CODE,
                                                   NVL(SERVICE_INFO_CODE, '*') SERVICE_INFO_CODE,
                                                   SERVICE_ORDER_NO,
                                                   STATUS_C,
                                                   STREET_NAME,
                                                   STREET_TYPE,
                                                   SVC_STRUCTURE_ID,
                                                   TOWN_NM,
                                                   TRANS_DATE,
                                                   TRF_CO_H,
                                                   TRF_STRUCTURE_ID,
                                                   UNIT_H,
                                                   USER_ID,
                                                   WMIS_POSTED_DATE FROM SERVICE_ACTIVITY WHERE STATUS_C IN ('FAILED', 'QUEUED', 'DELETED')";
         fieldActivityErrorRecords = gtDataContext.OpenRecordset(fieldActivityErrorQuery, CursorTypeEnum.adOpenDynamic, LockTypeEnum.adLockOptimistic, -1);
         if (fieldActivityErrorRecords.EOF && fieldActivityErrorRecords.BOF)
         {
             ErrorMessage = "No Errors found.";
         }
         else
         {
             //trying to deal with the datamanagement that is "outside" the dialog here for consistancy, if it doesnt work move it to the _load function in the dialog cs
             fieldActivityErrorRecords.MoveFirst();
             fieldActivityErrorRecords.MoveLast();
             odaListMaker = new OleDbDataAdapter();
             dtList       = new DataTable();
             odaListMaker.Fill(dtList, fieldActivityErrorRecords);
             DataColumn[] PrimaryKeyColumns = new DataColumn[1];
             PrimaryKeyColumns[0] = dtList.Columns["SERVICE_ACTIVITY_ID"];
             dtList.PrimaryKey    = PrimaryKeyColumns;
             dtList.Columns.Add("EDITED_CELLS", typeof(string));
             dtList.Columns.Add("STRUCT_ID", typeof(string));
             foreach (DataRow row in dtList.Rows)
             {
                 //row.SetField<string>("STRUCT_ID", row.Field<string>("FLNX_H") + "-" + row.Field<string>("FLNY_H"));
                 row.SetField <string>("STRUCT_ID", row.Field <string>("SVC_STRUCTURE_ID"));
                 row["TRANS_DATE"] = DateTime.Parse((row["TRANS_DATE"].ToString())).ToString("MM/dd/yyyy");
             }
         }
     }
     catch (Exception error)
     {
         MessageBox.Show("Error in LoadData (" + error.Message + ")", "G/Technology");
     }
 }
示例#16
0
        //private void CreatePointDataset(string tableName)
        //{
        //    Workspace workspace = new Workspace();
        //    DatasourceConnectionInfo info = new DatasourceConnectionInfo();
        //    Datasource datasource = GetDbDatasource(workspace, info);
        //    var datasetVector = (DatasetVector)datasource.Datasets[tableName];
        //    if (datasetVector == null)
        //    {
        //        CreateDataset(datasource, DatasetType.Point, tableName);
        //    }
        //    //只取了数据结构,没有取数据
        //    var recordset = datasetVector.GetRecordset(true, SuperMap.Data.CursorType.Dynamic);
        //    recordset.Edit();
        //    recordset.fi
        //}

        private void InsertRecordSetToDb(string shapeFieldName, string tableName)
        {
            Workspace workspace           = new Workspace();
            DatasourceConnectionInfo info = new DatasourceConnectionInfo();
            var filePath = $"{Directory.GetCurrentDirectory()}\\{Guid.NewGuid().ToString()}";
            var files    = new List <string> {
                $"{filePath}.udb", $"{filePath}.udd"
            };

            Datasource datasource = GetDbDatasource(workspace, info);

            if (datasource != null)
            {
                //临时数据源
                DatasourceConnectionInfo tempInfo = new DatasourceConnectionInfo();
                //设置数据源连接的引擎类型
                tempInfo.EngineType = EngineType.UDB;
                tempInfo.Alias      = tableName;

                tempInfo.Server = filePath;
                // 创建/打开数据库数据源
                Datasource tempDatasource = workspace.Datasources.Create(tempInfo);
                Recordset  recordset = null, tempRecordset = null;
                if (tempDatasource != null)
                {
                    ImportResult result = ImportShpToTemp(shapeFieldName, tempDatasource, tableName);
                    if (result.FailedSettings.Length == 0)
                    {
                        Console.WriteLine($"导入{shapeFieldName}成功!");
                        try
                        {
                            for (int index = 0; index < tempDatasource.Datasets.Count; index++)
                            {
                                DatasetVector tempDatasetVector = (DatasetVector)tempDatasource.Datasets[index];
                                tempRecordset = tempDatasetVector.GetRecordset(false, SuperMap.Data.CursorType.Dynamic);
                                //没有数据
                                if (tempRecordset.RecordCount == 0)
                                {
                                    continue;
                                }
                                var tempFieldInfos = tempDatasetVector.FieldInfos;
                                //注意:数据集是手工录入的,不是超图sdk生成的,所以不能删除数据集
                                //如果更新数据集中的记录,则应该操纵记录集(删除、修改、新增)
                                var datasetVector = (DatasetVector)datasource.Datasets[tableName];
                                if (datasetVector == null)
                                {
                                    CreateDataset(datasource, DatasetType.Point, tableName);
                                    //throw new Exception($"不存在数据集名称为{tableName}的数据集!");
                                }
                                //删去之前的所有记录
                                //datasetVector.GetRecordset(false, SuperMap.Data.CursorType.Dynamic).DeleteAll();
                                //只取了数据结构,没有取数据
                                recordset = datasetVector.GetRecordset(true, SuperMap.Data.CursorType.Dynamic);
                                //设置批量提交
                                // 设置批量更新的限度为5000,注意一定要在开始批量更新前设置MaxRecordCount!
                                recordset.Batch.MaxRecordCount = 500;
                                // 开始批量更新,当添加到设置的MaxRecordCount的下一条记录时,将会将MaxRecordCount条记录自动提交到数据库中。
                                recordset.Batch.Begin();

                                tempRecordset.MoveFirst();
                                //遍历临时记录集
                                for (Int32 i = 0; i < tempRecordset.RecordCount; i++)
                                {
                                    //往mysql新增记录
                                    SuperMap.Data.Geometry geoPoint = tempRecordset.GetGeometry();
                                    recordset.AddNew(geoPoint);
                                    //SeekID:在记录中搜索指定 ID 号的记录,并定位该记录为当前记录。
                                    recordset.MoveLast();
                                    foreach (SuperMap.Data.FieldInfo fileInfo in tempFieldInfos)
                                    {
                                        if (!fileInfo.IsSystemField && IsHaveField(datasetVector.FieldInfos, fileInfo.Name))
                                        {
                                            recordset.Edit();
                                            recordset.SetFieldValue(fileInfo.Name, tempRecordset.GetFieldValue(fileInfo.Name));
                                            Object valueID = recordset.GetFieldValue(fileInfo.Name);
                                        }
                                    }

                                    //处理业务数据

                                    tempRecordset.MoveNext();

                                    //recordset.Update();
                                }

                                // 使用批量更新的Update,提交没有自动提交的记录
                                recordset.Batch.Update();
                            }
                        }
                        catch (Exception ex)
                        {
                            throw ex;
                        }
                        finally
                        {
                            //示例程序BatchAdd说明要释放记录集
                            if (recordset != null)
                            {
                                recordset.Dispose();
                            }
                            if (tempRecordset != null)
                            {
                                tempRecordset.Dispose();
                            }
                        }
                    }
                    else
                    {
                        throw new Exception($"导入{shapeFieldName}失败!");
                    }
                }
                else
                {
                    throw new Exception($"创建临时数据源{filePath}失败!");
                }
            }

            // 释放工作空间资源
            info.Dispose();
            workspace.Dispose();


            foreach (var file in files)
            {
                if (File.Exists(file))
                {
                    File.Delete(file);
                }
            }

            MessageBox.Show("成功!");
        }
示例#17
0
        // Save the report to a shared location and hyperlink the report to the selected FID
        // Run validation for Guying
        private void cmdSaveReport_Click(object sender, EventArgs e)
        {
            // Perform validation for Guying
            if (m_CommandName == ConstantsDT.COMMAND_NAME_GUYING)
            {
                if (!ValidateGuyingResults())
                {
                    return;
                }
                else
                {
                    foreach (int fid in m_SelectedFIDs)
                    {
                        WriteGuyingResults(fid);
                    }
                }
            }

            string reportFilename = string.Empty;

            if (ExportReport(ref reportFilename))
            {
                try
                {
                    m_Application.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, ConstantsDT.MESSAGE_REPORT_SAVING);
                    m_Application.BeginWaitCursor();

                    Recordset tmpRs = null;

                    String  tmpQry       = String.Empty;
                    Boolean bSpFileAdded = false;


                    tmpQry = "select param_name, param_value from sys_generalparameter " +
                             "where SUBSYSTEM_NAME = ?";
                    tmpRs = m_Application.DataContext.OpenRecordset(tmpQry, CursorTypeEnum.adOpenStatic,
                                                                    LockTypeEnum.adLockReadOnly,
                                                                    (int)CommandTypeEnum.adCmdText,
                                                                    "Doc_Management");
                    if (!(tmpRs.BOF && tmpRs.EOF))
                    {
                        tmpRs.MoveFirst();
                        tmpRs.MoveLast();
                        tmpRs.MoveFirst();
                        OncDocManage.OncDocManage rptToSave = new OncDocManage.OncDocManage();
                        while (!tmpRs.EOF)
                        {
                            if (tmpRs.Fields["PARAM_NAME"].Value.ToString() == "JOBWO_REL_PATH")
                            {
                                rptToSave.SPRelPath = tmpRs.Fields["PARAM_VALUE"].Value.ToString();
                            }
                            if (tmpRs.Fields["PARAM_NAME"].Value.ToString() == "SP_URL")
                            {
                                rptToSave.SPSiteURL = tmpRs.Fields["PARAM_VALUE"].Value.ToString();
                            }
                            if (tmpRs.Fields["PARAM_NAME"].Value.ToString() == "ROOT_PATH")
                            {
                                rptToSave.SPRootPath = tmpRs.Fields["PARAM_VALUE"].Value.ToString();
                            }
                            tmpRs.MoveNext();
                        }
                        rptToSave.SrcFilePath = reportFilename;
                        rptToSave.WrkOrd_Job  = m_Application.DataContext.ActiveJob;
                        rptToSave.SPFileName  = reportFilename.Substring(reportFilename.LastIndexOf("\\") + 1);
                        if (m_CommandName == ConstantsDT.COMMAND_NAME_GUYING)
                        {
                            rptToSave.SPFileType = "Guying Program";
                        }
                        else if (m_CommandName == ConstantsDT.COMMAND_NAME_SAG_CLEARANCE)
                        {
                            rptToSave.SPFileType = "Sag Clearance";
                        }
                        else
                        {
                            rptToSave.SPFileType = "";
                        }
                        bSpFileAdded = rptToSave.AddSPFile(true);
                        if (bSpFileAdded == false)
                        {
                            string msg = string.Format("{0}: Error adding {1} to SharePoint.{2}{2}{3}", ConstantsDT.ERROR_REPORT_SAVING, rptToSave.SPFileName, System.Environment.NewLine, rptToSave.RetErrMessage);
                            MessageBox.Show(m_Application.ApplicationWindow, msg, ConstantsDT.APPLICATION_NAME, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                            return;
                        }
                        tmpRs = null;

                        m_TransactionManager.Begin("New Hyperlink");

                        if (AddHyperlinkComponent(rptToSave.RetFileURL))
                        {
                            if (m_CommandName == ConstantsDT.COMMAND_NAME_GUYING && m_NewGuyScenario)
                            {
                                string sql             = "update g3e_job set guy_scenario_count = ? where g3e_identifier = ?";
                                int    recordsAffected = 0;
                                m_Application.DataContext.Execute(sql, out recordsAffected, (int)CommandTypeEnum.adCmdText, m_GuyScenarioCount, m_Application.DataContext.ActiveJob);
                                m_Application.DataContext.Execute("commit", out recordsAffected, (int)CommandTypeEnum.adCmdText);
                            }

                            m_TransactionManager.Commit();
                        }
                        else
                        {
                            m_TransactionManager.Rollback();
                        }
                    }
                    else
                    {
                        if (m_TransactionManager.TransactionInProgress)
                        {
                            m_TransactionManager.Rollback();
                        }
                        MessageBox.Show(m_Application.ApplicationWindow, ConstantsDT.ERROR_REPORT_SAVING + ": " +
                                        "Error finding General Parameters JOBWO_REL_PATH or 'SP_URL",
                                        ConstantsDT.APPLICATION_NAME, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        return;
                    }
                    m_Application.EndWaitCursor();
                    m_Application.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "");
                }
                catch (Exception ex)
                {
                    m_Application.EndWaitCursor();
                    m_Application.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "");
                    MessageBox.Show(m_Application.ApplicationWindow, ConstantsDT.ERROR_REPORT_SAVING + ": " + ex.Message, ConstantsDT.APPLICATION_NAME, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
        }
示例#18
0
        private void CopyPhaseAndPositionFromChangeoutInstance(int changeOutInstance)
        {
            try
            {
                string phase         = string.Empty;
                string phasePosition = string.Empty;
                string isNeutral     = string.Empty;

                short cno = GetUnitOrBankAttributeCNoForFNo(m_oFeature.FNO);

                if (cno == 0)
                {
                    return;
                }
                Recordset attributeRS = m_oDataContext.OpenFeature(m_oFeature.FNO, m_oFeature.FID).Components.GetComponent(cno).Recordset;

                if (attributeRS != null && attributeRS.RecordCount > 0)
                {
                    attributeRS.Filter = "G3E_CID = " + changeOutInstance;

                    if (!(attributeRS.EOF && attributeRS.BOF))
                    {
                        try
                        {
                            phase         = Convert.ToString(attributeRS.Fields["PHASE_C"].Value);
                            phasePosition = Convert.ToString(attributeRS.Fields["PHASE_POS_C"].Value);
                        }
                        catch (Exception)
                        { }

                        try
                        {
                            isNeutral = Convert.ToString(attributeRS.Fields["NEUTRAL_YN"].Value);
                        }
                        catch (Exception)
                        { }
                    }
                    attributeRS.Filter = FilterGroupEnum.adFilterNone;

                    attributeRS.MoveFirst();
                    attributeRS.MoveLast();
                    if (!(attributeRS.EOF && attributeRS.BOF))
                    {
                        try
                        {
                            attributeRS.Fields["PHASE_C"].Value     = phase;
                            attributeRS.Fields["PHASE_POS_C"].Value = phasePosition;
                        }
                        catch (Exception)
                        { }

                        try
                        {
                            attributeRS.Fields["NEUTRAL_YN"].Value = isNeutral;
                        }
                        catch
                        { }
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
        /// <summary>
        /// Method to set the standard attributed on the Unit component
        /// </summary>
        /// <param name="sCUCode"></param>
        /// <param name="iCUCID"></param>
        /// <param name="m_iCompUnitCNO"></param>
        /// <param name="m_oDataContext"></param>
        /// <returns></returns>
        private int SetStaticAttrModifiedVersion(string sCUCode, int iCUCID, int m_iCompUnitCNO, IGTDataContext m_oDataContext)
        {
            IGTKeyObject oKeyObject;

            ///''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
            //Query for the ANOs and their values from the m_sCUStaticAttributeTable table.
            //For each record returned in that query, set the ANO value.
            ///''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

            oKeyObject = m_oApp.DataContext.OpenFeature(Convert.ToInt16(m_oComponents[m_componentName].Recordset.Fields["G3e_FNO"].Value), Convert.ToInt32(m_oComponents[m_componentName].Recordset.Fields["G3e_FID"].Value));

            string       sSQL          = string.Empty;
            Recordset    oRS           = null;
            int          iDataType     = 0;
            string       sValue        = null;
            int          iValue        = 0;
            string       sField        = null;
            int          iCNO          = 0;
            int          iCurrentCNO   = 0;
            string       sExceptionMsg = null;
            Exception    oEx           = null;
            bool         bNumericField = false;
            IGTComponent oComp         = null;
            Recordset    oCompRS       = null;
            bool         bFoundRecord  = false;
            int          iCreatedCID   = 0;

            try
            {
                sSQL = @" select a.g3e_datatype,b.attr_key,a.g3e_field,a.g3e_cno from CULIB_ATTRIBUTE s,G3E_ATTRIBUTEINFO_OPTABLE a, CULIB_UNITATTRIBUTE b
                            where s.g3e_fno=? and b.cu_id=? and a.g3e_ano=s.g3e_ano and s.category_C = b.category_c and s.ATTRIBUTE_ID = b.ATTRIBUTE_ID
                            order by a.g3e_cno";

                oRS = m_oDataContext.OpenRecordset(sSQL, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockReadOnly, (int)ADODB.CommandTypeEnum.adCmdText, oKeyObject.FNO, sCUCode);

                if (!(oRS.BOF && oRS.EOF))
                {
                    oRS.MoveFirst();
                    while (!oRS.EOF)
                    {
                        //Set the various attributes in the recordset.
                        iDataType = System.Convert.ToInt32(oRS.Fields["g3e_datatype"].Value);
                        sValue    = oRS.Fields["attr_key"].Value.ToString();
                        sField    = oRS.Fields["g3e_field"].Value.ToString();
                        iCNO      = System.Convert.ToInt32(oRS.Fields["g3e_cno"].Value);

                        //The recordset is ordered by G3E_CNO.
                        //When that value changes, then determine whether
                        //to generate a new component record.
                        if (iCurrentCNO != iCNO)
                        {
                            //Prevent this branch of logic from executing
                            //until the next distinct G3E_CNO is encountered.
                            iCurrentCNO = iCNO;
                            //Do we need to generate a new record for this attribute
                            //If the CNO is the Primary CU Component, then do not create any additional records.
                            if (iCNO != m_iCompUnitCNO)
                            {
                                //If a component record does not exist, create one.
                                oComp = oKeyObject.Components.GetComponent((short)iCNO);
                                if (!(oComp == null))
                                {
                                    oCompRS = oComp.Recordset;
                                    if (!(oCompRS == null))
                                    {
                                        if (0 == oCompRS.RecordCount)
                                        {
                                            //No component record exists.  Create one.
                                            oCompRS.AddNew(System.Type.Missing, System.Type.Missing);
                                            oCompRS.Fields["g3e_fno"].Value = oKeyObject.FNO;
                                            oCompRS.Fields["g3e_fid"].Value = oKeyObject.FID;
                                        }
                                    }
                                }
                            }
                        }

                        oCompRS = null;
                        oComp   = null;

                        if (1 <= iDataType & 7 >= iDataType)
                        {
                            bNumericField = true;
                            try
                            {
                                //Ensure the value given is indeed numeric.
                                Decimal dTemp = Convert.ToDecimal(sValue);
                                iValue = System.Convert.ToInt32(dTemp);
                            }
                            catch (Exception)
                            {
                                sExceptionMsg = "Attribute " + System.Convert.ToString(sField) + " cannot be set to " + System.Convert.ToString(sValue) + ". The value must be numeric.";
                                oEx           = new Exception(System.Convert.ToString(sExceptionMsg));
                                throw (oEx);
                            }
                        }
                        else
                        {
                            bNumericField = false;
                        }

                        //Get the component for the selected attribute
                        oComp = oKeyObject.Components.GetComponent((short)iCNO);
                        if (!(oComp == null))
                        {
                            oCompRS = oComp.Recordset;
                            if (!(oCompRS == null))
                            {
                                if (!(oCompRS.BOF && oCompRS.EOF))
                                {
                                    //These are some hard-coded adjustments to certain attributes.
                                    if ((string)sValue == "NONE")
                                    {
                                        sValue = "";
                                    }

                                    //Set the attribute value on the G3E_CID of the current component
                                    //that matches the G3E_CID of the CU on the CU component.

                                    oCompRS.MoveFirst();
                                    while (!oCompRS.EOF)
                                    {
                                        if (iCUCID == System.Convert.ToInt32(oCompRS.Fields["g3e_cid"].Value))
                                        {
                                            bFoundRecord = true;

                                            try
                                            {
                                                if (bNumericField)
                                                {
                                                    try
                                                    {
                                                        oCompRS.Fields[sField].Value = iValue;
                                                    }
                                                    catch (Exception)
                                                    {
                                                    }
                                                }
                                                else
                                                {
                                                    try
                                                    {
                                                        oCompRS.Fields[sField].Value = sValue;
                                                    }
                                                    catch (Exception ex)
                                                    {
                                                    }
                                                }
                                                break;
                                            }
                                            catch (Exception)
                                            {
                                                //  throw;
                                            }
                                        }
                                        oCompRS.MoveNext();
                                    }
                                    if (!bFoundRecord)
                                    {
                                        if (IsRepeatingComponent(iCNO) || (!IsRepeatingComponent(iCNO) && oCompRS.RecordCount == 0))
                                        {
                                            //No component record exists.  Create one.
                                            oCompRS.AddNew(System.Type.Missing, System.Type.Missing);
                                            oCompRS.Fields["g3e_fno"].Value = oKeyObject.FNO;
                                            oCompRS.Fields["g3e_fid"].Value = oKeyObject.FID;
                                            iCreatedCID = Convert.ToInt32(oCompRS.Fields["g3e_cid"].Value);

                                            oCompRS.MoveLast();
                                            if (bNumericField)
                                            {
                                                try
                                                {
                                                    oCompRS.Fields[sField].Value = iValue;
                                                }
                                                catch (Exception)
                                                {
                                                }
                                            }
                                            else
                                            {
                                                try
                                                {
                                                    oCompRS.Fields[sField].Value = sValue;
                                                }
                                                catch (Exception)
                                                {
                                                }
                                            }
                                        }
                                        else if ((!IsRepeatingComponent(iCNO) && oCompRS.RecordCount == 1))
                                        {
                                            oCompRS.MoveFirst();

                                            if (bNumericField)
                                            {
                                                try
                                                {
                                                    oCompRS.Fields[sField].Value = iValue;
                                                }
                                                catch (Exception)
                                                {
                                                }
                                            }
                                            else
                                            {
                                                try
                                                {
                                                    oCompRS.Fields[sField].Value = sValue;
                                                }
                                                catch (Exception)
                                                {
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                        oRS.MoveNext();
                    }
                }
            }
            catch (Exception ex)
            {
                throw (ex);
            }
            return(iCreatedCID);
        }
        /// <summary>
        /// Locates the error based on the address, using the Premise_n table.
        /// </summary>
        /// <param name="houseNumber"></param>
        /// <param name="streetName"></param>
        /// <param name="streetType"></param>
        /// <param name="houseNumberFraction"></param>
        /// <param name="direction"></param>
        /// <param name="directionTrailing"></param>
        /// <param name="unit"></param>
        public static void LocateByAddress(int?houseNumber, string streetName, string streetType, string houseNumberFraction, string direction, string directionTrailing, string unit)
        {
            string selectStatement = "SELECT G3E_FID, G3E_FNO FROM PREMISE_N WHERE";
            int    nullCheck       = selectStatement.Count();

            if (houseNumber != null)
            {
                selectStatement += " HOUSE_NBR = '" + houseNumber + "'";
            }
            if (streetName != "")
            {
                selectStatement += "AND STREET_NM = '" + streetName + "'";
            }
            if (streetType != "")
            {
                selectStatement += "AND STREET_TYPE_C = '" + streetType + "'";
            }
            if (houseNumberFraction != "")
            {
                selectStatement += "AND HOUSE_FRACTION_NBR = " + houseNumberFraction;
            }
            if (direction != "")
            {
                selectStatement += "AND DIR_LEADING_C = '" + direction + "'";
            }
            if (directionTrailing != "")
            {
                selectStatement += "AND DIR_TRAILING_C = '" + directionTrailing + "'";
            }
            if (unit != "")
            {
                selectStatement += "AND UNIT_NBR = " + unit;
            }
            if (selectStatement.Count() == nullCheck)
            {
                MessageBox.Show("No address data found in record.", "G/Technology");
            }
            else
            {
                Recordset featureID = gtDataContext.OpenRecordset(selectStatement, CursorTypeEnum.adOpenDynamic, LockTypeEnum.adLockOptimistic, -1);
                locateFeatures = null;
                if (featureID.EOF && featureID.BOF)
                {
                    MessageBox.Show("No features found with a matching address.", "G/Technology");
                }
                else
                {
                    featureID.MoveFirst();
                    featureID.MoveLast();
                    odaListMaker   = new OleDbDataAdapter();
                    locateFeatures = new DataTable();
                    odaListMaker.Fill(locateFeatures, featureID);
                    if (!featureID.EOF && featureID.RecordCount > 0)
                    {
                        short FNO = Int16.Parse(featureID.Fields["G3E_FNO"].Value.ToString());
                        int   FID = Int32.Parse(featureID.Fields["G3E_FID"].Value.ToString());
                        locate(FID, FNO);
                    }
                }
            }
        }
示例#21
0
        public TIC_BIN_DATA GetUTICMachineNumber(string Sn)
        {
            //"TIC_EQUIP_ID" = 58
            //"TIC_EVENT_DATE" = 59
            TIC_BIN_DATA ticdata = new TIC_BIN_DATA();

            lock (_lockObject)
            {
                string returnMcNo = string.Empty;
                int    autoretry  = 1;

                while (autoretry > 0)
                {
                    try
                    {
                        FisSession ses = _server.FisSessions();
                        ses.UnitType = FisApiServer.UNIT_HGA;

                        if (Sn == string.Empty)
                        {
                            Sn = "";
                        }

                        Recordset rec = ses.RequestRecordset(FisSession.REQUEST_ATTRIBUTE, Sn, "NA");
                        if (rec.RecordCount() > 0)
                        {
                            bool end                 = false;
                            bool isEquipfound        = false;
                            bool isEventDataFound    = false;
                            bool isDockSideDataFound = false;

                            rec.MoveTo(15);

                            while (!rec.Eof() && !end)
                            {
                                if (rec.Fields(rec.GetColumnName(0)).Value.ToUpper().Equals(TIC_BIN_DATA.TIC_PARAM_BIN.TIC_EQUIP_ID.ToString()))
                                {
                                    ticdata.EQUIP_ID = rec.Fields(rec.GetColumnName(1)).Value;
                                    isEquipfound     = true;
                                }
                                else if (rec.Fields(rec.GetColumnName(0)).Value.ToUpper().Equals(TIC_BIN_DATA.TIC_PARAM_BIN.TIC_EVENT_DATE.ToString()))
                                {
                                    ticdata.EVENT_DATE = rec.Fields(rec.GetColumnName(1)).Value;
                                    isEventDataFound   = true;
                                }
                                else if (rec.Fields(rec.GetColumnName(0)).Value.ToUpper().Equals(TIC_BIN_DATA.TIC_PARAM_BIN.DOCKSIDE.ToString()))
                                {
                                    ticdata.DOCK_SIDE   = rec.Fields(rec.GetColumnName(1)).Value;
                                    isDockSideDataFound = true;
                                    rec.MoveTo(50);
                                }
                                if (isEquipfound && isEventDataFound && isDockSideDataFound)
                                {
                                    rec.MoveLast();
                                    rec.Eof();
                                    end       = true;
                                    autoretry = 0;
                                }
                                else
                                {
                                    rec.MoveNext();
                                }
                                Thread.Sleep(10);
                            }
                        }
                        ses.CloseSession();
                    }
                    catch (Exception ex)
                    {
                        throw new Exception(ex.Message);
                    }
                    autoretry--;
                }
                return(ticdata);
            }
        }
示例#22
0
 public void MoveLast()
 {
     recordset.MoveLast();
 }
示例#23
0
        /// <summary>
        /// This method copied CU values from source feature to target feature
        /// </summary>
        /// <param name="source"> Source recordset</param>
        /// <param name="target"> Target recordset</param>
        /// <param name="cu"> part of CU information about source and target</param>
        //private void CopyValuesFromSource(ref Recordset source, ref Recordset target, CuInformation cu)
        private void CopyValuesFromSource(Recordset source, CuInformation cu, bool newInstall, int replaceCid = -1)
        {
            try
            {
                source.MoveFirst();
                Recordset target = m_dataContext.OpenFeature(m_selectedObject.FNO, m_selectedObject.FID).Components.GetComponent(21).Recordset;

                target.Filter = "REPLACED_CID = " + replaceCid;

                if (!target.BOF && !target.EOF && target.RecordCount > 0)
                {
                    cu.TargetCid = Convert.ToInt16(target.Fields["g3e_cid"].Value);
                    newInstall   = false;
                }

                target.Filter = FilterGroupEnum.adFilterNone;

                if (!newInstall)
                {
                    target.Filter = "G3E_CID = " + cu.TargetCid;
                }
                if (target.RecordCount > 0)
                {
                    target.MoveLast();
                }
                if (newInstall)
                {
                    target.AddNew("G3E_FID", m_selectedObject.FID);
                    target.Fields["G3E_FNO"].Value = m_selectedObject.FNO;
                    target.Fields["G3E_CNO"].Value = 21;
                }
                target.Fields["ACTIVITY_C"].Value       = source.Fields["ACTIVITY_C"].Value;
                target.Fields["CIAC_C"].Value           = source.Fields["CIAC_C"].Value;
                target.Fields["CU_C"].Value             = source.Fields["CU_C"].Value;
                target.Fields["CU_DESC"].Value          = source.Fields["CU_DESC"].Value;
                target.Fields["FIELD_DESIGN_XML"].Value = source.Fields["FIELD_DESIGN_XML"].Value;
                target.Fields["LENGTH_FLAG"].Value      = source.Fields["LENGTH_FLAG"].Value;
                target.Fields["MACRO_CU_C"].Value       = source.Fields["MACRO_CU_C"].Value;
                target.Fields["PRIME_ACCT_ID"].Value    = source.Fields["PRIME_ACCT_ID"].Value;
                target.Fields["PROP_UNIT_ID"].Value     = source.Fields["PROP_UNIT_ID"].Value;
                target.Fields["QTY_LENGTH_Q"].Value     = source.Fields["QTY_LENGTH_Q"].Value;
                target.Fields["RETIREMENT_C"].Value     = source.Fields["RETIREMENT_C"].Value;
                target.Fields["WM_SEQ"].Value           = source.Fields["WM_SEQ"].Value;
                target.Fields["WR_EDITED"].Value        = source.Fields["WR_EDITED"].Value;
                if (replaceCid != -1)
                {
                    target.Fields["REPLACED_CID"].Value = replaceCid;
                }
                target.Update(Type.Missing, Type.Missing);
                target.Filter = FilterGroupEnum.adFilterNone;

                // Copy Phase and Phase position - ALM-1836-ONCORDEV-2516
                target = m_dataContext.OpenFeature(m_selectedObject.FNO, m_selectedObject.FID).Components.GetComponent(m_wireAttributesCno).Recordset;
                if (!newInstall)
                {
                    target.Filter = "G3E_CID = " + cu.TargetCid;
                }
                if (target.RecordCount > 0)
                {
                    target.MoveLast();
                }
                if (m_isPrimaryConductor)
                {
                    target.Fields["PHASE_C"].Value = cu.Phase;
                    try
                    {
                        target.Fields["PHASE_POS_C"].Value = cu.PhasePosition;
                    }
                    catch { }
                }
                else
                {
                    if (cu.isNeutral.Equals(false))
                    {
                        target.Fields["NEUTRAL_YN"].Value = "N";
                    }
                    else if (cu.isNeutral.Equals(true))
                    {
                        target.Fields["NEUTRAL_YN"].Value = "Y";
                    }
                }
                target.Update(Type.Missing, Type.Missing);
                target.Filter = FilterGroupEnum.adFilterNone;
            }
            catch (Exception)
            {
                throw;
            }
        }