public static List<MEOMSS_discipline_new> FindAll(string sql) { OracleDatabase db = new OracleDatabase(DataAccess.OIDSConnStr); //OracleDatabase db = new OracleDatabase(UserSecurity.ConnectionString); DbCommand cmd = db.GetSqlStringCommand(sql); return EntityBase<MEOMSS_discipline_new>.DReaderToEntityList(db.ExecuteReader(cmd)); }
/// <summary> /// ��������Project�б� /// </summary> /// <returns></returns> public static List<ReasonCode> FindAll() { OracleDatabase db = new OracleDatabase(DataAccess.IFSConnStr); // Database db = DatabaseFactory.CreateDatabase("ifsConnection"); string sql = "SELECT * FROM IFSAPP.YRS_REQUISITION_REASON_TAB"; DbCommand cmd = db.GetSqlStringCommand(sql); return EntityBase<ReasonCode>.DReaderToEntityList(db.ExecuteReader(cmd)); }
/// <summary> /// ��������Project�б� /// </summary> /// <returns></returns> public static DataSet FindUnitDataset() { OracleDatabase db = new OracleDatabase(DataAccess.IFSConnStr); // Database db = DatabaseFactory.CreateDatabase("ifsConnection"); string sql = "SELECT UNIT_CODE from IFSAPP.ISO_UNIT"; DbCommand cmd = db.GetSqlStringCommand(sql); return db.ExecuteDataSet(cmd); }
/// <summary> /// ����Ȩ��ID���Ȩ����Ϣ /// </summary> /// <param name="id"></param> /// <returns></returns> public static Privilege Find(int id) { OracleDatabase db = new OracleDatabase(DataAccess.OIDSConnStr); string sql = "SELECT * FROM PLM.PRIVILEGE_TAB WHERE PRIVILEGE_ID=:id"; DbCommand cmd = db.GetSqlStringCommand(sql); db.AddInParameter(cmd, "id", DbType.Int32, id); return Populate(db.ExecuteReader(cmd)); }
/// <summary> /// ����Ȩ�ޱ�ʶ�����Ȩ����Ϣ /// </summary> /// <param name="flag"></param> /// <returns></returns> public static Privilege Find(string flag) { OracleDatabase db = new OracleDatabase(DataAccess.OIDSConnStr); string sql = "SELECT * FROM PLM.PRIVILEGE_TAB WHERE PRIVILEGE_FLAG=:flag"; DbCommand cmd = db.GetSqlStringCommand(sql); db.AddInParameter(cmd, "flag", DbType.String, flag); return Populate(db.ExecuteReader(cmd)); }
/// <summary> /// ��������Project�б� /// </summary> /// <returns></returns> public static List<project> FindAll() { OracleDatabase db = new OracleDatabase(DataAccess.IFSConnStr); // Database db = DatabaseFactory.CreateDatabase("ifsConnection"); string sql = "SELECT * FROM IFSAPP.PROJECT"; DbCommand cmd = db.GetSqlStringCommand(sql); return EntityBase<project>.DReaderToEntityList(db.ExecuteReader(cmd)); }
/// <summary> /// ����ERPID��ȡ��Ӧ��ECDMSID /// </summary> /// <param name="id"></param> /// <returns></returns> public static string FindECDMSID(string id) { //Database db = DatabaseFactory.CreateDatabase(); OracleDatabase db = new OracleDatabase(DataAccess.OIDSConnStr); string sql = "SELECT ECDMSID FROM plm.PROJECT_RELATION_TAB WHERE ERPid=:id"; DbCommand cmd = db.GetSqlStringCommand(sql); db.AddInParameter(cmd, "id", DbType.String, id); return Convert.ToString(db.ExecuteScalar(cmd)); }
public static string FindDesc(string id) { //Database db = DatabaseFactory.CreateDatabase(); OracleDatabase db = new OracleDatabase(DataAccess.IFSConnStr); string sql = "SELECT DESCRIPTION FROM IFSAPP.YRS_REQUISITION_REASON_TAB WHERE REASON_CODE=:id"; DbCommand cmd = db.GetSqlStringCommand(sql); db.AddInParameter(cmd, "id", DbType.String, id); return Convert.ToString(db.ExecuteScalar(cmd)); }
public static Unit Find(string id) { //Database db = DatabaseFactory.CreateDatabase(); OracleDatabase db = new OracleDatabase(DataAccess.IFSConnStr); string sql = "SELECT UNIT_CODE FROM IFSAPP.ISO_UNIT WHERE UNIT_CODE=:id"; DbCommand cmd = db.GetSqlStringCommand(sql); db.AddInParameter(cmd, "id", DbType.String, id); return Populate(db.ExecuteReader(cmd)); }
/// <summary> /// ����Ȩ�ޱ�ʶ���ж��Ƿ���ڴ�Ȩ�� /// </summary> /// <param name="flag"></param> /// <returns></returns> public static bool Exist(string flag) { OracleDatabase db = new OracleDatabase(DataAccess.OIDSConnStr); string sql = "SELECT PRIVILEGE_FLAG FROM PLM.PRIVILEGE_TAB WHERE PRIVILEGE_FLAG=:flag"; DbCommand cmd = db.GetSqlStringCommand(sql); db.AddInParameter(cmd, "flag", DbType.String, flag); object ret = db.ExecuteScalar(cmd); return (ret == null || ret == DBNull.Value) ? false : true; }
public static SubProject Find(string id) { //Database db = DatabaseFactory.CreateDatabase(); OracleDatabase db = new OracleDatabase(DataAccess.IFSConnStr); string sql = "SELECT * FROM IFSAPP.SUB_PROJECT WHERE project_id=:id"; DbCommand cmd = db.GetSqlStringCommand(sql); db.AddInParameter(cmd, "id", DbType.String, id); return Populate(db.ExecuteReader(cmd)); }
public static ReasonCode Find(string id) { OracleDatabase db = new OracleDatabase(DataAccess.IFSConnStr); //Database db = DatabaseFactory.CreateDatabase(); //OracleDatabase db = new OracleDatabase(UserSecurity.ConnectionString); string sql = "SELECT * FROM IFSAPP.YRS_REQUISITION_REASON_TAB WHERE REASON_CODE=:id"; DbCommand cmd = db.GetSqlStringCommand(sql); db.AddInParameter(cmd, "id", DbType.String, id); return Populate(db.ExecuteReader(cmd)); }
/// <summary> /// �жϽ�ɫ�Ƿ���� /// </summary> /// <param name="roleName"></param> /// <returns></returns> public static bool Available(string roleName) { OracleDatabase db = new OracleDatabase(DataAccess.OIDSConnStr); string sql = "SELECT STATE FROM PLM.ROLE_TAB WHERE ROLENAME=:rolename"; DbCommand cmd = db.GetSqlStringCommand(sql); db.AddInParameter(cmd, "rolename", DbType.String, roleName); object state = db.ExecuteScalar(cmd); if (state == null || state == DBNull.Value) return false; return state.ToString().ToUpper() == RoleState.NORMAL.ToString(); }
/// <summary> /// ��ӽ�ɫ��Ȩ�� /// </summary> /// <param name="roleName">��ɫ����</param> /// <param name="privilegeId">Ȩ��ID</param> /// <param name="projectIDs">��ĿID����</param> /// <returns></returns> public static int AddPrivilege(string roleName, int privilegeId, string projectIDs) { string sql = "INSERT INTO PLM.ROLEINPRIVILEGE_TAB (ROLENAME, PRIVILEGE_ID, PROJECT_ID) VALUES (:rolename, :privilegeid, :projectids)"; OracleDatabase db = new OracleDatabase(DataAccess.OIDSConnStr); DbCommand cmd = db.GetSqlStringCommand(sql); db.AddInParameter(cmd, "rolename", DbType.String, roleName); db.AddInParameter(cmd, "privilegeid", DbType.Int32, privilegeId); db.AddInParameter(cmd, "projectids", DbType.String, projectIDs); return db.ExecuteNonQuery(cmd); }
/// <summary> /// 查看是否存在修改通知单 /// </summary> /// <param name="pid"></param> /// <param name="drawingno"></param> /// <returns></returns> public static bool ExistModifyDrawing(string pid, string drawingno) { OracleDatabase db = new OracleDatabase(DataAccess.OIDSConnStr); string sql = "select t.modifydrawings from plm.SP_CREATEPDFDRAWING t where t.projectid='" + pid + "' and t.drawingno='" + drawingno + "' and t.FRONTPAGE is not null AND t.FLAG = 'Y'"; DbCommand cmd = db.GetSqlStringCommand(sql); object ret = db.ExecuteScalar(cmd); if (ret == null || ret == DBNull.Value) return false; return true; }
/// <summary> /// 查看合并生成图纸表中是否存在该项 /// </summary> /// <param name="pid"></param> /// <param name="drawingno"></param> /// <returns></returns> public static bool ExistInfo(string pid,string drawingno) { OracleDatabase db = new OracleDatabase(DataAccess.OIDSConnStr); string sql = "select count(*) from plm.SP_CREATEPDFDRAWING t where t.projectid='"+pid+"' and t.drawingno='"+drawingno+"' AND t.FLAG = 'Y'"; DbCommand cmd = db.GetSqlStringCommand(sql); object ret = db.ExecuteScalar(cmd); int num = Convert.ToInt32(ret); if (num==0) return false; return true; }
/// <summary> /// �ڵ��Ƿ��и�Ȩ������ /// </summary> /// <returns></returns> public static bool ExistPrivilege(int privilegeid,int nodeid) { OracleDatabase db = new OracleDatabase(DataAccess.OIDSConnStr); //OracleDatabase db = new OracleDatabase(UserSecurity.ConnectionString); string sql = "SELECT * FROM PLM.PRIVILEGE_NODE_TAB WHERE PRIVILEGE_ID=:privilegeid AND NODE_ID=:nodeid"; DbCommand cmd = db.GetSqlStringCommand(sql); db.AddInParameter(cmd, "privilegeid", DbType.Int32, privilegeid); db.AddInParameter(cmd, "nodeid", DbType.Int32, nodeid); object ret = db.ExecuteScalar(cmd); if (ret == null || ret == DBNull.Value) return false; return true; }
/// <summary> /// ��ӽ�ɫ�̳� /// </summary> /// <param name="roleName"></param> /// <param name="inheritRoleName"></param> /// <returns></returns> public static void AddInherit(string roleName, string[] inheritRoleName) { string sql = "INSERT INTO PLM.ROLEINHERIT_TAB (ROLENAME, INHERITNAME) VALUES (:rolename, :inheritname)"; OracleDatabase db = new OracleDatabase(DataAccess.OIDSConnStr); DbCommand cmd = db.GetSqlStringCommand(sql); db.AddInParameter(cmd, "rolename", DbType.String, roleName); foreach (string inheritName in inheritRoleName) { if (inheritName == string.Empty) continue; if (cmd.Parameters.Contains("inheritname")) cmd.Parameters.RemoveAt("inheritname"); db.AddInParameter(cmd, "inheritname", DbType.String, inheritName); db.ExecuteNonQuery(cmd); } }
/// <summary> /// ��øĽڵ����е�Ȩ��id /// </summary> /// <param name="nodeid"></param> /// <returns></returns> public static List<int> GetPrivilegeIds(int nodeid) { List<int> privilegeids=new List<int>(); OracleDatabase db = new OracleDatabase(DataAccess.OIDSConnStr); //Database db = DatabaseFactory.CreateDatabase("oidsConnection"); string sql = "SELECT PRIVILEGE_ID FROM PRIVILEGE_NODE_TAB WHERE NODE_ID=:nodeid ORDER BY PRIVILEGE_ID"; DbCommand cmd = db.GetSqlStringCommand(sql); db.AddInParameter(cmd, "nodeid", DbType.Int32, nodeid); using (IDataReader dr = db.ExecuteReader(cmd)) { while (dr.Read()) { privilegeids.Add(Convert.ToInt32(dr[0])); } dr.Close(); } return privilegeids; }
/// <summary> /// ���ݽ�ɫ��ͼֽ��Ż�ȡ�Ƿ�������ʱ�ʶ /// </summary> /// <param name="roleName"></param> /// <param name="drawingId"></param> /// <returns></returns> public static string DrawingAllowedFlag(string roleName, int drawingId) { OracleDatabase db = new OracleDatabase(DataAccess.OIDSConnStr); string sql = "SELECT ALLOW_FLAG FROM PLM.ROLEINDRAWING_TAB WHERE ROLENAME=:rolename AND DRAWING_ID=:drawingid"; DbCommand cmd = db.GetSqlStringCommand(sql); db.AddInParameter(cmd, "rolename", DbType.String, roleName); db.AddInParameter(cmd, "drawingid", DbType.Int32, drawingId); object allowFlag = db.ExecuteScalar(cmd); if (allowFlag == DBNull.Value || allowFlag == null) return string.Empty; return allowFlag.ToString(); }
/// <summary> /// ������������Ŀ�µ�����Ŀ�б� /// </summary> /// <returns></returns> public static DataSet FindSub2ProjectsDs(string id, string subId) { OracleDatabase db = new OracleDatabase(DataAccess.IFSConnStr); // Database db = DatabaseFactory.CreateDatabase("ifsConnection"); string sql = " SELECT * FROM IFSAPP.SUB_PROJECT T WHERE T.PROJECT_ID = :id AND T.PARENT_SUB_PROJECT_ID =:subId ORDER BY t.sub_project_id"; DbCommand cmd = db.GetSqlStringCommand(sql); db.AddInParameter(cmd, "id", DbType.String, id); db.AddInParameter(cmd, "subId", DbType.String, subId); return db.ExecuteDataSet(cmd); }
/// <summary> /// ��������Project�б� /// </summary> /// <returns></returns> public static DataSet FindReasonDataset() { OracleDatabase db = new OracleDatabase(DataAccess.IFSConnStr); //Database db = DatabaseFactory.CreateDatabase("ifsConnection"); string sql = "SELECT * FROM IFSAPP.YRS_REQUISITION_REASON_TAB"; DbCommand cmd = db.GetSqlStringCommand(sql); return db.ExecuteDataSet(cmd); }
/// <summary> /// ���Ľ�ɫ��״̬ /// </summary> /// <returns></returns> public static int UpdateState(string roleName, RoleState us) { //OracleDatabase db = new OracleDatabase(UserSecurity.ConnectionString); OracleDatabase db = new OracleDatabase(DataAccess.OIDSConnStr); string sql = "UPDATE PLM.ROLE_TAB SET STATE=:state WHERE LOWER(ROLENAME)=:rolename"; DbCommand cmd = db.GetSqlStringCommand(sql); db.AddInParameter(cmd, "state", DbType.String, us.ToString()); db.AddInParameter(cmd, "rolename", DbType.String, roleName.ToLower()); return db.ExecuteNonQuery(cmd); }
/// <summary> /// ������������Ŀ�б� /// </summary> /// <returns></returns> public static List<SubProject> FindAll(string id) { OracleDatabase db = new OracleDatabase(DataAccess.IFSConnStr); //Database db = DatabaseFactory.CreateDatabase("ifsConnection"); string sql = "SELECT * FROM IFSAPP.SUB_PROJECT T WHERE T.PROJECT_ID =:id AND T.PARENT_SUB_PROJECT_ID IS NULL ORDER BY t.sub_project_id"; DbCommand cmd = db.GetSqlStringCommand(sql); db.AddInParameter(cmd, "id", DbType.String, id); return EntityBase<SubProject>.DReaderToEntityList(db.ExecuteReader(cmd)); }
/// <summary> /// ����PROJECTNAME��ȡ��Ӧ��ERP����ĿID /// </summary> /// <param name="id"></param> /// <returns></returns> public static string FindERPID(string id) { //Database db = DatabaseFactory.CreateDatabase(); OracleDatabase db = new OracleDatabase(DataAccess.OIDSConnStr); string sql = "SELECT ERPID FROM plm.project_relation_view WHERE projectname_db=:id"; DbCommand cmd = db.GetSqlStringCommand(sql); db.AddInParameter(cmd, "id", DbType.String, id); return Convert.ToString(db.ExecuteScalar(cmd)); }
/// <summary> /// ��������Project�б� /// </summary> /// <returns></returns> public static DataSet FindProDataset() { OracleDatabase db = new OracleDatabase(DataAccess.IFSConnStr); //Database db = DatabaseFactory.CreateDatabase("ifsConnection"); string sql = "SELECT * FROM IFSAPP.PROJECT where project_id in ('YRO-06-194','YRO-06-209','YRO-197-C', 'YRO-06-201','YRO-07-218','YRO-07-233','YRO-07-211', 'YRO-06-206','YRO-11-266','YCRO11-256','YRO-11MA20','YRO-06-195','YRO-07-212','YRO-11-267', 'YRO-06-196','YRO-11-264','YRO-11-265') order by project_id"; DbCommand cmd = db.GetSqlStringCommand(sql); return db.ExecuteDataSet(cmd); }
public static string FindSiteName(string id) { //Database db = DatabaseFactory.CreateDatabase(); OracleDatabase db = new OracleDatabase(DataAccess.IFSConnStr); string sql = "SELECT CONTRACT_REF FROM IFSAPP.site_tab WHERE CONTRACT=:id"; DbCommand cmd = db.GetSqlStringCommand(sql); db.AddInParameter(cmd, "id", DbType.String, id); return Convert.ToString(db.ExecuteScalar(cmd)); }
/// <summary> /// ��������Site�б� /// </summary> /// <returns></returns> public static DataSet FindSiteDataset() { OracleDatabase db = new OracleDatabase(DataAccess.IFSConnStr); // Database db = DatabaseFactory.CreateDatabase("ifsConnection"); string sql = "SELECT * FROM IFSAPP.site_tab"; DbCommand cmd = db.GetSqlStringCommand(sql); return db.ExecuteDataSet(cmd); }
/// <summary> /// ������������Ŀ�б� /// </summary> /// <returns></returns> public static DataSet FindAllSubPro(string id) { OracleDatabase db = new OracleDatabase(DataAccess.IFSConnStr); //Database db = DatabaseFactory.CreateDatabase("ifsConnection"); string sql = "SELECT t.project_id, t.sub_project_id,nvl(parent_sub_project_id,'0') parent_sub_project_id,t.description FROM IFSAPP.SUB_PROJECT T WHERE T.PROJECT_ID =:id ORDER BY t.sub_project_id"; DbCommand cmd = db.GetSqlStringCommand(sql); db.AddInParameter(cmd, "id", DbType.String, id); return db.ExecuteDataSet(cmd); }
public static string FindName(string id) { //Database db = DatabaseFactory.CreateDatabase(); OracleDatabase db = new OracleDatabase(DataAccess.IFSConnStr); string sql = "SELECT description FROM IFSAPP.PROJECT WHERE project_id=:id"; DbCommand cmd = db.GetSqlStringCommand(sql); db.AddInParameter(cmd, "id", DbType.String, id); return Convert.ToString (db.ExecuteScalar(cmd)); }