public void svcSendRecordedFiles(clsMessageContract mcSendRecordedFiles)
 {
     try
     {
         if (EntsvcSendRecordedFiles != null)
         {
             EntsvcSendRecordedFiles(mcSendRecordedFiles);
         }
     }
     catch (Exception ex)
     {
         ClsException.WriteToLogFile("svcSendRecordedFiles() :- NetP2PBootStrapRecordedFileDelegate.cs" + ex.Message);
     }
 }
 public void svcRecordedFileUnJoin(clsMessageContract mcRFUnJoin)
 {
     try
     {
         if (EntsvcRecordedFileUnJoin != null)
         {
             EntsvcRecordedFileUnJoin(mcRFUnJoin);
         }
     }
     catch (Exception ex)
     {
         ClsException.WriteToLogFile("svcRecordedFileUnJoin() :- NetP2PBootStrapRecordedFileDelegate.cs" + ex.Message);
     }
 }
        void fncRecordedFileUpload(long LeadID, DateTime CalledDate, long DispositionID)
        {
            try
            {
                string ZoneName = ClsDisposition.GetZoneName(LeadID);
                string DispositionName = objChannelManager.GetDispositionName(DispositionID);
                string PhoneNo = objChannelManager.GetPhoneNo(LeadID);

                //Point out to the file from a specific folder

                DateTime dt = DateTime.Now;
                string FilePath = StrOrkaInstallDirectory + @"\AudioRecordings\" + dt.ToString("yyyy") + "\\" + dt.ToString("MM") + "\\" + dt.ToString("dd") + "\\" + dt.ToString("HH");
                string[] FileName = Directory.GetFiles(FilePath);

                //string fname = System.IO.Path.GetFileName(FileName[0]
                string oldFilePath = FilePath + "\\" + System.IO.Path.GetFileName(FileName[0]);
                string fext = System.IO.Path.GetExtension(FileName[0]);

                string date = CalledDate.ToString("yyyy") + CalledDate.ToString("MM") + CalledDate.ToString("dd");
                string time = CalledDate.ToString("HH") + "." + CalledDate.ToString("mm") + "." + CalledDate.ToString("ss");

                string newFileName = DispositionName + "_" + ZoneName + "_" + date + "_" + time + "_" + PhoneNo + fext;
                string newFilePath = FilePath.Trim() + "\\" + newFileName.Trim();

                FileInfo fi = new FileInfo(oldFilePath);
                if (File.Exists(newFilePath))
                    File.Delete(newFilePath);
                else
                    File.Move(oldFilePath, newFilePath);


                objChannelManager.ActiveChannel.RecordedFileName = newFileName;
                FileStream fs = new FileStream(newFilePath, FileMode.Open, FileAccess.Read);
                byte[] FileData = new byte[fs.Length];
                fs.Read(FileData, 0, (int)fs.Length);
                fs.Close();
                //fs.Flush();

                MemoryStream mms = new MemoryStream(FileData);
                mms.Position = 0;

                clsMessageContract objContract = new clsMessageContract();
                objContract.uname = VMuktiAPI.VMuktiInfo.CurrentPeer.DisplayName;
                objContract.fName = System.IO.Path.GetFileName(newFilePath);
                objContract.fExtension = System.IO.Path.GetExtension(newFilePath);
                objContract.fLength = mms.Length;
                objContract.fStream = mms;

                channelNetTcpUploadRecorededFiles.svcSendRecordedFiles(objContract);
                File.Delete(newFilePath);

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                VMuktiAPI.VMuktiHelper.ExceptionHandler(ex, "fncRecordedFileUpload", "AutoDialer-MyDialer.xaml.cs");
            }
        }
 void PredictiveDialer_EntsvcRecordedFileUnJoin(clsMessageContract mcRFUnJoin)
 {
 }
 void PredictiveDialer_EntsvcSendRecordedFiles(clsMessageContract mcSendRecordedFiles)
 {
 }
        public void HostRecordedFiles(object lstparam)
        {
            try
            {
                List<object> lstTempObj = (List<object>)lstparam;
                strUri = lstTempObj[0].ToString();

                NetPeerClient npcRecordedFiles = new NetPeerClient();
                ((NetP2PBootStrapRecordedFileDelegate)objRecordedFiles).EntsvcRecordedFileJoin += new NetP2PBootStrapRecordedFileDelegate.delsvcRecordedFileJoin(PredictiveDialer_EntsvcRecordedFileJoin);
                ((NetP2PBootStrapRecordedFileDelegate)objRecordedFiles).EntsvcSendRecordedFiles += new NetP2PBootStrapRecordedFileDelegate.delsvcSendRecordedFiles(PredictiveDialer_EntsvcSendRecordedFiles);
                ((NetP2PBootStrapRecordedFileDelegate)objRecordedFiles).EntsvcRecordedFileUnJoin += new NetP2PBootStrapRecordedFileDelegate.delsvcRecordedFileUnJoin(PredictiveDialer_EntsvcRecordedFileUnJoin);


                channelNetTcpUploadRecorededFiles = (INetP2PBootStrapRecordedFileChannel)npcRecordedFiles.OpenClient<INetP2PBootStrapRecordedFileChannel>(strUri, lstTempObj[1].ToString(), ref objRecordedFiles);

                clsMessageContract objContract = new clsMessageContract();
                objContract.uname = VMuktiAPI.VMuktiInfo.CurrentPeer.DisplayName;
                objContract.fName = "";
                objContract.fExtension = "";
                objContract.fLength = 0;
                objContract.fStream = new MemoryStream();

                channelNetTcpUploadRecorededFiles.svcRecordedFileJoin(objContract);
            }
            catch (Exception ex)
            {
                VMuktiAPI.VMuktiHelper.ExceptionHandler(ex, "HostRecordedFiles()", "MyDialer.xaml.cs");
            }
        }