Exemplo n.º 1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     studentID = 0;
     if (GetAdminInfo_CCOM().Role_id == 3)
     {
         studentID = GetAdminInfo_CCOM().User_id;
     }
     else
     {
         studentID = long.Parse(DESEncrypt.Decrypt(MyRequest.GetQueryString("studentID")));
     }
     this.MyUserID.Text = studentID.ToString();
     if (!Page.IsPostBack)
     {
         if (studentID == 0)
         {
             JscriptMsg("传输参数不正确!", "back", "Error");
             return;
         }
         string ht = "";
         Model.CCOM.Topic_relation model = new Model.CCOM.Topic_relation();
         model = new BLL.CCOM.Topic_relation().GetModel(" Student_id=" + studentID + "and Accept_state=1");
         if (model == null)
         {
             ht = " <div class=\"content\" align=\"center\"><h3>您尚无选题<h3></div>";
             this.print_div.InnerHtml = ht;
         }
         else
         {
             AddSubmitButton();
             ShowInfo();
         }
     }
 }
Exemplo n.º 2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     UserID = 0;
     UserID = GetAdminInfo_CCOM().User_id;
     if (!Page.IsPostBack)
     {
         if (UserID == 0)
         {
             JscriptMsg("传输参数不正确!", "back", "Error");
             return;
         }
         string ht = "";
         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><table class=\"table table-striped table-bordered dataTable\"></table></div>";
             this.print_div.InnerHtml = ht;
             btnSubmit.Visible        = false;
             //JscriptMsg("您尚无选题!", "back", "Error");
             //return;
         }
         else
         {
             ShowInfo();
         }
     }
 }
        protected void btnSubmit_Error(object sender, EventArgs e)
        {
            BLL.CCOM.Topic_relation bll = new BLL.CCOM.Topic_relation();
            for (int i = 0; i < topicrelation.Length; i++)
            {
                try
                {
                    Model.CCOM.Topic_relation model = bll.GetModel(" Topic_relation_id=" + topicrelation[i]);
                    if (model != null)
                    {
                        model.Accept_state = 2;
                        if (bll.Update(model))
                        {
                            BLL.CCOM.Topic   topic_bll   = new BLL.CCOM.Topic();
                            Model.CCOM.Topic topic_model = topic_bll.GetModel(model.Topic_id);
                            topic_model.Selected_state = false;
                            topic_bll.Update(topic_model);

                            JscriptMsg("审核成功啦!", "TeacherChoose.aspx?fun_id=" + get_fun_id("CCOM/TopicManage/TeacherChoose.aspx"), "Success");
                        }
                        else
                        {
                            JscriptMsg("审核失败", "TeacherChoose.aspx?fun_id=" + get_fun_id("CCOM/TopicManage/TeacherChoose.aspx"), "Success");
                        }
                    }
                }
                catch
                {
                    continue;
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            relationID = 0;
            studentID  = 0;
            if (GetAdminInfo_CCOM().Role_id == 3)
            {
                studentID = GetAdminInfo_CCOM().User_id;
                this.btnSubmit.Visible = false;
            }
            else
            {
                studentID = long.Parse(DESEncrypt.Decrypt(MyRequest.GetQueryString("studentID")));
            }
            string ht = "";

            Model.CCOM.Topic_relation model = new Model.CCOM.Topic_relation();
            model = new BLL.CCOM.Topic_relation().GetModel(" Student_id=" + studentID + "and Accept_state=1");
            if (model != null)
            {
                relationID = model.Topic_relation_id;
            }
            if (!Page.IsPostBack)
            {
                if (studentID == 0)
                {
                    JscriptMsg("传输参数不正确!", "back", "Error");
                    return;
                }
                //if(GetAdminInfo_CCOM().Role_id != 3)
                //{
                //    JscriptMsg("只有学生用户才可以提交材料!", "back", "Error");
                //    return;
                //}

                if (model == null)
                {
                    ht = " <div class=\"content\" align=\"center\"><h3>该学生尚无选题<h3><table class=\"table table-striped table-bordered dataTable\"></table></div>";
                    this.print_div.InnerHtml = ht;
                }
                else
                {
                    ShowInfo();
                }
            }
        }
        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;
        }
        protected string ImportDataItem(DataSet ds, ref int success, ref int error)//基础数据
        {
            string result = "";

            BLL.CCOM.User_information   stu_bll   = new BLL.CCOM.User_information();
            Model.CCOM.User_information stu_model = new Model.CCOM.User_information();
            BLL.CCOM.Topic            topic_bll   = new BLL.CCOM.Topic();
            Model.CCOM.Topic          topic_model = new Model.CCOM.Topic();
            BLL.CCOM.Topic_relation   rela_bll    = new BLL.CCOM.Topic_relation();
            Model.CCOM.Topic_relation rela_model  = new Model.CCOM.Topic_relation();

            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                string checkmsg = null;
                #region 添加学生信息==========================
                //学号
                string number = ds.Tables[0].Rows[i]["学号"].ToString().Trim();
                if (!ValidDFValue(number, true, "", ref checkmsg))
                {
                    result += "×第" + (i + 1).ToString() + "行数据更新失败,学号" + checkmsg + "<br/>";
                    error++;
                    continue;
                }
                else if (stu_bll.GetModel(" User_number='" + number + "'") != null)
                {
                    stu_model = stu_bll.GetModel(" User_number='" + number + "'");
                }
                else if (number != "")
                {
                    stu_model.User_number = number;
                }
                //姓名
                string name = ds.Tables[0].Rows[i]["姓名"].ToString().Trim();
                if (!ValidDFValue(name, true, "", ref checkmsg))
                {
                    result += "×第" + (i + 1).ToString() + "行数据更新失败,姓名" + checkmsg + "<br/>";
                    error++;
                    continue;
                }
                else if (name != "")
                {
                    stu_model.User_realname = name;
                }
                //性别
                //string gender = ds.Tables[0].Rows[i]["性别"].ToString().Trim();
                //if (!ValidDFValue(gender, true, "男|女", ref checkmsg))
                //{
                //    result += "×第" + (i + 1).ToString() + "行数据更新失败,性别" + checkmsg + "<br/>";
                //    error++;
                //    continue;
                //}
                //else if (gender == "男")
                //{
                //    stu_model.User_gender = false;
                //}
                //else if (gender == "女")
                //{
                //    stu_model.User_gender = true;
                //}
                //机构
                stu_model.User_gender = false;
                string angency = ds.Tables[0].Rows[i]["行政班"].ToString().Trim();
                if (!ValidDFValue(angency, true, "", ref checkmsg))
                {
                    result += "×第" + (i + 1).ToString() + "行数据更新失败,所在班号" + checkmsg + "<br/>";
                    error++;
                    continue;
                }
                BLL.CCOM.Agency   agency_bll   = new BLL.CCOM.Agency();
                Model.CCOM.Agency agency_model = new Model.CCOM.Agency();
                agency_model = agency_bll.GetModel(" Agency_name='" + angency + "'");
                if (agency_model == null)
                {
                    result += "×第" + (i + 1).ToString() + "行数据更新失败,所在班号不存在<br/>";
                    error++;
                    continue;
                }
                stu_model.Agency_id = agency_model.Agency_id;
                stu_model.Role_id   = 3;

                stu_model.User_password = DESEncrypt.MD5Encrypt(number);
                if (stu_bll.GetModel(" User_number='" + number + "'") == null)
                {
                    stu_model.User_id = stu_bll.Add(stu_model);
                    if (stu_model.User_id == 0)
                    {
                        result += "×第" + (i + 1).ToString() + "行数据更新异常<br/>";
                        error++;
                        continue;
                    }
                    else
                    {
                        BLL.CCOM.User_information   user_bll      = new BLL.CCOM.User_information();
                        Model.CCOM.User_information user_model    = user_bll.GetModel("User_number='" + number + "'");
                        BLL.CCOM.Student            student_bll   = new BLL.CCOM.Student();
                        Model.CCOM.Student          student_model = new Model.CCOM.Student();
                        student_model.User_id   = user_model.User_id;
                        student_model.Period_id = 4;
                        student_bll.Add(student_model);
                    }
                }
                else
                {
                    if (!stu_bll.Update(stu_model))
                    {
                        result += "×第" + (i + 1).ToString() + "行数据更新异常<br/>";
                        error++;
                        continue;
                    }
                }
                #endregion

                #region 更新导师信息==========================
                var tea_model = new Model.CCOM.Tutor();
                //姓名
                string tea_name = ds.Tables[0].Rows[i]["指导教师"].ToString().Trim();
                if (!ValidDFValue(tea_name, true, "", ref checkmsg))
                {
                    result += "×第" + (i + 1).ToString() + "行数据更新失败,指导教师" + checkmsg + "<br/>";
                    error++;
                    continue;
                }
                else if (tea_name != "")
                {
                    var tea_user_model = new BLL.CCOM.User_information().GetModel(" User_realname='" + tea_name + "'");
                    if (tea_user_model == null)
                    {
                        result += "×第" + (i + 1).ToString() + "行数据更新失败,指导教师" + tea_name + "不存在<br/>";
                        error++;
                        continue;
                    }
                    tea_model = new BLL.CCOM.Tutor().GetModel(" User_id=" + tea_user_model.User_id);
                    string title_name = ds.Tables[0].Rows[i]["职称"].ToString().Trim();
                    if (!ValidDFValue(title_name, true, "", ref checkmsg))
                    {
                        result += "×第" + (i + 1).ToString() + "行数据更新失败,职称" + checkmsg + "<br/>";
                        error++;
                        continue;
                    }
                    else if (title_name != "")
                    {
                        var title_model = new BLL.CCOM.Title().GetModel(" Title_name='" + title_name + "'");
                        if (title_model == null)
                        {
                            result += "×第" + (i + 1).ToString() + "行数据更新失败,职称" + title_name + "不存在<br/>";
                            error++;
                            continue;
                        }
                        tea_model.Title_id = title_model.Title_id;
                        if (!new BLL.CCOM.Tutor().Update(tea_model))
                        {
                            result += "×第" + (i + 1).ToString() + "行数据更新失败,更新导师信息失败<br/>";
                            error++;
                            continue;
                        }
                    }
                }
                #endregion

                #region 导入选题信息==========================
                string topic_name = ds.Tables[0].Rows[i]["毕业设计题目"].ToString().Trim();
                if (!ValidDFValue(topic_name, true, "", ref checkmsg))
                {
                    result += "×第" + (i + 1).ToString() + "行数据更新失败,题目名称" + checkmsg + "<br/>";
                    error++;
                    continue;
                }
                else if (topic_name != "")
                {
                    topic_model.Topic_name = topic_name;
                }

                string Topic_nature = ds.Tables[0].Rows[i]["题目性质"].ToString().Trim();
                if (!ValidDFValue(Topic_nature, false, "", ref checkmsg))
                {
                    result += "×第" + (i + 1).ToString() + "行数据更新失败,题目性质" + checkmsg + "<br/>";
                    error++;
                    continue;
                }
                else if (Topic_nature != "")
                {
                    topic_model.Topic_nature = Topic_nature;
                }

                string Topic_source = ds.Tables[0].Rows[i]["题目来源"].ToString().Trim();
                if (!ValidDFValue(Topic_source, false, "", ref checkmsg))
                {
                    result += "×第" + (i + 1).ToString() + "行数据更新失败,题目来源" + checkmsg + "<br/>";
                    error++;
                    continue;
                }
                else if (Topic_source != "")
                {
                    topic_model.Topic_source = Topic_source;
                }

                string Topic_content = ds.Tables[0].Rows[i]["题目详情"].ToString().Trim();
                if (!ValidDFValue(Topic_content, false, "", ref checkmsg))
                {
                    result += "×第" + (i + 1).ToString() + "行数据更新失败,题目详情" + checkmsg + "<br/>";
                    error++;
                    continue;
                }
                else if (Topic_content != "")
                {
                    topic_model.Topic_content = Topic_content;
                }

                string Topic_task = ds.Tables[0].Rows[i]["任务书"].ToString().Trim();
                if (!ValidDFValue(Topic_task, false, "", ref checkmsg))
                {
                    result += "×第" + (i + 1).ToString() + "行数据更新失败,任务书" + checkmsg + "<br/>";
                    error++;
                    continue;
                }
                else if (Topic_task != "")
                {
                    topic_model.Topic_task = Topic_task;
                }

                topic_model.Selected_state = true;
                topic_model.Check_state    = 1;
                topic_model.Teacher_id     = tea_model.User_id;
                topic_model.Company        = "软件学院";
                topic_model.Topic_id       = topic_bll.Add(topic_model);
                if (topic_model.Topic_id == 0)
                {
                    result += "×第" + (i + 1).ToString() + "行数据更新异常<br/>";
                    error++;
                    continue;
                }
                #endregion

                #region  题对应关系信息==========================
                if (rela_bll.GetModel(" Student_id=" + stu_model.User_id) != null && rela_bll.GetModel(" Student_id=" + stu_model.User_id).Accept_state != 2)

                {
                    result += "×第" + (i + 1).ToString() + "行学生选题对应关系更新异常,该学生已经在系统有选题记录!<br/>";
                    error++;
                    continue;
                }
                rela_model.Student_id        = stu_model.User_id;
                rela_model.Teacher_id        = tea_model.User_id;
                rela_model.Topic_id          = topic_model.Topic_id;
                rela_model.Accept_state      = 1;
                rela_model.Apply_time        = DateTime.Now;
                rela_model.Topic_relation_id = rela_bll.Add(rela_model);
                if (rela_model.Topic_relation_id == 0)
                {
                    result += "×第" + (i + 1).ToString() + "行数据更新异常<br/>";
                    error++;
                    continue;
                }
                else
                {
                    success++;
                }
                #endregion
            }
            return(result);
        }
        protected string UpdateTopicState()
        {
            JsonData data = new JsonData();
            string   id   = MyRequest.GetString("ID");
            string   myid = MyRequest.GetString("MYID");
            string   msg  = "";

            try
            {
                var     bll  = new BLL.CCOM.Topic();
                var     m    = bll.GetModel("Topic_id=" + id);
                Boolean isOn = m.Selected_state == true;
                m.Selected_state = isOn ^ true;

                Model.CCOM.Topic_relation rela_model;
                rela_model = new BLL.CCOM.Topic_relation().GetModel(" Student_id=" + myid);
                if (rela_model == null)
                {
                    rela_model              = new Model.CCOM.Topic_relation();
                    rela_model.Student_id   = Int64.Parse(myid);
                    rela_model.Teacher_id   = m.Teacher_id;
                    rela_model.Topic_id     = m.Topic_id;
                    rela_model.Apply_time   = DateTime.Now;
                    rela_model.Accept_state = 0;
                    long rela_id = (new BLL.CCOM.Topic_relation()).Add(rela_model);
                    if (rela_id != 0)
                    {
                        if (bll.Update(m) == false)
                        {
                            new BLL.CCOM.Topic_relation().Delete(rela_id);
                            msg = "修改发生异常!";
                        }
                    }
                    else
                    {
                        msg = "选题发生异常!";
                    }
                }
                else
                {
                    Model.CCOM.Topic last_model = new BLL.CCOM.Topic().GetModel(rela_model.Topic_id);
                    last_model.Selected_state = false;
                    bll.Update(last_model);

                    rela_model.Student_id   = Int64.Parse(myid);
                    rela_model.Teacher_id   = m.Teacher_id;
                    rela_model.Topic_id     = m.Topic_id;
                    rela_model.Apply_time   = DateTime.Now;
                    rela_model.Accept_state = 0;
                    if (new BLL.CCOM.Topic_relation().Update(rela_model))
                    {
                        if (bll.Update(m) == false)
                        {
                            new BLL.CCOM.Topic_relation().Delete(rela_model.Topic_relation_id);
                            msg = "修改发生异常!";
                        }
                    }
                    else
                    {
                        msg = "选题发生异常!";
                    }
                }
            }
            catch
            {
                msg = "修改发生异常!";
            }

            if (msg == "")
            {
                data["msg"]  = "修改成功";
                data["code"] = 1;
            }
            else
            {
                data["msg"]  = msg;
                data["code"] = 0;
            }
            return(data.ToJson());
        }