Пример #1
0
 private void btnFinished_Click(object sender, System.EventArgs e)
 {
     if(lvUsers.SelectedItems.Count == 0)
     {
         this.DialogResult = DialogResult.None;
         return;
     }
     SelectedUser = (OysterClassLibrary.User)lvUsers.SelectedItems[0].Tag;
 }
Пример #2
0
        private void btnStopRecording_ServerClick(object sender, System.EventArgs e)
        {
            //if(m_conn.State() == OCTLNET.eSystemState.Recording)
            //{
                LUser =(OysterClassLibrary.User) Session["LUser"];
                m_conn = (OCTLNET.Connection) Session["Connection"];

                m_conn.Swipe(LUser.CardNumber);
            //}

            txtCloseApp.Value = "Closing";
        }
Пример #3
0
        private void Button1_ServerClick(object sender, System.EventArgs e)
        {
            //LUser =(OysterClassLibrary.User) Session["LUser"];
            txtDidOnce.Value = "DIDONCE";
            OSystem = (OysterClassLibrary.Oyster) Session["Oyster"];

            int RMID = Convert.ToInt32(txtRoomId.Value,10);
            int LUID = Convert.ToInt32(txtLUserId.Value,10);
            LUser = OSystem.GetUserById(LUID);

            OysterClassLibrary.Room RM = OSystem.GetRoomById(RMID);

            lbTitle.Value = "Recording Scene: " + RM.Description;
            tbStartTime.Value = System.DateTime.Now.ToShortTimeString();
            tbEndTime.Value = System.DateTime.Now.AddHours(2).ToShortTimeString();

            m_broker = new OCTLNET.Broker();
            Msg("Attempting to create a new control agent...");
            m_conn = m_broker.Create(RM.AllCurrentStreamingEncoders.Item(0).CurrentMediaBufferServer.Address);
            Msg("successfully created control agent for " + LUser.Description);
            Session["Connection"] = m_conn;
            Session["Broker"] = m_broker;

            if(!m_conn.Open())
            {
                Msg("Agent failed to connect to Oyster System");
                Msg("killing agent..");
                txtCloseApp.Value = "Error: Failed to start recording. Unable to establish connection.";
                return;
            }
            Msg("Agent successfully connected to Oyster System");
            int CardReaderId = RM.AllCurrentCardReaders.Item(0).ID;

            m_conn.CreateSession(CardReaderId);
            m_conn.Swipe(LUser.CardNumber);

            Session["Connection"] = m_conn;
            Session["Broker"] = m_broker;
        }
Пример #4
0
 private void menuItem3_Click(object sender, System.EventArgs e)
 {
     frmManageRecordings fmr = new frmManageRecordings();
     fmr.Owner = this;
     DialogResult DR = fmr.ShowDialog(this);
     if(DR == DialogResult.OK)
     {
         LoginUser = OSystem.Refresh();
     }
     fmr.Dispose();
 }
Пример #5
0
        private void Form1_Load(object sender, System.EventArgs e)
        {
            this.Opacity = 0;
            Splash = new frmSplash();
            Splash.lblVersion.Text = VERSION;
            Splash.lblStatus.Text = "Loading Login Screen...";
            Splash.Show();

            Login1 L = new Login1();

            System.Windows.Forms.DialogResult LDR = L.ShowDialog(this);

            if(LDR != DialogResult.OK)
            {
                Application.Exit();
                return;
            }
            else
            {
                Splash.Msg("Loading User data...");
                OSystem = L.OSystem;
                LoginUser = L.LoginUser;
                g_COMPORT = L.g_COMPORT;
                g_LoginDenied = OSystem.SystemAdminLoginDenied;
            }

            //            if(this.Tag is PassOysterLogin)
            //            {
            //
            //                PassOysterLogin POL = (PassOysterLogin)this.Tag;
            //                OSystem = POL.OSystem;
            //                LoginUser = POL.LoginUser;
            //                g_COMPORT = POL.COMPORT;
            //                g_LoginDenied = OSystem.SystemAdminLoginDenied;
            //                this.Tag = null;
            //            }
            //            else
            //                return;

            //ReadMediaBufferServerLocalAddress();

            g_Obj = new System.Object();
            try
            {
                CardSwipe = new CARDSCAN.SerialPortScanClass();
                //MHClient = new MHCOM.MediaHawkClientClass();
            }
            catch(Exception Err)
            {
                MessageBox.Show(Err.Message,"Application Closing..");
                Application.Exit();
                return;
            }

            gLogTime = new DateTime();
            gLogTime = System.DateTime.Now;
            gLastActivity = System.DateTime.Now;
            StatusTimer.Enabled = true;
            ActivityTimer.Enabled = true;
            HighestSectionType = LoginUser.HighestAuthorityLevel;
            MainSystemSection = OSystem.CurrentSystemSection("6419DC43-84B9-43e2-89FE-BB8C96D5CF6F");

            menuItem1.Visible = false;
            menuItem3.Visible = false;
            mnuSystem.Visible = false;
            mnuHelp.Visible = false;

            //For Oakland Permissions
            if(HighestSectionType.ID == OSystem.SectionTypeSysAdmin.ID)
            {
                menuItem3.Visible = true;
                mnuSystem.Visible = true;
                menuItem1.Visible = true;
            }
            else if(HighestSectionType.ID == OSystem.SectionTypeSysAdmin.NextSectionTypeID)
            {
                mnuSystem.Visible = true;
                menuItem3.Visible = true;
                menuItem1.Visible = true;
            }
            else
            {
                foreach(OysterClassLibrary.Permission P in HighestSectionType.CanShareRecordings)
                {
                    string peek = P.TargetSectionTypeId.ToString();
                    menuItem1.Visible = true;
                    break;
                }
            }

            ShowDisplay(ShowUserInfo);
            Splash.Msg("Building Users Hierarchy...");
            Status(LoginUser.Description + " logged in...");
            BuildUserHierarchy();
            BuildCameraView();
            treeView1.Focus();
            if(treeView1.SelectedNode != null)
            {
                if(treeView1.SelectedNode.Tag is OysterClassLibrary.Section)
                {

                }
                else
                {
                    treeView1.SelectedNode = treeView1.Nodes[0];
                }
            }
            else
            {
                treeView1.SelectedNode = treeView1.Nodes[0];
            }
            treeView1_MouseUp(treeView1,new MouseEventArgs(MouseButtons.Left,1,0,0,0));

            Splash.Msg("Completed..exiting Splash Screen");
            Splash.Dispose();
            this.Opacity = 100;
        }
