//获取选择状态
        protected String GetStatusText(string TopicID)
        {
            Boolean isOn  = new BLL.CCOM.Topic().GetModel(" Topic_id=" + TopicID).Selected_state;
            int     state = 0;

            Model.CCOM.Topic_relation model = new BLL.CCOM.Topic_relation().GetModel(" Student_id=" + GetAdminInfo_CCOM().User_id);
            if (model == null)
            {
                state = 2;                              //未选
            }
            else if (model.Accept_state == 0)
            {
                state = 3;                              //已选,可换
            }
            else if (model.Accept_state == 1)
            {
                state = 1;                              //已选,不可换
            }
            else if (model.Accept_state == 2)
            {
                state = 3;
            }
            else
            {
                state = 1;
            }
            if (!isOn)
            {
                return("&nbsp;<a href=\"javascript:void(0);\" onclick='ChooseTopic(" + TopicID + "," + state + ")'>选择");
            }
            else
            {
                return("已选");
            }
        }
        private void RptBind(string _strWhere, string _order)
        {
            int    pageSize    = GetPageSize(15); //每页数量
            int    page        = MyRequest.GetQueryInt("page", 1);
            string keywords    = MyRequest.GetQueryString("keywords");
            int    start_index = pageSize * (page - 1) + 1;

            this.st_index = pageSize * (page - 1) + 1;
            int end_index = pageSize * page;

            this.txtKeywords.Value = keywords;

            BLL.CCOM.Topic bll = new BLL.CCOM.Topic();
            //计算数量
            int totalCount = bll.GetRecordCount(_strWhere);

            //绑定当页
            this.rptList.DataSource = bll.GetListByPage(_strWhere, _order, start_index, end_index);
            this.rptList.DataBind();

            //绑定页码
            txtPageNum.Text = pageSize.ToString();
            string pageUrl = Utils.CombUrlTxt("StudentChoose.aspx", "fun_id={0}&keywords={1}&sort={2}&page={3}", this.fun_id, this.keywords, MyRequest.GetString("sort"), "__id__");

            this.PageContent.InnerHtml = Utils.OutPageList(pageSize, page, totalCount, pageUrl, 8, true);

            //绑定我的选题

            BLL.CCOM.View_Selete_Topic selete_bll = new BLL.CCOM.View_Selete_Topic();
            this.rptList2.DataSource = selete_bll.GetList(" Student_id =" + GetAdminInfo_CCOM().User_id);
            //this.rptList2.DataSource = selete_bll.GetListByPage(_strWhere + "and Student_id ="+GetAdminInfo_CCOM().User_id, _order, start_index, end_index);
            this.rptList2.DataBind();
        }
        //删除
        protected void lbtSingleDelete_Click(object sender, EventArgs e)
        {
            BLL.CCOM.Topic bll = new BLL.CCOM.Topic();


            var lbtn = sender as LinkButton;

            if (lbtn != null)
            {
                var  id     = Int32.Parse(DESEncrypt.Decrypt(lbtn.ToolTip.ToString()));
                bool result = true;
                try
                {
                    result = bll.Delete(id);
                }
                catch
                {
                    result = false;
                }
                string keywords = MyRequest.GetQueryString("keywords");
                int    page     = MyRequest.GetQueryInt("page", 1);
                if (result == true)
                {
                    //JscriptMsg("删除成功!", Utils.CombUrlTxt("ManagerList.aspx", "fun_id={0}&keywords={1}&page={2}",
                    //    DESEncrypt.Encrypt(this.fun_id), keywords, page.ToString()), "Success");
                    JscriptMsg("删除成功!", Utils.CombUrlTxt("TopicList.aspx", "fun_id={0}&keywords={1}&page={2}", this.fun_id, keywords, page.ToString()), "Success");
                    // Response.Redirect("TopicList.aspx?fun_id=" + get_fun_id("CCOM/TopicManage/TopicList.aspx"));
                }
                else
                {
                    JscriptMsg("删除失败!", Utils.CombUrlTxt("TopicList.aspx", "fun_id={0}&keywords={1}&page={2}", DESEncrypt.Encrypt(this.fun_id), keywords, page.ToString()), "Error");
                }
            }
        }
        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 string UpdateTopicState()
        {
            JsonData data = new JsonData();
            string   id   = MyRequest.GetString("ID");

            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;
                if (bll.Update(m) == false)
                {
                    msg = "修改发生异常!";
                }
            }
            catch
            {
                msg = "修改发生异常!";
            }

            if (msg == "")
            {
                data["msg"]  = "修改成功";
                data["code"] = 1;
            }
            else
            {
                data["msg"]  = msg;
                data["code"] = 0;
            }
            return(data.ToJson());
        }
