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.SysFasc bll = new SchSystem.BLL.SysFasc(); SchSystem.Model.SysFasc model = bll.GetModel(int.Parse(id)); if (model != null && model.AutoId > 0) { code = model.FascCode; name = model.FascName; stat = model.Stat.ToString(); } else { Response.Write("无该名称!"); Response.End(); } } else//不在添加及修改之内,则返回 { } }
public static Com.DataPack.DataRsp <string> save(string Name, string stat, 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.SysFasc SysFasc_bll = new SchSystem.BLL.SysFasc(); SchSystem.Model.SysFasc SysFasc_model = new SchSystem.Model.SysFasc(); SysFasc_model.FascName = Com.Public.SqlEncStr(Name).ToString(); SysFasc_model.Stat = Convert.ToInt32(Com.Public.SqlEncStr(stat)); if (AutoId != "") { SysFasc_model.AutoId = Convert.ToInt32(AutoId); if (SysFasc_bll.Update(SysFasc_model)) { rsp.code = "success"; rsp.msg = "修改成功"; } } else { DataTable dt = SysFasc_bll.GetList("top 1 FascCode", " 1=1 order by FascCode DESC").Tables[0]; if (dt != null && dt.Rows.Count > 0) { string Code = dt.Rows[0]["FascCode"].ToString(); SysFasc_model.FascCode = (int.Parse(Code) + 1).ToString("00"); } else { SysFasc_model.FascCode = "01"; } if (SysFasc_bll.Add(SysFasc_model) != 0) { rsp.code = "success"; rsp.msg = "添加成功"; } } } catch (Exception ex) { rsp.code = "error"; rsp.msg = ex.Message; } } return(rsp); }
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.SysFasc sysfasc = new SchSystem.BLL.SysFasc(); string strwhere = "Stat<2 "; 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 = sysfasc.GetListCols("AutoId,FascName,FascCode,Stat", strwhere, "FascCode", "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); }