private string DoSubmit() { string result = ""; Model.CCOM.Homework work_model = new BLL.CCOM.Homework().GetModel(Homework_id); this.type.InnerText = new BLL.CCOM.Datum_type().GetModel(work_model.DatumType_id).DatumType_name; if (work_model.DatumType_id == 1)//周志 { Model.CCOM.Week_log week_model = new BLL.CCOM.Week_log().GetModel(CheckId); week_model.Advice = this.txtAdvice.InnerText; if (!new BLL.CCOM.Week_log().Update(week_model)) { result = "评价发生异常"; } } else //其他 { Model.CCOM.Datum datum_model = new BLL.CCOM.Datum().GetModel(CheckId); datum_model.Tutor_advice = this.txtAdvice.InnerText; if (!new BLL.CCOM.Datum().Update(datum_model)) { result = "评价发生异常"; } } return(result); }
public void ShowInfo() { Model.CCOM.Homework work_model = new BLL.CCOM.Homework().GetModel(Homework_id); this.type.InnerText = new BLL.CCOM.Datum_type().GetModel(work_model.DatumType_id).DatumType_name; if (work_model.DatumType_id == 1)//周志 { this.fileTR.Visible = false; this.logTRcontent.Visible = true; this.logTRproblem.Visible = true; this.logTRplan.Visible = true; this.logTRstarttime.Visible = true; this.logTRendtime.Visible = true; Model.CCOM.Week_log week_model = new BLL.CCOM.Week_log().GetModel(CheckId); Model.CCOM.Topic_relation rela_model = new BLL.CCOM.Topic_relation().GetModel(week_model.Topic_relation_id); this.name.InnerText = new BLL.CCOM.User_information().GetModel(rela_model.Student_id).User_realname; this.time.InnerText = week_model.Submit_time.ToString("yyyy年MM月dd日 ddd HH:mm"); this.txtAdvice.InnerText = week_model.Advice; this.txtStarttime.InnerText = week_model.Start_time.ToString("yyyy-MM-dd"); this.txtEndtime.InnerText = week_model.End_time.ToString("yyyy-MM-dd"); this.lbContent.InnerText = week_model.Work_condition; this.lbProblem.InnerText = week_model.Problem; this.lbPlan.InnerText = week_model.Work_plan; } else //其他 { this.fileTR.Visible = true; this.logTRcontent.Visible = false; this.logTRproblem.Visible = false; this.logTRplan.Visible = false; this.logTRstarttime.Visible = false; this.logTRendtime.Visible = false; Model.CCOM.Datum datum_model = new BLL.CCOM.Datum().GetModel(CheckId); Model.CCOM.Topic_relation rela_model = new BLL.CCOM.Topic_relation().GetModel(datum_model.Topic_relation_id); this.name.InnerText = new BLL.CCOM.User_information().GetModel(rela_model.Student_id).User_realname; this.time.InnerText = datum_model.Submit_time.ToString("yyyy年MM月dd日 ddd HH:mm"); this.txtAdvice.InnerText = datum_model.Tutor_advice; //this.file.InnerHtml = "<p><a href='" + // "/home/news/Attach.aspx?id=" + DESEncrypt.Encrypt(datum_model.Datum_id.ToString()) + // ("&address=") + (HttpUtility.UrlEncode(datum_model.File_path)) + // ("&name=") + (HttpUtility.UrlEncode(datum_model.File_name)) + // ("' target='_blank' >") + // (datum_model.File_name) + // ("</a>") + // (OnlineViewHelper.GetOnlineViewWrapLink(datum_model.File_path, datum_model.File_name)) + ("</p>"); this.lbtnDownLoad.Text = datum_model.File_name; } }
private string DoAction() { string result = ""; #region 文件 if (this.txtUserUpload.PostedFile.FileName == "") { return("请选择上传文件"); } string path = "../../../upload/file/"; //取出所选文件的本地路径 string fullFileName = this.txtUserUpload.PostedFile.FileName; //从路径中截取出文件名 string fileName = fullFileName.Substring(fullFileName.LastIndexOf("\\") + 1); //限定上传文件的格式 string type = fullFileName.Substring(fullFileName.LastIndexOf(".") + 1); string saveFileName = ""; if (type == "doc" || type == "docx" || type == "xls" || type == "xlsx" || type == "ppt" || type == "pptx" || type == "pdf" || type == "jpg" || type == "bmp" || type == "gif" || type == "png" || type == "txt" || type == "zip" || type == "rar") { //将文件保存在服务器中根目录下的files文件夹中 saveFileName = Server.MapPath(path) + "\\" + fileName; this.txtUserUpload.PostedFile.SaveAs(saveFileName); } else { return("请选择正确的文件格式"); } #endregion Model.CCOM.Homework work_model = new BLL.CCOM.Homework().GetModel(homeworkId); Model.CCOM.View_Datum model = new BLL.CCOM.View_Datum().GetModel(" Homework_id=" + homeworkId); try { if (model == null) //增加一条数据 { Model.CCOM.Datum datum_model = new Model.CCOM.Datum(); datum_model.Homework_id = homeworkId; datum_model.Submit_time = DateTime.Now; datum_model.DatumType_id = work_model.DatumType_id; datum_model.File_name = fileName; datum_model.File_path = saveFileName; datum_model.Topic_relation_id = new BLL.CCOM.Topic_relation().GetModel(" Student_id=" + GetAdminInfo_CCOM().User_id).Topic_relation_id; new BLL.CCOM.Datum().Add(datum_model); } else //更新一条数据 { Model.CCOM.Datum datum_model = new BLL.CCOM.Datum().GetModel(model.Datum_id); FileOperate.FileDel(datum_model.File_path);//删除原有文件 datum_model.Submit_time = DateTime.Now; datum_model.File_name = fileName; datum_model.File_path = saveFileName; new BLL.CCOM.Datum().Update(datum_model); } } catch { result = "提交发生异常"; } return(result); }