Пример #6
0
        //public void RecursiveDisplay(OysterClassLibrary.Section DrawBody, ref TreeNode NodeX, OysterClassLibrary.SectionType MyCurrentSectionType)
        public void RecursiveDisplay(OysterClassLibrary.Section DrawSection, ref TreeNode NodeX, OysterClassLibrary.SectionType MyCurrentSectionType)
        {
            OysterClassLibrary.Functions F = new OysterClassLibrary.Functions();

            if(DrawSection.IsDefault == false)
            {

                TreeNode NodeBody = NodeX.Nodes.Add(DrawSection.Description);

                string testme = DrawSection.Description;
                NodeBody.Tag = DrawSection;
                NodeBody.ImageIndex = 1;
                NodeBody.SelectedImageIndex =1;
                NodeBody.ForeColor = System.Drawing.Color.DarkBlue;
                if((g_SelectedAnItem == false)&&(DrawSection.CreatedBySectionType.ID != OSystem.SectionTypeSysAdmin.ID))
                {
                    g_SelectedAnItem = true;
                    treeView1.SelectedNode = NodeBody;
                    NodeBody.EnsureVisible();
                    MouseEventArgs A = new MouseEventArgs(MouseButtons.Left,1,1,1,0);
                    treeView1_MouseUp(treeView1,A);
                }

                if(OpenToBody == DrawSection.ID)
                {
                    NodeBody.EnsureVisible();
                    treeView1.SelectedNode = NodeBody;
                    g_objSection = DrawSection;
                }
                //bool DidOnce = false;

                foreach(OysterClassLibrary.User DrawUser in DrawSection.CurrentUsers)
                {
                    TreeNode NodeUser = null;
                    int[] UO = OSystem.UnassignedIDs;

                    if(UO[0]== DrawUser.ID)
                    {
                        NodeUser = NodeBody.Nodes.Add(DrawUser.Description);
                        NodeUser.ForeColor = System.Drawing.Color.Red;
                        NodeUser.NodeFont = new Font("Arial",10,FontStyle.Bold);
                    }
                    else
                    {
                        NodeUser = NodeBody.Nodes.Add(DrawUser.Description);
                        NodeUser.ForeColor = System.Drawing.Color.Black;
                        NodeUser.NodeFont = new Font("Arial",10,FontStyle.Regular);
                    }

                    string test = DrawUser.Description;

                    test = DrawUser.CurrentSectionID.ToString();

                    NodeUser.Tag = DrawUser;

                    NodeUser.ImageIndex = 0;
                    NodeUser.SelectedImageIndex = 0;
                    if(OpenToUser == DrawUser.ID)
                    {
                        //    NodeUser.EnsureVisible();
                        treeView1.SelectedNode = NodeUser;
                        g_objUser = DrawUser;
                    }

                    OysterClassLibrary.SectionType UT =  F.GetSectionType(DrawSection.CreatedBySectionType.NextSectionTypeID);
                    TreeNode NodeLabel = null;

                    //if((DrawSection.CurrentRecordings.Count > 0)||(DrawUser.NextOwnedSections.Count > 0))
                    if(DrawUser.NextOwnedSections.Count > 0)
                    {
                        NodeLabel = new TreeNode();
                        NodeLabel = NodeUser.Nodes.Add(UT.Description);
                        NodeLabel.ImageIndex = 8;
                        NodeLabel.SelectedImageIndex = 8;
                    }
                    else
                    {

                        // NodeLabel = NodeUser.Nodes.Add("No Recordings");
                    }
                    //TreeNode NodeLabel = NodeLabel.Nodes.Add(DrawUser.Description);

                    foreach(OysterClassLibrary.Section B in DrawUser.NextOwnedSections)
                    {
                        OysterClassLibrary.SectionType prevUT = F.GetSectionType(B.CreatedBySectionType.PreviousSectionTypeID);

                        RecursiveDisplay(B,ref NodeLabel,prevUT);
                    }
                    //						RecursiveDisplay(DrawUser.Bodys,NodeUser);
                    if(DrawSection.CurrentRecordings.Count > 0)
                    {
                        bool drawonce = false;
                        testme = DrawSection.CurrentRecordings.Count.ToString();
                        //NodeRT.NodeFont = new Font("Arial",10,FontStyle.Bold);
                        TreeNode NodeRT = new TreeNode();

                        //IF Recording Sessions go ahead and prepare to draw
                        ListView lvSessions = new ListView();
                        foreach(OysterClassLibrary.Recording R in DrawSection.CurrentRecordings)
                        {
                            bool DoesHaveCopy = F.HasInstanceOfRecording(DrawUser.ID,R.ID,DrawSection.ID);
                            if(DoesHaveCopy == true)
                            {
                                if(R.SessionID != "")
                                {
                                    foreach(ListViewItem LVI in lvSessions.Items)
                                    {
                                        if(LVI.Text == R.SessionName)
                                            goto SkipItem;
                                    }

                                    ListViewItem LCI = lvSessions.Items.Add(R.SessionName);
                                    LCI.Tag = R.SessionID;

                                }
                            SkipItem:{}
                            }
                        }
                        TreeNode[] NodeSessions = new TreeNode[lvSessions.Items.Count];
                        int SessionCount = 0;

                        //End Recording Session Preparation

                        foreach(OysterClassLibrary.Recording DrawRecording in DrawSection.CurrentRecordings)
                        {
                            bool DoesHaveCopy = F.HasInstanceOfRecording(DrawUser.ID,DrawRecording.ID,DrawSection.ID);
                            if(DoesHaveCopy == true)
                            {

                                if(drawonce == false)
                                {
                                    drawonce = true;
                                    NodeRT = NodeUser.Nodes.Add("Recordings");
                                    NodeRT.ForeColor = System.Drawing.Color.DarkSlateBlue;
                                    NodeRT.ImageIndex = 6;
                                    NodeRT.SelectedImageIndex = 6;
                                    OysterClassLibrary.StreamingEncoder SE = OSystem.GetStreamingEncoderById(DrawRecording.StreamingEncoderID);
                                    foreach(ListViewItem LVI in lvSessions.Items)
                                    {
                                        NodeSessions[SessionCount] = NodeRT.Nodes.Add(LVI.Text);
                                        NodeSessions[SessionCount].ImageIndex = 3;
                                        NodeSessions[SessionCount].Tag = SE.CurrentRoom;
                                        NodeSessions[SessionCount].ImageIndex = 2;
                                        NodeSessions[SessionCount].SelectedImageIndex = 2;
                                        SessionCount++;
                                    }

                                }
                                //DrawRecording.BodyId = DrawBody.ID;
                                //                                if(DrawRecording.DisplayName == null)
                                //                                    DrawRecording.DisplayName = DrawRecording.Created.ToString();

                                TreeNode NodeRecording = new TreeNode();
                                if(DrawRecording.SessionID == "")
                                {
                                    NodeRecording = NodeRT.Nodes.Add(DrawRecording.DisplayName);
                                }
                                else
                                {
                                    for(int a=0; a < SessionCount;a++)
                                    {
                                        if(DrawRecording.SessionName == NodeSessions[a].Text)
                                            NodeRecording = NodeSessions[a].Nodes.Add(DrawRecording.DisplayName);
                                    }
                                }
                                if(DrawRecording.IsReady)
                                    NodeRecording.Tag = DrawRecording;
                                else
                                    NodeRecording.ForeColor = Color.Gray;
                                NodeRecording.ImageIndex = 3;
                                NodeRecording.SelectedImageIndex = 3;
                                NodeRecording.NodeFont = new Font("Arial",10,FontStyle.Regular);
                                if(OpenToRecording == DrawRecording.ID)
                                {
                                    //  NodeRecording.EnsureVisible();
                                    treeView1.SelectedNode = NodeRecording;
                                    g_objRecording = DrawRecording;
                                }
                            }
                        }
                        //						if( NodeLabel != null)
                        //                            NodeLabel.Nodes.Add(NodeRT);
                        //                        else if(NodeRT.Nodes.Count > 0)
                        //                            NodeUser.Nodes.Add(NodeRT);

                    }
                }

            }
            else
            {

                //                    foreach(OysterClassLibrary.Permission P in MyCurrentSectionType.CanViewUnassignedRecordings)
                //                    {
                //                        string testme = P.CanOperateOn.ToString();
                //
                //                        if((DrawBody.CreatedBySectionType.ID == P.CanOperateOn)&&(DrawBody.OwnerID != cvosUser.ID))
                //OAKLAND SPECIFIC CODE THAT ALLOWS ONLY SYSTEM ADMIN OR ADMIN TO VIEW UNASSIGNED RECORDINGS
                if(LoginUser.HighestAuthorityLevel.CanViewUnassignedRecordings.Count > 0)
                {
                    string testme = MyCurrentSectionType.Description;
                    if((DrawSection.CurrentRecordings.Count > 0)&&(DrawSection.OwnerID != LoginUser.ID))
                    {
                        //THIS LITTLE SECTION IS OAKLAND SPECIFIC.. THAT IS BECAUSE I HAD TOOO
                        TreeNode NodeURT = new TreeNode();
                        //                        if(DrawBody.CreatedBySectionType.ID == OSystem.SectionTypeSysAdmin.NextSectionTypeID)
                        //                        {
                        //                            NodeURT= NodeX.Nodes.Add("Recordings");
                        //                            NodeURT.ForeColor = Color.DarkBlue;
                        //                        }
                        //                        else
                        //                        {
                        NodeURT= NodeX.Nodes.Add("Unassigned Recordings");
                        NodeURT.ForeColor = Color.Brown;
                        NodeURT.ImageIndex = 6;
                        NodeURT.SelectedImageIndex = 6;

                        //                        }
                        //IF Recording Sessions go ahead and prepare to draw
                        ListView lvSessions = new ListView();
                        foreach(OysterClassLibrary.Recording R in DrawSection.CurrentRecordings)
                        {
                            if(R.SessionID != null)
                            {
                                foreach(ListViewItem LVI in lvSessions.Items)
                                {
                                    if(LVI.Text == R.SessionName)
                                        goto SkipItem;
                                }

                                ListViewItem LGI = lvSessions.Items.Add(R.SessionName);
                                LGI.Tag = R.SessionID;

                            }
                        SkipItem:{}
                        }
                        TreeNode[] NodeSessions = new TreeNode[lvSessions.Items.Count];
                        int SessionCount = 0;

                        foreach(ListViewItem LVI in lvSessions.Items)
                        {
                            //OysterClassLibrary.StreamingEncoder SE = OSystem.GetStreamingEncoderById(R.StreamingEncoderID);

                            NodeSessions[SessionCount] = NodeURT.Nodes.Add(LVI.Text);
                            NodeSessions[SessionCount].ImageIndex = 2;
                            NodeSessions[SessionCount].SelectedImageIndex = 2;
                            NodeSessions[SessionCount].Tag =  LVI.Tag;
                            SessionCount++;
                        }

                        //End Recording Session Preparation

                        foreach(OysterClassLibrary.Recording DrawRecording in DrawSection.CurrentRecordings)
                        {
                            // bool DoesOwnCopy = F.HasInstanceOfRecording(DrawSection.OwnerID,DrawRecording.ID,DrawSection.ID);
                            if(true)// if(DoesOwnCopy == true)
                            {
                                //DrawRecording.BodyId = DrawBody.ID;
                                //                                if(DrawRecording.DisplayName == null)
                                //                                    DrawRecording.DisplayName = DrawRecording.Created.ToString();

                                TreeNode NodeRecording = new TreeNode();
                                if(DrawRecording.SessionID == null)
                                {
                                    NodeRecording = NodeURT.Nodes.Add(DrawRecording.DisplayName);
                                }
                                else
                                {
                                    for(int a=0; a < SessionCount;a++)
                                    {
                                        if(DrawRecording.SessionName == NodeSessions[a].Text)
                                            NodeRecording = NodeSessions[a].Nodes.Add(DrawRecording.DisplayName);
                                    }
                                }

                                if(DrawRecording.IsReady)
                                    NodeRecording.Tag = DrawRecording;
                                else
                                    NodeRecording.ForeColor = Color.Gray;

                                NodeRecording.ImageIndex = 3;
                                NodeRecording.SelectedImageIndex = 3;

                                //NodeRecording.ForeColor = System.Drawing.Color.Brown;
                                NodeRecording.NodeFont = new Font("Arial",10,FontStyle.Regular);

                                if(OpenToRecording == DrawRecording.ID)
                                {
                                    //     NodeRecording.EnsureVisible();
                                    treeView1.SelectedNode = NodeRecording;
                                    g_objRecording = DrawRecording;
                                }
                            }
                        }
                    }
                    // else {TreeNode NodeURT = NodeX.Nodes.Add("No Unassigned Recordings");}
                }
            }
            F.Dispose();
        }
Пример #7
0
        private void ReLoad_Groups()
        {
            FrmParent.LoginUser = FrmParent.OSystem.Refresh();
            LoginUser = FrmParent.LoginUser;
            OysterClassLibrary.Groups GPS = null;
            if(LoginUser.HighestAuthorityLevel == FrmParent.OSystem.SectionTypeSysAdmin)
                GPS = FrmParent.OSystem.GetALLGroups(false);
            else
                GPS = LoginUser.CurrentGroups;

            lvPublic.Items.Clear();
            lvPrivate.Items.Clear();
            bool DidOnePub = false;
            bool DidOnePri = false;
            foreach(OysterClassLibrary.Group G in GPS)
            {
                if(G.IsPublicAccess == true)
                {
                    ListViewItem LVI = lvPublic.Items.Add(G.Description);

                    LVI.ForeColor = Color.DarkBlue;
                    LVI.Tag = G;
                    if(DidOnePub == false)
                    {
                        DidOnePub = true;
                        LVI.Selected = true;
                    }
                }
                else if(G.IsPublicAccess == false)
                {
                    ListViewItem LVI = lvPrivate.Items.Add(G.Description);
                    LVI.ForeColor = Color.DarkGreen;
                    LVI.Tag = G;
                    if(DidOnePri == false)
                    {
                        DidOnePri = true;
                        LVI.Selected = true;
                    }
                }
            }
        }
Пример #8
0
        private void frmGroups_Load(object sender, System.EventArgs e)
        {
            if(this.Tag is OysterClassLibrary.User)
            {
                LoginUser = (OysterClassLibrary.User)this.Tag;
                FrmParent = (Form1)this.Owner;
            }
            else
            {
                this.DialogResult = DialogResult.Abort;
                return;
            }

            OysterClassLibrary.Groups GPS = null;
            if(LoginUser.HighestAuthorityLevel.ID == FrmParent.OSystem.SectionTypeSysAdmin.ID)
                GPS = FrmParent.OSystem.GetALLGroups(false);
            else
                GPS = LoginUser.CurrentGroups;
            bool DidOncePri = false;
            bool DidOncePub = false;
            foreach(OysterClassLibrary.Group G in GPS)
            {
                if(G.IsPublicAccess == true)
                {
                    ListViewItem LVI = lvPublic.Items.Add(G.Description);
                    LVI.ForeColor = Color.DarkBlue;
                    LVI.Tag = G;
                    if(DidOncePub == false)
                    {
                        DidOncePub = true;
                        LVI.Selected = true;
                    }
                }
                else
                {
                    ListViewItem LVI = lvPrivate.Items.Add(G.Description);
                    LVI.ForeColor = Color.DarkGreen;
                    LVI.Tag = G;
                    if(DidOncePri == false)
                    {
                        DidOncePri = true;
                        LVI.Selected = true;
                    }
                }
            }
        }
