示例#1
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();
        }