Esempio n. 6
0
 protected void btnSubmit_Error(object sender, EventArgs e)
 {
     BLL.CCOM.Topic bll = new BLL.CCOM.Topic();
     for (int i = 0; i < topics.Length; i++)
     {
         try
         {
             Model.CCOM.Topic model = bll.GetModel(" Topic_id=" + topics[i]);
             if (model != null)
             {
                 model.Check_state = 2;
                 if (bll.Update(model))
                 {
                     JscriptMsg("审核成功啦!", "TopicCheckList.aspx?fun_id=" + get_fun_id("CCOM/TopicManage/TopicCheckList.aspx"), "Success");
                 }
                 else
                 {
                     JscriptMsg("审核失败", "TopicCheckList.aspx?fun_id=" + get_fun_id("CCOM/TopicManage/TopicCheckList.aspx"), "Success");
                 }
             }
         }
         catch
         {
             continue;
         }
     }
 }
        //保存
        protected void btn_Submit_Click(object sender, EventArgs e)
        {
            var student_models = new BLL.CCOM.User_information().GetModelList(" Role_id=3");

            foreach (var student_model in student_models)
            {
                if (!new BLL.CCOM.User_information().Delete(student_model.User_id))
                {
                    JscriptMsg("删除学生:" + student_model.User_realname + "时,发生异常!", "", "Error");
                    return;
                }
            }

            var topic_models = new BLL.CCOM.Topic().GetModelList("");

            foreach (var topic_model in topic_models)
            {
                if (!new BLL.CCOM.Topic().Delete(topic_model.Topic_id))
                {
                    JscriptMsg("删除选题:" + topic_model.Topic_name + "时,发生异常!", "", "Error");
                    return;
                }
            }

            var teachweek_models = new BLL.CCOM.Teach_week().GetModelList("");

            foreach (var teachweek_model in teachweek_models)
            {
                if (!new BLL.CCOM.Teach_week().Delete(teachweek_model.TeachWeek_id))
                {
                    JscriptMsg("删除异常!", "", "Error");
                    return;
                }
            }

            var reply_models = new BLL.CCOM.Reply_group().GetModelList("");

            foreach (var reply_model in reply_models)
            {
                if (!new BLL.CCOM.Reply_group().Delete(reply_model.Group_id))
                {
                    JscriptMsg("删除答辩组:" + reply_model.Group_name + "时,发生异常!", "", "Error");
                    return;
                }
            }

            var user_models = new BLL.CCOM.User_information().GetModelList(" Role_id!=1");

            foreach (var student_model in user_models)
            {
                if (!new BLL.CCOM.User_information().Delete(student_model.User_id))
                {
                    JscriptMsg("删除用户:" + student_model.User_realname + "时,发生异常!", "", "Error");
                    return;
                }
            }

            JscriptMsg("初始化成功!", "InitSystem.aspx?fun_id=" + DESEncrypt.Encrypt(this.fun_id), "Success");
        }
        protected void lbtAble_Click(object sender, EventArgs e)
        {
            var bll = new BLL.CCOM.Topic();

            var lbtn = sender as LinkButton;

            if (lbtn != null)
            {
                var  id     = Int64.Parse(DESEncrypt.Decrypt(lbtn.ToolTip.ToString()));
                bool isOn   = false;
                bool result = true;
                try
                {
                    var m = bll.GetModel("Topic_id=" + id);
                    //isOn = m.Selected_state == true;
                    //m.Selected_state = isOn ^ true;
                    if (bll.Update(m) == false)
                    {
                        result = false;
                    }
                }
                catch
                {
                    result = false;
                }
                string keywords = MyRequest.GetQueryString("keywords");
                int    page     = MyRequest.GetQueryInt("page", 1);
                if (result == true)
                {
                    JscriptMsg(isOn ? "退选成功!" : "选择成功!", Utils.CombUrlTxt("StudentChoose.aspx", "fun_id={0}&keywords={1}&page={2}",
                                                                          DESEncrypt.Encrypt(this.fun_id), keywords, page.ToString()), "Success");
                }
                else
                {
                    JscriptMsg(isOn ? "退选失败!" : "选择失败!", Utils.CombUrlTxt("StudentChoose.aspx", "fun_id={0}&keywords={1}&page={2}",
                                                                          DESEncrypt.Encrypt(this.fun_id), keywords, page.ToString()), "Error");
                }
                RptBind(CombSqlTxt(this.keywords), " User_id desc ");
            }
        }
        public void ShowInfo()
        {
            var model = new BLL.CCOM.Topic().GetModel(TopicID);

            this.lblName.InnerText = model.Topic_name;
            if (model.Topic_source != null)
            {
                this.lblSource.InnerText = model.Topic_source;
            }
            else
            {
                this.lblSource.InnerText = "--";
            }
            if (model.Topic_nature != null)
            {
                this.lblNature.InnerText = model.Topic_nature;
            }
            else
            {
                this.lblNature.InnerText = "--";
            }
            if (model.Topic_content != null)
            {
                this.lblContent.InnerText = model.Topic_content;
            }
            else
            {
                this.lblContent.InnerText = "--";
            }
            if (model.Topic_task != null)
            {
                this.lblTask.InnerText = model.Topic_task;
            }
            else
            {
                this.lblTask.InnerText = "--";
            }
        }