Пример #9
0
		private void btnLoginName_Click(object sender, System.EventArgs e)
		{			
			string g_sLoginName = tbLoginName.Text;
			string g_sLoginPassword = tbLoginPassword.Text;
			this.Opacity = 0;		
			FrmParent.Msg("Authenticating User...");	
			MyGlobals.Logger.WriteLog("authenticating {0}", g_sLoginName);
			
			tryagain:{}
			
				try
				{
					OSystem = new OysterClassLibrary.Oyster();    
				}
				catch (Exception Err)
				{
					this.Opacity = 100;

					if (Err.Message == "SQL Server does not exist or access denied.")
					{
						MyGlobals.Logger.WriteLog("SQL Server not found. Asking for server location.");
						DialogResult DR = MessageBox.Show("Do you wish to try to locate the server manually",
							CarverLab.Utility.AppInfo.Title + ": Server connection error.", System.Windows.Forms.MessageBoxButtons.YesNo);

						if(DR == DialogResult.No)
						{
							this.DialogResult = DialogResult.Abort;
							return;
						}

						frmServerLocation SL = new frmServerLocation();
						DR = SL.ShowDialog(this);
						if (DR != DialogResult.OK)
						{
							this.DialogResult = DialogResult.Abort;
							return;
						}
						goto tryagain;
				
					}
					else
					{
						MyGlobals.Logger.WriteLog("SQL Server not found. Exception: {0}.", Err.ToString());
						MessageBox.Show(this, Err.Message, CarverLab.Utility.AppInfo.Title + ": Server connection error.");
						this.DialogResult = DialogResult.None;
						return;
					}
				}
				try
				{
					try
					{
						LoginUser = OSystem.Login(g_sLoginName,g_sLoginPassword);
					}
					catch (Exception Err)
					{
						string peek = Err.Message;
						MyGlobals.Logger.WriteLog("Login error. Exception: {0}.", Err.ToString());
						MessageBox.Show("Invalid Login ID or Password.", CarverLab.Utility.AppInfo.Title + ": Login Message");
						return;					
					}

					if(LoginUser != null)
					{
						if(!CheckForValidLicense(LoginUser))
						{
							LoginUser = null;
							return;
						}

						FrmParent.Msg("User authenticated.");
					}
					if(OSystem.SystemAdminLoginDenied == true)
					{
						MessageBox.Show("Someone has already logged in with System Administrator access...\nYour SYSTEM privileges are being set to READONLY Access.\nFor Full Access please try to login again at a later time.",CarverLab.Utility.AppInfo.Title + ": System Administrator account in use!");
					}
				}
				catch(Exception Err)
				{
					//Splash.Dispose();
						

					if(Err.Message == "SQL Server does not exist or access denied.")
					{
						DialogResult DR = MessageBox.Show("Do you wish to try to locate the server manually","Unable to establish a connection to Oyster Server",System.Windows.Forms.MessageBoxButtons.YesNo);

						if(DR == DialogResult.No)
						{
							this.DialogResult = DialogResult.Abort;
							return;
						}
						frmServerLocation SL = new frmServerLocation();
						DR = SL.ShowDialog(this);
						if(DR != DialogResult.OK)
						{
							this.DialogResult = DialogResult.Abort;
							return;
						}
						goto tryagain;				
					}
					else
					{
						this.Opacity = 100;
#if USE_LICENSING
						MessageBox.Show("Possible license authentication error.","Unknown Error");
#else
						MessageBox.Show(Err.Message, "Oyster Hardcopy Error");
#endif
						MessageBox.Show("Application will now close","Oyster Hardcopy");
						this.DialogResult = DialogResult.Abort;
						return;					
					}										
				}
				
#if USE_CARDSCAN
				if(g_COMPORT != cbConfigureCardScan.Text.ToString())
				{
					g_COMPORT = cbConfigureCardScan.Text.ToString();
					RK = Registry.CurrentUser.OpenSubKey("Software\\" + sProductKey,true);
					RK.SetValue("COMPORT",g_COMPORT);
				}
#endif			
				this.DialogResult = DialogResult.OK;			
		}
Пример #10
0
        private void btnLoginName_Click(object sender, System.EventArgs e)
        {
            string g_sLoginName = tbLoginName.Text;
            string g_sLoginPassword = tbLoginPassword.Text;

            FrmParent.Msg("Authenticating User...");

            tryagain:{}

            try
            {

                try
                {
                    //OSystem = new OysterClassLibrary.Oyster(serveraddress,password);
                    //OSystem = new OysterClassLibrary.Oyster();
                    OSystem = new OysterClassLibrary.Oyster(ConnectionString);
                }
                catch(Exception Err)
                {
                    if(Err.Message == "SQL Server does not exist or access denied.")
                    {
                        DialogResult DR = MessageBox.Show("Do you wish to try to locate the server manually","Unable to establish a connection to Oyster Server",System.Windows.Forms.MessageBoxButtons.YesNo);

                        if(DR == DialogResult.No)
                        {
                            this.DialogResult = DialogResult.Abort;
                            return;
                        }

                        frmServerLocation SL = new frmServerLocation();
                        DR = SL.ShowDialog(this);
                        if(DR != DialogResult.OK)
                        {
                            this.DialogResult = DialogResult.Abort;
                            return;
                        }
                        goto tryagain;

                    }
                }

            try
            {
                LoginUser = OSystem.Login(g_sLoginName,g_sLoginPassword);
            }
            catch (Exception Err)
            {
                string peek = Err.Message;
                MessageBox.Show("Invalid Login ID or Password.","Oyster Executive: Login Message");
                return;
            }
                if(LoginUser != null)
                {

                    if(!CheckForValidLicense(LoginUser))
                    {
                        LoginUser = null;
                        return;
                    }

                    //Splash.Dispose();

                    FrmParent.Msg("User authenticated.");
                }
                if(OSystem.SystemAdminLoginDenied == true)
                {
                    MessageBox.Show("Someone has already logged in with System Administrator access...\nYour SYSTEM priviledges are being set to READONLY Access.\nFor Full Access please try to login again at a later time.","System Administrator account in use!");
                }
            }
            catch(Exception Err)
            {
                //Splash.Dispose();
                if(Err.Message == "SQL Server does not exist or access denied.")
                {
                    DialogResult DR = MessageBox.Show("Do you wish to try to locate the server manually","Unable to establish a connection to Oyster Server",System.Windows.Forms.MessageBoxButtons.YesNo);

                    if(DR == DialogResult.No)
                    {
                        this.DialogResult = DialogResult.Abort;
                        return;
                    }

                    frmServerLocation SL = new frmServerLocation();
                    DR = SL.ShowDialog(this);
                    if(DR != DialogResult.OK)
                    {
                        this.DialogResult = DialogResult.Abort;
                        return;
                    }
                    goto tryagain;
                }
                else
                {
                    this.Opacity = 100;
                    MessageBox.Show("Unknown error occurred while attempting to login to system","Unknown Error");
                    MessageBox.Show("Application will now close","Oyster Executive");
                    this.DialogResult = DialogResult.Abort;
                    return;
                }
            }

            if(g_COMPORT != cbConfigureCardScan.Text.ToString())
            {
                g_COMPORT = cbConfigureCardScan.Text.ToString();
                RK = Registry.LocalMachine.OpenSubKey("Software\\Carver Lab\\Oyster V2.0\\Data",true);
                RK.SetValue("COMPORT",g_COMPORT);
            }

            this.DialogResult = DialogResult.OK;
        }
Пример #11
0
        private void UserWizard_Load(object sender, System.EventArgs e)
        {
            if(this.Owner is System_Properties)
                FrmParent = (Form1)this.Owner.Owner;
            else if(this.Owner is Form1)
                FrmParent = (Form1)this.Owner;
            else
            {
                MessageBox.Show("Illegal open attempt made on Forwarding Server Wizard");
                this.DialogResult = DialogResult.Abort;
                return;
            }
            if(this.Tag is OysterClassLibrary.User)
            {
                EditUser = (OysterClassLibrary.User)this.Tag;
                IsEditUser = true;
                tbFirstName.Text = EditUser.FirstName;
                tbMiddleName.Text = EditUser.MiddleName;
                tbLastName.Text = EditUser.LastName;
                tbLoginName.Text = EditUser.LoginName;
                tbPassword.Text = "*******************";//EditUser.Password;
                tbIDCard.Text = EditUser.CardNumber;
                cbCanRecord.Checked = EditUser.CanRecord;
                this.Text = "Edit User (1 of 3)";

                return;
            }
            this.Text = "Create New User (1 of 3)";
            pnlName.Focus();
            tbFirstName.Select();
        }
Пример #12
0
 public AUser(string sName, OysterClassLibrary.User user)
 {
     m_sName = sName;
     m_User = user;
 }
Пример #13
0
		private void btnLoginCardScan_Click(object sender, System.EventArgs e)
		{          
#if USE_CARDSCAN
			if((g_COMPORT != cbConfigureCardScan.Text.ToString())&&(cbConfigureCardScan.Text != "NO COMPORTS"))
			{
				g_COMPORT = cbConfigureCardScan.Text.ToString();
				RK = Registry.CurrentUser.OpenSubKey("Software\\" + sProductKey,true);
				RK.SetValue("COMPORT",g_COMPORT);
			}
			FrmParent.Msg("Scan User Identification Card");	
			this.Opacity = 0;
			string CardNumber = CardSwipe.Scan(g_COMPORT);
			if(CardNumber == "")return;
			CardNumber = FormatCardNumber(CardNumber);
			
			
			tryagain2:{}
			FrmParent.Msg("Authenticating User...");		
			try
			{	
				OSystem = new OysterClassLibrary.Oyster();				
				try
				{				
					LoginUser = OSystem.Login(CardNumber);
				}
				catch (Exception Err)
				{
					string peek = Err.Message;
					MessageBox.Show("Invalid Login ID or Password.","Oyster Hardcopy: Login Message");
					return;					
				}
				if(LoginUser != null)
				{
					if(!CheckForValidLicense(LoginUser))
					{
						LoginUser = null;
						return;
					}
					FrmParent.Msg("User authenticated.");
				}
			}
			catch(Exception Err)
			{
				if(Err.Message == "SQL Server does not exist or access denied.")
				{
					DialogResult DR = MessageBox.Show("Do you wish to try to locate the server manually","Unable to establish a connection to Oyster Server",System.Windows.Forms.MessageBoxButtons.YesNo);

					if(DR == DialogResult.No)
					{
						this.DialogResult = DialogResult.Abort;
						return;
					}

					frmServerLocation SL = new frmServerLocation();
					DR = SL.ShowDialog(this);
					if(DR != DialogResult.OK)
					{
						this.DialogResult = DialogResult.Abort;
						return;
					}

					goto tryagain2;
				
				}
				else
				{
					this.Opacity = 100;
					MessageBox.Show("Possible license authentication error.","Unknown Error");
					MessageBox.Show("Application will now close","Oyster Hardcopy");
					this.DialogResult = DialogResult.Abort;
					return;					
				}	
			}
           
			if(OSystem.SystemAdminLoginDenied == true)
			{
				MessageBox.Show("Someone has already logged in with System Administrator access...\nYour SYSTEM privileges are being set to READONLY Access.\nFor Full Access please try to login again at a later time.","System Administrator account in use!");
			}
			FrmParent.Msg("User authenticated.");	
			this.DialogResult = DialogResult.OK;
#endif
		}
