Пример #1
0
        private void RefreshGrid()
        {
            try
            {
                imgButtonView.ImageUrl = "images/Tab_B_NewNote_Disabled.jpg";
                imgButtonRename.ImageUrl = "images/Tab_B_EditNote_Disabled.jpg";
                imgButtonMove.ImageUrl = "images/Tab_B_RemoveNote_Disabled.jpg";

                imgButtonView.ToolTip = "Create a new Note";
                imgButtonRename.ToolTip = "Edit selected Note";
                imgButtonMove.ToolTip = "Permanently removes selected Note";
                OSystem = (Oyster)Session["Oyster"];
                LUser = (User)Session["LUser"];

                //TabStrip1.Enabled = true;
                int SelectedIndex = Convert.ToInt32(txtSelectedIndex.Value,10);

                if(SelectedIndex != 1)
                {
                    return;
                }
                int numselected = Convert.ToInt32(NumSelected.Value,10);

                lblNoNote.Visible = true;
                dgNotes.Visible = false;

                if(numselected == 0)
                    lblNoNote.Text = "Notes for each recording are available only after selecting a Player View.  To do this: Click the Recording Tab then select the desired recording.       Click View Recording.        When ever the recording is selected in the view area, its Notes options will become available by clicking the Notes Tab.";
                else if(numselected > 1)
                    lblNoNote.Text = "Notes will not show if multiple Players are selected. Please choose only one Player to view it's Notes.";
                else
                {
                    lblNoNote.Visible = false;
                    dgNotes.Visible = true;
                }
                if((txtLastNote.Value != "")&&(txtLastNote.Value != "Restricted"))
                {
                    taNote.Visible = false;
                    string[] NodeData = txtLastNote.Value.Split('~');
                    Functions F = new Functions();

                    int RecordingId = Convert.ToInt32(NodeData[0],10);

                    F.GetNotes(RecordingId,ref DA,ref DS,ref SC);
                    //OSystem.GetNotes(RecordingId,ref DS);
                    DS.Tables[0].Columns[0].ColumnMapping = MappingType.Hidden;

                    Session["DS"] = DS;
                    Session["DA"] = DA;
                    Session["SC"] = SC;

                    dgNotes.DataSource = DS.Tables[0];
                    dgNotes.SelectedIndex = -1;
                    //dgNotes.AllowSorting = true;
                    dgNotes.DataBind();

                    //imgButtonMisc.ImageUrl = "images/Tab_B_UpdateNote.jpg";
                    //imgButtonMisc.Visible = false;
                    dgNotes.Visible = true;
                    lblSync.Visible = false;
                    tbSync.Visible = false;
                    tbSync.Disabled = true;
                    taNote.Visible = false;
                    lblNoNote.Visible = false;
                    Recording R = OSystem.GetRecordingById(RecordingId);
                    Session["NoteRecording"] = R;
                    bool bEnableControls = false;
                    if(R.OwnerID == LUser.ID)
                        bEnableControls = true;
                    if(bEnableControls == true)
                    {
                        imgButtonView.ImageUrl = "images/Tab_B_NewNote.jpg";
                    }
                    else
                    {
                        imgButtonView.ImageUrl = "images/Tab_B_NewNote_Disabled.jpg";

                    }
                    if(dgNotes.Items.Count != 0)
                    {
                        if((dgNotes.SelectedItem != null)&&(bEnableControls == true))
                        {
                            imgButtonRename.ImageUrl = "images/Tab_B_EditNote.jpg";
                            imgButtonMove.ImageUrl = "images/Tab_B_RemoveNote.jpg";
                        }
                        else
                        {

                        }
                    }
                    else
                    {
                        imgButtonRename.ImageUrl = "images/Tab_B_EditNote_Disabled.jpg";
                        imgButtonMove.ImageUrl = "images/Tab_B_RemoveNote_Disabled.jpg";
                        dgNotes.Visible = false;
                        lblNoNote.Visible = true;
                        lblNoNote.Text = "There are currently no notes associated with this recording";
                    }

                    if(DS.Tables[0].Rows.Count < 1)
                    {

                        //                    imgButtonRename.Visible = false;
                        //                    imgButtonMove.Visible = false;
                        //                    imgButtonMisc.Visible = false;
                        //                    imgButtonView.Visible = true;

                        //                    lblNoNote.Visible = true;
                        //                    dgNotes.Visible = false;
                        //                    if(numselected == 0)
                        //                        lblNoNote.Text = "Notes for each recording are available only after selecting a Player View.  To do this: Click the Recording Tab then select the desired recording.       Click View Recording.        When ever the recording is selected in the view area, its Notes options will become available by clicking the Notes Tab.";
                        //                    else if(numselected > 1)
                        //                        lblNoNote.Text = "Notes will not show if multiple Players are selected. Please choose only one Player to view it's Notes.";
                        //                    else
                        //                    {
                        //                        lblNoNote.Visible = false;
                        //                        dgNotes.Visible = true;
                        //                    }

                    }
                    //                else
                    //                {
                    //                    imgButtonRename.Visible = false;
                    //                    imgButtonMove.Visible = false;
                    //                    imgButtonMisc.Visible = false;
                    //                    imgButtonView.Visible = true;
                    //                }

                }
                else
                {
                    //DataTable dt = new DataTable();
                    //dgNotes.DataSource = dt;

                    imgButtonMisc.ImageUrl = "images/Tab_B_UpdateNote.jpg";
                    imgButtonMisc.Visible = false;
                    lblSync.Visible = false;
                    tbSync.Visible = false;
                    taNote.Visible = false;
                    //                lblNoNote.Visible = true;
                    //                dgNotes.Visible = false;
                    //                if(numselected == 0)
                    //                    lblNoNote.Text = "Notes for each recording are available only after selecting a Player View.  To do this: Click the Recording Tab then select the desired recording.       Click View Recording.        When ever the recording is selected in the view area, its Notes options will become available by clicking the Notes Tab.";
                    //                else if(numselected > 1)
                    //                    lblNoNote.Text = "Notes will not show if multiple Players are selected. Please choose only one Player to view it's Notes.";
                    //                else
                    //                {
                    //                    lblNoNote.Visible = false;
                    //                    dgNotes.Visible = true;
                    //                }
                    //                if(txtNotes.Value == "")
                    //                    lblNoNote.Text = "Notes for each recording are available only after selecting a Player View.  To do this: Click the Recording Tab then select the desired recording.       Click View Recording.        When ever the recording is selected in the view area, its Notes options will become available by clicking the Notes Tab.";
                    //                else
                    //                    lblNoNote.Text = "Notes will not show if multiple Players are selected. Please choose only one Player to view it's Notes.";
                    //                //imgButtonRename.Visible = false;
                    //imgButtonMove.Visible = false;
                    //imgButtonMisc.Visible = false;
                    //imgButtonView.Visible = false;
                }
            }
            catch(Exception Err)
            {
                string peekerror = Err.Message;
            }
        }
