예제 #1
0
 /// <summary>
 /// 创建缩略图。
 /// </summary>
 /// <param name="store"></param>
 /// <param name="ls"></param>
 /// <param name="wf"></param>
 /// <param name="w"></param>
 /// <param name="h"></param>
 /// <returns></returns>
 public static Image CreateThumbnail(LocalStudentWorkStore store, LocalStudent ls, LocalStudentWorkFile wf, int w, int h)
 {
     if (store != null && ls != null && wf != null)
     {
         try
         {
             string root = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures) + "\\SFIT_TeaClient\\" + store.TeacherID + "_" + store.CatalogID;
             if (!Directory.Exists(root)) Directory.CreateDirectory(root);
             string path = Path.GetFullPath(string.Format("{0}\\{1}_{2}_{3}x{4}.jpg", root, ls.StudentID, wf.FileID, w, h));
             if (File.Exists(path)) return Image.FromFile(path);
             if (DefaultThumbnailFormat.IsExistThumbnailFormat(wf.FileExt))
             {
                 string source = ls.Work.StudentWorkFilePath(store, ls, wf);
                 if (File.Exists(source))
                 {
                     Image img = ImageHelper.MakeThumbnail(Image.FromFile(source), w, h);
                     if (img != null)
                     {
                         img.Save(path, System.Drawing.Imaging.ImageFormat.Jpeg);
                         return img;
                     }
                 }
             }
         }
         catch (Exception e)
         {
             UtilTools.OnExceptionRecord(e, typeof(ThumbnailsHelpers));
         }
     }
     return null;
 }