Пример #14
0
        /*
            private void MediaPlayer_ErrorEvent(object sender, System.EventArgs e)
            {

               // AxMicrosoft.MediaPlayer.Interop.AxWindowsMediaPlayer Player = (AxMicrosoft.MediaPlayer.Interop.AxWindowsMediaPlayer) sender;
                AxWMPLib.AxWindowsMediaPlayer Player = (AxWMPLib.AxWindowsMediaPlayer) sender;

                string sError = Player.Error.ToString();

                if((sError == "An unknown error has occurred.")||(sError == "Failed to set the property on this stream."))
                {

                }
                else if(sError == "Cannot play back the file.  The format is not supported.")
                {
                    MessageBox.Show("Cannot play back file. Either file is missing or Video Server is down.","Adminstrative Software Video Playback Error");
                }
                else
                    MessageBox.Show(sError,"Video Player Message");

                try
                {
                    btnPause.ForeColor = System.Drawing.Color.Black;
                    btnReverse.ForeColor = Color.Black;
                    btnForward.ForeColor = Color.Black;

                    btnPlay.Enabled = true;
                    btnPause.Enabled = false;
                    btnStop.Enabled = false;
                    btnForward.Enabled = false;
                    btnReverse.Enabled = false;
                    btnGoTo.Enabled = false;
                    tbHR.Enabled = false;
                    tbMin.Enabled = false;
                    tbSec.Enabled = false;
                }
                catch(Exception Err)
                {
                    string peekerror = Err.Message;
                }
            }

            private void MediaPlayer_MediaError(object sender, AxWMPLib._WMPOCXEvents_MediaErrorEvent e)
            {
                AxWMPLib.AxWindowsMediaPlayer Player = (AxWMPLib.AxWindowsMediaPlayer) sender;
                //AxMicrosoft.MediaPlayer.Interop.AxWindowsMediaPlayer Player = (AxMicrosoft.MediaPlayer.Interop.AxWindowsMediaPlayer) sender;

                string sError = Player.Error.ToString();

                if((sError == "An unknown error has occurred.")||(sError == "Failed to set the property on this stream."))
                {

                }
                else if(sError == "Cannot play back the file.  The format is not supported.")
                {
                    MessageBox.Show("Cannot play back file. Either file is missing or Video Server is down.","Adminstrative Software Video Playback Error");
                }
                else
                    MessageBox.Show(sError,"Video Player Message");

                try
                {
                    btnPause.ForeColor = System.Drawing.Color.Black;
                    btnReverse.ForeColor = Color.Black;
                    btnForward.ForeColor = Color.Black;

                    btnPlay.Enabled = true;
                    btnPause.Enabled = false;
                    btnStop.Enabled = false;
                    btnForward.Enabled = false;
                    btnReverse.Enabled = false;
                    btnGoTo.Enabled = false;
                    tbHR.Enabled = false;
                    tbMin.Enabled = false;
                    tbSec.Enabled = false;
                }
                catch(Exception Err)
                {
                    string peekerror = Err.Message;
                }
            }

            private void MediaPlayer_EndOfStream(object sender, AxWMPLib._WMPOCXEvents_EndOfStreamEvent e)
            {
                try
                {

                    btnPause.ForeColor = System.Drawing.Color.Black;
                    btnReverse.ForeColor = Color.Black;
                    btnForward.ForeColor = Color.Black;

                    btnPlay.Enabled = true;
                    btnPause.Enabled = false;
                    btnStop.Enabled = false;
                    btnForward.Enabled = false;
                    btnReverse.Enabled = false;
                    btnGoTo.Enabled = false;
                    tbHR.Enabled = false;
                    tbMin.Enabled = false;
                    tbSec.Enabled = false;

                }
                catch(Exception Err)
                {
                    string peekerror = Err.Message;
                }
            }

            private void MediaPlayer_PlayStateChange(object sender, AxWMPLib._WMPOCXEvents_PlayStateChangeEvent e)
            {
                HeadSpeedCount = 0;
                ReverseTimer.Enabled = false;
                ForwardTimer.Enabled = false;
                //if(e.newState == e.oldState) return;

                switch(e.newState)
                {
                    case 0:

                        btnPause.ForeColor = System.Drawing.Color.Black;
                        btnReverse.ForeColor = Color.Black;
                        btnForward.ForeColor = Color.Black;
                        MediaPlayer.Ctlcontrols.currentPosition = 0;
                        btnPlay.Enabled = true;
                        btnPause.Enabled = false;
                        btnStop.Enabled = false;
                        btnForward.Enabled = false;
                        btnReverse.Enabled = false;

                        break;
                    case 1:

                        btnPause.ForeColor = System.Drawing.Color.Red;
                        btnPlay.Enabled = false;
                        btnPause.Enabled = true;
                        btnStop.Enabled = true;
                        btnForward.Enabled = true;
                        btnReverse.Enabled = true;
                        break;
                    case 2:

                        btnPause.ForeColor = System.Drawing.Color.Black;
                        btnPlay.Enabled = true;
                        btnPause.Enabled = false;
                        btnStop.Enabled = true;
                        btnForward.Enabled = true;
                        btnReverse.Enabled = true;
                        break;
                    case 3:
                        break;
                    case 4:
                        break;
                    case 5:
                        break;
                    case 6:
                        break;
                    case 7:
                        break;
                    case 8:
                        MediaPlayer.Ctlcontrols.currentPosition = 0;
                        btnPlay.Enabled = false;
                        btnPause.Enabled = false;
                        btnStop.Enabled = false;
                        btnForward.Enabled = false;
                        btnReverse.Enabled = false;
                        break;
                }
            }

            */
        private void tbActionBar_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)
        {
            if(e.Button == tbActionBar.Buttons[0])
            {
                switch(e.Button.Text)
                {
                    case "Add User(s)":
                        if(treeView1.SelectedNode != null)
                        {
                            TreeNode XNode = treeView1.SelectedNode;
                            if(XNode.Tag is OysterClassLibrary.Section)
                            {
                                g_objSection = (OysterClassLibrary.Section)XNode.Tag;
                                PassOysterData POD = new PassOysterData();
                                POD.CurrentSection = g_objSection;
                                POD.CurrentUser = LoginUser;
                                POD.OSystem = OSystem;

                                AddUsersDialog1 AUD = new AddUsersDialog1();
                                AUD.Tag = POD;
                                DialogResult DR = AUD.ShowDialog(this);
                                POD = (PassOysterData)AUD.Tag;
                                AUD.Dispose();
                                if(DR == DialogResult.Abort)
                                {
                                    MessageBox.Show("An error has occurred attempting to open AddUsersDialog!");
                                    return;
                                }
                                else if(DR == DialogResult.OK)
                                {

                                    if(POD.NumMessages != 0)
                                    {
                                        string Display_Errors = "";
                                        foreach(string err_msg in POD.sMessage)
                                        {
                                            if(err_msg != "")
                                                Display_Errors += "\n" + "System Error! Failed to Add User: "******"One or more Users failed to be Added to Group! These Users may have been deleted by another party...");
                                    }
                                    if(POD.IsSuccess == true)
                                    {
                                        LoginUser = OSystem.Refresh();
                                        BuildUserHierarchy();
                                    }
                                }
                            }
                        }
                        break;

                    case "Edit User":
                        if(treeView1.SelectedNode != null)
                        {
                            TreeNode XNode = treeView1.SelectedNode;
                            if(XNode.Tag is OysterClassLibrary.User)
                            {
                                UserWizard UW = new UserWizard();
                                UW.Tag = XNode.Tag;
                                DialogResult DR = UW.ShowDialog(this);
                                UW.Dispose();
                                if(DR == DialogResult.OK)
                                {
                                    LoginUser = OSystem.Refresh();
                                    BuildUserHierarchy();
                                }
                                else
                                {
                                    return;
                                }
                            }

                        }
                        break;
                    case "Create New User":
                        if(treeView1.SelectedNode != null)
                        {
                            TreeNode XNode = treeView1.SelectedNode;
                            if(XNode.Tag is string)
                            {
                                UserWizard UW = new UserWizard();

                                DialogResult DR = UW.ShowDialog(this);
                                UW.Dispose();
                                if(DR == DialogResult.OK)
                                {
                                    LoginUser = OSystem.Refresh();
                                    BuildUserHierarchy();
                                }
                                else
                                {
                                    return;
                                }
                            }
                        }
                        break;
                    case "View Recording":
                        if(treeView1.SelectedNode != null)
                        {
                            TreeNode XNode = treeView1.SelectedNode;
                            if(XNode.Tag is OysterClassLibrary.Recording)
                            {
                                g_objRecording = (OysterClassLibrary.Recording)XNode.Tag;
                                ShowDisplay(ShowRecordingInfo);
                                CurrentPlayingRecording = g_objRecording;
                                btnPlay.Enabled = false;

                                //						MediaPlayer.Height = 512;
                                //						MediaPlayer.Width = 696;
                                //						MediaPlayer.Location  = new System.Drawing.Point(pnlRecordingInfo.Location.X + 28, pnlRecordingInfo.Location.Y + 53);

                                OysterClassLibrary.VideoStorageServer VSS =  OSystem.GetVideoStorageServerById(g_objRecording.VideoStorageServerID);
                                string sRecording = "";
                                if(VSS.ControlAddress != "Not Assigned")
                                {
                                    OysterClassLibrary.VideoStorageServerType VST = VSS.CurrentVideoStorageServerType;

                                    bool UsePort = Convert.ToBoolean(VST["UsePort"]);
                                    string StreamHeader = (string)VST["StreamHeader"];
                                    string VSS_Directory = VSS.StorageDirectory;//(string)VST["OysterSourceDirectory"];
                                    if(VSS_Directory != "")
                                        sRecording = StreamHeader + VSS.ControlAddress + "/" + VSS_Directory + "/" + g_objRecording.Description;
                                    else if(UsePort == true)
                                        sRecording = StreamHeader + VSS.ControlAddress + ":" + VSS.ControlPort + "/" + VSS_Directory + "/" + g_objRecording.Description;
                                    else
                                        sRecording = StreamHeader + VSS.ControlAddress + "/" + g_objRecording.Description;
                                }
                                else
                                    sRecording = "d://" + g_objRecording.Description;
                                try
                                {
                                    WWWW.Open(sRecording);
                                    // MediaPlayer.URL = sRecording;
                                    //frmPlayer fP = new frmPlayer();
                                    //fP.sURL = sRecording;
                                    //fP.Show();
                                    gLastRecording = sRecording;
                                    //MediaPlayer.Ctlcontrols.play();
                                    //btnPlay_Click(btnPlay,new EventArgs());

                                }
                                catch(Exception Err)
                                {
                                    MessageBox.Show(Err.Message + ":" + Err.InnerException);
                                }

                                // btnPlay.Enabled = true;
                            }
                        }
                        break;
                    case "View Camera":
                        if(tvCameras.SelectedNode != null)
                        {
                            TreeNode XNode = tvCameras.SelectedNode;
                            if(XNode.Tag is OysterClassLibrary.StreamingEncoder)
                            {
                                OysterClassLibrary.StreamingEncoder SE = (OysterClassLibrary.StreamingEncoder)XNode.Tag;
                                string sURL = "";
                                switch(SE.StreamingHeader.ToLower())
                                {
                                    case "vbricksys://":
                                        sURL = SE.StreamingHeader + "ip=" + SE.StreamingAddress + "&port=" + SE.StreamingPort.ToString();

                                        break;
                                    case "vbrick://":
                                        sURL = SE.StreamingHeader + "ip=" + SE.StreamingAddress + "&port=" + SE.StreamingPort.ToString();
                                        break;
                                    default:
                                        MessageBox.Show("System not able to read header: '" + SE.StreamingHeader + "' at this time");
                                        return;
                                        break;
                                }
                                //								CameraPlayer.URL = sURL;
                                //								CameraPlayer.Ctlcontrols.play();
                            }
                        }
                        break;
                    default:
                        break;
                }
            }
            else if(e.Button == tbActionBar.Buttons[2])
            {
                switch(e.Button.Text)
                {
                    case "Record Scene":
                        TreeNode RSNode = tvCameras.SelectedNode;

                        if(RSNode.Tag is OysterClassLibrary.Room)
                        {
                            OysterClassLibrary.Room RM = (OysterClassLibrary.Room)RSNode.Tag;

                            frmRecordScene RC = new frmRecordScene();
                            RC.ThisRoom = RM;

                            DialogResult DR = RC.ShowDialog(this);
                            if(DR == DialogResult.Abort)
                            {
                                //MessageBox.Show("Detected Abort");
                            }
                            else if(DR == DialogResult.OK)
                            {
                                //MessageBox.Show("Detected OK");
                            }
                        }
                        break;
                    case "Control Camera":
                        TreeNode XNode = tvCameras.SelectedNode;
                        if(XNode.Tag is OysterClassLibrary.StreamingEncoder)
                        {
                            OysterClassLibrary.StreamingEncoder SE = (OysterClassLibrary.StreamingEncoder)XNode.Tag;

                            frmCameraControl CC = new frmCameraControl();
                            CC.CodecAddress = SE.ControlAddress;
                            CC.CodecPort = SE.ControlPort;

                            CC.ShowDialog(this);
                        }

                        break;
                    case "Delete User(s)":
                        DialogResult DR2 = new DialogResult();

                        DR2 = MessageBox.Show(this,"You have the authority to permanently delete any User in the System! For each User that you delete all of that User's Recordings will also be permanently deleted!","Show Delete User(s) Screen?",MessageBoxButtons.YesNo);
                        if(DR2 == DialogResult.No)
                            return;
                        Status(g_objUser.Description + " is preparing to delete users....");
                        Form RU = new RemoveUsers();

                        g_OAU.AllUsers = OSystem.CurrentSystemUsers;
                        g_OAU.CurrentUser = LoginUser;
                        g_OAU.CurrentBody = null;
                        g_OAU.ThisCurrentSectionType = LoginUser.HighestAuthorityLevel;
                        g_OAU.TrueDelete = true;

                        RU.Tag = g_OAU;
                        RU.ShowDialog(this);

                        if(RU.DialogResult == DialogResult.OK)
                        {
                            AdministrativeSoftware.RemoveUsers.User_List UL = (AdministrativeSoftware.RemoveUsers.User_List) RU.Tag;
                            foreach(string sUser in UL.DeletedUsers)
                                Status("Permanently deleted User: "******" has aborted Delete User operation.");
                            RU.Dispose();
                        }
                        break;
                    case "Remove User(s)":
                        if(treeView1.SelectedNode != null)
                        {
                            TreeNode XNode2 = treeView1.SelectedNode;
                            if(XNode2.Tag is OysterClassLibrary.Section)
                            {
                                g_objSection = (OysterClassLibrary.Section)XNode2.Tag;
                                DialogResult DR3 = new DialogResult();

                                OysterClassLibrary.SectionType UT = OSystem.GetSectionTypeById(g_objSection.CreatedBySectionType.NextSectionTypeID);

                                DR3 = MessageBox.Show(this,"You have the authority to remove any " + UT.Description  + " in this " + g_objSection.CreatedBySectionType.CreatesSectionTypeDescription + ". For each " + UT.Description  + " that you delete all of that " + UT.Description  + "'s recordings will also be permanently deleted!","Show Delete " + UT.Description  + "(s) Screen?",MessageBoxButtons.YesNo);
                                if(DR3 == DialogResult.No)
                                    return;

                                Form RU2 = new RemoveUsers();

                                g_OAU.AllUsers = null;
                                g_OAU.CurrentUser = null;
                                g_OAU.CurrentBody = g_objSection;
                                g_OAU.ThisCurrentSectionType = g_objSection.CreatedBySectionType;
                                g_OAU.TrueDelete = false;
                                g_OAU.iLocalMBSAddress = LocalIpAddress;

                                RU2.Tag = g_OAU;

                                RU2.ShowDialog(this);

                                if(RU2.DialogResult == DialogResult.OK)
                                {
                                    AdministrativeSoftware.RemoveUsers.User_List UL = (AdministrativeSoftware.RemoveUsers.User_List) RU2.Tag;
                                    foreach(string sUser in UL.DeletedUsers)
                                        Status("Removed User: "******" has aborted Remove User operation.");
                                    RU2.Dispose();
                                }
                            }
                        }
                        break;
                    case "Reassign Recording":
                        AdministrativeSoftware.PassRecordingInfo PRI= new AdministrativeSoftware.PassRecordingInfo();

                        ListView lvMember = new ListView();

                        OysterClassLibrary.Section B = OSystem.GetSectionById(g_objRecording.CurrentSectionID);

                        PRI.objSectionType = CurrentSectionType;
                        OysterClassLibrary.Functions F = new OysterClassLibrary.Functions();

                        OysterClassLibrary.Sections MembersOf = LoginUser.AllMemberSections;//F.GetMemberSections(LoginUser.ID,false);
                        if(PRI.objSectionType == null)
                            PRI.objSectionType = HighestSectionType;
                        F.Dispose();
                        //Check to See if B is in LoginUsers Hierarchy
                        if(!B.IsMember)
                        {
                            ListView lvCheckEm = new ListView();
                            if(B.IsDefault)
                            {
                                foreach(OysterClassLibrary.Section TSection in LoginUser.AllOwnedSections)
                                {
                                    if(!TSection.IsDefault)
                                    {
                                        bool AddToMe = true;
                                        foreach(ListViewItem LVIK in lvMember.Items)
                                        {
                                            OysterClassLibrary.Section lvMSection = (OysterClassLibrary.Section)LVIK.Tag;

                                            if(lvMSection.ID == TSection.ID)
                                            {
                                                AddToMe = false;
                                                break;
                                            }
                                        }
                                        if(AddToMe)
                                        {
                                            ListViewItem LVAM = lvMember.Items.Add(TSection.Description);
                                            LVAM.Tag = TSection;
                                        }
                                    }
                                }
                            }

                            foreach(OysterClassLibrary.Section MySection in LoginUser.AllOwnedSections)
                            {
                                if((!MySection.IsDefault)&&(MySection.CreatedBySectionType.ID != OSystem.SectionTypeSysAdmin.ID))

                                {
                                    bool AddToMe = true;
                                    foreach(ListViewItem LVJK in lvMember.Items)
                                    {
                                        OysterClassLibrary.Section lvMSection = (OysterClassLibrary.Section)LVJK.Tag;

                                        if(lvMSection.ID == MySection.ID)
                                        {
                                            AddToMe = false;
                                            break;
                                        }
                                    }
                                    if(AddToMe)
                                    {
                                        ListViewItem LVI = lvCheckEm.Items.Add(MySection.Description);
                                        LVI.Tag = MySection;
                                    }
                                }
                            }

                            if(lvCheckEm.Items.Count != 0)
                            {
                                foreach(ListViewItem TLVI in lvCheckEm.Items)
                                {
                                    OysterClassLibrary.Section S = (OysterClassLibrary.Section)TLVI.Tag;
                                    ListViewItem LII = lvMember.Items.Add(S.Description);
                                    LII.Tag = S;

                                    foreach(OysterClassLibrary.User U in S.AllUsersInHierarchy)
                                    {
                                        foreach(OysterClassLibrary.Section USection in U.AllOwnedSections)
                                        {
                                            if(S.IsSectionInMyHierarchy(USection.ID))
                                            {
                                                bool AddToMe = true;
                                                foreach(ListViewItem LVIK in lvMember.Items)
                                                {
                                                    OysterClassLibrary.Section lvMSection = (OysterClassLibrary.Section)LVIK.Tag;

                                                    if(lvMSection.ID == USection.ID)
                                                    {
                                                        AddToMe = false;
                                                        break;
                                                    }
                                                }
                                                if(AddToMe)
                                                {
                                                    ListViewItem LVAM = lvMember.Items.Add(USection.Description);
                                                    LVAM.Tag = USection;
                                                }
                                            }
                                        }
                                    }
                                }
                            }

                        }

                        if(PRI.objSectionType.ID == OSystem.SectionTypeSysAdmin.ID)
                        {
                            foreach(OysterClassLibrary.Section SystemBody in LoginUser.AllOwnedSections)
                            {
                                if(SystemBody.IsDefault == false)
                                {
                                    if(SystemBody.CreatedBySectionTypeID != OSystem.SectionTypeSysAdmin.ID)
                                    {
                                        bool AddIt = true;
                                        foreach(ListViewItem ALVI in lvMember.Items)
                                        {
                                            OysterClassLibrary.Section OS = (OysterClassLibrary.Section)ALVI.Tag;

                                            if(OS.ID == SystemBody.ID)
                                            {
                                                AddIt = false;
                                                break;
                                            }
                                        }
                                        if(AddIt)
                                        {
                                            ListViewItem LI = new ListViewItem();
                                            LI = lvMember.Items.Add(SystemBody.Description);
                                            LI.Tag = SystemBody;
                                        }
                                    }
                                    GatherAllBodys(lvMember,SystemBody.CurrentUsers);
                                }
                            }
                        }
                        else
                        {
                            if(!B.IsDefault)
                            {
                                if(B.CreatedBySectionTypeID != OSystem.SectionTypeSysAdmin.ID)
                                {
                                    bool AddIt = true;
                                    foreach(ListViewItem BLVI in lvMember.Items)
                                    {
                                        OysterClassLibrary.Section OS = (OysterClassLibrary.Section)BLVI.Tag;

                                        if(OS.ID == B.ID)
                                        {
                                            AddIt = false;
                                            break;
                                        }
                                    }
                                    if(AddIt)
                                    {
                                        ListViewItem LI = new ListViewItem();
                                        LI = lvMember.Items.Add(B.Description);
                                        LI.Tag = B;
                                    }
                                }
                                GatherAllBodys(lvMember,B.CurrentUsers);
                            }
                            foreach(OysterClassLibrary.Section M in MembersOf)
                            {
                                bool AddIt = true;
                                foreach(ListViewItem ALVI in lvMember.Items)
                                {
                                    OysterClassLibrary.Section OS = (OysterClassLibrary.Section)ALVI.Tag;

                                    if(OS.ID == M.ID)
                                    {
                                        AddIt = false;
                                        break;
                                    }
                                }
                                if(AddIt)
                                {
                                    ListViewItem LA = lvMember.Items.Add(M.Description);
                                    LA.Tag = M;
                                }
                            }
                        }
                        if(lvMember.Items.Count == 0)
                        {
                            MessageBox.Show("No Member Sections or Owned Sections detected for " + LoginUser.FirstName + " " + LoginUser.LastName +
                                " at this time.","No legal location to send recording...abort action.");
                            return;
                        }

                        PRI.CurrentUser = LoginUser;
                        PRI.Rec = g_objRecording;
                        PRI.LV = lvMember;
                        PRI.OSystem = OSystem;
                        //PRI.objSectionType = CurrentSectionType;

                        Form RA = new frmMoveRecording();

                        RA.Tag = PRI;

                        RA.ShowDialog(this);

                        if(RA.DialogResult == DialogResult.OK)
                        {
                            LoginUser = OSystem.Refresh();
                            BuildUserHierarchy();
                        }
                        else
                            RA.Dispose();
                        break;
                    default:
                        break;
                }
            }
            else if(e.Button == tbActionBar.Buttons[4])
            {
                string sEditButton = "Edit " + g_objSection.CreatedBySectionType.CreatesSectionTypeDescription;

                if(e.Button.Text == sEditButton) //Edit Section
                {
                    if(treeView1.SelectedNode != null)
                    {
                        TreeNode XNode = treeView1.SelectedNode;
                        if(XNode.Tag is OysterClassLibrary.Section)
                        {
                            SectionWizard SW = new SectionWizard();
                            PassSectionInfo PSI = new PassSectionInfo();
                            PSI.CurrentSection = (OysterClassLibrary.Section)XNode.Tag;
                            PSI.PreviousSection = PSI.CurrentSection.PreviousSection;
                            PSI.OSystem = OSystem;
                            PSI.CurrentUser = LoginUser;
                            PSI.IsEdit = true;
                            SW.Tag = PSI;
                            DialogResult DR = SW.ShowDialog(this);
                            SW.Dispose();
                            if(DR == DialogResult.Abort)
                            {
                                MessageBox.Show("Edit " + PSI.CurrentSection.Description + " failed");
                            }
                            else if(DR == DialogResult.OK)
                            {
                                LoginUser = OSystem.Refresh();
                                BuildUserHierarchy();
                            }
                        }
                    }
                }
                else if(e.Button.Text == "Remove User")
                {
                    //User doesn't exist
                    System.Windows.Forms.DialogResult DR = new System.Windows.Forms.DialogResult();
                    bool bSuccess = false;
                    TreeNode X = null;
                    //int ErrorNumber = 0;
                    if(g_objUser == null)
                    {
                        X = treeView1.SelectedNode;
                        if(X == null)return;
                        g_objUser = (OysterClassLibrary.User)X.Tag;
                    }

                    if(g_objUser == null)return;

                    string UserName = g_objUser.FirstName + " " + g_objUser.MiddleName + ". " + g_objUser.LastName;
                    DR = System.Windows.Forms.MessageBox.Show("Removing " + UserName + " will delete any of " +
                        UserName + " recordings that are assigned to " + g_objUser.CurrentSection.Description + ".", "Do you wish to proceed with Remove User?", System.Windows.Forms.MessageBoxButtons.YesNo);
                    if(DR == DialogResult.Yes)
                    {
                        OysterClassLibrary.Functions F = new OysterClassLibrary.Functions();

                        try
                        {
                            //OysterClassLibrary.Functions F = new OysterClassLibrary.Functions();
                            try
                            {
                                F.RemoveUser(g_objUser.ID,g_objUser.CurrentSectionID);
                                F.Dispose();

                                g_objSection = g_objUser.CurrentSection;
                                bSuccess = true;
                            }
                            catch(Exception Err)
                            {
                                string peekError = Err.Message;
                                bSuccess = false;
                            }
                            //       bSuccess = objBody.DestroyUser(g_objUser,false,ref ErrorNumber);
                            if(bSuccess ==true)
                            {

                                Status("Successfully Removed " + g_objUser.Description + " from " + g_objSection.Description);

                                LoginUser = OSystem.Refresh();
                                BuildUserHierarchy();
                                ShowDisplay(ShowGroupInfo);
                            }
                        }
                        catch(Exception Err)
                        {
                            MessageBox.Show(Err.Message);
                            return;
                        }
                    }
                }
                else if(e.Button.Text == "Rename Recording")
                {
                    UpdateRecording RR = new UpdateRecording();

                    RR.Tag = g_objRecording;
                    RR.ShowDialog(this);

                    if(RR.DialogResult == DialogResult.OK)
                    {
                        BuildUserHierarchy();
                        //ShowDisplay(ShowRecordingInfo);
                        Status("Rename Recording completed.");
                        RR.Dispose();
                    }
                    else
                        Status("Aborted Rename Recording operation.");
                    RR.Dispose();
                }
                else
                {
                    switch(e.Button.Text)
                    {
                        default:
                            break;
                    }
                }
            }
            else if(e.Button == tbActionBar.Buttons[6])
            {
                string sNewSection = "";
                string sDeleteSection = "";
                string sSType = "";
                //TreeNode YNode = treeView1.SelectedNode;
                if(treeView1.SelectedNode.Tag is OysterClassLibrary.User)
                {
                    sSType = g_objUser.CurrentSection.CreatedBySectionType.NextSectionType.CreatesSectionTypeDescription;
                    sNewSection = "New " + sSType;
                }
                else if(treeView1.SelectedNode.Tag is OysterClassLibrary.Section)
                {
                    if(g_objSection.ID == MainSystemSection.ID)
                    {
                        sSType = g_objSection.CreatedBySectionType.NextSectionType.CreatesSectionTypeDescription;

                    }
                    else
                    {
                        sSType = g_objSection.CreatedBySectionType.CreatesSectionTypeDescription;
                    }
                    sDeleteSection = "Delete " + sSType;
                    sNewSection = "New " + sSType;

                }
                if(e.Button.Text == sNewSection)
                {
                    if(treeView1.SelectedNode != null)
                    {
                        TreeNode XNode = treeView1.SelectedNode;
                        if(XNode.Tag is OysterClassLibrary.Section)
                        {
                            SectionWizard SW = new SectionWizard();
                            PassSectionInfo PSI = new PassSectionInfo();
                            PSI.PreviousSection = (OysterClassLibrary.Section)XNode.Tag;
                            PSI.OSystem = OSystem;
                            PSI.CurrentUser = LoginUser;
                            PSI.IsEdit = false;
                            SW.Tag = PSI;
                            DialogResult DR = SW.ShowDialog(this);
                            SW.Dispose();
                            if(DR == DialogResult.Abort)
                            {
                                MessageBox.Show("Create New " + PSI.CurrentSection.CreatedBySectionType.NextSectionType.CreatesSectionTypeDescription + " failed");
                            }
                            else if(DR == DialogResult.OK)
                            {
                                LoginUser = OSystem.Refresh();
                                BuildUserHierarchy();
                            }

                        }
                        else if(XNode.Tag is OysterClassLibrary.User)
                        {
                            OysterClassLibrary.User UU = (OysterClassLibrary.User)XNode.Tag;
                            SectionWizard SW = new SectionWizard();
                            PassSectionInfo PSI = new PassSectionInfo();
                            PSI.PreviousSection = UU.CurrentSection;
                            PSI.CurrentUser = UU;
                            PSI.OSystem = OSystem;
                            PSI.IsEdit = false;
                            SW.Tag = PSI;
                            DialogResult DR = SW.ShowDialog(this);
                            SW.Dispose();
                            if(DR == DialogResult.Abort)
                            {
                                MessageBox.Show("Create New " + PSI.PreviousSection.CreatedBySectionType.NextSectionType.CreatesSectionTypeDescription + " failed");
                            }
                            else if(DR == DialogResult.OK)
                            {
                                LoginUser = OSystem.Refresh();
                                BuildUserHierarchy();
                            }
                        }
                    }
                }
                else if(e.Button.Text == sDeleteSection)
                {
                    if(treeView1.SelectedNode != null)
                    {
                        TreeNode XNode = treeView1.SelectedNode;
                        if(XNode.Tag is OysterClassLibrary.Section)
                        {
                            System.Windows.Forms.DialogResult DR = new System.Windows.Forms.DialogResult();
                            bool bSuccess = false;

                            DR = System.Windows.Forms.MessageBox.Show("Destroying " + g_objSection.Description + " will permanently destroy ALL Recordings that have been assigned to this " + sSType,"Do you wish to proceed with Delete " + sSType + "?",System.Windows.Forms.MessageBoxButtons.YesNo);

                            if(DR == DialogResult.Yes)
                            {
                                Status(LoginUser.Description + " gave order to proceed with deletion...");
                                OysterClassLibrary.Functions F = new OysterClassLibrary.Functions();
                                OysterClassLibrary.User objUser = F.GetUser(g_objSection.OwnerID);
                                if(objUser == null)
                                    return;
                                try
                                {
                                    F.RemoveSection(g_objSection.ID);
                                    F.Dispose();
                                    bSuccess = true;
                                }
                                catch(Exception Err)
                                {
                                    string peekerror = Err.Message;
                                    F.Dispose();
                                    bSuccess = false;
                                }

                                if(bSuccess ==true)
                                {
                                    Status("Successfully deleted: " + g_objSection.Description);
                                    //cbSectionType.Items.Clear();
                                    //cbSectionType.Text = "";
                                    LoginUser = OSystem.Refresh();
                                    BuildUserHierarchy();
                                    ShowDisplay(ShowGroupInfo);
                                }
                            }
                        }
                    }
                }
                else if(e.Button.Text == "Delete Recording")
                {
                    DialogResult DR = new DialogResult();
                    if((btnPlay.Enabled == true)||(btnPause.Enabled == true)||(btnStop.Enabled == true))
                    {
                        try
                        {
                            //                            MediaPlayer.Ctlcontrols.stop();
                            if(gLastRecording != "")
                            {
                                try
                                {
                                    // MediaPlayer.URL = "";
                                }
                                catch(Exception Err)
                                {
                                    string peekerror = Err.Message;
                                }
                            }
                            btnPlay.Enabled = false;

                        }
                        catch(Exception Err)
                        {
                            MessageBox.Show(Err.Message);
                        }

                    }

                    DR = MessageBox.Show(this,"Do you wish to permanently delete tne recording: '" + g_objRecording.DisplayName + "'","Deleting Recording",MessageBoxButtons.YesNo);

                    if(DR == DialogResult.No)
                        return;
                    OysterClassLibrary.Functions F = new OysterClassLibrary.Functions();

                    TreeNode X = treeView1.SelectedNode;
                    string test = X.Text;
                    X = X.Parent;
                    test = X.Text;
                    OysterClassLibrary.Section B = F.GetSection(g_objRecording.CurrentSectionID);

                    if(g_objRecording.CurrentUserID == g_objRecording.OwnerID)
                    {
                        int CurrentUser = 0;
                        if(g_objUser == null)
                        {
                            if(g_objRecording.CurrentUserID == 0)
                                CurrentUser = LoginUser.ID;
                            else
                                CurrentUser = g_objRecording.CurrentUserID;
                        }
                        else
                            CurrentUser = g_objUser.ID;
                        try
                        {
                            F.RemoveRecording(g_objRecording.ID,CurrentUser,B.ID);
                            LoginUser = OSystem.Refresh();
                        }
                        catch(Exception Err)
                        {
                            MessageBox.Show(Err.Message,"Error occurred during Delete Recording operation");
                        }
                        BuildUserHierarchy();
                        return;
                    }
                    else  // test == "Recordings" which means all we have to do is go up till we find the body it is attached to
                    {
                        try
                        {
                            F.RemoveRecording(g_objRecording.ID,g_objRecording.CurrentUserID,g_objRecording.CurrentSectionID);
                            LoginUser = OSystem.Refresh();
                            BuildUserHierarchy();
                            return;
                        }
                        catch(Exception Err)
                        {
                            MessageBox.Show(Err.Message);
                            return;
                        }
                    }
                }
                else
                {
                    switch(e.Button.Text)
                    {
                        default:
                            break;
                    }
                }
            }
            else if(e.Button == tbActionBar.Buttons[8])
            {
                if(e.Button.Text == "View Notes")
                {
                    if(FN != null)
                    {
                        if(FN.IsDisposed != true)
                        {
                            FN.Dispose();
                        }
                    }
                    FN = new frmNotes();
                    FN.Owner = this;
                    LastSelectedRecording = g_objRecording;
                    FN.Show();
                }
            }
        }
