Пример #1
0
 /// <summary>
 /// @author : TrungMT
 /// @CreateDate:04/07/2008
 /// @Description: constructor
 /// </summary>
 public FrmTestFTPConnection(WebUpdownUtil pFTPl)
     : base()
 {
     mFTPl = pFTPl;
     SetProcessingStyle(ProgressBarStyle.Marquee);
     SetProcessingLabel("Đang kiểm tra kết nối đến server!");
     VisibleOverall = false;
 }
Пример #2
0
 /// <summary>
 /// @author : TrungMT
 /// @CreateDate:04/07/2008
 /// @Description: Processing upload clip to ftp server
 /// </summary>
 public override void Process()
 {
     try
     {
         int i = 0;
         //mftpConnection = QTC.Adv.BusinessModule.Global.
         mftpConnection = QTC.Adv.BusinessModule.Global.MakeFTPUploadConnection();
         mftpConnection.BufferLength = 230400;
         mftpConnection.OpenConnection();
         while (i < mUploadClips.Length)
         {
             if (Cancel)
                 return;
             if (!Pause)
             {
                 UploadOneFile(mUploadClips[i]);
                 i++;
                 SetOverallValue(i);
                 //Thread.Sleep(100);
             }
         }
         mblnSuccess = true;
         mException = null;
     }
     catch (Exception exp)
     {
         mException = exp;
         mblnSuccess = false;
         MsgBoxVN.ShowError(exp.Message,Dic.STRING_WARNING);
     }
     finally
     {
         // Release connection
         mftpConnection.ReleaseConnection();
         CloseForm();
     }
 }
Пример #3
0
        /// <summary>
        /// @author : KhoaHT
        /// @CreateDate:04/07/2008
        /// @Description: Processing upload clip to ftp server
        /// </summary>
        public override void Process()
        {
            try
            {
                int i = 0;
                //mftpConnection = QTC.Adv.BusinessModule.Global.
                mftpConnection = QTC.Adv.BusinessModule.Global.MakeFTPDownloadConnection();
                mftpConnection.BufferLength = 230400;
                mftpConnection.OpenConnection();

                ScheduleDetail pScheduleDetail = new ScheduleDetail();
                // Define how long to download
                int intLength = 0;
                // if download only one rows
                if (mRow != null)
                    intLength = 1;
                // Or many rows
                else
                    intLength = (mScheduleDetails == null) ? mRowCollection.Count : mScheduleDetails.Length;

                while (i < intLength)
                {
                    if (Cancel)
                        return;
                    if (!Pause)
                    {
                        if (mScheduleDetails != null)
                            pScheduleDetail = mScheduleDetails[i];
                        else if (mRowCollection != null)
                        {
                            pScheduleDetail.ClipId = (int)mRowCollection[i]["CLIP_ID"];
                            pScheduleDetail.URL = (string)mRowCollection[i]["URL"];
                            pScheduleDetail.FileName = (string)mRowCollection[i]["File_Name"];
                            pScheduleDetail.Downloaded = (byte)mRowCollection[i]["DOWNLOADED"];
                            pScheduleDetail.ScheduleId = (int)mRowCollection[i]["SCHEDULE_ID"];
                            // if downloaded one time, stop download
                            if (mclipStatus.IsDownloaded(pScheduleDetail.FileName))
                            {
                                mRowCollection[i]["DOWNLOADED"] = (byte) 1;
                                pScheduleDetail.Downloaded = 1;
                            }

                            pScheduleDetail.Code = (string)mRowCollection[i]["CODE"];
                            pScheduleDetail.Name = (string)mRowCollection[i]["NAME"];
                        }
                        else
                        {
                            pScheduleDetail.ClipId = (int)mRow["CLIP_ID"];
                            pScheduleDetail.URL = (string)mRow["URL"];
                            pScheduleDetail.FileName = (string)mRow["File_Name"];
                            pScheduleDetail.Downloaded = 0;
                            pScheduleDetail.Code = (string)mRow["CODE"];
                            pScheduleDetail.Name = (string)mRow["NAME"];
                            pScheduleDetail.ScheduleId = (int)mRow["SCHEDULE_ID"];
                        }

                        pScheduleDetail.ScheduleDate = mDateTime;
                        pScheduleDetail.WorkstationId = mWorkstationID;
                        // write a log that this clip has been downloaded
                        if (pScheduleDetail.Downloaded == 1)
                        {
                            mbScheduleDetail.CheckDownloaded(pScheduleDetail);
                        }
                        // download only if have'nt downloaded
                        if (pScheduleDetail.Downloaded == 0)
                        {
                            if (DownloadOneFile(pScheduleDetail))
                            {
                                pScheduleDetail.Downloaded = 1;
                                mbScheduleDetail.CheckDownloaded(pScheduleDetail);
                                if (mScheduleDetails != null)
                                {
                                    mclipStatus.SetDownloaded(pScheduleDetail.FileName);
                                    pScheduleDetail.Downloaded = 1;
                                }
                                else if (mRowCollection != null)
                                {
                                    mclipStatus.SetDownloaded((string)mRowCollection[i]["File_Name"]);
                                    mRowCollection[i]["DOWNLOADED"] = 1;
                                }
                                else
                                {
                                    mclipStatus.SetDownloaded((string)mRow["File_Name"]);
                                    mRow["DOWNLOADED"] = 1;
                                }
                            }
                        }
                        i++;
                        SetOverallValue(i);
                        //Thread.Sleep(100);
                    }
                }
            }
            catch (Exception exp)
            {
                QTCMessageBox.Show(this, exp, "");
                return;
            }
            finally
            {
                // Release connection
                mftpConnection.ReleaseConnection();
                CloseForm();
            }
        }