private void GetUserInfo() { string sql = "select loginname,username,usergroup,department,permission from T_USER_INFO_MANAGEMENT"; if (database.ReturnDS(sql).Tables[0] != null) { _dgrvdUserInfo.DataSource = database.ReturnDS(sql).Tables[0]; for (int i = 0; i < _dgrvdUserInfo.ColumnCount; i++) { if (_dgrvdUserInfo.Columns[i].HeaderText == "loginname") { _dgrvdUserInfo.Columns[i].HeaderText = "登陆名"; } if (_dgrvdUserInfo.Columns[i].HeaderText == "usergroup") { _dgrvdUserInfo.Columns[i].HeaderText = "所属用户组"; } if (_dgrvdUserInfo.Columns[i].HeaderText == "username") { _dgrvdUserInfo.Columns[i].HeaderText = "用户姓名"; } if (_dgrvdUserInfo.Columns[i].HeaderText == "department") { _dgrvdUserInfo.Columns[i].HeaderText = "所属部门"; } if (_dgrvdUserInfo.Columns[i].HeaderText == "permission") { _dgrvdUserInfo.Columns[i].HeaderText = "用户权限"; } _dgrvdUserInfo.Columns[i].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; } } }
private void button2_Click(object sender, EventArgs e) { //检查图例是否重复 bool isHas = false; for (int i = 0; i < dgvLegendList.Rows.Count; i++) { if ((bool)dgvLegendList[0, i].Value == true) { string tempname = dgvLegendList[1, i].Value.ToString().Split('.')[0].ToString();; DataSet tempds = TheManage.ReturnDS("select * from T_MAP_LEGEND where LegendName='" + tempname + "'"); if (tempds.Tables[0].Rows.Count > 0) { dgvLegendList[0, i].Value = false; } } } for (int i = 0; i < dgvLegendList.Rows.Count; i++) { if ((bool)dgvLegendList[0, i].Value == true) { tempFilePath = dgvLegendList[3, i].Value.ToString(); if (System.IO.File.Exists(tempFilePath)) { ms = File.OpenRead(tempFilePath); pbFilep = new byte[ms.Length]; ms.Position = 0; ms.Read(pbFilep, 0, Convert.ToInt32(ms.Length)); } string tempTitle = dgvLegendList[1, i].Value.ToString().Split('.')[0].ToString(); TheManage.OperateDB("insert into T_MAP_LEGEND (LegendName,LegendPic) values ('" + tempTitle + "',@LegendPic)", pbFilep, "@LegendPic"); } } MessageBox.Show("保存成功!"); }
///// <summary> ///// 获取预警数据字段与规则编码关系表中所有预警数据字段。 ///// </summary> ///// <param name="tableName"></param> ///// <returns></returns> //string[] GetPreWarningDataBindingTableFieldNames(string bindinTableName) //{ // //string sql = "select name from syscolumns where id=object_id(N'" + bindinTableName + "')"; // string sql = "SELECT DISTINCT COLUMN_NAME FROM " + bindinTableName; // ManageDataBase db = new ManageDataBase(DATABASE_TYPE.WarningManagementDB); // DataSet ds = db.ReturnDS(sql); // string[] ret = null; // try // { // int n = ds.Tables[0].Rows.Count; // if (n > 0) // { // ret = new string[n]; // } // for (int i = 0; i < n; i++) // { // ret[i] = ds.Tables[0].Rows[i][0].ToString(); // } // } // catch (Exception ex) // { // Alert.alert(ex.Message); // return null; // } // return ret; //} /// <summary> /// 读取当前预警数据表对应的预警数据字段与规则编码关系表,获取预警数据字段与规则编码关系表中所有字段名(Distinct)及字段使用方式 /// </summary> /// <param name="tableName">预警数据绑定表名</param> /// <returns></returns> BindingTableEntity[] GetPreWarningDataBindingTableEntity(string bindinTableName) { BindingTableEntity[] ret = null; //string sql = "SELECT COLUMN_NAME, COLUMN_USE_MANNER, BINDING_WARNING_RULES FROM " + bindinTableName; string sql = "SELECT " + WarningDataBindingTableCommonDbConstNames.COLUMN_NAME + ", " + WarningDataBindingTableCommonDbConstNames.COLUMN_USE_MANNER + ", " + WarningDataBindingTableCommonDbConstNames.BINDING_WARNING_RULES + " FROM " + bindinTableName; ManageDataBase db = new ManageDataBase(DATABASE_TYPE.WarningManagementDB); DataSet ds = db.ReturnDS(sql); try { int n = ds.Tables[0].Rows.Count; if (n > 0) { ret = new BindingTableEntity[n]; } for (int i = 0; i < n; i++) { ret[i] = new BindingTableEntity(); ret[i].ColumnName = ds.Tables[0].Rows[i][WarningDataBindingTableCommonDbConstNames.COLUMN_NAME].ToString(); ret[i].UseManner = (COLUMN_USE_MANNER)Enum.Parse(typeof(COLUMN_USE_MANNER), ds.Tables[0].Rows[i][WarningDataBindingTableCommonDbConstNames.COLUMN_USE_MANNER].ToString()); ret[i].BindingWarningRules = ds.Tables[0].Rows[i][WarningDataBindingTableCommonDbConstNames.BINDING_WARNING_RULES].ToString(); } } catch (Exception ex) { Alert.alert(ex.Message); return(null); } return(ret); }
selectWorkTimeNameByWorkTimeGroupIdAndSysTime(int workTimeGroupId, string sysDateTime) { StringBuilder strSql = new StringBuilder(); strSql.Append(" SELECT " + MineDataSimpleDbConstNames.WORK_TIME_NAME); strSql.Append(" FROM " + MineDataSimpleDbConstNames.TABLE_NAME); strSql.Append(" WHERE "); strSql.Append(MineDataSimpleDbConstNames.WORK_TIME_GROUP_ID + " = " + workTimeGroupId); strSql.Append(" AND "); strSql.Append("'" + sysDateTime + "'" + " <= " + MineDataSimpleDbConstNames.WORK_TIME_TO); strSql.Append(" AND "); strSql.Append("'" + sysDateTime + "'" + " >= " + MineDataSimpleDbConstNames.WORK_TIME_FROM); ManageDataBase db = new ManageDataBase(DATABASE_TYPE.GeologyMeasureDB); DataSet ds = db.ReturnDS(strSql.ToString()); if (ds.Tables[0].Rows.Count > 0) { return(ds.Tables[0].Rows[0][0].ToString()); } else { return(null); } }
/// <summary> /// 返回某条回采巷道信息 /// </summary> /// <param name="tunnelHCID">回采巷道ID</param> /// <returns>回采巷道实体</returns> public static TunnelHCEntity selectTunnelHC(int tunnelHCID) { ManageDataBase db = new ManageDataBase(DATABASE_TYPE.MiningSchedulingDB); string sql = "SELECT * FROM " + TunnelHCDbConstNames.TABLE_NAME + " WHERE " + TunnelHCDbConstNames.ID + " = " + tunnelHCID; DataSet ds = db.ReturnDS(sql); TunnelHCEntity tunnelHCEntity = new TunnelHCEntity(); if (ds.Tables[0].Rows.Count > 0) { try { tunnelHCEntity.ID = (int)ds.Tables[0].Rows[0][TunnelHCDbConstNames.ID]; tunnelHCEntity.TunnelID_ZY = (int)ds.Tables[0].Rows[0][TunnelHCDbConstNames.TUNNEL_ID1]; tunnelHCEntity.TunnelID_FY = (int)ds.Tables[0].Rows[0][TunnelHCDbConstNames.TUNNEL_ID2]; tunnelHCEntity.TunnelID_KQY = (int)ds.Tables[0].Rows[0][TunnelHCDbConstNames.TUNNEL_ID3]; tunnelHCEntity.TeamNameID = (int)ds.Tables[0].Rows[0][TunnelHCDbConstNames.TEAM_NAME_ID]; tunnelHCEntity.StartDate = Convert.ToDateTime(ds.Tables[0].Rows[0][TunnelHCDbConstNames.START_DATE]); tunnelHCEntity.IsFinish = (int)ds.Tables[0].Rows[0][TunnelHCDbConstNames.IS_FINISH]; tunnelHCEntity.StopDate = Convert.ToDateTime(ds.Tables[0].Rows[0][TunnelHCDbConstNames.STOP_DATE]); tunnelHCEntity.WorkStyle = ds.Tables[0].Rows[0][TunnelHCDbConstNames.WORK_STYLE].ToString(); tunnelHCEntity.WorkTime = ds.Tables[0].Rows[0][TunnelHCDbConstNames.WORK_TIME].ToString(); } catch { return(null); } } else { return(null); } return(tunnelHCEntity); }
private static TunnelHChuan selectTunnelHChuan(int tunnelHChuanID) { ManageDataBase db = new ManageDataBase(DATABASE_TYPE.MiningSchedulingDB); string sql = "SELECT * FROM " + TunnelHChuanDbConstNames.TABLE_NAME + " WHERE " + TunnelHChuanDbConstNames.ID + " = " + tunnelHChuanID; DataSet ds = db.ReturnDS(sql); TunnelHChuan tunnelHChuanEntity = new TunnelHChuan(); if (ds.Tables[0].Rows.Count > 0) { try { tunnelHChuanEntity.Id = (int)ds.Tables[0].Rows[0][TunnelHChuanDbConstNames.ID]; tunnelHChuanEntity.TunnelId1 = (int)ds.Tables[0].Rows[0][TunnelHChuanDbConstNames.TUNNEL_ID1]; tunnelHChuanEntity.TunnelId2 = (int)ds.Tables[0].Rows[0][TunnelHChuanDbConstNames.TUNNEL_ID2]; tunnelHChuanEntity.X1 = (double)ds.Tables[0].Rows[0][TunnelHChuanDbConstNames.TUNNEL_X1]; tunnelHChuanEntity.Y1 = (double)ds.Tables[0].Rows[0][TunnelHChuanDbConstNames.TUNNEL_Y1]; tunnelHChuanEntity.Z1 = (double)ds.Tables[0].Rows[0][TunnelHChuanDbConstNames.TUNNEL_Z1]; tunnelHChuanEntity.X2 = (double)ds.Tables[0].Rows[0][TunnelHChuanDbConstNames.TUNNEL_X2]; tunnelHChuanEntity.Y2 = (double)ds.Tables[0].Rows[0][TunnelHChuanDbConstNames.TUNNEL_Y2]; tunnelHChuanEntity.Z2 = (double)ds.Tables[0].Rows[0][TunnelHChuanDbConstNames.TUNNEL_Z2]; tunnelHChuanEntity.Azimuth = (double)ds.Tables[0].Rows[0][TunnelHChuanDbConstNames.TUNNEL_AZIMUTH]; tunnelHChuanEntity.Team.TeamId = (int)ds.Tables[0].Rows[0][TunnelHChuanDbConstNames.TEAM_NAME_ID]; tunnelHChuanEntity.StartDate = Convert.ToDateTime(ds.Tables[0].Rows[0][TunnelHChuanDbConstNames.START_DATE]); tunnelHChuanEntity.IsFinish = (int)ds.Tables[0].Rows[0][TunnelHChuanDbConstNames.IS_FINISH]; tunnelHChuanEntity.StopDate = Convert.ToDateTime(ds.Tables[0].Rows[0][TunnelHChuanDbConstNames.STOP_DATE]); tunnelHChuanEntity.WorkStyle = ds.Tables[0].Rows[0][TunnelHChuanDbConstNames.WORK_STYLE].ToString(); tunnelHChuanEntity.WorkTime = ds.Tables[0].Rows[0][TunnelHChuanDbConstNames.WORK_TIME].ToString(); tunnelHChuanEntity.State = ds.Tables[0].Rows[0][TunnelHChuanDbConstNames.TUNNEL_STATE].ToString(); } catch { return(null); } } else { return(null); } return(tunnelHChuanEntity); }
//查找重复用户名,查找到时,返回true public static bool FindTheSameLoginName(string newLoginName) { //DataTable dt = database.ReturnDS("T_USER_INFO_MANAGEMENT where USER_LOGIN_NAME = '" + name + "'").Tables[0]; bool returnValue = false; StringBuilder strSql = new StringBuilder(); strSql.Append("select * from "); strSql.Append(UserInformationManagementDbConstNames.TABLE_NAME); strSql.Append(" where "); strSql.Append(UserInformationManagementDbConstNames.USER_LOGIN_NAME); strSql.Append(" = "); strSql.Append("'" + LibEncryptDecrypt.DWEncryptDecryptClass.EncryptString(newLoginName) + "'"); ManageDataBase database = new ManageDataBase(DATABASE_TYPE.WarningManagementDB); DataTable dt = database.ReturnDS(strSql.ToString()).Tables[0]; if (dt != null) { if (dt.Rows.Count > 0) { returnValue = true; } } return(returnValue); }
/// <summary> /// 验证数据库中是否存在表 tableName /// </summary> /// <param name="tableName"></param> /// <returns></returns> public static bool ExistTableInDatabase(string tableName) { StringBuilder strSql = new StringBuilder(); strSql.Append("if objectproperty(object_id("); strSql.Append("'" + tableName + "'"); strSql.Append("),'IsUserTable') = 1 "); strSql.Append("select 1 else select 0"); ManageDataBase database = new ManageDataBase(LibDatabase.DATABASE_TYPE.WarningManagementDB); DataSet ds = database.ReturnDS(strSql.ToString()); if (ds != null) { DataTable dt = ds.Tables[0]; if (dt.Rows.Count > 0) { string value = dt.Rows[0][0].ToString(); if (value == "1") { return(true); } else { return(false); } } } return(false); }
/// <summary> /// 通过用户ID查询用户电话号码 /// </summary> /// <param name="id">选择的用户ID</param> /// <returns></returns> public static string ReturnPhoneNumber(int id) { var manaDB = new ManageDataBase(DATABASE_TYPE.GasEmissionDB); var strBuilder = new StringBuilder(); strBuilder.Append("SELECT " + UserInformationDetailsManagementDbConstNames.USER_PHONENUMBER); strBuilder.Append(" FROM " + UserInformationDetailsManagementDbConstNames.TABLE_NAME); strBuilder.Append(" WHERE " + UserInformationDetailsManagementDbConstNames.ID + "=" + id); var ds = manaDB.ReturnDS(strBuilder.ToString()); if (ds != null && ds.Tables[0].Rows.Count > 0) { return(ds.Tables[0].Rows[0][0].ToString()); } return(""); //if (double.TryParse(ds.Tables[0].Rows[0][0].ToString(), out douPhoneNumber) == false) //{ // return false; //} //else //{ // return true; //} //if(ds.count) }
GetUserLoginInformationByID(int id) { UserInformationDetails ent = null; StringBuilder strSql = new StringBuilder(); strSql.Append("SELECT * FROM "); strSql.Append(UserInformationDetailsManagementDbConstNames.TABLE_NAME); strSql.Append(" WHERE "); strSql.Append(UserInformationDetailsManagementDbConstNames.ID); strSql.Append(" = "); strSql.Append(id); ManageDataBase database = new ManageDataBase(DATABASE_TYPE.WarningManagementDB); DataTable dt = database.ReturnDS(strSql.ToString()).Tables[0]; if (dt != null) { int n = dt.Rows.Count; for (int i = 0; i < n; i++) { ent = new UserInformationDetails(); ent.Id = (int)dt.Rows[i][0]; ent.Name = dt.Rows[i][1].ToString(); ent.PhoneNumber = dt.Rows[i][2].ToString(); ent.TelePhoneNumber = dt.Rows[i][3].ToString(); ent.Email = dt.Rows[i][4].ToString(); ent.Depratment = dt.Rows[i][5].ToString(); ent.Position = dt.Rows[i][6].ToString(); ent.Remarks = dt.Rows[i][7].ToString(); ent.IsInform = Convert.ToInt16(dt.Rows[i][8]); } } return(ent); }
/// <summary> /// 查找重复用户名,查找到时,返回true /// </summary> /// <param name="newGroupName"></param> /// <returns></returns> public static bool FindTheSameGroupName(string newGroupName) { bool returnValue = false; StringBuilder strSql = new StringBuilder(); strSql.Append("SELECT * FROM "); strSql.Append(UserGroupInformationMangementDbConstNames.TABLE_NAME); strSql.Append(" WHERE "); strSql.Append(UserGroupInformationMangementDbConstNames.USER_GROUP_NAME); strSql.Append(" = "); strSql.Append("'" + newGroupName + "'"); ManageDataBase database = new ManageDataBase(DATABASE_TYPE.WarningManagementDB); DataTable dt = database.ReturnDS(strSql.ToString()).Tables[0]; if (dt != null) { if (dt.Rows.Count > 0) { returnValue = true; } } return(returnValue); }
/// <summary> /// 获取字段名对应的所有规则编码(查询当前预警数据表对应的预警数据字段与规则编码关系表) /// 注意:各个绑定表中字段名称要一致! /// </summary> /// <param name="fieldName">字段名</param> /// <returns>注:无数据或出错返回null</returns> string[] GetRuleCodesByFieldName(string fieldName, string bindingTableName) { string[] retRuleCodes = null; //string sql = "SELECT BINDING_WARNING_RULES FROM " + bindingTableName + " WHERE COLUMN_NAME='" + fieldName + "'"; string sql = "SELECT " + WarningDataBindingTableCommonDbConstNames.BINDING_WARNING_RULES + " FROM " + bindingTableName + " WHERE " + WarningDataBindingTableCommonDbConstNames.COLUMN_NAME + "='" + fieldName + "'"; ManageDataBase db = new ManageDataBase(DATABASE_TYPE.WarningManagementDB); DataSet ds = db.ReturnDS(sql); try { int n = ds.Tables[0].Rows.Count; if (n > 0) { retRuleCodes = new string[n]; } else { Alert.alert("字段名:" + fieldName + "未绑定规则编码!【表名:" + bindingTableName + "】"); return(null); } for (int i = 0; i < n; i++) { //retRuleCodes[i] = ds.Tables[0].Rows[i]["BINDING_WARNING_RULES"].ToString(); retRuleCodes[i] = ds.Tables[0].Rows[i][WarningDataBindingTableCommonDbConstNames.BINDING_WARNING_RULES].ToString(); } } catch (Exception ex) { Alert.alert(ex.Message); return(null); } return(retRuleCodes); }
/// <summary> /// 获取巷道绑定的所有规则编码和参数 /// </summary> /// <param name="preWarningParamsInDB">数据库中保存的预警规则参数</param> /// <returns>规则参数与编码单元</returns> /// <summary> public static RuleInfo[] GetTunnelBindingRuleIdsAndParams(int tunnelID) { //获取巷道绑定的规则编码字符串和预警参数字符串 string sql = "SELECT " + TunnelInfoDbConstNames.RULE_IDS + ", " + TunnelInfoDbConstNames.PRE_WARNING_PARAMS + " FROM " + TunnelInfoDbConstNames.TABLE_NAME + " WHERE " + TunnelInfoDbConstNames.ID + "=" + tunnelID; ManageDataBase db = new ManageDataBase(DATABASE_TYPE.GeologyMeasureDB); DataSet ds = db.ReturnDS(sql); string allRuleIds = ""; if (ds.Tables[0].Rows.Count < 1) { //Alert.alert("数据库中无对应巷道!"); return(null); } allRuleIds = ds.Tables[0].Rows[0][TunnelInfoDbConstNames.RULE_IDS].ToString(); string allParams = ds.Tables[0].Rows[0][TunnelInfoDbConstNames.PRE_WARNING_PARAMS].ToString(); if (allRuleIds == "")//未绑定规则编码 { return(null); } RuleInfo[] ret = ParseRuleIdsAndParams(allRuleIds, allParams); return(ret); }
selectDefaultTunnel(string tableName) { string sql = "SELECT * FROM " + TunnelDefaultSelectDbConstNames.TABLE_NAME + " WHERE " + TunnelDefaultSelectDbConstNames.TABLE_NAME_USE + " = '" + tableName + "'"; ManageDataBase db = new ManageDataBase(LibDatabase.DATABASE_TYPE.GeologyMeasureDB); DataSet ds = db.ReturnDS(sql); LibEntity.TunnelDefaultSelect tunnelDefaultSelectEntity = new LibEntity.TunnelDefaultSelect(); if (ds.Tables[0].Rows.Count > 0) { tunnelDefaultSelectEntity.TableName = ds.Tables[0].Rows[0][TunnelDefaultSelectDbConstNames.TABLE_NAME_USE].ToString(); tunnelDefaultSelectEntity.MineID = Convert.ToInt32(ds.Tables[0].Rows[0][TunnelDefaultSelectDbConstNames.MINE_ID].ToString()); tunnelDefaultSelectEntity.HorizontalID = Convert.ToInt32(ds.Tables[0].Rows[0][TunnelDefaultSelectDbConstNames.HORIZONTAL_ID].ToString()); tunnelDefaultSelectEntity.MiningAreaID = Convert.ToInt32(ds.Tables[0].Rows[0][TunnelDefaultSelectDbConstNames.MINING_AREA_ID].ToString()); tunnelDefaultSelectEntity.WorkingFaceID = Convert.ToInt32(ds.Tables[0].Rows[0][TunnelDefaultSelectDbConstNames.WORKING_FACE_ID].ToString()); return(tunnelDefaultSelectEntity); } return(null); }
/// <summary> /// 获取当前预警数据表中所有预警数据(不考虑巷道ID、时间等约束条件)。 /// </summary> /// <param name="dataTableName"></param> /// <param name="tunnelID"></param> /// <param name="minTime"></param> /// <param name="maxTime"></param> /// <returns></returns> DataSet GetPreWarningDatas(string dataTableName) { string sql = "SELECT * FROM " + dataTableName; ManageDataBase db = new ManageDataBase(DATABASE_TYPE.WarningManagementDB); return(db.ReturnDS(sql)); }
public static List <String> GetWarningIdListWithTunnelId(string tunnelId) { List <String> results = new List <string>(); StringBuilder strSql = new StringBuilder(); strSql.Append("SELECT * FROM "); strSql.Append(PreWarningResultViewDbConstNames.VIEW_NAME); strSql.Append(" WHERE "); strSql.Append(PreWarningResultDBConstNames.WARNING_RESULT); strSql.Append(" < 2 "); strSql.Append(" AND " + PreWarningResultDBConstNames.HANDLE_STATUS + " < 3"); // 3指 HANDLED strSql.Append(" AND WARNING_STATUS = 1"); strSql.Append(" AND "); strSql.Append(TunnelInfoDbConstNames.ID + " = '" + tunnelId + "'"); ManageDataBase db = new ManageDataBase(DATABASE_TYPE.WarningManagementDB); DataTable dt = db.ReturnDS(strSql.ToString()).Tables[0]; for (int i = 0; i < dt.Rows.Count; i++) { results.Add(dt.Rows[i][PreWarningResultDBConstNames.ID].ToString()); } return(results); }
/// <summary> /// 查询回采巷道数据 /// </summary> /// <returns></returns> public static DataSet selectTunnelHChuan() { ManageDataBase db = new ManageDataBase(DATABASE_TYPE.MiningSchedulingDB); string sql = "SELECT * FROM " + TunnelHChuanDbConstNames.TABLE_NAME; DataSet ds = db.ReturnDS(sql); return(ds); }
/// <summary> /// 获取当前预警数据表中巷道ID、时间等符合条件的所有预警数据。 /// </summary> /// <param name="dataTableName"></param> /// <param name="tunnelID"></param> /// <param name="minTime"></param> /// <param name="maxTime"></param> /// <returns></returns> DataSet GetPreWarningDatas(string dataTableName, int tunnelID, DateTime minTime, DateTime maxTime) { string sql = "SELECT * FROM " + dataTableName + " WHERE " + WarningDatasCommonDbConstNames.TUNNEL_ID + "=" + tunnelID + " AND " + WarningDatasCommonDbConstNames.DATETIME + ">='" + minTime.ToString() + "'" + " AND " + WarningDatasCommonDbConstNames.DATETIME + "<='" + maxTime.ToString() + "'"; ManageDataBase db = new ManageDataBase(DATABASE_TYPE.WarningManagementDB); return(db.ReturnDS(sql)); }
/// <summary> /// 查询所有预警规则 /// </summary> /// <returns></returns> public static DataSet selectAllWarningRules() { string sql = "SELECT * FROM " + PreWarningRulesDbConstNames.TABLE_NAME + " ORDER BY " + PreWarningRulesDbConstNames.SUITABLE_LOCATION;; ManageDataBase db = new ManageDataBase(DATABASE_TYPE.WarningManagementDB); return(db.ReturnDS(sql)); }
/// <summary> /// 获取全部煤层信息 /// </summary> /// <returns>全部煤层信息</returns> public static DataSet selectAllCoalSeamsInfo() { string sqlStr = "SELECT * FROM " + CoalSeamsDbConstNames.TABLE_NAME; ManageDataBase db = new ManageDataBase(DATABASE_TYPE.GeologyMeasureDB); DataSet ds = db.ReturnDS(sqlStr); return(ds); }
/// <summary> /// 获取所有登录用户信息 /// </summary> /// <returns>DataSet</returns> public static DataSet GetUserInformationDetailsDS() { StringBuilder strSql = new StringBuilder(); strSql.Append("SELECT * FROM "); strSql.Append(UserInformationDetailsManagementDbConstNames.TABLE_NAME); ManageDataBase database = new ManageDataBase(DATABASE_TYPE.WarningManagementDB); DataSet ds = database.ReturnDS(strSql.ToString()); return(ds); }
/// <summary> /// 通过<采区编号>,获取该<采区>下所有<工作面>信息 /// </summary> /// <returns><工作面>信息</returns> public static DataSet selectWorkingFaceInfoByMiningAreaId(int iMiningAreaId) { StringBuilder sqlStr = new StringBuilder(); sqlStr.Append("SELECT * FROM " + WorkingFaceDbConstNames.TABLE_NAME); sqlStr.Append(" WHERE " + WorkingFaceDbConstNames.MININGAREA_ID + " = " + iMiningAreaId); ManageDataBase db = new ManageDataBase(DATABASE_TYPE.GeologyMeasureDB); DataSet ds = db.ReturnDS(sqlStr.ToString()); return(ds); }
/// <summary> /// 通过<工作面>,获取<工作面>信息 /// </summary> /// <returns><工作面>信息</returns> public static DataSet selectWorkingFaceInfoByWorkingFaceIdOrderBy(int iWorkingFaceId) { StringBuilder sqlStr = new StringBuilder(); sqlStr.Append("SELECT * FROM " + WorkingFaceDbConstNames.TABLE_NAME); sqlStr.Append(" WHERE " + WorkingFaceDbConstNames.WORKINGFACE_ID + " = " + iWorkingFaceId + " ORDER BY " + WorkingFaceDbConstNamesNew.WORKINGFACE_ID + " DESC"); ManageDataBase db = new ManageDataBase(DATABASE_TYPE.GeologyMeasureDB); DataSet ds = db.ReturnDS(sqlStr.ToString()); return(ds); }
/// <summary> /// 同时适用掘进面和回采面的预警规则 /// </summary> /// <returns></returns> public static DataSet selectJueJinHuiCaiCommonRules() { string sql = "SELECT * FROM " + PreWarningRulesDbConstNames.TABLE_NAME + " WHERE " + PreWarningRulesDbConstNames.SUITABLE_LOCATION + "='" + Const_WM.SUITABLE_LOCATION_JUE_JIN_HUI_CAI_COMMON + "' ORDER BY " + PreWarningRulesDbConstNames.SUITABLE_LOCATION; ManageDataBase db = new ManageDataBase(DATABASE_TYPE.WarningManagementDB); return(db.ReturnDS(sql)); }
/// <summary> /// 查询所有突出预警规则 /// </summary> /// <returns></returns> public static DataSet selectTuChuWarningRules() { string sql = "SELECT * FROM " + PreWarningRulesDbConstNames.TABLE_NAME + " WHERE " + PreWarningRulesDbConstNames.WARNING_TYPE + "='" + Const_WM.WARNING_TYPE_GAS_OUTBURST + "' ORDER BY " + PreWarningRulesDbConstNames.WARNING_TYPE; ManageDataBase db = new ManageDataBase(DATABASE_TYPE.WarningManagementDB); return(db.ReturnDS(sql)); }
/// <summary> /// 其他地点 /// </summary> /// <returns></returns> public static DataSet selectOthersRules() { string sql = "SELECT * FROM " + PreWarningRulesDbConstNames.TABLE_NAME + " WHERE " + PreWarningRulesDbConstNames.SUITABLE_LOCATION + "='" + Const_WM.SUITABLE_LOCATION_OTHERS + "' ORDER BY " + PreWarningRulesDbConstNames.SUITABLE_LOCATION; ManageDataBase db = new ManageDataBase(DATABASE_TYPE.WarningManagementDB); return(db.ReturnDS(sql)); }
/// <summary> /// 分页用返回回采巷道所有信息 /// </summary> /// <returns></returns> public static DataSet selectTunnelHChuan(int iStartIndex, int iEndIndex) { ManageDataBase db = new ManageDataBase(DATABASE_TYPE.MiningSchedulingDB); StringBuilder sb = new StringBuilder(); sb.Append("SELECT * FROM ( "); sb.Append("SELECT ROW_NUMBER() OVER(ORDER BY " + TunnelHChuanDbConstNames.ID + ") AS rowid, * "); sb.Append("FROM " + TunnelHChuanDbConstNames.TABLE_NAME + " ) AS TB "); sb.Append("WHERE rowid >= " + iStartIndex); sb.Append("AND rowid <= " + iEndIndex); DataSet ds = db.ReturnDS(sb.ToString()); return(ds); }
/// <summary> /// 分页用返回停采区所有信息 /// </summary> /// <returns>分页用停采区所有信息</returns> public static DataSet selectStopLineInfo(int iStartIndex, int iEndIndex) { ManageDataBase db = new ManageDataBase(DATABASE_TYPE.GeologyMeasureDB); StringBuilder sb = new StringBuilder(); sb.Append("SELECT * FROM ( "); sb.Append("SELECT ROW_NUMBER() OVER(ORDER BY " + StopLineDbConstNames.ID + ") AS rowid, * "); sb.Append("FROM " + StopLineDbConstNames.TABLE_NAME + " ) AS TB "); sb.Append("WHERE rowid >= " + iStartIndex); sb.Append("AND rowid <= " + iEndIndex); DataSet ds = db.ReturnDS(sb.ToString()); return(ds); }
/// <summary> /// load数据 /// </summary> private void loadData() { // TeeChart初期化 teechartInit(); // 重绘 tChart1.AutoRepaint = false; var sqlStr = "SELECT * FROM T_GAS_CONCENTRATION_PROBE_DATA WHERE RECORD_TIME > '" + _dateTimeStart.Text + "' AND RECORD_TIME < '" + _dateTimeEnd.Text + "' ORDER BY RECORD_TIME"; var db = new ManageDataBase(DATABASE_TYPE.GasEmissionDB); var ds = db.ReturnDS(sqlStr); // 禁止自动生成列(※位置不可变) _dgvData.AutoGenerateColumns = false; var sqlCnt = ds.Tables[0].Rows.Count; if (sqlCnt > 0) { // 重新设置X轴的最大值和最小值 fastLine1.GetHorizAxis.SetMinMax(Convert.ToDateTime(ds.Tables[0].Rows[0]["RECORD_TIME"]).ToOADate(), Convert.ToDateTime(ds.Tables[0].Rows[0]["RECORD_TIME"]).AddSeconds(120).ToOADate()); for (var i = 0; i < sqlCnt; i++) { var value = Convert.ToDouble(ds.Tables[0].Rows[i]["PROBE_VALUE"]); var time = Convert.ToDateTime(ds.Tables[0].Rows[i]["RECORD_TIME"]); //fastLine1.Add(time, value); fastLine1.Add(time, value); // 往DGV中填充数据 _dgvData.Rows.Add(value + "%", time); // 预警值 var dWarnValue = _WarnValue; // 当某点的Y坐标超过某一值时 if (value > dWarnValue) { _dgvData.Rows[_dgvData.Rows.Count - 1].DefaultCellStyle.BackColor = Color.Red; } } } // 重绘 tChart1.AutoRepaint = true; tChart1.Refresh(); }
getHistoryWarningResultDetails(string sWorkingface, string sDate, string sShift, string sWarningResult, string sWarningType, string sWarningItem) { string sqlStr = "SELECT * FROM " + PreWarningDetailsViewDbConstName.VIEW_NAME; sqlStr += " WHERE " + WorkingFaceDbConstNames.WORKINGFACE_NAME + " = '" + sWorkingface + "'"; if (!String.IsNullOrEmpty(sDate)) { sqlStr += " AND "; sqlStr += PreWarningResultDBConstNames.DATA_TIME + " BETWEEN '" + sDate + " 00:00:00:000' AND '" + sDate + " 23:59:59:000'"; } if (!String.IsNullOrEmpty(sShift)) { sqlStr += " AND "; sqlStr += PreWarningResultDBConstNames.DATE_SHIFT + " = '" + sShift + "'"; } if (!String.IsNullOrEmpty(sWarningResult)) { sqlStr += " AND "; sqlStr += PreWarningResultDBConstNames.WARNING_RESULT + " = '" + sWarningResult + "'"; } if (!String.IsNullOrEmpty(sWarningType)) { sqlStr += " AND "; sqlStr += PreWarningDetailsViewDbConstName.WARNING_TYPE_RULES + " = '" + sWarningType + "'"; } if (!String.IsNullOrEmpty(sWarningItem)) { sqlStr += " AND "; sqlStr += PreWarningRulesDbConstNames.RULE_TYPE + " = '" + sWarningItem + "'"; } ManageDataBase db = new ManageDataBase(DATABASE_TYPE.WarningManagementDB); DataTable dt = db.ReturnDS(sqlStr).Tables[0]; return(getDetailsListByDataTable(dt)); }