Esempio n. 10
0
        protected string ImportDataItem(DataSet ds, ref int success, ref int error)//基础数据
        {
            string result = "";

            BLL.CCOM.Topic   bll   = new BLL.CCOM.Topic();
            Model.CCOM.Topic model = new Model.CCOM.Topic();

            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                string checkmsg   = null;
                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 != "")
                {
                    model.Topic_name = topic_name;
                }

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

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

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

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

                model.Selected_state = false;
                model.Check_state    = 0;
                model.Teacher_id     = GetAdminInfo_CCOM().User_id;
                model.Company        = "软件学院";
                if (bll.Add(model) == 0)
                {
                    result += "×第" + (i + 1).ToString() + "行数据更新异常<br/>";
                    error++;
                    continue;
                }
                else
                {
                    success++;
                }
            }
            return(result);
        }
        public void ShowInfo()
        {
            Model.CCOM.View_User user_model = new BLL.CCOM.View_User().GetModel(" User_id=" + UserID);
            var group_model  = new BLL.CCOM.Reply_group().GetModel(" Group_id=" + Group_id);
            var leader_model = new BLL.CCOM.View_User().GetModel(" User_id=" + group_model.User_id);

            if (GetAdminInfo_CCOM().User_id != leader_model.User_id)
            {
                this.txtOpinion.Disabled = true;
                this.ddlresult.Enabled   = false;
                this.btnSubmit.Visible   = false;
            }

            this.lblName.InnerText   = user_model.User_realname;
            this.lblNumber.InnerHtml = user_model.User_number;
            var relation_model = new BLL.CCOM.Topic_relation().GetModel(" Student_id=" + UserID);

            if (relation_model != null)
            {
                this.lblTeacher.InnerText = new BLL.CCOM.User_information().GetModel(relation_model.Teacher_id).User_realname;
                var topic_model = new BLL.CCOM.Topic().GetModel(relation_model.Topic_id);
                this.lblTitle.InnerText  = topic_model.Topic_name;
                this.lblNature.InnerText = topic_model.Topic_nature;
                this.lblSource.InnerText = topic_model.Topic_source;
            }
            else
            {
                return;
            }

            string leader_title       = "--";
            var    leader_tutor_model = new BLL.CCOM.Tutor().GetModel(" User_id=" + leader_model.User_id);

            if (leader_tutor_model != null)
            {
                if (leader_tutor_model.Title_id != null)
                {
                    leader_title = new BLL.CCOM.Title().GetModel((int)leader_tutor_model.Title_id).Title_name;
                }
                else
                {
                    leader_title = "--";
                }
            }
            reviewTr = "<tr><td style=\"text-align:center;\">组长</td><td style=\"text-align:center;\">" + leader_model.User_realname + "</td><td style=\"text-align:center;\">" + leader_title + "</td><td colspan=\"3\" style=\"text-align:center;\">" + leader_model.Agency_name + "</td></tr>";
            var rcs = new BLL.CCOM.Reply_commission().GetModelList(" Group_id=" + Group_id);

            foreach (var rc in rcs)
            {
                var    u_model     = new BLL.CCOM.View_User().GetModel(" User_id=" + rc.User_id);
                string title       = "--";
                var    tutor_model = new BLL.CCOM.Tutor().GetModel(" User_id=" + rc.User_id);
                if (tutor_model != null)
                {
                    if (tutor_model.Title_id != null)
                    {
                        title = new BLL.CCOM.Title().GetModel((int)tutor_model.Title_id).Title_name;
                    }
                    else
                    {
                        title = "--";
                    }
                }
                reviewTr += "</tr><td style=\"text-align:center;\">组员</td><td style=\"text-align:center;\">" + u_model.User_realname + "</td><td style=\"text-align:center;\">" + title + "</td><td colspan=\"3\" style=\"text-align:center;\">" + u_model.Agency_name + "</td></tr>";
            }

            var proposal_model = new BLL.CCOM.Proposal().GetModel(" Topic_relation_id=" + relation_model.Topic_relation_id);

            if (proposal_model != null)
            {
                this.txtOpinion.InnerText    = proposal_model.Review;
                this.ddlresult.SelectedValue = proposal_model.Result.ToString();
            }
        }
        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());
        }