/// <summary> /// 获取学期列表数据 分页 /// </summary> /// <param name="Mod">查询条件</param> /// <param name="pageIndex">当前页</param> /// <param name="pageSize">页容量,每页显示条数</param> /// <returns></returns> public EmsModel.JsonModel GetJsonModel(EmsModel.LearnYear Mod, int pageIndex, int pageSize) { List <EmsModel.LearnYear> modList = dal.GetListByPageAndSear(Mod, ((pageIndex - 1) * pageSize) + 1, (pageIndex * pageSize)); //定义分页数据实体 PagedDataModel <EmsModel.LearnYear> pagedDataModel = null; //定义JSON标准格式实体中 JsonModel jsonModel = null; if (modList.Count > 0) { var list = modList; //总条数 int rowCount = dal.GetListByPageCountAndSear(Mod); //总页数 int pageCount = (int)Math.Ceiling(rowCount * 1.0 / pageSize); //将数据封装到PagedDataModel分页数据实体中 pagedDataModel = new PagedDataModel <EmsModel.LearnYear>() { PageCount = pageCount, PagedData = list, PageIndex = pageIndex, PageSize = pageSize, RowCount = rowCount }; //将分页数据实体封装到JSON标准实体中 jsonModel = new JsonModel() { Data = pagedDataModel, Msg = "成功", Status = "ok", BackUrl = "" }; return(jsonModel); } else { jsonModel = new JsonModel() { Status = "no", Msg = "失败" }; return(jsonModel); } }
/// <summary> /// 修改 /// </summary> /// <param name="ht"></param> /// <returns></returns> public JsonModel Update(Hashtable ht) { try { EmsModel.LearnYear Model = dal.GetModelList(ht)[0]; Model.Name = ht["Name"].ToString(); //学期名称 Model.StartDate = Convert.ToDateTime(ht["StartDate"].ToString()); //开学时间 Model.EndDate = Convert.ToDateTime(ht["EndDate"].ToString()); //结束时间 Model.DataCollectionTime = Convert.ToByte(ht["DataCollectionTime"].ToString()); //数据采集时间 //Model.Creator = ht["Creator"].ToString();//创建人 //Model.CreateTime = Convert.ToDateTime(ht["CreateTime"].ToString());//创建时间 Model.Editor = ht["Editor"].ToString(); //修改人 Model.UpdateTime = DateTime.Now; //修改时间 Model.Remarks = ht["Remarks"].ToString(); //备注 //Model.IsDelete = 0;//是否删除 int result = dal.Update(Model); //定义JSON标准格式实体中 JsonModel jsonModel = new JsonModel(); if (result > 0) { jsonModel.Status = "ok"; jsonModel.Msg = "修改成功"; } else { jsonModel.Status = "no"; jsonModel.Msg = "修改失败"; } return(jsonModel); } catch (Exception ex) { JsonModel jsonModel = new JsonModel(); jsonModel.Status = "error"; jsonModel.Msg = ex.ToString(); return(jsonModel); } }