예제 #2
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="store"></param>
 /// <param name="handler"></param>
 public void Issue(LocalStudentWorkStore store,RaiseChangedHandler handler)
 {
     lock (this)
     {
         if (store == null || store.Students == null)
         {
             this.RaiseChanged(handler, "没有作品分发!");
             MessageBox.Show("没有作品分发!");
             return;
         }
         else if(this.netService != null && this.panelWork != null && this.panelWork.Controls != null)
         {
             bool flag = false;
             for (int i = 0; i < this.panelWork.Controls.Count; i++)
             {
                 StudentControl sc = this.panelWork.Controls[i] as StudentControl;
                 if (sc != null && sc.UserInfo != null && ((sc.State & StudentControl.EnumStudentState.Online) == StudentControl.EnumStudentState.Online))
                 {
                     flag = true;
                     this.IssueWorkData(store,store.Students[sc.UserInfo.UserID], handler);
                 }
             }
             if (!flag)
             {
                 string msg = "没有在线学生可分发作品数据!";
                 this.RaiseChanged(handler, msg);
                 MessageBox.Show(msg);
             }
         }
     }
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="service"></param>
 /// <param name="store"></param>
 /// <param name="students"></param>
 public BatchUploadWaitWindow(ICoreService service, LocalStudentWorkStore store, LocalStudents students)
     : base(service)
 {
     this.store = store;
     this.students = students;
     InitializeComponent();
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="store"></param>
 /// <param name="ls"></param>
 public MouseThumbnailWindow(LocalStudentWorkStore store, LocalStudent ls, Point point)
 {
     this.store = store;
     this.ls = ls;
     this.point = point;
     InitializeComponent();
 }
예제 #5
0
 /// <summary>
 /// 获取评阅数据。
 /// </summary>
 /// <param name="store"></param>
 /// <param name="cbb"></param>
 /// <param name="txtSubjectiveReviews"></param>
 /// <returns></returns>
 public static LocalWorkReview GetEvaluateFromWin(LocalStudentWorkStore store, ComboBox cbb, TextBox txtSubjectiveReviews)
 {
     if (store != null && cbb != null && txtSubjectiveReviews != null)
     {
         LocalWorkReview result = new LocalWorkReview();
         result.TeacherID = store.TeacherID;
         result.TeacherName = store.TeacherName;
         result.SubjectiveReviews = txtSubjectiveReviews.Text.Trim();
         if (store.Evaluate.Type == EnumEvaluateType.Hierarchy)
         {
             result.ReviewValue = string.Format("{0}", cbb.SelectedValue);
         }
         else
         {
             int val = -1;
             if (int.TryParse(cbb.Text, out val))
             {
                 if (val < store.Evaluate.MinValue || val > store.Evaluate.MaxValue)
                 {
                     MessageBox.Show(string.Format("评阅分数无效,须在[{0}-{1}]之间!", store.Evaluate.MinValue, store.Evaluate.MaxValue));
                 }
             }
             if (val < store.Evaluate.MinValue)
             {
                 val = store.Evaluate.MinValue;
             }
             result.ReviewValue = string.Format("{0}", val);
         }
         if (!string.IsNullOrEmpty(result.ReviewValue))
         {
             return result;
         }
     }
     return null;
 }
예제 #6
0
 /// <summary>
 /// 构造函数。
 /// </summary>
 /// <param name="service"></param>
 /// <param name="store"></param>
 /// <param name="studentIDs"></param>
 public WorkUploadToServer(ICoreService service, LocalStudentWorkStore store,string[] studentIDs)
     : base(service)
 {
     this.Store = store;
     InitializeComponent();
     this.LoadControls(studentIDs);
 }
 /// <summary>
 /// 构造函数。
 /// </summary>
 /// <param name="service"></param>
 /// <param name="store"></param>
 /// <param name="students"></param>
 /// <param name="studentID"></param>
 public ModifyWorkDetailsWindow(ICoreService service, LocalStudentWorkStore store, string studentID)
     : base(service)
 {
     this.pluginService = new LoadingPluginService(service, this);
     //及时加载作业索引文件,同步修改信息。
     this.store = LocalStudentWorkStore.DeSerializer(store.FileSavePath());
     this.localStudentCollection = this.store.HasWorks();
     if (this.localStudentCollection != null && this.localStudentCollection.Count > 0 && !string.IsNullOrEmpty(studentID))
     {
         this.index = this.localStudentCollection.FindIndex(studentID);
     }
     this.InitializeComponent();
 }
예제 #8
0
 /// <summary>
 /// 创建缩略图。
 /// </summary>
 /// <param name="store"></param>
 /// <param name="studentID"></param>
 /// <param name="w"></param>
 /// <param name="h"></param>
 /// <returns></returns>
 public static Image[] CreateThumbnails(LocalStudentWorkStore store, string studentID, int w, int h)
 {
     List<Image> list = new List<Image>();
     if (store != null && store.Students != null && !string.IsNullOrEmpty(studentID))
     {
         LocalStudentWork lsw = null;
         LocalStudent ls = store.Students[studentID];
         if (ls != null && ((lsw = ls.Work) != null) && (lsw.WorkFiles != null && lsw.WorkFiles.Count > 0))
         {
             foreach (LocalStudentWorkFile wf in lsw.WorkFiles)
             {
                 Image img = CreateThumbnail(store, ls, wf, w, h);
                 if (img != null)
                 {
                     list.Add(img);
                 }
             }
         }
     }
     if (list.Count == 0) return new Image[] { LoadDefaultNULLImage(w, h) };
     return list.ToArray();
 }
 private void uploadWorks(LocalStudentWorkStore store, LocalStudents students, out int success,out int failure, out List<string> listFailure)
 {
     success = 0;
     failure = 0;
     listFailure = new List<string>();
     ///TODO:老师上传作业。
     //if (store != null && store.Students != null && store.Students.Count > 0 && students != null && students.Count > 0)
     //{
     //    string storeFielPath = store.FileSavePath();
     //    using (TeaClientServicePoxyFactory factory = TeaClientServicePoxyFactory.Instance(this.CoreService, new RaiseChangedHandler(delegate(string content)
     //    {
     //        this.OnChanged(content);
     //    })))
     //    {
     //        bool complete = false;
     //        for (int i = 0; i < students.Count; i++)
     //        {
     //            LocalStudent ls = this.students[i];
     //            #region 处理作品。
     //            ls = this.store.Students[ls.StudentID];
     //            if (ls != null && ls.Works != null && ls.Works.Count > 0)
     //            {
     //                if (((ls.Works[0].Status & EnumWorkStatus.Review) == EnumWorkStatus.Review))
     //                {
     //                    if ((ls.Works[0].Status & EnumWorkStatus.Upload) != EnumWorkStatus.Upload)
     //                    {
     //                        this.OnChanged(string.Format("开始上传:[{0},{1}]作品[{2}]...", ls.StudentName, ls.StudentCode, ls.Works[0].WorkName));
     //                        string content = null;
     //                        if (complete = factory.UploadStudentWorks(ref this.store, ref ls, out content))
     //                        {
     //                            success++;
     //                            ls.Works[0].Status |= EnumWorkStatus.Upload;
     //                            WorkStoreHelper.UpdateWorkStatusToQueueStore(new WorkStoreHelper.WorkReviewQueueEntity(ls.StudentID, ls.Works[0].WorkID, ls.Works[0].Status, null, storeFielPath));
     //                        }
     //                        else
     //                        {
     //                            failure++;
     //                            listFailure.Add(string.Format("[{0},{1}] {2} {3}", ls.StudentName, ls.StudentCode, ls.Works[0].WorkName, content));
     //                        }
     //                        this.OnChanged(string.Format("上传:[{0},{1}]作品[{2}] {3}", ls.StudentName, ls.StudentCode, ls.Works[0].WorkName, complete ? "成功" : "失败"));
     //                    }
     //                    else
     //                    {
     //                        this.OnChanged(string.Format("已上传:[{0},{1}]作品[{2}]", ls.StudentName, ls.StudentCode, ls.Works[0].WorkName));
     //                    }
     //                }
     //                else
     //                {
     //                    failure++;
     //                    listFailure.Add(string.Format("[{0},{1}] {2} {3}", ls.StudentName, ls.StudentCode, ls.Works[0].WorkName, "未批阅"));
     //                    this.OnChanged(string.Format("不能上传:[{0},{1}]作品[{2}],{3}", ls.StudentName, ls.StudentCode, ls.Works[0].WorkName, "未批阅!"));
     //                }
     //            }
     //            #endregion
     //        }
     //    }
     //}
 }
 /// <summary>
 /// 加载数据。
 /// </summary>
 /// <param name="teacherID"></param>
 /// <param name="catalogID"></param>
 /// <param name="classID"></param>
 private void LoadData(string teacherID,string catalogID, string classID)
 {
     if (!string.IsNullOrEmpty(teacherID) && !string.IsNullOrEmpty(catalogID) && !string.IsNullOrEmpty(classID))
     {
         this.store = LocalStudentWorkStore.DeSerializer(teacherID, catalogID, classID);
         if ((this.btnSave.Enabled = (this.store != null)))
         {
             Tools.SetEvaluateToWin(this.cbbReviewValue, this.store.Evaluate, new ToolTipHandler(delegate(Control ctrl, string tooltip)
             {
                 this.OnToolTipEvent(ctrl, tooltip);
             }));
             this.thumbnailsControls = BuildThumbnails(this.store, new EventHandler(delegate(object sender, EventArgs e)
             {
                 ThumbnailsControl tc = sender as ThumbnailsControl;
                 if (tc != null && this.store != null)
                 {
                     ModifyWorkDetailsWindow mw = new ModifyWorkDetailsWindow(this.CoreService, this.store, tc.StudentID);
                     mw.StartPosition = FormStartPosition.CenterParent;
                     UserInfo info = this.UserInfo;
                     if (mw.ShowDialog(this) == DialogResult.OK && info != null)
                     {
                         this.LoadData(info.UserID, this.catalogID, this.classID);
                     }
                 }
             }));
             if (this.thumbnailsControls != null) ThumbnailsDrawToPanel(this.thumbnailsControls, this.panelWork);
         }
     }
 }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSave_Click(object sender, EventArgs e)
        {
            Button btn = sender as Button;
            string btnStr = string.Empty;
            try
            {
                if (btn != null)
                {
                    btnStr = btn.Text;
                    btn.Text = "处理中...";
                    btn.Enabled = false;
                }
                string[] checkStudentWorks = GetSelectedThumbnails(this.panelWork);
                if (checkStudentWorks == null || checkStudentWorks.Length == 0)
                {
                    this.OnMessageEvent(MessageType.Normal | MessageType.PopupInfo, "请选中学生作业后方可保存!");
                    btn.Text = btnStr;
                    btn.Enabled = true;
                    return;
                }
                LocalWorkReview teaReview = Tools.GetEvaluateFromWin(this.store, this.cbbReviewValue, this.txtSubjectiveReviews);
                if (teaReview == null)
                {
                    this.OnMessageEvent(MessageType.Normal | MessageType.PopupInfo, "请评阅后方可保存!");
                    btn.Text = btnStr;
                    btn.Enabled = true;
                    return;
                }
                btn.Text = "保存中..";
                bool bPublish = this.chkPublish.Checked, bUpload = this.chkUpload.Checked;
                this.store = LocalStudentWorkStore.DeSerializer(this.store.FileSavePath());
                for (int i = 0; i < checkStudentWorks.Length; i++)
                {
                    LocalStudent ls = this.store.Students[checkStudentWorks[i]];
                    if (ls != null && ls.Work != null)
                    {
                        WorkStoreHelper.WorkReviewQueueEntity entity = new WorkStoreHelper.WorkReviewQueueEntity(ls.StudentID,
                                                                                                         ls.Work.WorkID,
                                                                                                         bPublish ? (EnumWorkStatus.Review | EnumWorkStatus.Release) : EnumWorkStatus.Review,
                                                                                                         teaReview,
                                                                                                         this.store.FileSavePath());
                        entity.Changed += new RaiseChangedHandler(delegate(string msg)
                        {
                            this.OnMessageEvent(MessageType.Normal, msg);
                        });
                        //添加到保存队列。
                        WorkStoreHelper.ReviewWorkToQueueStore(entity);
                        this.OnMessageEvent(MessageType.Normal, string.Format("开始保存[{0},{1}]作业批阅...",ls.StudentName, ls.Work.WorkName));
                    }
                }

                if (bUpload)
                {
                    btn.Text = "上传中...";
                    WorkUploadToServer win = new WorkUploadToServer(this.CoreService, this.store, checkStudentWorks);
                    win.StartPosition = FormStartPosition.CenterParent;
                    win.Changed += new RaiseChangedHandler(delegate(string msg)
                    {
                        this.OnMessageEvent(MessageType.Normal, msg);
                    });
                    win.ShowDialog(this);
                }

                btn.Text = "刷新状态...";
                //刷新学生作品评阅状态。
                for (int i = 0; i < checkStudentWorks.Length; i++)
                {
                    StudentEx stuEx = Program.STUDENTS != null ? Program.STUDENTS[checkStudentWorks[i]] : null;
                    if (stuEx != null && ((stuEx.Status & StudentControl.EnumStudentState.Review) != StudentControl.EnumStudentState.Review))
                    {
                        stuEx.Status |= StudentControl.EnumStudentState.Review;
                        if (this.NetService != null) this.NetService.OnUpdateControls(stuEx);
                    }
                }

                //
                this.DialogResult = DialogResult.OK;
                this.Close();

            }
            catch (Exception ex)
            {
                Program.GlobalExceptionHandler(ex);
                this.OnMessageEvent(MessageType.Normal, "发生异常:" + ex.Message);
            }
            finally
            {
                if (btn != null)
                {
                    btn.Text = btnStr;
                    btn.Enabled = true;
                }
            }
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="storage"></param>
        /// <param name="handler"></param>
        private void ImportWorkData(StudentWorkTeaStorage storage,RaiseChangedHandler handler)
        {
            lock (this)
            {
                if (string.IsNullOrEmpty(this.teacherID) || string.IsNullOrEmpty(this.teacherName))
                {
                    return;
                }
                if (this.zipFile != null && storage != null && !string.IsNullOrEmpty(storage.CatalogID) && !string.IsNullOrEmpty(storage.ClassID) &&
                    (storage.Student != null) && !string.IsNullOrEmpty(storage.Student.StudentID))
                {
                    LocalStudentWorkStore store = LocalStudentWorkStore.DeSerializer(this.teacherID, storage.CatalogID, storage.ClassID);
                    #region 初始化数据。
                    if (store == null)
                    {
                        store = new LocalStudentWorkStore();
                        store.TeacherID = this.teacherID;
                        store.TeacherName = this.teacherName;

                        store.GradeID = storage.GradeID;
                        store.GradeName = null;

                        store.CatalogID = storage.CatalogID;
                        store.CatalogName = storage.CatalogName;

                        store.ClassID = storage.ClassID;
                        store.ClassName = null;

                        store.Evaluate = null;
                    }
                    #endregion

                    if (store.Students == null)
                    {
                        store.Students = new LocalStudents();
                    }

                    LocalStudent ls = store.Students[storage.Student.StudentID];
                    if (ls == null)
                    {
                        ls = new LocalStudent();
                        ls.StudentID = storage.Student.StudentID;
                        ls.StudentCode = storage.Student.StudentCode;
                        ls.StudentName = storage.Student.StudentName;
                        store.Students.Add(ls);
                    }

                    if (ls.Work == null) ls.Work = new LocalStudentWork();
                    ls.Work.WorkID = storage.WorkID;
                    ls.Work.WorkName = storage.WorkName;
                    ls.Work.UploadIP = storage.UploadIP;
                    ls.Work.Type = storage.Type;
                    ls.Work.Time = storage.Time;
                    ls.Work.Status = storage.Status;
                    if (storage.Review != null)
                    {
                        ls.Work.Review = new LocalWorkReview();
                        ls.Work.Review.ReviewValue = storage.Review.ReviewValue;
                        ls.Work.Review.SubjectiveReviews = storage.Review.SubjectiveReviews;
                        ls.Work.Review.TeacherID = storage.Review.TeacherID;
                        ls.Work.Review.TeacherName = storage.Review.TeacherName;
                    }
                    ls.Work.FileExt = storage.FileExt;
                    ls.Work.Description = storage.Description;
                    //ls.Work.CheckCode = storage.CheckCode;

                    this.RaiseChanged(handler, string.Format("导入[{0},{1}]作品数据...", ls.StudentName, ls.StudentCode));
                    if (this.isImportFile && !string.IsNullOrEmpty(storage.WorkPath))
                    {
                        //导入文件。
                        ls.Work.WorkFiles = new LocalStudentWorkFiles();
                        this.ImportWorkFiles(storage.WorkPath, store, ls, ls.Work, handler);
                    }
                    //序列化保存。
                    WorkStoreHelper.Serializer(ref store);
                }
            }
        }
예제 #13
0
 /// <summary>
 /// 获取学生作品路径。
 /// </summary>
 /// <param name="store"></param>
 /// <param name="ls"></param>
 /// <param name="workFile"></param>
 /// <returns></returns>
 public string StudentWorkFilePath(LocalStudentWorkStore store, LocalStudent ls, LocalStudentWorkFile workFile)
 {
     if (store != null && ls != null && workFile != null)
     {
         string rootDir = store.RootDir();
         if (!string.IsNullOrEmpty(rootDir) && Directory.Exists(rootDir))
         {
             string dir = Path.GetFullPath(string.Format("{0}/{1}", rootDir, ls.StudentID));
             if (!Directory.Exists(dir))
             {
                 Directory.CreateDirectory(dir);
             }
             return Path.GetFullPath(string.Format("{0}/{1}{2}", dir, workFile.FileID, workFile.FileExt));
         }
     }
     return null;
 }
예제 #14
0
 /// <summary>
 /// 删除作业文件。
 /// </summary>
 /// <param name="store"></param>
 /// <param name="ls"></param>
 public bool DeleteFiles(LocalStudentWorkStore store, LocalStudent ls)
 {
     if (store == null || ls == null) return false;
     if (this.WorkFiles == null || this.WorkFiles.Count == 0) return true;
     for (int i = 0; i < this.WorkFiles.Count; i++)
     {
         try
         {
             string path = this.StudentWorkFilePath(store, ls, this.WorkFiles[i]);
             if (File.Exists(path))
             {
                 File.Delete(path);
                 this.WorkFiles.Remove(this.WorkFiles[i]);
             }
         }
         catch (Exception e)
         {
             UtilTools.OnExceptionRecord(e, this.GetType());
             return false;
         }
     }
     return true;
 }
예제 #15
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="store"></param>
 public void Add(LocalStudentWorkStore store)
 {
     if (store != null)
     {
         LocalStudentWorkStore lss = store;
         this.queue.Enqueue(lss);
         if (!this.timer.Enabled && !this.isRuning)
         {
             this.timer.Start();
         }
     }
 }
예제 #16
0
 /// <summary>
 /// 创建缩略图。
 /// </summary>
 /// <param name="store"></param>
 /// <param name="studentID"></param>
 /// <param name="w"></param>
 /// <param name="h"></param>
 /// <returns></returns>
 public static Image CreateThumbnailFrist(LocalStudentWorkStore store, string studentID, int w, int h)
 {
     if (store != null && !string.IsNullOrEmpty(studentID) && store.Students != null)
     {
         LocalStudentWork lsw = null;
         LocalStudent ls = store.Students[studentID];
         if (ls != null && ((lsw = ls.Work) != null) && (lsw.WorkFiles != null && lsw.WorkFiles.Count > 0))
         {
             foreach (LocalStudentWorkFile wf in lsw.WorkFiles)
             {
                 Image img = CreateThumbnail(store, ls, wf, w, h);
                 if (img != null)
                 {
                     return img;
                 }
             }
             return LoadDefaultNULLImage(w, h);
         }
     }
     return null;
 }
예제 #17
0
        /// <summary>
        /// 查询数据。
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnQuery_Click(object sender, EventArgs e)
        {
            string catalogID = null, classID = null;
            TreeNode node = this.treeView.SelectedNode;
            if (node == null || string.IsNullOrEmpty(classID = this.LeftTreeNodeValue(node, "ClassID")))
            {
                return;
            }
            catalogID = this.LeftTreeNodeValue(node.Parent, "CatalogID");
            this.store = LocalStudentWorkStore.DeSerializer(this.userInfo.UserID, catalogID, classID);

            #region 查询数据。
            if (this.store != null && this.store.Students != null)
            {
                string workName = this.txtWorkName.Text.Trim();
                string studentName = this.txtStudentName.Text.Trim();
                EnumWorkStatus status = EnumWorkStatus.None;
                if (this.chkReview.Checked)
                {
                    status |= EnumWorkStatus.Review;
                }
                if (this.chkUpload.Checked)
                {
                    status |= EnumWorkStatus.Upload;
                }
                if (this.chkRelease.Checked)
                {
                    status |= EnumWorkStatus.Release;
                }
                if (status != EnumWorkStatus.None)
                {
                    status &= ~EnumWorkStatus.None;
                }

                this.students = this.store.HasWorks();
                if (!string.IsNullOrEmpty(studentName))
                {
                    this.students = this.students.FindStudents(studentName);
                }
                if (!string.IsNullOrEmpty(workName) || (status != EnumWorkStatus.None))
                {
                    this.students = this.students.FindStudents(workName, status);
                }

                #region 未批阅。
                if (this.chkNoReview.Checked && this.students != null && this.students.Count > 0)
                {//未批阅。
                    List<LocalStudent> list = new List<LocalStudent>();
                    for (int i = 0; i < this.students.Count; i++)
                    {
                        LocalStudent ls = this.students[i];
                        if (ls.HasWork() && ((ls.Work.Status & EnumWorkStatus.Review) == EnumWorkStatus.Review))
                        {
                            list.Add(ls);
                        }
                    }
                    if (list.Count > 0)
                    {
                        this.students.Remove(list.ToArray());
                    }
                }
                #endregion

                #region 未上传。
                if (this.chkNoUpload.Checked && this.students != null && this.students.Count > 0)
                {//未上传。
                    List<LocalStudent> list = new List<LocalStudent>();
                    for (int i = 0; i < this.students.Count; i++)
                    {
                        LocalStudent ls = this.students[i];
                        if (ls.HasWork() && ((ls.Work.Status & EnumWorkStatus.Upload) == EnumWorkStatus.Upload))
                        {
                            list.Add(ls);
                        }
                    }
                    if (list.Count > 0)
                    {
                        this.students.Remove(list.ToArray());
                    }
                }
                #endregion
            }
            #endregion;

            #region 绘制数据。
            this.listView.BeginUpdate();
            this.listView.Items.Clear();
            if (this.store != null && this.students != null && this.students.Count > 0)
            {
                 ImageList images = ThumbnailsHelpers.ThumbnailImageList(this.store, this.students, this.components, 100, 75);
                 this.listView.LargeImageList = images;
                 this.listView.SmallImageList = images;
                 List<ListViewItem> items = new List<ListViewItem>();
                 for (int i = 0; i < this.students.Count; i++)
                 {
                     LocalStudent ls = this.students[i];
                     if (ls.Work != null)
                     {
                         ListViewItem item = new ListViewItem(ls.StudentName, ls.StudentID);
                         item.Tag = ls.StudentID;
                         item.ToolTipText = ls.Work.Description;
                         item.SubItems.Add(ls.Work.WorkName);
                         item.SubItems.Add(EnumWorkStatusOperaTools.GetStatusName(ls.Work.Status));
                         item.SubItems.Add(string.Format("{0:yyyy-MM-dd HH:mm:ss}", ls.Work.Time));
                         if (ls.Work.Review != null)
                         {
                             item.SubItems.Add(string.Format("评阅:{0}", ls.Work.Review.ReviewValue));
                         }
                         item.SubItems.Add(ls.Work.Description);
                         items.Add(item);
                     }
                 }
                 this.listView.Items.AddRange(items.ToArray());
            }
            this.listView.EndUpdate();
            #endregion
        }
예제 #18
0
        /// <summary>
        /// 恢复作业关联。
        /// </summary>
        public static void RecoveryWorkAssociation(ref LocalStudentWorkStore store, string studentId)
        {
            if (store == null || store.Students == null || store.Students.Count == 0 || string.IsNullOrEmpty(studentId)) return;
            LocalStudent ls = store.Students[studentId];
            if (ls == null || ls.HasWork()) return;
            string dir = Path.GetFullPath(string.Format("{0}/{1}", store.RootDir(), ls.StudentID));
            if (!Directory.Exists(dir)) return;
            FileInfo[] files = new DirectoryInfo(dir).GetFiles();
            if (files == null || files.Length == 0) return;

            ls.Work = new LocalStudentWork();
            ls.Work.WorkID = Guid.NewGuid().ToString().Replace("-", "");
            ls.Work.WorkName = store.CatalogName;
            ls.Work.UploadIP = "127.0.0.1";
            ls.Work.Type = EnumWorkType.Public;
            ls.Work.Time = DateTime.Now;
            ls.Work.Status = EnumWorkStatus.Recive | EnumWorkStatus.Submit;
            ls.Work.Description = new CDATA();
            ls.Work.WorkFiles = new LocalStudentWorkFiles();

            for (int i = 0; i < files.Length; i++)
            {
                if (files[i].Exists)
                {
                    LocalStudentWorkFile file = new LocalStudentWorkFile();
                    file.FileID = Path.GetFileNameWithoutExtension(files[i].Name);
                    file.FileName = ls.Work.WorkName + "_" + (i + 1);
                    file.FileExt = files[i].Extension;
                    file.Size = files[i].Length;

                    if (ls.Work.FileExt == null)
                        ls.Work.FileExt = file.FileExt;
                    else if (ls.Work.FileExt.IndexOf(file.FileExt) == -1)
                        ls.Work.FileExt += string.Format("|{0}", file.FileExt);

                    ls.Work.WorkFiles.Add(file);
                }
            }
        }
예제 #19
0
 /// <summary>
 /// 构造函数。
 /// </summary>
 /// <param name="store"></param>
 /// <param name="ls"></param>
 public StudentWorkUpload(LocalStudentWorkStore store, LocalStudent ls)
 {
     this.Status = 0;
     this.Store = store;
     this.Student = ls;
     this.Number = 1;
 }
예제 #20
0
        protected void LoadControls(string[] studentIDs)
        {
            this.btnStartUpload.Enabled = false;
            string err = null;
            if (studentIDs == null || studentIDs.Length == 0)
            {
                this.btnStartUpload.Enabled = true;
                this.OnChanged(err = "未选择上传作业的学生!");
                MessageBox.Show(err);
                return;
            }
            this.Store = LocalStudentWorkStore.DeSerializer(this.Store.FileSavePath());
            if (this.Store == null || this.Store.Students == null || this.Store.Students.Count == 0)
            {
                this.btnStartUpload.Enabled = true;
                this.OnChanged(err = "加载作业存储索引文件失败或索引中没有学生作业数据!");
                MessageBox.Show(err);
                return;
            }
            this.uploadStudents = new List<StudentWorkUpload>();
            for (int i = 0; i < studentIDs.Length; i++)
            {
                LocalStudent ls = this.Store.Students[studentIDs[i]];
                if (ls != null && ls.HasWork())
                {
                    this.uploadStudents.Add(new StudentWorkUpload(this.Store, ls));
                }
            }
            if (this.uploadStudents.Count == 0)
            {
                this.btnStartUpload.Enabled = true;
                this.OnChanged(err = "没有找到学生的作业数据!");
                MessageBox.Show(err);
                return;
            }

            this.uploadFailureQueue.Clear();

            this.SuspendLayout();
            this.panel.SuspendLayout();
            int w = this.panel.Width - 5;
            for (int i = 0; i < this.uploadStudents.Count; i++)
            {
                StudentWorkUpload swp = this.uploadStudents[i];
                WorkUploadProgress workProgress = new WorkUploadProgress(string.Format("{0}.{1}", i + 1, swp.Title));
                workProgress.Width = w;
                workProgress.Margin = new Padding(3);
                workProgress.Location = new Point(0, workProgress.Height * i + 3);
                this.panel.Controls.Add(swp.Progress = workProgress);
            }
            this.panel.ResumeLayout(true);
            this.ResumeLayout(true);
            this.btnStartUpload.Enabled = true;
        }
예제 #21
0
 /// <summary>
 /// 创建学生作业缩略图集合。
 /// </summary>
 /// <param name="store"></param>
 /// <param name="localStudents"></param>
 /// <param name="container"></param>
 /// <param name="w"></param>
 /// <param name="h"></param>
 /// <returns></returns>
 public static ImageList ThumbnailImageList(LocalStudentWorkStore store, LocalStudents students, IContainer container, int w, int h)
 {
     if (store == null || students == null || students.Count == 0) return null;
     ImageList imgList = container == null ? new ImageList() : new ImageList(container);
     imgList.ImageSize = new Size(w, h);
     imgList.TransparentColor = Color.Transparent;
     foreach (LocalStudent ls in students)
     {
         Image img = CreateThumbnailFrist(store, ls.StudentID, w, h);
         if (img != null)
         {
             imgList.Images.Add(ls.StudentID, img);
         }
     }
     return imgList;
 }
예제 #22
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="store"></param>
 /// <param name="ls"></param>
 /// <param name="handler"></param>
 private void IssueWorkData(LocalStudentWorkStore store,LocalStudent ls, RaiseChangedHandler handler)
 {
     lock (this)
     {
         if (store != null && ls != null && ls.HasWork())
         {
             LocalStudentWork lsw = ls.Work;
             int len = 0;
             if (lsw.WorkFiles != null && (len = lsw.WorkFiles.Count) > 0)
             {
                 this.RaiseChanged(handler, string.Format("下发[{0},{1}]作品数据{2}", ls.StudentName, ls.StudentCode, lsw.WorkName));
                 string[] filePaths = new string[len];
                 for (int i = 0; i < len; i++)
                 {
                     filePaths[i] = lsw.StudentWorkFilePath(store, ls, lsw.WorkFiles[i]);
                 }
                 byte[] data = ZipUtils.Zip(filePaths);
                 if (data != null && data.Length > 0)
                 {
                     IssueWorkFile issue = new IssueWorkFile();
                     issue.StudentID = ls.StudentID;
                     issue.WorkName = lsw.WorkName;
                     issue.UID = store.TeacherID;
                     issue.Time = DateTime.Now;
                     issue.Data = data;
                     this.netService.SendIssueWork(issue);
                 }
                 else
                 {
                     this.RaiseChanged(handler, string.Format("压缩数据文件失败![{0},{1}]", ls.StudentName, lsw.WorkName));
                 }
             }
         }
     }
 }
예제 #23
0
        /// <summary>
        /// 保存数据。
        /// </summary>
        /// <param name="store">学生作品存储。</param>
        /// <param name="ls">学生信息。</param>
        /// <param name="files">文件数据。</param>
        public void SaveFiles(LocalStudentWorkStore store, LocalStudent ls, StudentWorkFiles files)
        {
            if (store != null && ls != null && files != null && files.Count > 0)
            {
                if (this.WorkFiles == null)
                    this.WorkFiles = new LocalStudentWorkFiles();
                else
                    this.WorkFiles.Clear();
                for (int i = 0; i < files.Count; i++)
                {
                    StudentWorkFile swf = files[i];
                    if (swf.Data != null && swf.Data.Length > 0)
                    {
                        LocalStudentWorkFile file = new LocalStudentWorkFile();
                        file.FileID = swf.FileID;
                        file.FileName = Path.GetFileNameWithoutExtension(swf.FileName);
                        file.FileExt = swf.FileExt;
                        file.Size = swf.Size > 0 ? swf.Size : swf.Data.Length;

                        if (this.FileExt == null)
                            this.FileExt = file.FileExt;
                        else if (this.FileExt.IndexOf(file.FileExt) == -1)
                            this.FileExt += string.Format("|{0}", file.FileExt);

                        string path = this.StudentWorkFilePath(store, ls, file);
                        if (!string.IsNullOrEmpty(path))
                        {
                            using (FileStream fs = new FileStream(path, FileMode.Create, FileAccess.Write))
                            {
                                fs.Write(swf.Data, 0, swf.Data.Length);
                            }
                            this.WorkFiles.Add(file);
                        }
                    }
                }
            }
        }
예제 #24
0
 /// <summary>
 /// 修正作业文件后缀。
 /// </summary>
 private void CorrectWorkFileSuffix(LocalStudentWorkStore store)
 {
     if (store != null && store.Students != null && store.Students.Count > 0)
     {
         for (int i = 0; i < store.Students.Count; i++)
         {
             LocalStudent ls = store.Students[i];
             if (ls != null && ls.HasWork())
             {
                 LocalStudentWork lsw = ls.Work;
                 if (lsw != null && lsw.WorkFiles != null && lsw.WorkFiles.Count > 0)
                 {
                     for (int k = 0; k < lsw.WorkFiles.Count; k++)
                     {
                         LocalStudentWorkFile lswf = lsw.WorkFiles[k];
                         if (lswf != null)
                         {
                             lswf.FileName = Path.GetFileNameWithoutExtension(lswf.FileName);
                         }
                     }
                 }
             }
         }
     }
 }
예제 #25
0
        /// <summary>
        /// 启动侦听。
        /// </summary>
        /// <param name="students"></param>
        public void StartListen(StudentsEx students)
        {
            if (students == null)
            {
                throw new ArgumentNullException("students", "学生未准备就绪");
            }
            students.SetOfflineStatus();
            #region 初始化学生作品存储。
            if (this.userInfo != null && this.sci != null)
            {
                lock (this)
                {
                    this.classId = this.sci.ClassInfo.ClassID;
                    LocalStudentWorkStore store = LocalStudentWorkStore.DeSerializer(this.userInfo.UserID, this.sci.CatalogInfo.CatalogID, this.sci.ClassInfo.ClassID);
                    #region 初始化。
                    if (store == null)
                    {
                        store = new LocalStudentWorkStore();
                        store.TeacherID = this.userInfo.UserID;
                        store.GradeID = this.sci.GradeID;
                        store.CatalogID = this.sci.CatalogInfo.CatalogID;
                        store.ClassID = this.sci.ClassInfo.ClassID;
                        store.Evaluate = this.sci.Evaluate;
                    }
                    #endregion

                    #region 更新。
                    store.TeacherName = this.userInfo.UserName;
                    store.GradeName = this.sci.GradeName;
                    store.CatalogName = this.sci.CatalogInfo.CatalogName;
                    store.ClassName = this.sci.ClassInfo.ClassName;
                    store.Evaluate = this.sci.Evaluate;
                    #endregion

                    #region 更新学生信息。
                    if (students != null && students.Count > 0)
                    {
                        if (store.Students == null) store.Students = new LocalStudents();
                        string sId = null;
                        for (int i = 0; i < students.Count; i++)
                        {
                            sId = students[i].StudentID;
                            if (!string.IsNullOrEmpty(sId))
                            {
                                LocalStudent ls = store.Students[sId];
                                if (ls == null)
                                {
                                    ls = new LocalStudent(students[i]);
                                    store.Students.Add(ls);
                                }
                                //恢复关联。
                                Tools.RecoveryWorkAssociation(ref store, ls.StudentID);
                                if (ls.HasWork())
                                {
                                    students[i].Status |= StudentControl.EnumStudentState.Upload;
                                    if ((ls.Work.Status & EnumWorkStatus.Review) == EnumWorkStatus.Review)
                                    {
                                        students[i].Status |= StudentControl.EnumStudentState.Review;
                                    }
                                }

                            }
                        }
                    }
                    #endregion

                    //序列化数据。
                    if (!WorkStoreHelper.Serializer(ref store))
                    {
                        throw new Exception("生成索引文件失败(索引文件被占用),请稍后重试!");
                    }
                    //设置当前班级学生。
                    Program.STUDENTS = students;
                }
            }
            #endregion

            this.RaiseChanged("开启端口监听...");
            this.udpSocket.Start();

            this.RaiseChanged("打开文件上传端口侦听...");
            this.workUpTcpService.StartListen();
        }
        /// <summary>
        /// 加载数据。
        /// </summary>
        /// <param name="index">学生索引。</param>
        private void LoadData(int index)
        {
            lock (this)
            {
                if (this.store == null) return;

                this.isDialogResult = false;

                this.store = LocalStudentWorkStore.DeSerializer(this.store.FileSavePath());

                if (this.store.Students != null && this.localStudentCollection != null)
                {
                    this.Tag = null;
                    int count = this.localStudentCollection.Count;
                    this.isPrevEnabled = this.btnPrev.Enabled = (index > 0);
                    this.isNextEnabled = this.btnNext.Enabled = (index < (count - 1));
                    if ((index > -1) && (index < count))
                    {
                        LocalStudent ls = this.localStudentCollection[index];
                        if (ls != null)
                        {
                            ls = this.store.Students[ls.StudentID];
                            if (ls != null)
                            {
                                this.Tag = ls;

                                #region 填充数据。
                                LocalStudentWork lsw = ls.Work;
                                this.linkDownloadWork.Tag = ls.StudentID;
                                if (lsw != null)
                                {
                                    this.Title = this.txtWorkName.Text = lsw.WorkName;
                                    this.txtWorkstatusName.Text = EnumWorkStatusOperaTools.GetStatusName(lsw.Status);
                                    this.txtUploadIP.Text = lsw.UploadIP;
                                    this.chkPublic.Checked = (lsw.Type == EnumWorkType.Public);
                                    this.txtTime.Text = string.Format("{0:yyyy-MM-dd HH:mm:ss}", lsw.Time);
                                    //this.txtCheckCode.Text = lsw.CheckCode;
                                    this.txtDescription.Text = lsw.Description == null ?  new CDATA() : lsw.Description;
                                    this.chkPublish.Checked = ((lsw.Status & EnumWorkStatus.Release) == EnumWorkStatus.Release);
                                }
                                else
                                {
                                    this.Title = this.txtWorkName.Text = string.Empty;
                                    this.txtWorkstatusName.Text = string.Empty;
                                    this.txtUploadIP.Text = string.Empty;
                                    this.chkPublic.Checked = false;
                                    this.txtTime.Text = string.Empty;
                                    //this.txtCheckCode.Text = string.Empty;
                                    this.txtDescription.Text = string.Empty;
                                    this.chkPublish.Checked = false;
                                }
                                this.OnToolTipEvent(this.txtWorkName, string.Format("所属科目:{0}", this.store.CatalogName));
                                this.txtStudentName.Text = string.Format("{0}[{1}]", ls.StudentName, ls.StudentCode);
                                this.OnToolTipEvent(this.txtStudentName, string.Format("所属年级:{0},所属班级:{1}", this.store.GradeName, this.store.ClassName));
                                #endregion

                                #region 加载缩略图。
                                int len = 0;
                                if (lsw.WorkFiles != null && (len = lsw.WorkFiles.Count) > 0)
                                {
                                    this.pictureBox.Image = ThumbnailsHelpers.CreateThumbnailFrist(this.store, ls.StudentID, 200, 150);
                                    this.pictureBox.Tag = ls;
                                    this.OnToolTipEvent(this.pictureBox, "学生作品缩略图,双击将查看作品文件!");
                                }
                                else
                                {
                                    this.pictureBox.Image = null;
                                }
                                #endregion

                                this.linkDownloadWork.Text = string.Format(this.linkDownloadWork.Text, len);

                                #region 加载评阅信息。
                                this.cbbReviewValue.SelectedIndex = -1;
                                this.txtSubjectiveReviews.Text = string.Empty;
                                if (this.store.Evaluate != null && lsw.Review != null)
                                {
                                    this.txtSubjectiveReviews.Text = lsw.Review.SubjectiveReviews;
                                    if (this.store.Evaluate.Type == EnumEvaluateType.Hierarchy)
                                    {
                                        if (!string.IsNullOrEmpty(lsw.Review.ReviewValue))
                                        {
                                            this.cbbReviewValue.SelectedValue = lsw.Review.ReviewValue;
                                        }
                                    }
                                    else
                                    {
                                        this.cbbReviewValue.Text = lsw.Review.ReviewValue;
                                    }
                                }
                                #endregion

                            }
                            else
                            {
                                this.OnMessageEvent(MessageType.PopupInfo, "该学生或被删除,请刷新界面或重新查询!");
                                this.btnClose_Click(this.btnClose, null);
                            }
                        }
                    }
                    this.btnDelete.Enabled = this.btnSave.Enabled = (this.Tag != null);
                }
            }
        }
 private static ThumbnailsControl BuildThumbnail(LocalStudentWorkStore store, LocalStudent ls)
 {
     if (store == null || ls == null) return null;
     if (ls.Work != null)
     {
         ThumbnailsControl control = new ThumbnailsControl();
         Image img = ThumbnailsHelpers.CreateThumbnailFrist(store, ls.StudentID, control.Width, control.Height);
         if (img != null)
         {
             control.WorkID = ls.Work.WorkID;
             control.StudentID = ls.StudentID;
             control.Text = ls.Work.WorkName;
             control.StudentName = ls.StudentName;
             control.Time = ls.Work.Time;
             control.ToolTip = string.Format("学生姓名:{0}\r\n作品名称:{1}\r\n目录名称:{2}\r\n作品状态:{3}\r\n作品类型:{4}\r\n描述:{5}\r\n提交时间:{6:yyyy-MM-dd HH:mm:ss}",
                 ls.StudentName, ls.Work.WorkName, store.CatalogName, EnumWorkStatusOperaTools.GetStatusName(ls.Work.Status), EnumWorkTypeOperaTools.GetTypeName(ls.Work.Type),
                 ls.Work.Description, ls.Work.Time);
             control.Thumbnails = img;
             return control;
         }
     }
     return null;
 }
        private static ThumbnailsControls BuildThumbnails(LocalStudentWorkStore store, EventHandler doubleClickHandler)
        {
            if (store != null && store.Students != null && store.Students.Count > 0)
            {
                ThumbnailsControls thumbnails = new ThumbnailsControls();

                for (int i = 0; i < store.Students.Count; i++)
                {
                    ThumbnailsControl tc = BuildThumbnail(store, store.Students[i]);
                    if (tc != null)
                    {
                        tc.Cursor = Cursors.Hand;
                        if (doubleClickHandler != null) tc.DoubleClick += doubleClickHandler;
                        thumbnails.Add(tc);
                    }
                }
                return thumbnails;
            }
            return null;
        }
예제 #29
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="store"></param>
 /// <param name="students"></param>
 /// <param name="dir"></param>
 /// <param name="zipFile"></param>
 /// <param name="handler"></param>
 private void ImportWorkFiles(LocalStudentWorkStore store, LocalStudents students, string dir, ZipFile zipFile, RaiseChangedHandler handler)
 {
     if (store != null && students != null && students.Count > 0 && zipFile != null)
     {
         foreach (LocalStudent ls in students)
         {
             if (ls.HasWork())
             {
                 LocalStudentWork lsw = ls.Work;
                 if (lsw.WorkFiles != null && lsw.WorkFiles.Count > 0)
                 {
                     string zipDir = string.Format("{0}{1}{2}{1}", dir, Path.DirectorySeparatorChar, ls.StudentID);
                     this.RaiseChanged(handler, string.Format("导入[{0},{1}]作品数据...", ls.StudentName, ls.StudentCode));
                     foreach (LocalStudentWorkFile lswf in lsw.WorkFiles)
                     {
                         string sPath = string.Format("{0}{1}{2}", zipDir, lswf.FileID, lswf.FileExt);
                         try
                         {
                             using (Stream stream = ZipUtils.ZipFileData(zipFile, sPath))
                             {
                                 if (stream != null)
                                 {
                                     this.RaiseChanged(handler, string.Format("导入作品{0}{1}...", lswf.FileName, lswf.FileExt));
                                     using (FileStream fs = new FileStream(lsw.StudentWorkFilePath(store, ls, lswf), FileMode.Create, FileAccess.Write))
                                     {
                                         byte[] buf = new byte[512];
                                         int len = 0;
                                         while ((len = stream.Read(buf, 0, buf.Length)) > 0)
                                         {
                                             fs.Write(buf, 0, len);
                                         }
                                     }
                                 }
                             }
                         }
                         catch (Exception x)
                         {
                             Exception t = new Exception(string.Format("[{0},{1}]{2}{3}:{4}", ls.StudentName, ls.StudentCode, lswf.FileName, lswf.FileExt, sPath), x);
                             UtilTools.OnExceptionRecord(t, typeof(ImportWorkUtils));
                         }
                     }
                 }
             }
         }
     }
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="zipWorkPath"></param>
 /// <param name="store"></param>
 /// <param name="ls"></param>
 /// <param name="lsw"></param>
 /// <param name="handler"></param>
 private void ImportWorkFiles(string zipWorkPath, LocalStudentWorkStore store, LocalStudent ls, LocalStudentWork lsw, RaiseChangedHandler handler)
 {
     if (this.zipFile != null && !string.IsNullOrEmpty(zipWorkPath))
     {
         Stream stream = stream = ZipUtils.ZipFileData(this.zipFile, zipWorkPath);
         if (stream != null)
         {
             if (string.Equals(Path.GetExtension(zipWorkPath), ".zip", StringComparison.InvariantCultureIgnoreCase))
             {
                 #region 压缩文件解压。
                 using (ZipInputStream zipStream = new ZipInputStream(stream))
                 {
                     if (zipStream == null)
                     {
                         return;
                     }
                     ZipEntry entry = null;
                     while ((entry = zipStream.GetNextEntry()) != null)
                     {
                         if (entry != null && entry.IsFile && !string.IsNullOrEmpty(entry.Name))
                         {
                             LocalStudentWorkFile lswf = new LocalStudentWorkFile();
                             lswf.FileID = string.Format("{0}", Guid.NewGuid()).Replace("-", string.Empty);
                             lswf.FileExt = Path.GetExtension(entry.Name);
                             lswf.FileName = Path.GetFileNameWithoutExtension(entry.Name);
                             if (string.IsNullOrEmpty(lsw.FileExt))
                             {
                                 lsw.FileExt = lswf.FileExt;
                             }
                             else if (lsw.FileExt.IndexOf(lswf.FileExt) == -1)
                             {
                                 lsw.FileExt += "|" + lswf.FileExt;
                             }
                             lswf.Size = entry.Size;
                             lsw.WorkFiles.Add(lswf);
                             this.RaiseChanged(handler, string.Format("导入作品{0}{1}...", lswf.FileName, lswf.FileExt));
                             using (FileStream fs = new FileStream(lsw.StudentWorkFilePath(store, ls, lswf), FileMode.Create, FileAccess.Write))
                             {
                                 byte[] buf = new byte[512];
                                 int len = 0;
                                 while ((len = zipStream.Read(buf, 0, buf.Length)) > 0)
                                 {
                                     fs.Write(buf, 0, len);
                                 }
                             }
                         }
                     }
                 }
                 #endregion
             }
             else
             {
                 #region 导入单独文件。
                 LocalStudentWorkFile lswf = new LocalStudentWorkFile();
                 lswf.FileID = string.Format("{0}", Guid.NewGuid()).Replace("-", string.Empty);
                 lswf.FileName = lsw.WorkName;
                 lswf.FileExt = Path.GetExtension(zipWorkPath);
                 if (string.IsNullOrEmpty(lsw.FileExt))
                 {
                     lsw.FileExt = lswf.FileExt;
                 }
                 else if (lsw.FileExt.IndexOf(lswf.FileExt) == -1)
                 {
                     lsw.FileExt += "|" + lswf.FileExt;
                 }
                 lswf.Size = stream.Length;
                 lsw.WorkFiles.Add(lswf);
                 this.RaiseChanged(handler, string.Format("导入作品{0}{1}...", lswf.FileName, lswf.FileExt));
                 using (FileStream fs = new FileStream(lsw.StudentWorkFilePath(store, ls, lswf), FileMode.Create, FileAccess.Write))
                 {
                     byte[] buf = new byte[512];
                     StreamUtils.Copy(stream, fs, buf);
                 }
                 #endregion
             }
         }
     }
 }