protected void Page_Load(object sender, EventArgs e)
        {
            strPagePrivilege.Add("ZDPGZT");
            strPageUserType.Add("mana");
            if (Request.QueryString["ID"] != null)
            {
                if (!IsPostBack)
                {
                    int ID;
                    if (int.TryParse(Request.QueryString["ID"].ToString(), out ID))
                    {
                        IDHF.Value = ID.ToString();
                        LabMS.BLL.EvaluationTitle EvaTitle = new LabMS.BLL.EvaluationTitle();
                        LabMS.Model.EvaluationTitle EvaTitleModel = new LabMS.Model.EvaluationTitle();

                        EvaTitleModel = EvaTitle.GetModel(ID);
                        TitleCodeLbl.Text = EvaTitleModel.Title_Code.ToString();//编号
                        TitleNameLbl.Text = EvaTitleModel.Title_Name;//名称
                        AuthorLbl.Text = EvaTitleModel.Title_Author;//作者
                    }
                    else
                    {
                        ERRLbl.Text = "系统异常,参数不合法!";
                        ERRLbl.Visible = true;
                        mondifybtn.Visible = false;
                    }
                }
            }
            else
            {
                ERRLbl.Text = "系统异常,参数为空!";
                ERRLbl.Visible = true;
                mondifybtn.Visible = false;
            }
        }
Ejemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            strPagePrivilege.Add("ZDPGZT");
            strPageUserType.Add("mana");
            if (Request.QueryString["ID"] == null && Request.QueryString["Code"]!=null)
            {
                if (!IsPostBack)
                {
                    ViewState["Code"] = Request.QueryString["Code"];
                }
            }
            else if (Request.QueryString["ID"] != null)
            {
                if (!IsPostBack)
                {
                    int ID;
                    if (int.TryParse(Request.QueryString["ID"].ToString(), out ID))
                    {
                        ViewState["ID"] = ID;
                        LabMS.BLL.EvaluationTitle EvaTitle = new LabMS.BLL.EvaluationTitle();
                        LabMS.Model.EvaluationTitle EvaTitleModel = new LabMS.Model.EvaluationTitle();

                        EvaTitleModel = EvaTitle.GetModel(ID);
                        ViewState["CategoryID"] = EvaTitleModel.Title_Category;
                        TitleCodeTBX.Text = EvaTitleModel.Title_Code.ToString();//���
                        TitleNameTBX.Text = EvaTitleModel.Title_Name;//����
                        AuthorTBX.Text = EvaTitleModel.Title_Author;//����
                    }
                    else
                    {
                        ERRLbl.Text = "ϵͳ�쳣���������Ϸ���";
                        ERRLbl.Visible = true;
                        SaveBtn.Visible = false;
                    }
                }
            }
            else
            {
                ERRLbl.Text = "ϵͳ�쳣������Ϊ�գ�";
                ERRLbl.Visible = true;
                SaveBtn.Visible = false;
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// �õ�һ������ʵ��
        /// </summary>
        public LabMS.Model.EvaluationTitle GetModel(int ID)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select  top 1 ID,Title_Code,Title_Name,Title_Author,Title_SubmitDate,Title_ModifyDate,Title_Category,LabID from EvaluationTitle ");
            strSql.Append(" where ID=@ID ");
            SqlParameter[] parameters = {
                    new SqlParameter("@ID", SqlDbType.Int,4)};
            parameters[0].Value = ID;

            LabMS.Model.EvaluationTitle model=new LabMS.Model.EvaluationTitle();
            DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters);
            if(ds.Tables[0].Rows.Count>0)
            {
                if(ds.Tables[0].Rows[0]["ID"].ToString()!="")
                {
                    model.ID=int.Parse(ds.Tables[0].Rows[0]["ID"].ToString());
                }
                model.Title_Code=ds.Tables[0].Rows[0]["Title_Code"].ToString();
                model.Title_Name=ds.Tables[0].Rows[0]["Title_Name"].ToString();
                model.Title_Author=ds.Tables[0].Rows[0]["Title_Author"].ToString();
                if(ds.Tables[0].Rows[0]["Title_SubmitDate"].ToString()!="")
                {
                    model.Title_SubmitDate=DateTime.Parse(ds.Tables[0].Rows[0]["Title_SubmitDate"].ToString());
                }
                if(ds.Tables[0].Rows[0]["Title_ModifyDate"].ToString()!="")
                {
                    model.Title_ModifyDate=DateTime.Parse(ds.Tables[0].Rows[0]["Title_ModifyDate"].ToString());
                }
                if(ds.Tables[0].Rows[0]["Title_Category"].ToString()!="")
                {
                    model.Title_Category=int.Parse(ds.Tables[0].Rows[0]["Title_Category"].ToString());
                }
                if(ds.Tables[0].Rows[0]["LabID"].ToString()!="")
                {
                    model.LabID=int.Parse(ds.Tables[0].Rows[0]["LabID"].ToString());
                }
                return model;
            }
            else
            {
                return null;
            }
        }
Ejemplo n.º 4
0
 //������Ϣ
 protected void Save_OnClick(object sender, EventArgs e)
 {
     if (TitleCodeTBX.Text.Trim() == "")
     {
         Page.ClientScript.RegisterClientScriptBlock(GetType(), "", "<script type='text/javascript'>alert('�������ţ�');winclose()</script>");
         return;
     }
     LabMS.BLL.EvaluationTitle EvaTitle = new LabMS.BLL.EvaluationTitle();
     LabMS.Model.EvaluationTitle EvaTitleModel = new LabMS.Model.EvaluationTitle();
     EvaTitleModel.Title_Code = TitleCodeTBX.Text.Trim();//���
     EvaTitleModel.Title_Author = AuthorTBX.Text.Trim();//����
     //if (ViewState["CategoryID"] != null)
     //{
     //    EvaTitleModel.Title_Category = int.Parse(ViewState["CategoryID"].ToString());
     //}
     //else
     //{
     //    Page.ClientScript.RegisterClientScriptBlock(GetType(), "", "<script type='text/javascript'>alert('������Ϣʧ�ܣ�');winclose()</script>");
     //    return;
     //}
     EvaTitleModel.Title_Name = TitleNameTBX.Text.Trim();//����
     EvaTitleModel.Title_ModifyDate = DateTime.Now;//�޸�����
     if (ViewState["ID"] != null)
     {
         EvaTitleModel.ID = int.Parse(ViewState["ID"].ToString());
         EvaTitleModel.Title_Category = int.Parse(ViewState["CategoryID"].ToString());//��׼����
         EvaTitle.Update(EvaTitleModel);
         Page.ClientScript.RegisterClientScriptBlock(GetType(), "", "<script type='text/javascript'>alert('������Ϣ�ɹ���');refreshParent();winclose();</script>");
     }
     else
     {
         EvaTitleModel.Title_SubmitDate = DateTime.Now;//�ύ����
         EvaTitleModel.Title_Category = int.Parse(ViewState["Code"].ToString());//��׼���
         EvaTitle.Add(EvaTitleModel);
         Page.ClientScript.RegisterClientScriptBlock(GetType(), "", "<script type='text/javascript'>alert('�����Ϣ�ɹ���');refreshParent();</script>");
     }
 }