Пример #15
0
        private void btnLoginCardScan_Click(object sender, System.EventArgs e)
        {
            if((g_COMPORT != cbConfigureCardScan.Text.ToString())&&(cbConfigureCardScan.Text != "NO COMPORTS"))
            {
                g_COMPORT = cbConfigureCardScan.Text.ToString();
                RK = Registry.CurrentUser.OpenSubKey("Software\\Carver Lab\\Oyster V2.0\\Data",true);
                RK.SetValue("COMPORT",g_COMPORT);
            }

            FrmParent.Msg("Scan User Identification Card");
            string CardNumber = CardSwipe.Scan(g_COMPORT);
            if(CardNumber == "")return;
            CardNumber = FormatCardNumber(CardNumber);

            tryagain2:{}
            FrmParent.Msg("Searching for server please wait...");
            try
            {
                OSystem = new OysterClassLibrary.Oyster();
                FrmParent.Msg("Authenticating User...");
                try
                {
                    LoginUser = OSystem.Login(CardNumber);
                }
                catch (Exception Err)
                {
                    string peek = Err.Message;
                    MessageBox.Show("Unrecognized Access Card.","Oyster Executive: Login Message");
                    return;
                }
                //LoginUser = OSystem.Login(g_sLoginName,g_sLoginPassword);
                if(LoginUser != null)
                {
                    if(!CheckForValidLicense(LoginUser))
                    {
                        FrmParent.Msg("All available login slots are currently in use.");
                        LoginUser = null;
                        return;
                    }
                    FrmParent.Msg("User authenticated.");
                }
            }
            catch(Exception Err)
            {
                if(Err.Message == "SQL Server does not exist or access denied.")
                {
                    DialogResult DR = MessageBox.Show("Do you wish to try to locate the server manually","Unable to establish a connection to Oyster Server",System.Windows.Forms.MessageBoxButtons.YesNo);

                    if(DR == DialogResult.No)
                    {
                        this.DialogResult = DialogResult.Abort;
                        return;
                    }

                    frmServerLocation SL = new frmServerLocation();
                    DR = SL.ShowDialog(this);
                    if(DR != DialogResult.OK)
                    {
                        this.DialogResult = DialogResult.Abort;
                        return;
                    }
                    //FrmParent.Msg("Searching for server please wait...");
                    goto tryagain2;

                }
                else
                {
                    this.Opacity = 100;
                    MessageBox.Show("Error received while attempting to login user.","Unknown Error");
                    MessageBox.Show("Application will now close","Oyster Executive");
                    this.DialogResult = DialogResult.Abort;
                    return;
                }
            }

            if(OSystem.SystemAdminLoginDenied == true)
            {
                MessageBox.Show("Someone has already logged in with System Administrator access...\nYour SYSTEM priviledges are being set to READONLY Access.\nFor Full Access please try to login again at a later time.","System Administrator account in use!");
            }
            FrmParent.Msg("User authenticated.");
            this.DialogResult = DialogResult.OK;
        }
