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);
        }
Example #2
0
        public void Bind_Data()
        {
            BLL.CCOM.Teach_week week_bll = new BLL.CCOM.Teach_week();
            List <university.Model.CCOM.Teach_week> week_models = week_bll.GetModelList("");
            string ht = "";

            foreach (university.Model.CCOM.Teach_week week_model in week_models)
            {
                if (week_model != null)
                {
                    ht += "<li id=\"section-1\" class=\"mainTab\">";
                    ht += "<hr style=\"height:10px;border:none;border-top:10px groove skyblue;\" />";
                    ht += "<div class=\"content\">";
                    ht += "<div class=\"span4\">";
                    ht += "<h3 class=\"sectionname\"><span>" + GetDateString(week_model.Start_time) + " - " + GetDateString(week_model.End_time) + "</span></h3><hr /></div>";
                    ht += "<div class=\"span6\" style=\"padding:22px 0;\">";
                    ht += "<a href=\"WeeklyAdd.aspx?weeklyId=" + week_model.TeachWeek_id + "&action=" + MyEnums.ActionEnum.Edit.ToString() + "&fun_id=<%=DESEncrypt.Encrypt(\"15\") %><i class=\"icon-pencil\"></i>修改</a>&nbsp;";
                    ht += "<a onclick=\"javascript:DeleteWeekly(" + week_model.TeachWeek_id + ")\"><i class=\"icon-remove\"></i>删除</a></div>";
                    ht += "<ul class=\"span12\">";
                    BLL.CCOM.Homework work_bll = new BLL.CCOM.Homework();
                    List <university.Model.CCOM.Homework> work_models = work_bll.GetModelList(" Week_id=" + week_model.TeachWeek_id);
                    foreach (university.Model.CCOM.Homework work_model in work_models)
                    {
                        ht += "<li class=\"fileTab\"><div><div class=\"mod-indent-outer\"><div class=\"mod-indent\"></div><div><div class=\"activityinstance\">";
                        ht += "<a><img src=\"/images/sendfile.png\"/>  提交" + (new BLL.CCOM.Datum_type().GetModel(work_model.DatumType_id).DatumType_name) + "</a>";
                        ht += "</div></div></div></div></li>";
                    }
                    ht += "</ul></div></li>";
                }
            }
            this.week_list.InnerHtml = ht;
        }
        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 DoSubmit()
        {
            string result = "";

            Model.CCOM.Homework work_model = new BLL.CCOM.Homework().GetModel(homeworkId);
            Model.CCOM.Week_log model      = new BLL.CCOM.Week_log().GetModel(" Homework_id=" + homeworkId);
            try
            {
                if (model == null)          //增加一条数据
                {
                    Model.CCOM.Week_log log_model = new Model.CCOM.Week_log();
                    log_model.Topic_relation_id = new BLL.CCOM.Topic_relation().GetModel(" Student_id=" + GetAdminInfo_CCOM().User_id).Topic_relation_id;
                    log_model.Homework_id       = homeworkId;
                    log_model.Start_time        = Convert.ToDateTime(this.txtStarttime.Value);
                    log_model.End_time          = Convert.ToDateTime(this.txtEndtime.Value);
                    log_model.Work_condition    = this.txtContent.InnerText;
                    log_model.Problem           = this.txtProblem.InnerText;
                    log_model.Work_plan         = this.txtPlan.InnerText;
                    log_model.Submit_time       = DateTime.Now;
                    if (log_model.Start_time == null || log_model.End_time == null || log_model.Work_condition == "" || log_model.Problem == "" || log_model.Work_plan == "")
                    {
                        return("请完善所有表项");
                    }
                    new BLL.CCOM.Week_log().Add(log_model);
                }
                else                        //更新一条数据
                {
                    model.Start_time     = Convert.ToDateTime(this.txtStarttime.Value);
                    model.End_time       = Convert.ToDateTime(this.txtEndtime.Value);
                    model.Work_condition = this.txtContent.InnerText;
                    model.Problem        = this.txtProblem.InnerText;
                    model.Work_plan      = this.txtPlan.InnerText;
                    model.Submit_time    = DateTime.Now;
                    if (model.Start_time == null || model.End_time == null || model.Work_condition == "" || model.Problem == "" || model.Work_plan == "")
                    {
                        return("请完善所有表项");
                    }
                    new BLL.CCOM.Week_log().Update(model);
                }
            }
            catch
            {
                result = "提交发生异常";
            }

            return(result);
        }
        public void Bind_Data()
        {
            BLL.CCOM.Teach_week week_bll = new BLL.CCOM.Teach_week();
            List <university.Model.CCOM.Teach_week> week_models = week_bll.GetModelList("");
            string ht = "";

            foreach (university.Model.CCOM.Teach_week week_model in week_models)
            {
                if (week_model != null)
                {
                    ht += "<li id=\"section-1\" class=\"mainTab\">";
                    ht += "<hr style=\"height:10px;border:none;border-top:10px groove skyblue;\" />";
                    ht += "<div class=\"content\">";
                    ht += "<div class=\"span4\">";
                    ht += "<h3 class=\"sectionname\"><span>" + GetDateString(week_model.Start_time) + " - " + GetDateString(week_model.End_time) + "</span></h3><hr /></div>";
                    ht += "<div class=\"span6\" style=\"padding:22px 0;\">";
                    ht += "</div><ul class=\"span12\">";
                    BLL.CCOM.Homework work_bll = new BLL.CCOM.Homework();
                    List <university.Model.CCOM.Homework> work_models = work_bll.GetModelList(" Week_id=" + week_model.TeachWeek_id);
                    foreach (university.Model.CCOM.Homework work_model in work_models)
                    {
                        if (work_model.DatumType_id == 2)//如果类型是提交开题报告
                        {
                            ht += "<li class=\"fileTab\"><div><div class=\"mod-indent-outer\"><div class=\"mod-indent\"></div><div><div class=\"activityinstance\">";
                            ht += "<a href=\"StudentSubmit.aspx?homeworkId=" + work_model.Homework_id + "&fun_id=<%=DESEncrypt.Encrypt(\"15\") %><img src=\"/images/sendfile.png\"/>  提交" + (new BLL.CCOM.Datum_type().GetModel(work_model.DatumType_id).DatumType_name) + "</a>";
                            ht += "</div></div></div></div></li>";
                        }
                        else
                        {
                            ht += "<li class=\"fileTab\"><div><div class=\"mod-indent-outer\"><div class=\"mod-indent\"></div><div><div class=\"activityinstance\">";
                            ht += "<a href=\"StudentSubmit.aspx?homeworkId=" + work_model.Homework_id + "&fun_id=<%=DESEncrypt.Encrypt(\"15\") %><img src=\"/images/sendfile.png\"/>  提交" + (new BLL.CCOM.Datum_type().GetModel(work_model.DatumType_id).DatumType_name) + "</a>";
                            ht += "</div></div></div></div></li>";
                        }
                    }
                    ht += "</ul></div></li>";
                }
            }
            Model.CCOM.Topic_relation model = new Model.CCOM.Topic_relation();
            model = new BLL.CCOM.Topic_relation().GetModel(" Student_id=" + GetAdminInfo_CCOM().User_id + "and Accept_state=1");
            if (model == null)
            {
                ht = " <div class=\"content\" align=\"center\"><h3>您尚无选题<h3></div>";
            }
            this.week_list.InnerHtml = ht;
        }
        public void ShowInfo(int homeworkId)
        {
            Model.CCOM.Homework work_model = new BLL.CCOM.Homework().GetModel(homeworkId);
            this.type.InnerText = new BLL.CCOM.Datum_type().GetModel(work_model.DatumType_id).DatumType_name;
            Boolean isOpen = new BLL.CCOM.Teach_week().GetModel(work_model.Week_id).State;

            if (isOpen)
            {
                this.massage.InnerText     = "";
                this.txtUserUpload.Enabled = true;
                this.btnUpload.Enabled     = true;
                this.btnSubmit.Text        = "提 交";
                this.btnSubmit.Enabled     = true;
            }
            else
            {
                this.massage.InnerText     = "已关闭";
                this.txtUserUpload.Enabled = false;
                this.btnUpload.Enabled     = false;
                this.btnSubmit.Text        = "已关闭";
                this.btnSubmit.Enabled     = false;
            }
            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;
                this.btnSubmit.Visible      = true;
                Model.CCOM.Week_log log_model = new BLL.CCOM.Week_log().GetModel(" Homework_id=" + homeworkId);
                if (log_model == null)
                {
                    this.state.InnerText = "未提交";
                }
                else
                {
                    this.state.InnerText      = "已提交";
                    this.time.InnerText       = log_model.Submit_time.ToString("yyyy年MM月dd日 ddd HH:mm");
                    this.advice.InnerText     = log_model.Advice;
                    this.txtStarttime.Value   = log_model.Start_time.ToString("yyyy-MM-dd");
                    this.txtEndtime.Value     = log_model.End_time.ToString("yyyy-MM-dd");
                    this.txtContent.InnerText = log_model.Work_condition;
                    this.txtProblem.InnerText = log_model.Problem;
                    this.txtPlan.InnerText    = log_model.Work_plan;
                    this.btnSubmit.Text       = "重新提交";
                }
            }
            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;
                this.btnSubmit.Visible      = false;
                Model.CCOM.View_Datum model = new BLL.CCOM.View_Datum().GetModel(" Homework_id=" + homeworkId);
                if (model == null)
                {
                    this.state.InnerText = "未提交";
                }
                else
                {
                    this.state.InnerText   = "已提交";
                    this.time.InnerText    = model.Submit_time.ToString("yyyy年MM月dd日 ddd HH:mm");
                    this.advice.InnerText  = model.Tutor_advice;
                    this.lbtnDownLoad.Text = model.File_name;
                    this.btnSubmit.Text    = "重新提交";
                }
            }
        }
        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);
        }
        public void ShowInfo(int homeworkId)
        {
            Model.CCOM.Homework work_model = new BLL.CCOM.Homework().GetModel(homeworkId);
            this.type.InnerText = new BLL.CCOM.Datum_type().GetModel(work_model.DatumType_id).DatumType_name;
            Boolean isOpen = new BLL.CCOM.Teach_week().GetModel(work_model.Week_id).State;

            if (isOpen)
            {
                this.massage.InnerText     = "";
                this.txtUserUpload.Enabled = true;
                this.btnUpload.Enabled     = true;
                this.btnSubmit.Text        = "提 交";
                this.btnSubmit.Enabled     = true;
            }
            else
            {
                this.massage.InnerText     = "已关闭";
                this.txtUserUpload.Enabled = false;
                this.btnUpload.Enabled     = false;
                this.btnSubmit.Text        = "已关闭";
                this.btnSubmit.Enabled     = false;
            }
            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;
                this.btnSubmit.Visible      = true;
                Model.CCOM.Week_log log_model = new BLL.CCOM.Week_log().GetModel(" Homework_id=" + homeworkId);
                if (log_model == null)
                {
                    this.state.InnerText = "未提交";
                }
                else
                {
                    this.state.InnerText      = "已提交";
                    this.time.InnerText       = log_model.Submit_time.ToString("yyyy年MM月dd日 ddd HH:mm");
                    this.advice.InnerText     = log_model.Advice;
                    this.txtStarttime.Value   = log_model.Start_time.ToString("yyyy-MM-dd");
                    this.txtEndtime.Value     = log_model.End_time.ToString("yyyy-MM-dd");
                    this.txtContent.InnerText = log_model.Work_condition;
                    this.txtProblem.InnerText = log_model.Problem;
                    this.txtPlan.InnerText    = log_model.Work_plan;
                    this.btnSubmit.Text       = "重新提交";
                }
            }
            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;
                this.btnSubmit.Visible      = false;
                Model.CCOM.View_Datum model = new BLL.CCOM.View_Datum().GetModel(" Homework_id=" + homeworkId);
                var user_model = HttpContext.Current.Session[MyKeys.SESSION_ADMIN_INFO] as Model.CCOM.User_information;//获得userid
                //String User_id_String = user_model.User_id.ToString();
                Model.CCOM.View_Datum model_1 = new BLL.CCOM.View_Datum().GetModel("User_id=" + user_model.User_id.ToString() + "and  Homework_id=" + homeworkId);

                if (model_1 == null)
                {
                    this.state.InnerText = "未提交";
                }
                else
                {
                    this.state.InnerText   = "已提交";
                    this.time.InnerText    = model.Submit_time.ToString("yyyy年MM月dd日 ddd HH:mm");
                    this.advice.InnerText  = model.Tutor_advice;
                    this.lbtnDownLoad.Text = model.File_name;
                    this.btnSubmit.Text    = "重新提交";
                }
            }
        }
        private string DoAction()
        {
            string result  = "";
            int    week_id = datumId;

            BLL.CCOM.Teach_week   week_bll = new BLL.CCOM.Teach_week();
            Model.CCOM.Teach_week week_model;
            if (action != MyEnums.ActionEnum.Edit.ToString())
            {
                week_model = new Model.CCOM.Teach_week();
            }
            else
            {
                week_model = week_bll.GetModel(datumId);
            }
            string startTime = this.txtStarttime.Value;
            string endTime   = this.txtEndtime.Value;
            string state     = this.rblState.SelectedValue;

            if (startTime == "")
            {
                return("请选择开始时间");
            }
            if (endTime == "")
            {
                return("请选择结束时间");
            }

            DateTime StartDate = Convert.ToDateTime(startTime);

            week_model.Start_time = StartDate;

            DateTime EndDate = Convert.ToDateTime(endTime);

            week_model.End_time = EndDate;

            week_model.State = Convert.ToInt32(state) != 0;

            try
            {
                if (action == MyEnums.ActionEnum.Edit.ToString()) //修改
                {
                    week_bll.Update(week_model);
                }
                else
                {
                    week_id = week_bll.Add(week_model);
                }
            }
            catch (Exception ex)
            {
                return(action == MyEnums.ActionEnum.Edit.ToString() ? "修改失败" : "添加失败" + ex.Message.ToString());
            }

            if (week_id == 0)
            {
                return("添加类型数据失败");
            }

            BLL.CCOM.Homework work_bll = new BLL.CCOM.Homework();

            //work_bll.Delete(" Week_id='" + week_id + "'");//首先清空原有数据
            var work_models = work_bll.GetModelList(" Week_id='" + week_id + "'");

            string[] typeList = this.txtAddName.Text.Split('|');
            foreach (Model.CCOM.Homework work_model in work_models)
            {
                string workID = work_model.DatumType_id.ToString();
                int    flag   = 0;
                for (int i = 0; i < typeList.Length; i++)
                {
                    if (typeList[i] == workID)
                    {
                        typeList[i] = "";
                        flag        = 1;
                        break;
                    }
                }
                if (flag == 0)
                {
                    work_bll.Delete(" Homework_id=" + work_model.Homework_id);
                }
            }

            foreach (string type in typeList)
            {
                if (type == "")
                {
                    continue;
                }
                int type_id = Int32.Parse(type);
                Model.CCOM.Homework work_model = new Model.CCOM.Homework();
                work_model.Week_id      = week_id;
                work_model.DatumType_id = type_id;

                work_bll.Add(work_model);
            }

            return(result);
        }