コード例 #1
0
        /// <summary>
        /// 获得分厂ID和名字
        /// </summary>
        /// <returns></returns>
        public string GetFactory()
        {
            ComplexQuery query = new ComplexQuery();
            query.AddNeedField("Factory", "ID");
            query.AddNeedField("Factory", "Name");
            DataTable dt = dataFactory.Query(query);

            if (dt.Rows.Count == 0)
                throw new Exception("查无数据");
            return ComboboxJsonParser.DataTableToJson(dt, "ID", "Name");
        }
コード例 #2
0
ファイル: UsersRepository.cs プロジェクト: nxjcproject/nxjc
        public string GetUserNameById(string id)
        {
            ComplexQuery cmquery = new ComplexQuery();
            cmquery.AddNeedField("users", "USER_NAME");
            cmquery.AddCriterion("USER_ID", id, CriteriaOperator.Equal);
            DataTable table = dataFactory.Query(cmquery);

            return table.Rows[0][0].ToString().Trim();
        }
コード例 #3
0
        public string GetEletricalRoom(int factoryId)
        {
            try
            {
                string connString = ConnectionStringFactory.GetByFactoryId(factoryId);
                ISqlServerDataFactory factory = new SqlServerDataFactory(connString);

                ComplexQuery query = new ComplexQuery();
                query.AddNeedField("ElectricalRoom", "ID");
                query.AddNeedField("ElectricalRoom", "Name");
                DataTable dt = factory.Query(query);

                return ComboboxJsonParser.DataTableToJson(dt, "ID", "Name");
            }
            catch
            {
                return "[]";
            }
        }
コード例 #4
0
        /// <summary>
        /// 获得视图中所有变量的Id值
        /// </summary>
        /// <param name="viewName"></param>
        /// <returns></returns>
        public System.Collections.ArrayList GetVariableId(int productLineId, string viewName)
        {
            string connectionString = ConnectionStringFactory.GetConnectionStringByProductLineID(productLineId, DatabaseType.DCSSystemDatabase);
            ISqlServerDataFactory dataFactory = new SqlServerDataFactory(connectionString);

            ArrayList result = new ArrayList();
            ComplexQuery cmpquery = new ComplexQuery();
            cmpquery.AddNeedField("ContrastTable", "VariableName");
            cmpquery.AddCriterion("ViewName", viewName, CriteriaOperator.Equal);
            DataTable data = dataFactory.Query(cmpquery);
            foreach (DataRow row in data.Rows)
            {
                result.Add(row["VariableName"].ToString().Trim());
            }
            return result;
        }
コード例 #5
0
        /// <summary>
        /// 获得实时数据的table表
        /// </summary>
        /// <param name="dataPathInfor"></param>
        /// <returns></returns>
        public DataTable GetDataItemTable(int productLineId, IEnumerable<DataPathInformation> dataPathInfor)
        {
            string connectionString = ConnectionStringFactory.NXJCConnectionString;
            ISqlServerDataFactory dataFactory = new SqlServerDataFactory(connectionString);

            ComplexQuery cmpquery = new ComplexQuery();
            foreach (var item in dataPathInfor)
            {
                cmpquery.AddNeedField(item.TableName, item.FieldName, item.ViewId);
            }
            cmpquery.JoinCriterion = new JoinCriterion
            {
                DefaultJoinFieldName = "v_date",
                JoinType = JoinType.FULL_JOIN
            };
            cmpquery.TopNumber = 1;
            //cmpquery.OrderByClause = new OrderByClause("realtime_line_data.v_date", true);
            DataTable table = dataFactory.Query(cmpquery);

            return table;
        }
コード例 #6
0
ファイル: DataSetProvider.cs プロジェクト: nxjcproject/nxjc
        private DataItem GetDataItem(DataSetInformation dataSetInformation)
        {
            DataItem result = new DataItem();
            ComplexQuery cmpquery = new ComplexQuery();
            cmpquery.AddNeedField(dataSetInformation.TableName, dataSetInformation.FieldName, dataSetInformation.FieldName);
            cmpquery.TopNumber = 1;
            cmpquery.AddOrderByClause("v_date", true);
            DataTable table = dataFactory.Query(cmpquery);

            foreach(DataRow item in table.Rows)
            {
                result = new DataItem
                {
                    ID = dataSetInformation.ViewId,
                    Value = item[dataSetInformation.FieldName].ToString().Trim()
                };
            }
            return result;
        }
コード例 #7
0
ファイル: DataSetProvider.cs プロジェクト: nxjcproject/nxjc
 /// <summary>
 /// 获得视图中所有变量的Id值
 /// </summary>
 /// <param name="viewName"></param>
 /// <returns></returns>
 private ArrayList GetParametorsId(string viewName)
 {
     ArrayList result = new ArrayList();
     ComplexQuery cmpquery = new ComplexQuery();
     cmpquery.AddNeedField("ContrastTable", "VariableName");
     cmpquery.AddCriterion("ViewName", viewName, CriteriaOperator.Equal);
     DataTable data = dataFactory.Query(cmpquery);
     foreach (DataRow row in data.Rows)
     {
         result.Add(row["VariableName"].ToString().Trim());
     }
     return result;
 }
コード例 #8
0
ファイル: DataSetProvider.cs プロジェクト: nxjcproject/nxjc
        /// <summary>
        /// 获得实时数据的table表
        /// </summary>
        /// <param name="dataSetInformations"></param>
        /// <returns></returns>
        private DataTable GetDataItemTable(IEnumerable<DataSetInformation> dataSetInformations)
        {
            //DataItem result = new DataItem();
            ComplexQuery cmpquery = new ComplexQuery();
            foreach (var item in dataSetInformations)
            {
                cmpquery.AddNeedField(item.TableName, item.FieldName, item.ViewId);
            }
            cmpquery.JoinCriterion = new JoinCriterion
            {
                DefaultJoinFieldName = "v_date",
                JoinType = JoinType.FULL_JOIN
            };
            cmpquery.TopNumber = 1;
            //cmpquery.OrderByClause = new OrderByClause("realtime_line_data.v_date", true);
            DataTable table = dataFactory.Query(cmpquery);

            return table;
        }
コード例 #9
0
        public string GetProductLineNameBy(int id)
        {
            ComplexQuery cmquery = new ComplexQuery();
            cmquery.AddNeedField("ProductLine", "Name");
            cmquery.AddCriterion("ID", id, CriteriaOperator.Equal);
            DataTable table = dataFactory.Query(cmquery);

            return table.Rows[0][0].ToString().Trim();
        }