Пример #2
0
        private void btnPostBack_ServerClick(object sender, System.EventArgs e)
        {
            txtWaitMessage.Value = "waiting";
            OSystem = (Oyster)Session["Oyster"];

            if(tbDialogResult.Value != "")
            {
                string[] sResponse = tbDialogResult.Value.Split('~');
                tbDialogResult.Value = "";
                switch(sResponse[1])
                {
                    case "RenameRecording":
                        Recording R = (Recording)Session["Recording"];
                        try
                        {
                            R.Update(R.Description,sResponse[0],R.VideoStorageServerID,R.StreamingEncoderID,R.IsReady);
                            DDL_SelectedIndexChanged(DDL,new EventArgs());
                        }
                        catch(Exception Err)
                        {
                            txtAlert.Value = Err.Message;
                        }
                        break;
                    case "RenameSession":
                        TreeNode XNode = (TreeNode)Session["SessionInfo"];
                        try
                        {
                            string[] SID = XNode.NodeData.Split(':');
                            Functions F = new Functions();
                            F.RenameSession(SID[0],sResponse[0]);
                            //OSystem.RenameSession(SID[0],sResponse[0]);

                            DDL_SelectedIndexChanged(DDL,new EventArgs());
                        }
                        catch(Exception Err)
                        {
                            txtAlert.Value = Err.Message;

                        }
                        Session["IsCancel"] = false;
                        break;
                    case "MoveRecording":
                        string[] sSelectedSection= sResponse[0].Split(':');
                        Section CS = (Section)Session["Section"];
                        Recording MRRec = (Recording)Session["Recording"];
                        User CU = (User)Session["User"];
                        int ThisSectionId = Convert.ToInt32(sSelectedSection[1],10);

                        try
                        {
                            OSystem.MoveRecording(MRRec.ID,CU.ID,ThisSectionId,CU.ID,CS.ID);
                            DDL_SelectedIndexChanged(DDL,new EventArgs());
                        }
                        catch(Exception Err)
                        {
                            txtAlert.Value = Err.Message;
                        }
                        break;
                    case "MoveSession":
                        string[] sSelection = sResponse[0].Split(':');
                        string SessionId = (string)Session["SessionId"];
                        Section MSec =(Section)Session["Section"];
                        User MUser = (User)Session["User"];
                        int NewSectionId = Convert.ToInt32(sSelection[1],10);
                        foreach(OysterClassLibrary.Recording MRec in MSec.CurrentRecordings)
                        {
                            if((MRec.CurrentUserID == MUser.ID)&&(SessionId == MRec.SessionID))
                            {
                                try
                                {
                                    OSystem.MoveRecording(MRec.ID,MUser.ID,NewSectionId,MRec.CurrentUserID,MRec.CurrentSectionID);
                                    DDL_SelectedIndexChanged(DDL,new EventArgs());
                                }
                                catch(Exception Err)
                                {
                                    txtAlert.Value = Err.Message;
                                }
                            }
                        }
                        break;
                    case "NewNote":
                        string[] NodeData = txtNotes.Value.Split('~');
            //						Functions FF = new Functions();
                        string[] sEnteredData = sResponse[0].Split('*');
                        string sNoteValue = sEnteredData[1];
            //                        FF.AddNote(Convert.ToInt32(NodeData[0],10),NodeData[2],sNoteValue);
                        string sTimeStamp = sEnteredData[0];
                        DS = (DataSet)Session["DS"];
                        DA = (SqlDataAdapter)Session["DA"];
                        SC = (SqlConnection)Session["SC"];
                        DataRow NewRow = DS.Tables[0].NewRow();
                        NewRow[1] = sTimeStamp;
                        NewRow[2] = sNoteValue;
                        NewRow[3] = Convert.ToInt32(NodeData[0],10);
                        DS.Tables[0].Rows.Add(NewRow);
                        try
                        {
                            DA.Update(DS);
                            //OSystem.InsertNewNote(ref DS);
                        }
                        catch(Exception Err)
                        {
                            txtAlert.Value = Err.Message;
                        }
                        SwitchButtons(3);
                        //RefreshGrid();
                        //Session["NoteAction"] = "Nutn";
                        TabStrip1.Enabled = true;
                        break;
                    case "EditNote":
                        string[] NodeData2 = txtNotes.Value.Split('~');

                        string[] sEnteredData2 = sResponse[0].Split('*');
                        string sNoteValue2 = sEnteredData2[1];
                        string sTimeStamp2 = sEnteredData2[0];
                        DS = (DataSet)Session["DS"];
                        DA = (SqlDataAdapter)Session["DA"];
                        SC = (SqlConnection)Session["SC"];

                        DataRow r2 = DS.Tables[0].Rows[dgNotes.SelectedIndex];
                        r2[1] = sTimeStamp2;
                        r2[2] = sNoteValue2;
                        r2.AcceptChanges();
                        DS.Tables[0].AcceptChanges();
                        int NoteID = Convert.ToInt32(r2[0]);
                        int RecID = Convert.ToInt32(r2[3]);

                        try
                        {
                            //OSystem.UpdateNote(ref DS);
                            Functions FNE = new Functions();
                            OysterClassLibrary.Notes RNotes = FNE.GetNotes(RecID);
                            foreach(OysterClassLibrary.Note RecNote in RNotes)
                            {
                                if(RecNote.ID == NoteID)
                                {
                                    RecNote.Update(sTimeStamp2,sNoteValue2);
                                }
                            }
                            //DA.Update(DS);
                        }
                        catch(Exception Err)
                        {
                            txtAlert.Value = Err.Message;
                        }

                        SwitchButtons(3);
                        //RefreshGrid();
                        //Session["NoteAction"] = "Nutn";
                        TabStrip1.Enabled = true;
                        break;
                    case "DeleteNote":
                        DS = (DataSet)Session["DS"];
                        DA = (SqlDataAdapter)Session["DA"];
                        SC = (SqlConnection)Session["SC"];
                        DataRow r3 = DS.Tables[0].Rows[dgNotes.SelectedIndex];
                        int NoteID2 = Convert.ToInt32(r3[0]);
                        int RecID2 = Convert.ToInt32(r3[3]);

                        //DS.Tables[0].AcceptChanges();
                        try
                        {
                            //OSystem.DeleteNote(ref DS);
                            //DA.Update(DS);
                            OysterClassLibrary.Functions FND = new OysterClassLibrary.Functions();
                            FND.RemoveNote(NoteID2);

                        }
                        catch(Exception Err)
                        {
                            txtAlert.Value = Err.Message;
                        }

                        SwitchButtons(3);
                       // RefreshGrid();
                        break;
                }
            }
            else if(txtSelectedIndex.Value == "1")
                RefreshGrid();
        }
