/// <summary> /// 将规则编码和参数信息更新至巷道信息表 /// 注意:当传入的参数为null时,说明该巷道未绑定规则编码,此时仍需更新数据库 /// </summary> /// <param name="tunnelID">巷道ID</param> /// <param name="info">巷道绑定的所有规则ID和参数信息</param> /// <returns>更新成功返回True</returns> public static bool UpdateRuleIdsAndParams2TunnelTable(int tunnelID, RuleInfo[] info) { string ruleIds = ""; string warningParams = ""; if (info != null) { int n = info.Length; for (int i = 0; i < n; i++) { RuleInfo cvtInfo = PreWarningRulesBLL.ConvertOneRuleCodeAndParamInfo2DBString(info[i]); ruleIds += cvtInfo.RuleCodesStr; warningParams += cvtInfo.ParamsInfoStr; } } string sql = "UPDATE " + TunnelInfoDbConstNames.TABLE_NAME + " SET " + TunnelInfoDbConstNames.RULE_IDS + "='" + ruleIds + "'," + TunnelInfoDbConstNames.PRE_WARNING_PARAMS + "='" + warningParams + "' WHERE " + TunnelInfoDbConstNames.ID + "=" + tunnelID; ManageDataBase db = new ManageDataBase(DATABASE_TYPE.GeologyMeasureDB); return(db.OperateDB(sql)); }
/// <summary> /// 通过部门名称修改部门信息记录 /// </summary> /// <param name="ent">部门信息实体</param> /// <param name="oldName">部门旧名称</param> /// <returns></returns> public static bool UpdateDepartmentInfomationDatabase(Department ent, string oldName) { StringBuilder strSql = new StringBuilder(); strSql.Append("UPDATE "); strSql.Append(DepartmentInformationManagemetDbConstNames.TABLE_NAME); strSql.Append(" SET "); strSql.Append(DepartmentInformationManagemetDbConstNames.DEPT_NAME + " = "); strSql.Append("'" + ent.Name + "',"); strSql.Append(DepartmentInformationManagemetDbConstNames.DEPT_TEL + " = "); strSql.Append("'" + ent.Tel + "',"); strSql.Append(DepartmentInformationManagemetDbConstNames.DEPT_EMAIL + " = "); strSql.Append("'" + ent.Email + "',"); strSql.Append(DepartmentInformationManagemetDbConstNames.DEPT_STAFF_COUNT + " = "); strSql.Append("'" + ent.Staff + "',"); strSql.Append(DepartmentInformationManagemetDbConstNames.DEPT_REMARKS + " = "); strSql.Append("'" + ent.Remark + "'"); strSql.Append(" WHERE "); strSql.Append(DepartmentInformationManagemetDbConstNames.DEPT_NAME + " = "); strSql.Append("'" + oldName + "'"); ManageDataBase database = new ManageDataBase(DATABASE_TYPE.WarningManagementDB); return(database.OperateDB(strSql.ToString())); }
/// <summary> /// 插入掘进巷道数据 /// </summary> /// <returns></returns> public static bool insertTunnelHC(TunnelHCEntityNew tunnelHCEntity) { ManageDataBase db = new ManageDataBase(DATABASE_TYPE.MiningSchedulingDB); StringBuilder sb = new StringBuilder(); sb.Append("INSERT INTO " + TunnelHCDbConstNames.TABLE_NAME + " (" + TunnelHCDbConstNames.TUNNEL_ID1 + "," + TunnelHCDbConstNames.TUNNEL_ID2 + "," + TunnelHCDbConstNames.TUNNEL_ID3 + "," + TunnelHCDbConstNames.TUNNEL_ID + "," + TunnelHCDbConstNames.TEAM_NAME_ID + "," + TunnelHCDbConstNames.START_DATE + "," + TunnelHCDbConstNames.IS_FINISH + "," + TunnelHCDbConstNames.STOP_DATE + "," + TunnelHCDbConstNames.WORK_STYLE + "," + TunnelHCDbConstNames.WORK_TIME + ") VALUES("); sb.Append(tunnelHCEntity.TunnelID_ZY + ","); sb.Append(tunnelHCEntity.TunnelID_FY + ","); sb.Append(tunnelHCEntity.TunnelID_KQY + ",'"); sb.Append(tunnelHCEntity.TunnelID + "','"); sb.Append(tunnelHCEntity.TeamNameID + "','"); sb.Append(tunnelHCEntity.StartDate + "',"); sb.Append(tunnelHCEntity.IsFinish + ",'"); sb.Append(tunnelHCEntity.StopDate + "','"); sb.Append(tunnelHCEntity.WorkStyle + "','"); sb.Append(tunnelHCEntity.WorkTime + "')"); bool bResult = db.OperateDB(sb.ToString()); setTunnelAsHC(tunnelHCEntity.TunnelID_ZY); setTunnelAsHC(tunnelHCEntity.TunnelID_FY); setTunnelAsHC(tunnelHCEntity.TunnelID_KQY); //其它巷道 string[] sArray = new string[10]; if (tunnelHCEntity.TunnelID != null) { sArray = tunnelHCEntity.TunnelID.Split(','); } foreach (string i in sArray) { int iTunnelID = Convert.ToInt16(i); setTunnelAsHC(iTunnelID); } return(bResult); }
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="workingFaceEntity"><工作面>实体</param> /// <returns>成功与否:true,false</returns> public static bool insertWorkingFaceInfo(WorkingFaceEntityNew workingFaceEntity) { StringBuilder sqlStr = new StringBuilder(); sqlStr.Append("INSERT INTO " + WorkingFaceDbConstNamesNew.TABLE_NAME); sqlStr.Append(" (" + WorkingFaceDbConstNamesNew.WORKINGFACE_NAME); sqlStr.Append(", " + WorkingFaceDbConstNamesNew.MININGAREA_ID); sqlStr.Append(", " + WorkingFaceDbConstNamesNew.COORDINATE_X); sqlStr.Append(", " + WorkingFaceDbConstNamesNew.COORDINATE_Y); sqlStr.Append(", " + WorkingFaceDbConstNamesNew.COORDINATE_Z); sqlStr.Append(", " + WorkingFaceDbConstNamesNew.BID); sqlStr.Append(" )"); sqlStr.Append(" VALUES ("); sqlStr.Append(" '" + workingFaceEntity.WorkingFaceName + "'"); sqlStr.Append(", '" + workingFaceEntity.MiningareaId + "'"); sqlStr.Append(", '" + workingFaceEntity.CoordinateX + "'"); sqlStr.Append(", '" + workingFaceEntity.CoordinateY + "'"); sqlStr.Append(", '" + workingFaceEntity.CoordinateZ + "'"); sqlStr.Append(", '" + workingFaceEntity.BID + "'"); sqlStr.Append(" )"); ManageDataBase db = new ManageDataBase(DATABASE_TYPE.GeologyMeasureDB); bool bResult = db.OperateDB(sqlStr.ToString()); return(bResult); }
/// <summary> /// 根据预警规则实体信息更新数据库中预警规则信息 /// </summary> /// <param name="ent"></param> /// <returns></returns> public static bool updateWarningRulesInfo(PreWarningRules ent) { string sql = "UPDATE " + PreWarningRulesDbConstNames.TABLE_NAME + " SET " + PreWarningRulesDbConstNames.RULE_CODE + "='" + ent.RuleCode + "'," + PreWarningRulesDbConstNames.RULE_TYPE + "='" + ent.RuleType + "'," + PreWarningRulesDbConstNames.WARNING_TYPE + "='" + ent.WarningType + "'," + PreWarningRulesDbConstNames.WARNING_LEVEL + "='" + ent.WarningLevel + "'," + PreWarningRulesDbConstNames.SUITABLE_LOCATION + "='" + ent.SuitableLocation + "'," + PreWarningRulesDbConstNames.RULE_DESCRIPTION + "='" + ent.RuleDescription + "'," + PreWarningRulesDbConstNames.INDICATOR_TYPE + "='" + ent.IndicatorType + "'," + PreWarningRulesDbConstNames.OPERATOR + "='" + ent.Operator + "'," + PreWarningRulesDbConstNames.MODIFY_DATE + "='" + ent.ModifyDate.ToString() + "', " +//MARK FIELD PreWarningRulesDbConstNames.REMARKS + "='" + ent.Remarks + "' " + " WHERE " + PreWarningRulesDbConstNames.RULE_ID + "=" + ent.RuleId.ToString(); ManageDataBase db = new ManageDataBase(DATABASE_TYPE.WarningManagementDB); bool ret = db.OperateDB(sql); //未添加更新巷道信息表的代码,参数中需要将参数名同时保存 //MARK YANGER return(ret); }
/// <summary> /// 通过用户组名更新记录 /// </summary> /// <param name="ent">用户组实体</param> /// <param name="oldName">用户组名称</param> /// <returns>是否更新成功</returns> public static bool UpdateUserGroupInfomationDatabase(UserGroup ent, string oldName) { StringBuilder strSql = new StringBuilder(); strSql.Append("UPDATE "); strSql.Append(UserGroupInformationMangementDbConstNames.TABLE_NAME); strSql.Append(" SET "); strSql.Append(UserGroupInformationMangementDbConstNames.USER_GROUP_NAME + " = "); strSql.Append("'" + ent.GroupName + "',"); strSql.Append(UserGroupInformationMangementDbConstNames.USER_GROUP_STAFF_COUNT + " = "); strSql.Append("'" + ent.UserCount + "',"); strSql.Append(UserGroupInformationMangementDbConstNames.USER_GROUP_REMARKS + " = "); strSql.Append("'" + ent.Remark + "'"); strSql.Append(" WHERE "); strSql.Append(UserGroupInformationMangementDbConstNames.USER_GROUP_NAME + " = "); strSql.Append("'" + oldName + "'"); ManageDataBase database = new ManageDataBase(DATABASE_TYPE.WarningManagementDB); return(database.OperateDB(strSql.ToString())); }
/// <summary> /// 处理地质构造信息 /// </summary> /// <param name="geologySpaceEntity"></param> /// <returns></returns> public static bool ProcGeologySpaceEntityInfo(GeologySpaceEntityNew geologySpaceEntity) { ManageDataBase db = new ManageDataBase(DATABASE_TYPE.MiningSchedulingDB); StringBuilder sb = new StringBuilder(); sb.Append("SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;"); sb.Append("BEGIN TRANSACTION;"); sb.Append("IF EXISTS( SELECT * FROM T_GEOLOGY_SPACE WHERE "); sb.Append(GeologySpaceDbConstNamesNew.WORKFACE_ID + "=" + geologySpaceEntity.WorkSpaceID); sb.Append(" AND " + GeologySpaceDbConstNamesNew.TECTONIC_ID + "=" + geologySpaceEntity.TectonicID); sb.Append(" AND " + GeologySpaceDbConstNamesNew.TECTONIC_TYPE + "=" + geologySpaceEntity.TectonicType); sb.Append(" BEGIN "); sb.Append(" UPDATE " + GeologySpaceDbConstNamesNew.TABLE_NAME + " SET "); sb.Append(GeologySpaceDbConstNamesNew.TECTONIC_DISTANCE + "=" + geologySpaceEntity.Distance); sb.Append("," + GeologySpaceDbConstNamesNew.DATE_TIME + "=" + geologySpaceEntity.onDateTime); sb.Append(" WHERE " + GeologySpaceDbConstNamesNew.WORKFACE_ID + "=" + geologySpaceEntity.WorkSpaceID); sb.Append(" AND " + GeologySpaceDbConstNamesNew.TECTONIC_ID + "=" + geologySpaceEntity.TectonicID); sb.Append(" AND " + GeologySpaceDbConstNamesNew.TECTONIC_TYPE + "=" + geologySpaceEntity.TectonicType + ";"); sb.Append(" END "); sb.Append(" ELSE "); sb.Append(" BEGIN "); sb.Append("INSERT INTO " + GeologySpaceDbConstNamesNew.TABLE_NAME + "(" + GeologySpaceDbConstNamesNew.WORKFACE_ID + "," + GeologySpaceDbConstNamesNew.TECTONIC_ID + "," + GeologySpaceDbConstNamesNew.TECTONIC_TYPE + "," + GeologySpaceDbConstNamesNew.TECTONIC_DISTANCE + "," + GeologySpaceDbConstNamesNew.DATE_TIME + ")VALUES("); sb.Append(geologySpaceEntity.WorkSpaceID + "," + geologySpaceEntity.TectonicID + "," + geologySpaceEntity.TectonicType + "," + geologySpaceEntity.Distance + ",'" + geologySpaceEntity.onDateTime + "');"); sb.Append(" END "); sb.Append("COMMIT TRANSACTION;"); bool bres = db.OperateDB(sb.ToString()); return(bres); }
/// <summary> /// 修改掘进巷道数据 /// </summary> /// <returns></returns> public static bool updateTunnelHChuan(TunnelHChuanEntity tunnelHChuanEntity) { clearTunnelTypeOfHChuan(tunnelHChuanEntity.ID); ManageDataBase db = new ManageDataBase(DATABASE_TYPE.MiningSchedulingDB); StringBuilder sb = new StringBuilder(); sb.Append("UPDATE " + TunnelHChuanDbConstNames.TABLE_NAME + " SET " + TunnelHChuanDbConstNames.TUNNEL_ID1 + " = "); sb.Append(tunnelHChuanEntity.TunnelID1 + "," + TunnelHChuanDbConstNames.TUNNEL_ID2 + " = "); sb.Append(tunnelHChuanEntity.TunnelID2 + "," + TunnelHChuanDbConstNames.TUNNEL_X1 + " = "); sb.Append(tunnelHChuanEntity.X_1 + "," + TunnelHChuanDbConstNames.TUNNEL_Y1 + " = "); sb.Append(tunnelHChuanEntity.Y_1 + "," + TunnelHChuanDbConstNames.TUNNEL_Z1 + " = "); sb.Append(tunnelHChuanEntity.Z_1 + "," + TunnelHChuanDbConstNames.TUNNEL_X2 + " = "); sb.Append(tunnelHChuanEntity.X_2 + "," + TunnelHChuanDbConstNames.TUNNEL_Y2 + " = "); sb.Append(tunnelHChuanEntity.Y_2 + "," + TunnelHChuanDbConstNames.TUNNEL_Z2 + " = "); sb.Append(tunnelHChuanEntity.Z_2 + "," + TunnelHChuanDbConstNames.TUNNEL_AZIMUTH + " = "); sb.Append(tunnelHChuanEntity.Azimuth + "," + TunnelHChuanDbConstNames.TEAM_NAME_ID + " = "); sb.Append(tunnelHChuanEntity.TeamNameID + "," + TunnelHChuanDbConstNames.START_DATE + "='"); sb.Append(tunnelHChuanEntity.StartDate + "'," + TunnelHChuanDbConstNames.IS_FINISH + "="); sb.Append(tunnelHChuanEntity.IsFinish + "," + TunnelHChuanDbConstNames.STOP_DATE + "='"); sb.Append(tunnelHChuanEntity.StopDate + "'," + TunnelHChuanDbConstNames.WORK_STYLE + "='"); sb.Append(tunnelHChuanEntity.WorkStyle + "'," + TunnelHChuanDbConstNames.WORK_TIME + "='"); sb.Append(tunnelHChuanEntity.WorkTime + "'," + TunnelHChuanDbConstNames.TUNNEL_STATE + " = '"); sb.Append(tunnelHChuanEntity.State + "' WHERE " + TunnelHChuanDbConstNames.ID + "="); sb.Append(tunnelHChuanEntity.ID); bool bResult = db.OperateDB(sb.ToString()); //setTunnelAsHChuan(tunnelHChuanEntity.TunnelID1); //setTunnelAsHChuan(tunnelHChuanEntity.TunnelID2); return(bResult); }
private static bool setTunnelAsHChuan(int tunnelID) { ManageDataBase db = new ManageDataBase(DATABASE_TYPE.GeologyMeasureDB); string sql = "UPDATE " + TunnelInfoDbConstNames.TABLE_NAME + " SET " + TunnelInfoDbConstNames.TUNNEL_TYPE + " = '" + TunnelHChuanDbConstNames.TUNNEL_TYPE + "' WHERE " + TunnelInfoDbConstNames.ID + " = " + tunnelID; bool bResult = db.OperateDB(sql); return(bResult); }
/// <summary> /// 删除停采线信息 /// </summary> /// <param name="stoplineEntity">停采线实体</param> /// <returns>是否成功删除?true:false</returns> public static bool deleteGeologySpaceEntityInfo(GeologySpaceEntityNew geologySpaceEntity) { ManageDataBase db = new ManageDataBase(DATABASE_TYPE.MiningSchedulingDB); string sql = "DELETE FROM " + GeologySpaceDbConstNamesNew.TABLE_NAME + " WHERE " + GeologySpaceDbConstNamesNew.TECTONIC_ID + " =" + geologySpaceEntity.TectonicID + " AND " + GeologySpaceDbConstNamesNew.TECTONIC_TYPE + "=" + geologySpaceEntity.TectonicType; bool bResult = db.OperateDB(sql); return(bResult); }
public static bool ClearPreWarningDB() { string sql = "TRUNCATE TABLE[" + PreWarningRulesDbConstNames.TABLE_NAME + "]"; ManageDataBase db = new ManageDataBase(DATABASE_TYPE.WarningManagementDB); return(db.OperateDB(sql)); }
/// <summary> /// 删除指定工作面的地质构造信息 /// </summary> /// <param name="workingFaceId">工作面ID</param> /// <returns></returns> public static bool DeleteGeologySpaceEntityInfos(int workingFaceId) { var db = new ManageDataBase(DATABASE_TYPE.MiningSchedulingDB); var sql = "DELETE FROM " + GeologySpaceDbConstNames.TABLE_NAME + " WHERE " + GeologySpaceDbConstNames.WORKFACE_ID + "=" + workingFaceId; var bResult = db.OperateDB(sql); return(bResult); }
/// <summary> /// 更改停采线信息 /// </summary> /// <param name="stopLineEntity">停采线实体</param> /// <returns>是否修改成功?true:false</returns> public static bool updateGeologySpaceEntityInfo(GeologySpaceEntityNew geologySpaceEntity) { ManageDataBase db = new ManageDataBase(DATABASE_TYPE.MiningSchedulingDB); StringBuilder sb = new StringBuilder(); sb.Append("UPDATE " + GeologySpaceDbConstNamesNew.TABLE_NAME + " SET " + GeologySpaceDbConstNamesNew.TECTONIC_DISTANCE + " = '"); sb.Append(geologySpaceEntity.Distance + " WHERE " + GeologySpaceDbConstNamesNew.TECTONIC_ID + "=" + geologySpaceEntity.TectonicID + " AND " + GeologySpaceDbConstNamesNew.TECTONIC_TYPE + "=" + geologySpaceEntity.TectonicType); bool bResult = db.OperateDB(sb.ToString()); return(bResult); }
InsertRecordIntoTableUserInformation(UserInformation ent) { //string sql = "insert into T_USER_INFO_MANAGEMENT values ('" + _txtLoginName.Text.ToString().Trim() + "','" // + _txtPassWord.Text.ToString().Trim() + "','" // + _cboGroup.Text.ToString().Trim() + "','" // + _cboDepartment.Text.ToString().Trim() + "','" // + _txtName.Text.ToString().Trim() + "','" // + _txtEmail.Text.ToString().Trim() + "','" // + _txtTel.Text.ToString().Trim() + "','" // + _txtPhoneNumber.Text.ToString().Trim() + "','" // + _rtxtRemark.Text.ToString().Trim() + "','" // + _cboPromission.Text.ToString().Trim() + "')"; //database.OperateDB(sql); StringBuilder strSql = new StringBuilder(); strSql.Append("insert into "); strSql.Append(UserInformationManagementDbConstNames.TABLE_NAME); strSql.Append(" values ("); strSql.Append("'" + LibEncryptDecrypt.DWEncryptDecryptClass.EncryptString(ent.LoginName) + "',"); strSql.Append("'" + LibEncryptDecrypt.DWEncryptDecryptClass.EncryptString(ent.PassWord) + "',"); strSql.Append("'" + LibEncryptDecrypt.DWEncryptDecryptClass.EncryptString(ent.Group) + "',"); strSql.Append("'" + LibEncryptDecrypt.DWEncryptDecryptClass.EncryptString(ent.Department) + "',"); strSql.Append("'" + LibEncryptDecrypt.DWEncryptDecryptClass.EncryptString(ent.Name) + "',"); strSql.Append("'" + LibEncryptDecrypt.DWEncryptDecryptClass.EncryptString(ent.Email) + "',"); strSql.Append("'" + LibEncryptDecrypt.DWEncryptDecryptClass.EncryptString(ent.Tel) + "',"); strSql.Append("'" + LibEncryptDecrypt.DWEncryptDecryptClass.EncryptString(ent.Phone) + "',"); strSql.Append("'" + LibEncryptDecrypt.DWEncryptDecryptClass.EncryptString(ent.Remark) + "',"); strSql.Append("'" + LibEncryptDecrypt.DWEncryptDecryptClass.EncryptString(ent.Permission) + "')"); ManageDataBase database = new ManageDataBase(DATABASE_TYPE.WarningManagementDB); return(database.OperateDB(strSql.ToString())); }
/// <summary> /// <工作面>信息删除 /// </summary> /// <param name="iWorkingFaceId">删除数据主键</param> /// <returns>成功与否:true,false</returns> public static bool deleteWorkingFaceInfo(int iWorkingFaceId) { StringBuilder sqlStr = new StringBuilder(); sqlStr.Append("DELETE FROM " + WorkingFaceDbConstNames.TABLE_NAME); sqlStr.Append(" WHERE " + WorkingFaceDbConstNames.WORKINGFACE_ID + " = " + iWorkingFaceId); ManageDataBase db = new ManageDataBase(DATABASE_TYPE.GeologyMeasureDB); bool bResult = db.OperateDB(sqlStr.ToString()); return(bResult); }
/// <summary> /// 删除回采巷道数据 /// </summary> /// <returns></returns> public static bool deleteTunnelHChuan(TunnelHChuanEntity tunnelHChuanEntity) { ManageDataBase db = new ManageDataBase(DATABASE_TYPE.MiningSchedulingDB); string sql = "DELETE FROM " + TunnelHChuanDbConstNames.TABLE_NAME + " WHERE " + TunnelHChuanDbConstNames.ID + " = " + tunnelHChuanEntity.ID; bool bResult = db.OperateDB(sql); if (bResult) { clearTunnelTypeOfHChuan(tunnelHChuanEntity.ID); } return(bResult); }
/// <summary> /// 通过ID删除用户信息记录 /// </summary> /// <param name="name">ID</param> /// <returns>删除成功,返回True</returns> public static bool DeleteUserLoginInformationByID(int id) { StringBuilder strSql = new StringBuilder(); strSql.Append("DELETE 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); return(database.OperateDB(strSql.ToString())); }
public static void DeleteWarningImgWithWarningIdAndFileName(string warningId, string fileName) { string sqlStr = "DELETE " + WarningImgDbConstNames.TABLE_NAME; sqlStr += " WHERE " + WarningImgDbConstNames.WARNING_ID + " LIKE '%" + warningId + "%'"; sqlStr += " AND " + WarningImgDbConstNames.IMG_FILENAME + "='" + fileName + "'"; ManageDataBase db = new ManageDataBase(DATABASE_TYPE.WarningManagementDB); db.OperateDB(sqlStr); }
/// <summary> /// 通过部门名删除记录 /// </summary> /// <param name="deptName"></param> /// <returns></returns> public static bool DeleteDeptInformationByDeptName(string deptName) { StringBuilder strSql = new StringBuilder(); strSql.Append("DELETE FROM "); strSql.Append(DepartmentInformationManagemetDbConstNames.TABLE_NAME); strSql.Append(" WHERE "); strSql.Append(DepartmentInformationManagemetDbConstNames.DEPT_NAME); strSql.Append(" = "); strSql.Append("'" + deptName + "'"); ManageDataBase database = new ManageDataBase(DATABASE_TYPE.WarningManagementDB); return(database.OperateDB(strSql.ToString())); }
/// <summary> /// <煤层>信息删除 /// </summary> /// <param name="iCoalSeamsId">删除数据主键</param> /// <returns>成功与否:true,false</returns> public static bool deleteCoalSeamsInfo(int iCoalSeamsId) { StringBuilder sqlStr = new StringBuilder(); sqlStr.Append("DELETE FROM " + CoalSeamsDbConstNames.TABLE_NAME); sqlStr.Append(" WHERE " + CoalSeamsDbConstNames.COAL_SEAMS_ID + " = " + iCoalSeamsId); ManageDataBase db = new ManageDataBase(DATABASE_TYPE.GeologyMeasureDB); bool bResult = db.OperateDB(sqlStr.ToString()); return(bResult); }
InsertRecordIntoTableUserGroupInformation(UserGroup ent) { StringBuilder strSql = new StringBuilder(); strSql.Append("INSERT INTO "); strSql.Append(UserGroupInformationMangementDbConstNames.TABLE_NAME); strSql.Append(" VALUES ("); strSql.Append("'" + ent.GroupName + "',"); strSql.Append(ent.UserCount + ","); strSql.Append("'" + ent.Remark + "',"); strSql.Append("'" + ent.Permission + "')"); ManageDataBase database = new ManageDataBase(DATABASE_TYPE.WarningManagementDB); return(database.OperateDB(strSql.ToString())); }
/// <summary> /// 插入新的部门信息记录 /// </summary> /// <param name="ent"></param> /// <returns></returns> public static bool InsertDeptInfoIntoTable(Department ent) { ManageDataBase database = new ManageDataBase(DATABASE_TYPE.WarningManagementDB); StringBuilder strSql = new StringBuilder(); strSql.Append("INSERT INTO "); strSql.Append(DepartmentInformationManagemetDbConstNames.TABLE_NAME); strSql.Append(" VALUES ("); strSql.Append("'" + ent.Name + "',"); strSql.Append("'" + ent.Tel + "',"); strSql.Append("'" + ent.Email + "',"); strSql.Append("'" + ent.Staff + "',"); strSql.Append("'" + ent.Remark + "')"); return(database.OperateDB(strSql.ToString())); }
/// <summary> /// 通过组名删除用户组记录 /// </summary> /// <param name="groupName">用户组名称</param> /// <returns>是否删除成功</returns> public static bool DeleteUserGroupInformationByGroupName(string groupName) { StringBuilder strSql = new StringBuilder(); strSql.Append("DELETE FROM "); strSql.Append(UserGroupInformationMangementDbConstNames.TABLE_NAME); strSql.Append(" WHERE "); strSql.Append(UserGroupInformationMangementDbConstNames.USER_GROUP_NAME); strSql.Append(" = "); strSql.Append("'" + groupName + "'"); ManageDataBase database = new ManageDataBase(DATABASE_TYPE.WarningManagementDB); return(database.OperateDB(strSql.ToString())); }
/// <summary> /// 修改用户详细信息中的部门 /// </summary> /// <param name="deptName"></param> /// <returns></returns> public static bool UpdateUserInformationWhenDeleteDept(string deptName) { ManageDataBase database = new ManageDataBase(DATABASE_TYPE.WarningManagementDB); StringBuilder strSql = new StringBuilder(); strSql.Append("UPDATE "); strSql.Append(UserInformationDetailsManagementDbConstNames.TABLE_NAME); strSql.Append(" SET "); strSql.Append(UserInformationDetailsManagementDbConstNames.USER_DEPARTMENT); strSql.Append(" = '' WHERE "); strSql.Append(UserInformationDetailsManagementDbConstNames.USER_DEPARTMENT); strSql.Append("="); strSql.Append("'" + deptName + "'"); return(database.OperateDB(strSql.ToString())); }
/// <summary> /// <煤层>信息修改 /// </summary> /// <param name="mineEntity"><煤层>实体</param> /// <returns>成功与否:true,false</returns> public static bool updateCoalSeamsInfo(CoalSeams coalSeamsEntity) { StringBuilder sqlStr = new StringBuilder(); sqlStr.Append("UPDATE " + CoalSeamsDbConstNames.TABLE_NAME); sqlStr.Append(" SET"); sqlStr.Append(" " + CoalSeamsDbConstNames.COAL_SEAMS_NAME + " = '" + coalSeamsEntity.CoalSeamsName + "'"); sqlStr.Append(" WHERE " + CoalSeamsDbConstNames.COAL_SEAMS_ID + " = " + coalSeamsEntity.CoalSeamsId); ManageDataBase db = new ManageDataBase(DATABASE_TYPE.GeologyMeasureDB); bool bResult = db.OperateDB(sqlStr.ToString()); return(bResult); }
/// <summary> /// 删除登录用户信息中用户组的值 /// </summary> /// <param name="groupName">用户组名称</param> /// <returns>是否更新成功</returns> public static bool UpdateUserInformationWhenDeleteGroup(string groupName) { ManageDataBase database = new ManageDataBase(DATABASE_TYPE.WarningManagementDB); StringBuilder strSql = new StringBuilder(); strSql.Append("UPDATE "); strSql.Append(LoginFormDbConstNames.TABLE_NAME); strSql.Append(" SET "); strSql.Append(LoginFormDbConstNames.USER_GROUP_NAME); strSql.Append(" = '' WHERE "); strSql.Append(LoginFormDbConstNames.USER_GROUP_NAME); strSql.Append("="); strSql.Append("'" + groupName + "'"); return(database.OperateDB(strSql.ToString())); }
/// <summary> /// 更新某个用户组的成员数量 /// </summary> /// <param name="groupName"></param> public static void UpdateUserCountFromUserGroup(string groupName) { int iCount = GetUserCountFromUserGroup(groupName); ManageDataBase database = new ManageDataBase(DATABASE_TYPE.WarningManagementDB); StringBuilder strSql = new StringBuilder(); strSql.Append("UPDATE "); strSql.Append(UserGroupInformationMangementDbConstNames.TABLE_NAME); strSql.Append(" SET "); strSql.Append(UserGroupInformationMangementDbConstNames.USER_GROUP_STAFF_COUNT); strSql.Append(" = " + iCount + " WHERE "); strSql.Append(UserGroupInformationMangementDbConstNames.USER_GROUP_NAME); strSql.Append("="); strSql.Append("'" + groupName + "'"); database.OperateDB(strSql.ToString()); }
private void _btnOK_Click(object sender, EventArgs e) { string strSelUser = "******""; for (int i = 0; i < _dgrvdUserInfo.SelectedRows.Count; i++) { if (_dgrvdUserInfo.SelectedRows[i].Cells[0] == null) { continue; } if (i == _dgrvdUserInfo.SelectedRows.Count - 1) { strSelUser += _dgrvdUserInfo.SelectedRows[i].Cells[0].Value.ToString() + "\""; } else { strSelUser += _dgrvdUserInfo.SelectedRows[i].Cells[0].Value.ToString() + "\"、\""; } } string strSelGroup = ""; if (_dgrvdGroupInfo.SelectedRows[0].Cells[0] != null) { strSelGroup = _dgrvdGroupInfo.SelectedRows[0].Cells[0].Value.ToString(); } string strQuestion = "确定将用户(" + strSelUser + ")\n添加到用户组(\"" + strSelGroup + "\")中吗?"; if (MessageBox.Show(strQuestion, "提示:", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) { for (int i = 0; i < _dgrvdUserInfo.SelectedRows.Count; i++) { if (_dgrvdUserInfo.SelectedRows[i].Cells[0] == null) { continue; } string sqlInsert = "UPDATE T_USER_INFO_MANAGEMENT SET usergroup = '" + strSelGroup + "' WHERE loginname = '" + _dgrvdUserInfo.SelectedRows[i].Cells[0].Value.ToString() + "'"; database.OperateDB(sqlInsert); } if (MessageBox.Show(@"操作成功,是否继续?", "提示:", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes) { this.Close(); } } }
/// <summary> /// <煤层>信息登录 /// </summary> /// <param name="coalSeamsEntity"><煤层>实体</param> /// <returns>成功与否:true,false</returns> public static bool insertCoalSeamsInfo(CoalSeams coalSeamsEntity) { StringBuilder sqlStr = new StringBuilder(); sqlStr.Append("INSERT INTO " + CoalSeamsDbConstNames.TABLE_NAME); sqlStr.Append(" (" + CoalSeamsDbConstNames.COAL_SEAMS_NAME); sqlStr.Append(" )"); sqlStr.Append(" VALUES ("); sqlStr.Append(" '" + coalSeamsEntity.CoalSeamsName + "'"); sqlStr.Append(" )"); ManageDataBase db = new ManageDataBase(DATABASE_TYPE.GeologyMeasureDB); bool bResult = db.OperateDB(sqlStr.ToString()); return(bResult); }