Пример #16
0
        //TreeView Control Functions
        private void treeView1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            tbActionBar.Buttons[0].Visible = false;
            tbActionBar.Buttons[1].Visible = false;
            tbActionBar.Buttons[2].Visible = false;
            tbActionBar.Buttons[3].Visible = false;
            tbActionBar.Buttons[4].Visible = false;
            tbActionBar.Buttons[5].Visible = false;
            tbActionBar.Buttons[6].Visible = false;
            tbActionBar.Buttons[7].Visible = false;
            tbActionBar.Buttons[8].Visible = false;

            tbActionBar.Buttons[0].Enabled = true;
            //tbActionBar.Buttons[1].Enabled = true;
            tbActionBar.Buttons[2].Enabled = true;
            //tbActionBar.Buttons[3].Enabled = true;
            tbActionBar.Buttons[4].Enabled = true;
            //tbActionBar.Buttons[5].Enabled = true;
            tbActionBar.Buttons[6].Enabled = true;
            //tbActionBar.Buttons[7].Enabled = true;
            tbActionBar.Buttons[8].Enabled = true;

            pnlMediaPlayerControls.Visible = true;
            string NodeText = "";
            TreeNode Y2 = treeView1.SelectedNode;
            if(Y2 != null)
                NodeText = Y2.Text;

            //Y2 = treeView1.GetNodeAt(e.X,e.Y);
            if(Y2 == null) return;
            NodeText = Y2.Text;
            treeView1.SelectedNode = Y2;
            g_RecordingNode = Y2;
            CalculateCurrentSectionType(Y2);
            switch (e.Button)
            {
                case MouseButtons.Left:

                    object UnknownObjA;
                    UnknownObjA = Y2.Tag;
                    if(UnknownObjA is string)
                    {
                        string sText = (string)UnknownObjA;
                        if(sText == "TopofPack")
                        {
                            g_objUser = LoginUser;
                            ShowDisplay(ShowUserInfo);
                            ////////MINITOOLBAR CONFIGURATION
                            foreach(OysterClassLibrary.Permission P in LoginUser.HighestAuthorityLevel.CanDestroyAnyUsers)
                            {
                                tbActionBar.Buttons[0].Text = "Create New User";
                                tbActionBar.Buttons[0].Visible = true;
                                tbActionBar.Buttons[1].Visible = false;
                                tbActionBar.Buttons[1].ToolTipText = "Creates a new user in the system";

                                tbActionBar.Buttons[2].Text = "Delete User(s)";
                                tbActionBar.Buttons[2].Visible = true;
                                tbActionBar.Buttons[2].ToolTipText = "Permanently deletes user from the system";
                                tbActionBar.Buttons[3].Visible = false;
                                tbActionBar.Buttons[4].Text = "";
                                tbActionBar.Buttons[4].Visible = false;
                                break;
                            }
                        }

                    }
                    else if(UnknownObjA is OysterClassLibrary.User)
                    {
                        g_objUser = (OysterClassLibrary.User)UnknownObjA;
                        ShowDisplay(ShowUserInfo);
                        int[] UO = OSystem.UnassignedIDs;

                        if(g_objUser.ID != UO[0])
                        {

                            ////////MINITOOLBAR CONFIGURATION
                            ///
                            foreach(OysterClassLibrary.Permission P in CurrentSectionType.CanEditSectionTypes)
                            {
                                if(P.CanOperateOn == g_objUser.CurrentSection.CreatedBySectionType.NextSectionTypeID)
                                {
                                    tbActionBar.Buttons[0].Text = "Edit User";
                                    tbActionBar.Buttons[0].Visible = true;
                                    tbActionBar.Buttons[1].Visible = false;

                                    tbActionBar.Buttons[2].Text = "";
                                    tbActionBar.Buttons[2].Visible = false;
                                    tbActionBar.Buttons[3].Visible = false;
                                    tbActionBar.Buttons[4].Text = "Remove User";
                                    tbActionBar.Buttons[4].Visible = true;
                                    break;
                                }
                            }

                            foreach(OysterClassLibrary.Permission P in CurrentSectionType.CanCreateSectionTypes)
                            {
                                if(P.CanOperateOn == g_objUser.CurrentSection.CreatedBySectionType.NextSectionTypeID)
                                {
                                    if(g_objUser.CurrentSection.CreatedBySectionType.NextSectionType.NextSectionTypeID != -99)
                                    {
                                        tbActionBar.Buttons[5].Visible = false;
                                        tbActionBar.Buttons[6].Text = "New " + g_objUser.CurrentSection.CreatedBySectionType.NextSectionType.CreatesSectionTypeDescription;
                                        tbActionBar.Buttons[6].Visible = true;
                                    }
                                    else
                                    {
                                        tbActionBar.Buttons[5].Visible = false;
                                        tbActionBar.Buttons[6].Text = "";
                                        tbActionBar.Buttons[6].Visible = false;
                                    }
                                    break;
                                }
                            }
                        }
                    }
                    else if(UnknownObjA is OysterClassLibrary.Section)
                    {
                        g_objSection = (OysterClassLibrary.Section)UnknownObjA;

                        if(g_objSection.ID == MainSystemSection.ID)
                        {
                            tbActionBar.Buttons[0].Text = "Add User(s)";
                            tbActionBar.Buttons[0].Visible = false;
                            tbActionBar.Buttons[1].Visible = false;

                            tbActionBar.Buttons[2].Text = "Remove User(s)";
                            tbActionBar.Buttons[2].Visible = false;
                            tbActionBar.Buttons[3].Visible = false;
                            tbActionBar.Buttons[4].Text = "";
                            tbActionBar.Buttons[4].Visible = false;

                            tbActionBar.Buttons[6].Text = "New " + g_objSection.CreatedBySectionType.NextSectionType.CreatesSectionTypeDescription;
                            tbActionBar.Buttons[6].Visible = true;
                            return;
                        }
                        if(g_objSection.IsMember == true)
                        {
                            tbActionBar.Buttons[0].Visible = false;
                            tbActionBar.Buttons[1].Visible = false;
                            tbActionBar.Buttons[2].Visible = false;
                            tbActionBar.Buttons[3].Visible = false;
                            tbActionBar.Buttons[4].Visible = false;
                            tbActionBar.Buttons[5].Visible = false;
                            tbActionBar.Buttons[6].Visible = false;
                            return;
                        }
                        else if(g_objSection.CreatedBySectionType.PreviousSectionTypeID == -99)
                        {
                            tbActionBar.Buttons[0].Visible = false;
                            tbActionBar.Buttons[1].Visible = false;
                            tbActionBar.Buttons[2].Visible = false;
                            tbActionBar.Buttons[3].Visible = false;
                            tbActionBar.Buttons[4].Visible = false;
                            tbActionBar.Buttons[5].Visible = false;
                            tbActionBar.Buttons[6].Visible = false;
                            return;
                        }
                        ShowDisplay(ShowGroupInfo);
                        ////////MINITOOLBAR CONFIGURATION
                        ///

                        foreach(OysterClassLibrary.Permission P in CurrentSectionType.CanEditSectionTypes)
                        {
                            if(P.CanOperateOn == g_objSection.CreatedBySectionType.NextSectionTypeID)
                            {
                                tbActionBar.Buttons[0].Text = "Add User(s)";
                                tbActionBar.Buttons[0].Visible = true;

                                tbActionBar.Buttons[1].Visible = false;
                                tbActionBar.Buttons[2].Text = "Remove User(s)";
                                tbActionBar.Buttons[2].Visible = true;

                                if(g_objSection.CurrentUsers.Count > 0)
                                {
                                    tbActionBar.Buttons[2].Enabled = true;
                                }
                                else
                                    tbActionBar.Buttons[2].Enabled = false;

                                tbActionBar.Buttons[3].Visible = false;
                                tbActionBar.Buttons[4].Text = "Edit " + g_objSection.CreatedBySectionType.CreatesSectionTypeDescription;
                                tbActionBar.Buttons[4].Visible = true;
                                break;
                            }
                        }
                        foreach(OysterClassLibrary.Permission P in CurrentSectionType.CanRemoveSectionTypes)
                        {
                            if(P.CanOperateOn == g_objSection.CreatedBySectionType.NextSectionTypeID)
                            {
                                tbActionBar.Buttons[5].Visible = false;
                                tbActionBar.Buttons[6].Text = "Delete " + g_objSection.CreatedBySectionType.CreatesSectionTypeDescription;
                                tbActionBar.Buttons[6].Visible = true;
                            }
                        }

                    }
                    else if(UnknownObjA is OysterClassLibrary.Recording)
                    {
                        g_objRecording = (OysterClassLibrary.Recording) UnknownObjA;
                        tbActionBar.Buttons[8].Text = "View Notes";
                        tbActionBar.Buttons[8].Visible = true;

                        //						statusBar1.Text = "Recording : " + g_objRecording.Created;
                        //                        ShowDisplay(ShowRecordingInfo);
                        //                        btnPlay.Enabled = false;
                        //                        //						MediaPlayer.Height = 512;
                        //                        //						MediaPlayer.Width = 696;
                        //                        //						MediaPlayer.Location  = new System.Drawing.Point(pnlRecordingInfo.Location.X + 28, pnlRecordingInfo.Location.Y + 53);
                        //
                        //                        OysterClassLibrary.VideoStorageServer VSS =  OSystem.GetVideoStorageServerById(g_objRecording.VideoStorageServerID);
                        //                        string sRecording = "";
                        //                        if(VSS.ControlAddress != "Not Assigned")
                        //                        {
                        //                            if(VSS.StorageDirectory != "")
                        //                                sRecording = "mms://" + VSS.ControlAddress + "/" + VSS.StorageDirectory + "/" + g_objRecording.Description;
                        //                            else
                        //                                sRecording = "mms://" + VSS.ControlAddress + "/" + g_objRecording.Description;
                        //                        }
                        //                        else
                        //                             sRecording = g_objRecording.Description;

                        //                        if(g_objRecording.VideoStorageServerControlAddress != "Not Assigned")
                        //                        {
                        //                            if(VSS.StorageDirectory != "")
                        //                                sRecording = "mms://" + VSS.ControlAddress + "/" + VSS.StorageDirectory + "/" + Rec.Description;
                        //                            else
                        //                                sRecording = "mms://" + VSS.ControlAddress + "/" + Rec.Description;
                        //                        }
                        //                        else
                        //                            sRecording = Rec.Description;
                        //                        if(DebugMode == true)
                        //                            sRecording = Recording_Location + g_objRecording.Description + ".mpg";
                        //                        else
                        //                            sRecording = "ivod://" + g_objRecording.VideoStorageServerControlAddress + "/" + g_objRecording.Description + ".mpg";
                        //
                        // btnPlay.Enabled = true;
                        //gLastRecording = sRecording;
                        ////////MINITOOLBAR CONFIGURATION
                        ///
                        tbActionBar.Buttons[0].Text = "View Recording";
                        tbActionBar.Buttons[0].Visible = true;
                        OysterClassLibrary.Section local_objSection = OSystem.GetSectionById(g_objRecording.CurrentSectionID);

                        if((local_objSection != null)&&(local_objSection.IsDefault == false))
                        {
                            foreach(OysterClassLibrary.Permission P in CurrentSectionType.CanMoveRecordings)
                            {
                                if(P.CanOperateOn == local_objSection.CreatedBySectionType.ID)
                                {
                                    tbActionBar.Buttons[1].Visible = false;
                                    tbActionBar.Buttons[2].Text = "Reassign Recording";
                                    tbActionBar.Buttons[2].Visible = true;
                                    break;
                                }
                            }

                            if(g_objRecording.OwnerID == LoginUser.ID)
                            {
                                tbActionBar.Buttons[3].Visible = false;
                                tbActionBar.Buttons[4].Text = "Rename Recording";
                                tbActionBar.Buttons[4].Visible = true;
                            }
                            foreach(OysterClassLibrary.Permission P in CurrentSectionType.CanDestroyRecordings)
                            {
                                if(P.CanOperateOn == local_objSection.CreatedBySectionType.ID)
                                {
                                    tbActionBar.Buttons[5].Visible = false;
                                    tbActionBar.Buttons[6].Text = "Delete Recording";
                                    tbActionBar.Buttons[6].Visible = true;
                                }
                            }
                        }
                        else if((local_objSection != null)&&(local_objSection.IsDefault == true))
                        {
                            if(g_objRecording.OwnerID == LoginUser.ID)
                            {
                                foreach(OysterClassLibrary.Permission P in CurrentSectionType.CanMoveRecordings)
                                {
                                    if(P.CanOperateOn == local_objSection.CreatedBySectionType.ID)
                                    {
                                        tbActionBar.Buttons[1].Visible = false;
                                        tbActionBar.Buttons[2].Text = "Reassign Recording";
                                        tbActionBar.Buttons[2].Visible = true;
                                        break;
                                    }
                                }

                                tbActionBar.Buttons[3].Visible = false;
                                tbActionBar.Buttons[4].Text = "Rename Recording";
                                tbActionBar.Buttons[4].Visible = true;
                            }

                            foreach(OysterClassLibrary.Permission P in LoginUser.HighestAuthorityLevel.CanDestroyRecordings)
                            {
                                tbActionBar.Buttons[5].Visible = false;
                                tbActionBar.Buttons[6].Text = "Delete Recording";
                                tbActionBar.Buttons[6].Visible = true;
                            }
                        }
                        else
                        {
                            if(g_objRecording.OwnerID == LoginUser.ID)
                            {
                                tbActionBar.Buttons[3].Visible = false;
                                tbActionBar.Buttons[4].Text = "Rename Recording";
                                tbActionBar.Buttons[4].Visible = true;
                            }

                            foreach(OysterClassLibrary.Permission P in LoginUser.HighestAuthorityLevel.CanDestroyRecordings)
                            {
                                tbActionBar.Buttons[5].Visible = false;
                                tbActionBar.Buttons[6].Text = "Delete Recording";
                                tbActionBar.Buttons[6].Visible = true;
                                break;
                            }
                        }
                    }
                    break;
            }

            treeView1.Refresh();
        }
