protected void Page_Load(object sender, EventArgs e)
        {
            string SysType = Request.Params["systype"].ToString();

            if (SysType == "e")//修改,不能修改用户的类型及学校参数
            {
                btname = "修改";
                id     = Request.Params["autoid"].ToString();
                //先得到操作类型
                SchSystem.BLL.SysTerm   bll   = new SchSystem.BLL.SysTerm();
                SchSystem.Model.SysTerm model = bll.GetModel(int.Parse(id));
                if (model != null && model.AutoId > 0)
                {
                    code = model.TermCode;
                    name = model.TermName;
                }
                else
                {
                    Response.Write("无该名称!");
                    Response.End();
                }
            }
            else//不在添加及修改之内,则返回
            {
            }
        }
 public static Com.DataPack.DataRsp <string> save(string Name, string AutoId)
 {
     Com.DataPack.DataRsp <string> rsp = new Com.DataPack.DataRsp <string>();
     if (Com.Session.userid == null)
     {
         rsp.code = "expire";
         rsp.msg  = "页面已经过期,请重新登录";
     }
     else
     {
         try
         {
             SchSystem.BLL.SysTerm   SysTerm_bll   = new SchSystem.BLL.SysTerm();
             SchSystem.Model.SysTerm SysTerm_model = new SchSystem.Model.SysTerm();
             SysTerm_model.TermName = Com.Public.SqlEncStr(Name).ToString();
             if (AutoId != "")
             {
                 SysTerm_model.AutoId = Convert.ToInt32(AutoId);
                 if (SysTerm_bll.Update(SysTerm_model))
                 {
                     rsp.code = "success";
                     rsp.msg  = "修改成功";
                 }
             }
             else
             {
                 DataTable dt = SysTerm_bll.GetList("top 1 TermCode", " 1=1 order by TermCode DESC").Tables[0];
                 if (dt != null && dt.Rows.Count > 0)
                 {
                     string Code = dt.Rows[0]["TermCode"].ToString();
                     SysTerm_model.TermCode = (int.Parse(Code) + 1).ToString("00");
                 }
                 else
                 {
                     SysTerm_model.TermCode = "01";
                 }
                 if (SysTerm_bll.Add(SysTerm_model) != 0)
                 {
                     rsp.code = "success";
                     rsp.msg  = "添加成功";
                 }
             }
         }
         catch (Exception ex)
         {
             rsp.code = "error";
             rsp.msg  = ex.Message;
         }
     }
     return(rsp);
 }
Exemplo n.º 3
0
        public static Com.DataPack.DataRsp <string> page(string PageIndex, string PageSize)
        {
            Com.DataPack.DataRsp <string> rsp = new Com.DataPack.DataRsp <string>();
            if (Com.Session.userid == null)
            {
                rsp.code = "expire";
                rsp.msg  = "页面已经过期,请重新登录";
            }
            else
            {
                try
                {
                    SchSystem.BLL.SysTerm systerm = new SchSystem.BLL.SysTerm();
                    string strwhere = " ";

                    Com.Public.PageModelResp pages = new Com.Public.PageModelResp();
                    pages.PageIndex = int.Parse(PageIndex);
                    pages.PageSize  = int.Parse(PageSize);
                    int rowc = 0;
                    int pc   = 0;

                    DataTable dt = systerm.GetListCols("AutoId,TermCode,TermName", strwhere, "TermCode", "ASC", pages.PageIndex, pages.PageSize, ref rowc, ref pc).Tables[0];
                    pages.PageCount = pc;
                    pages.RowCount  = rowc;
                    if (dt.Rows.Count > 0)
                    {
                        pages.list = dt;
                    }
                    rsp.data = Newtonsoft.Json.JsonConvert.SerializeObject(pages);
                }
                catch (Exception ex)
                {
                    rsp.code = "error";
                    rsp.msg  = ex.Message;
                }
            }
            return(rsp);
        }