Exemplo n.º 1
0
        public enuResourceState GetMeetingResourceState(string strResourceID)
        {
            // Quick error checks
            if (strResourceID == null || strResourceID.Length == 0)
            {
                throw new ArgumentException("Invalid resource ID", "strResourceID");
            }

            OdbcDataReader   dr    = null;
            enuResourceState state = new enuResourceState();

            try
            {
                StringBuilder strQueryBuilder = new StringBuilder();
                strQueryBuilder.Append(" SELECT ");
                strQueryBuilder.Append(Constants.RES_STATE);
                strQueryBuilder.Append(" FROM ");
                strQueryBuilder.Append(Constants.MEETING_RESOURCES_TABLENAME);
                strQueryBuilder.Append(" WHERE ");
                strQueryBuilder.Append(Constants.RES_ID);
                strQueryBuilder.Append("=");
                strQueryBuilder.Append("'" + QueryService.MakeQuotesafe(strResourceID) + "'");

                dr = QueryService.ExecuteReader(this.DBConnect, strQueryBuilder.ToString());

                if (dr == null)
                {
                    throw new Exception("Null data reader returned from query");
                }

                // Scroll thru list returned
                if (dr.Read())
                {
                    state = (enuResourceState)enuResourceState.Parse(typeof(enuResourceState), (string)dr[Constants.RES_STATE], true);
                }
            }
            catch (Exception /*e*/)
            {
            }
            finally
            {
                if (dr != null)
                {
                    dr.Close();
                }
            }

            return(state);
        }
        public MeetingResource(Resource res, string strMeetingID, string strOwner)
        {
            if (res == null)
            {
                throw new ArgumentNullException("res", "Invalid Resource");
            }
            if (strMeetingID == null || strMeetingID.Length == 0)
            {
                throw new ArgumentException("Invalid meeting ID", "strOwner");
            }
            if (strOwner == null || strOwner.Length == 0)
            {
                throw new ArgumentException("Invalid owner", "strOwner");
            }

            this.m_resState     = enuResourceState.Shared;
            this.m_strOwner     = strOwner;
            this.m_res          = res;
            this.m_strMeetingID = strMeetingID;
        }