Пример #17
0
        private void SectionWizard_Load(object sender, System.EventArgs e)
        {
            if(this.Owner is Form1)
                FrmParent = (Form1)this.Owner;

            if(this.Tag is PassSectionInfo)
            {
                PassSectionInfo PSI = (PassSectionInfo)this.Tag;
                CurrentSection = PSI.CurrentSection;
                PreviousSection = PSI.PreviousSection;
                IsEditing = PSI.IsEdit;
                CurrentUser = PSI.CurrentUser;
                if(IsEditing == true)
                {
                    this.Text = "Editing " + CurrentSection.Description;
                    tbDescription.Text = CurrentSection.Description;
                }
                else
                {
                    this.Text = "Creating a New " + PreviousSection.CreatedBySectionType.NextSectionType.CreatesSectionTypeDescription;
                    tbDescription.Text = "";
                }
                foreach(OysterClassLibrary.User SU in PSI.OSystem.CurrentSystemUsers)
                {
                    ListViewItem LVI = new ListViewItem(SU.LastName);
                    LVI.SubItems.Add(SU.FirstName);
                    LVI.SubItems.Add(SU.MiddleName);
                    LVI.Tag = SU;
                    lvUsers.Items.Add(LVI);
                }
                foreach(ListViewItem LI in lvUsers.Items)
                {
                    OysterClassLibrary.User US = (OysterClassLibrary.User)LI.Tag;
                    if(IsEditing == true)
                    {
                        if(US.ID == CurrentSection.OwnerID)
                        {
                            LI.Selected = true;
                            break;
                        }
                    }
                    else if(US.ID == CurrentUser.ID)
                    {
                       LI.Selected = true;
                    }
                }
            }
            else
            {
                this.DialogResult = DialogResult.Abort;
            }
        }