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()); }
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 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 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 "); } }
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()); }