コード例 #1
0
ファイル: Functions.cs プロジェクト: CarverLab/Oyster
 /// <summary>
 /// Returns SectionTypes Object Filled with All current SectionTypes in System
 /// </summary>
 /// <returns></returns>
 public SectionTypes ALLSectionTypes()
 {
     try
     {
         SectionTypes X = new SectionTypes();
         string sSQL = "Select * FROM tblSectionType";
         DataTable DT = GetDataTable(sSQL);
         foreach(DataRow R in DT.Rows)
         {
             SectionType S = null;
             S = GetSectionType(Convert.ToInt32((object)R[0]));
             if(S != null)
                 X.Add(S);
         }
         DT.Dispose();
         return X;
     }
     catch(Exception Err)
     {
         throw new ApplicationException(Err.Message);
     }
 }
コード例 #2
0
ファイル: Functions.cs プロジェクト: CarverLab/Oyster
        /// <summary>
        /// Returns all section types ordered from SystemAdmin
        /// </summary>
        /// <returns></returns>
        internal SectionTypes GetSectionTypes()
        {
            try
            {
                string sSQL = "Select ID FROM tblSectionType WHERE PreviousSectionTypeId = -99";
                object obj = this.ExecuteScalar(sSQL);
                int SysSectionTypeId = Convert.ToInt32(obj);

                SectionTypes AST = new SectionTypes();

                if(SysSectionTypeId == 0)
                {
                    return AST;
                }

                SectionType SystemST = GetSectionType(SysSectionTypeId);

                AST.Add(SystemST);

                int NextSectionId = SystemST.NextSectionTypeID;

                if(NextSectionId == -99)
                    return AST;

                SectionType X = SystemST.NextSectionType;
                NextSectionId = X.NextSectionTypeID;
                AST.Add(X);

                while(NextSectionId != -99)
                {
                    X = X.NextSectionType;
                    AST.Add(X);
                    NextSectionId = X.NextSectionTypeID;
                }
                return AST;
            }
            catch(Exception Err)
            {
                string Error = Err.Message;
                throw new ApplicationException(Err.Message);
                //return false;
            }
        }
コード例 #3
0
ファイル: Functions.cs プロジェクト: CarverLab/Oyster
        /// <summary>
        /// Used to determine a Users Highest Privilege Authority
        /// </summary>
        /// <param name="UserID"></param>
        /// <returns></returns>
        internal SectionType GetUsersHighestAuthorityLevel(int UserID)
        {
            try
            {
                SectionType Temp = new SectionType();
                int PreviousSectionType = 2147483645;
                SectionTypes UST = new SectionTypes();
                //Users Section Types

                string sSQL = "SELECT * FROM tblSectionSectionRel WHERE SectionId = PrevSectionId";
                DataTable DT = GetDataTable(sSQL);
                DataRow DR = DT.Rows[0];

                int SysSectionID =  Convert.ToInt32(DR[0]);
                Section SysSection = GetSection(SysSectionID);

                Sections SSS = null;

                if(SysSection.OwnerID != UserID)
                {
                    SSS = GetAllContainingSections(UserID);
                }
                else
                {
                    return SysSection.CreatedBySectionType;
                }

                //SqlDataAdapter DA = new SqlDataAdapter(sSQL,MC);
                //DataTable DT = new DataTable();
                //DA.Fill(DT);
                //DA.Dispose();

                foreach(Section S in SSS)
                {
                    if(S.CreatedBySectionType.ID == SysSection.CreatedBySectionType.ID)
                    {
                        SectionType SST = SysSection.CreatedBySectionType.NextSectionType;
                        UST.Add(SST);
                    }
                    else
                    {
                        int SectionTypeId = S.CreatedBySectionType.NextSectionTypeID;
                        // int SectionTypeId = S.CreatedBySectionType.ID;

                        if(SectionTypeId != -99)
                        {
                            SectionType ST = GetSectionType(SectionTypeId);
                            UST.Add(ST);
                        }
                    }
                }
                //Compare the Section Types and return the Highest Ranking Type
                foreach(SectionType S in UST)
                {
                    if(PreviousSectionType > S.PreviousSectionTypeID)
                    {
                        if(S.PreviousSectionTypeID == -99)
                        {
                            PreviousSectionType = S.ID;
                            Temp = S;
                            break;
                        }
                        else
                        {
                            PreviousSectionType = S.PreviousSectionTypeID;
                            Temp = S;
                        }
                    }
                }
                //DT.Dispose();
                return Temp;
            }
            catch(Exception Err)
            {
                throw new ApplicationException(Err.Message);
            }
        }
コード例 #4
0
ファイル: Functions.cs プロジェクト: CarverLab/Oyster
        /// <summary>
        /// Used by other functions to fill a SectionTypes object
        /// </summary>
        /// <param name="AST"></param>
        /// <returns></returns>
        internal bool FillSectionTypes(ref SectionTypes AST)
        {
            try
            {
                AST = new SectionTypes();

                string sSQL = "Select ID, Name, Created, UniqueIdentifier, NextSectionTypeId," +
                    " CreatesSectionTypeDescription, CreatesRootSection, PreviousSectionTypeId "+
                    "from tblSectionType ORDER BY PreviousSectionTypeId";

                DataTable DT = GetDataTable(sSQL);
                if(DT.Rows.Count > 0)
                {
                    foreach(DataRow  R in DT.Rows)
                    {
                        SectionType ST = new SectionType();
                        ST.mvarID = Convert.ToInt32((object)R[0]);
                        ST.mvarDescription = Convert.ToString((object)R[1]);
                        ST.mvarCreatedDate = Convert.ToDateTime((object)R[2]);
                        ST.mvarUniqueIdentifier = R[3].ToString();
                        ST.mvarNextSectionTypeID = Convert.ToInt32((object)R[4]);
                        ST.mvarCreatesSectionTypeDescription = Convert.ToString((object)R[5]);
                        ST.mvarCreatesRootSection = Convert.ToBoolean((object)R[6]);
                        ST.mvarPreviousSectionTypeID = Convert.ToInt32((object)R[7]);

                        FillPermissions(ref ST);
                        AST.Add(ST);
                    }
                }

                DT.Dispose();
            }
            catch(Exception Err)
            {
                throw new ApplicationException(Err.Message);
            }
            return true;
        }