Exemple #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string SysType = Com.Public.SqlEncStr(Request.Params["systype"].ToString()); //先得到操作类型

            if (SysType == "e")                                                          //修改
            {
                btname = "修改";
                id     = Request.Params["id"].ToString();
                SchSystem.BLL.SysPer   bll   = new SchSystem.BLL.SysPer();
                SchSystem.Model.SysPer model = bll.GetModel(int.Parse(id));
                if (model != null)
                {
                    code = model.PerCode;
                    name = model.PerName;
                    stat = model.Stat.ToString();
                    SchSystem.BLL.SysGrade bllgrade = new SchSystem.BLL.SysGrade();
                    string    srtWhere = "GradeType=" + Convert.ToInt32(model.PerCode);
                    DataTable dt       = bllgrade.GetList("AutoId as id,GradeName as name,'true' checked,GradeType", srtWhere).Tables[0];
                    if (dt.Rows.Count > 0)
                    {
                        grademodelstr = Newtonsoft.Json.JsonConvert.SerializeObject(dt);
                    }
                }
                else
                {
                    Response.Write("无该名称!");
                    Response.End();
                }
            }
            else
            {
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            string SysType = Com.Public.SqlEncStr(Request.Params["systype"].ToString());//先得到操作类型

            SchSystem.BLL.SysPer bll = new SchSystem.BLL.SysPer();
            if (SysType == "e")//修改
            {
                btname = "修改";
                id     = Request.Params["id"].ToString();

                SchSystem.Model.SysPer model = bll.GetModel(int.Parse(id));
                if (model != null)
                {
                    code = model.PerCode;
                    name = model.PerName;
                    stat = model.Stat.ToString();
                    year = model.PerYear.ToString();
                    SchSystem.BLL.SysGrade bllgrade = new SchSystem.BLL.SysGrade();
                    string    srtWhere = "GradeType=" + Convert.ToInt32(model.PerCode) + " order by convert(int,GradeCode)";
                    DataTable dt       = bllgrade.GetList("AutoId as id,GradeName as name,'true' checked,GradeType", srtWhere).Tables[0];
                    if (dt.Rows.Count > 0)
                    {
                        for (int i = 0; i < dt.Rows.Count; i++)
                        {
                            grademodelstr += dt.Rows[i]["name"].ToString() + "|";
                        }
                        grademodelstr = grademodelstr.Remove(grademodelstr.Length - 1);
                    }
                }
                else
                {
                    Response.Write("无该名称!");
                    Response.End();
                }
            }
            else
            {
                DataTable dt = bll.GetList(" top 1 PerCode", "  1=1 order by convert(int,PerCode) desc").Tables[0];

                if (dt != null && dt.Rows.Count > 0)
                {
                    string Code = dt.Rows[0]["PerCode"].ToString();
                    code = (int.Parse(Code) + 1).ToString("0");
                }
                else
                {
                    code = "1";
                }
            }
        }