Пример #3
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            // Put user code to initialize the page here
            InitializeEvents();
            if(!this.IsPostBack)
            {
                Functions F = new Functions();
                taNote.Visible = false;
                tbSync.Visible = false;
                //Session["IsRecording"] = "RecordingSession";
                OSystem = (Oyster)Session["Oyster"];
                LUser = (User)Session["LUser"];
                HideButtons(false);
                int timestried = 0;
                txtEnableViewButton.Value = "true";
            tryagain:{}
                try
                {
                    User CurrentUser = (User)Session["User"];
                    if(CurrentUser == null)
                        CurrentUser = LUser;

                    int SelectedIndex = Convert.ToInt32(txtSelectedIndex.Value,10);
                    switch(SelectedIndex)
                    {
                        case 0:
                            Users MyMembers = LUser.AllMembersInHierarchy;
                            MyMembers.SortAscending();

                            int NoID = OSystem.UnassignedIDs[0];

                            foreach(User NewUser in MyMembers)
                            {
                                if(NewUser.ID != NoID)
                                {
                                    ListItem LI = new ListItem(NewUser.Description,NewUser.ID.ToString());
                                    DDL.Items.Add(LI);
                                }
                            }
                            bool NoNeed = false;
                            foreach(ListItem LI in DDL.Items)
                            {
                                int MatchID = Convert.ToInt32(LI.Value);
                                if(MatchID == LUser.ID)
                                {
                                    NoNeed = true;
                                    if(CurrentUser.ID == LUser.ID)
                                        LI.Selected = true;
                                }
                            }
                            if(NoNeed == false)
                            {
                                ListItem LIL = new ListItem(LUser.Description,LUser.ID.ToString());
                                if(CurrentUser.ID == LUser.ID)
                                    LIL.Selected = true;
                                DDL.Items.Add(LIL);
                            }
                            if(CurrentUser.ID != LUser.ID)
                            {
                                foreach(ListItem LI in DDL.Items)
                                {
                                    int MatchID = Convert.ToInt32(LI.Value);
                                    if(MatchID == CurrentUser.ID)
                                    {
                                        LI.Selected = true;
                                    }
                                }
                            }
                            FillTree(CurrentUser.ID);
                            SwitchButtons(1);
                            System.GC.Collect();
                            break;
                        case 1:
                            if((txtNotes.Value != "")&&(txtNotes.Value != "Restricted"))
                            {
                                string[] NodeData = new string[0];
                                NodeData = txtNotes.Value.Split(' ');

                                try
                                {
                                    int id = Convert.ToInt32(NodeData[0]);
                                    F.GetNotes(id,ref DA,ref DS,ref SC);
                                    dgNotes.DataSource = DS.Tables[0];
                                    dgNotes.DataBind();
                                    dgNotes.AllowSorting = true;
                                }
                                catch(Exception Err)
                                {
                                    txtAlert.Value = Err.Message;
                                }
                            }
                            else
                            {
                                dgNotes = new DataGrid();
                            }
                            SwitchButtons(2);
                            break;
                        case 2:
                            SwitchButtons(4);
                            break;
                    }
                }
                catch(Exception Err)
                {

                    if(timestried > 4)
                    {
                        txtAlert.Value = Err.Message;
                        return;
                    }
                    timestried++;
                    goto tryagain;
                }

            }
            else
            {
                if(Transitioning == true)
                {
                    Transitioning = false;
                }
                txtRecording.Value = "";
                int SelectedIndex = Convert.ToInt32(txtSelectedIndex.Value,10);
                if(SelectedIndex == 0)
                {
                    dgNotes.Visible = false;
                    TreeNode TN = tv.GetNodeFromIndex(tv.SelectedNodeIndex);
                    if(TN != null)
                    {
                        if(TN.Type == "RecordingSession")
                            SwitchButtons(2);
                        else
                            SwitchButtons(1);
                    }
                    else
                        SwitchButtons(1);
                }
                else if(SelectedIndex == 1)
                {
                    DS = (DataSet)Session["DS"];
                    DA = (SqlDataAdapter)Session["DA"];
                    SC = (SqlConnection)Session["SC"];

                    if(txtNotes.Value != txtLastNote.Value)
                    {
                        SwitchButtons(3);
                    }
                    else
                        RefreshNoteButtons();

                    //dgNotes.DataSource = DS.Tables[0];
                }
                else if(SelectedIndex == 2)
                {
                    dgNotes.Visible = false;
                    TreeNode CTVNode = (TreeNode)Session["CTVNode"];

                    if(CTVNode != null)
                    {
                        if(CTVNode.Type == "Scene")
                            SwitchButtons(5);
                        else
                            SwitchButtons(4);
                    }
                    else
                    {
                        SwitchButtons(4);
                    }
                }

            }
            txtWaitMessage.Value = "safetocontinue";
            //Response.Write("<script> HideTable(WaitMessage); </script>");
             //   txtLastNote.Value = txtNotes.Value;
        }