protected void Page_Load(object sender, EventArgs e) { strPagePrivilege.Add("ZDPGBZ"); strPageUserType.Add("mana"); if (Request.QueryString["ID"] == null && Request.QueryString["TitleID"]!=null) { if (!IsPostBack) { ViewState["TitleID"] = Request.QueryString["TitleID"]; } } else if (Request.QueryString["ID"] != null) { if (!IsPostBack) { int ID; if(int.TryParse(Request.QueryString["ID"].ToString(),out ID)) { LabMS.BLL.Standard sta = new LabMS.BLL.Standard(); LabMS.Model.Standard staModel = new LabMS.Model.Standard(); staModel = sta.GetModel(ID); ViewState["TitleID"] = staModel.EvTitleID; ViewState["ID"] = ID; BindData(ID); } } } else { ERRLbl.Text = "ϵͳ�쳣���������Ϸ���"; ERRLbl.Visible = true; SaveBtn.Visible = false; } }
protected void Page_Load(object sender, EventArgs e) { strPagePrivilege.Add("ZDPGBZ"); strPageUserType.Add("mana"); if (Request.QueryString["ID"] != null) { if (!IsPostBack) { int ID; if (int.TryParse(Request.QueryString["ID"].ToString(), out ID)) { LabMS.BLL.Standard sta = new LabMS.BLL.Standard(); LabMS.Model.Standard staModel = new LabMS.Model.Standard(); staModel = sta.GetModel(ID); IDHF.Value = ID.ToString(); BindData(ID); } else { ERRLbl.Text = "系统异常,参数不合法!"; ERRLbl.Visible = true; modifybtn.Visible = false; } } } else { ERRLbl.Text = "系统异常,参数不合法!"; ERRLbl.Visible = true; modifybtn.Visible = false; } }
//������ protected void BindData(int ID) { LabMS.BLL.Standard sta = new LabMS.BLL.Standard(); LabMS.Model.Standard staModel = new LabMS.Model.Standard(); staModel = sta.GetModel(ID); CodeTBX.Text = staModel.St_Num.ToString(); ContentTBX.Text = staModel.St_Content; StandardTBX.Text = staModel.St_Standard; MethodTBX.Text = staModel.St_Method; ExplainTBX.Text = staModel.St_Explain; }
//绑定数据 protected void BindData(int ID) { LabMS.BLL.Standard sta = new LabMS.BLL.Standard(); LabMS.Model.Standard staModel = new LabMS.Model.Standard(); staModel = sta.GetModel(ID); CodeLbl.Text = staModel.St_Num.ToString(); ContentLbl.Text = staModel.St_Content; StandardLbl.Text = staModel.St_Standard.Replace("\r\n","<br/>"); MethodLbl.Text = staModel.St_Method.Replace("\r\n", "<br/>"); ExplainLbl.Text = staModel.St_Explain.Replace("\r\n", "<br/>"); }
//�ж��������Ƿ��Ѵ��� protected bool IsCode(string code) { LabMS.BLL.Standard title = new LabMS.BLL.Standard(); List<LabMS.Model.Standard> list = new List<LabMS.Model.Standard>(); if (ViewState["ID"] != null) { list = title.GetModelList("St_Num='" + code + "' and [ID]<>" + int.Parse(ViewState["ID"].ToString())); } else { list = title.GetModelList("St_Num='" + code + "'"); } if (list.Count == 0) { return false; } else { return true; } }
//�������� protected void Save_OnClick(object sender, EventArgs e) { if (CodeTBX.Text.Trim() == "") { Page.ClientScript.RegisterClientScriptBlock(GetType(), "", "<script type='text/javascript'>alert('��������ţ�')</script>"); return; } if (ContentTBX.Text.Trim() == "") { Page.ClientScript.RegisterClientScriptBlock(GetType(), "", "<script type='text/javascript'>alert('�������������ݣ�')</script>"); return; } LabMS.BLL.Standard stan = new LabMS.BLL.Standard(); LabMS.Model.Standard stanModel = new LabMS.Model.Standard(); stanModel.St_Num = CodeTBX.Text.Trim();//��� stanModel.St_Content = ContentTBX.Text.Trim();//���� stanModel.St_Standard = StandardTBX.Text.Trim();//�� stanModel.St_Method = MethodTBX.Text.Trim();//���� stanModel.St_Explain = ExplainTBX.Text.Trim();//˵�� stanModel.St_Date = DateTime.Now;//���� if (ViewState["ID"] != null) { stanModel.EvTitleID = int.Parse(ViewState["TitleID"].ToString()); stanModel.ID = int.Parse(ViewState["ID"].ToString()); stan.Update(stanModel); Page.ClientScript.RegisterClientScriptBlock(GetType(), "", "<script type='text/javascript'>alert('���³ɹ���');refreshParent();wincolse();</script>"); } else { stanModel.EvTitleID = int.Parse(ViewState["TitleID"].ToString()); stan.Add(stanModel); Page.ClientScript.RegisterClientScriptBlock(GetType(), "", "<script type='text/javascript'>alert('��ӳɹ���');refreshParent();</script>"); } }
//绑定GridView protected void LabEvalGV_DataBind(int TitleID) { LabMS.BLL.Standard sta = new LabMS.BLL.Standard(); List<LabMS.Model.Standard> staModelList = new List<LabMS.Model.Standard>(); staModelList = sta.GetModelList("EvTitleID=" + TitleID); LabEvalGridView.DataSource = HandleList(staModelList); LabEvalGridView.DataBind(); }