private void GetBookCatalog(HttpContext context) { Edu_BookCatalogService CatalogBll = new Edu_BookCatalogService(); try { Hashtable ht = new Hashtable(); ht.Add("PageIndex", context.Request["PageIndex"].SafeToString()); ht.Add("PageSize", context.Request["PageSize"].SafeToString()); ht.Add("BookID", context.Request["BookID"].SafeToString()); ht.Add("Pid", context.Request["Pid"].SafeToString()); ht.Add("Name", context.Request["Name"].SafeToString()); bool Ispage = true; if (context.Request["Ispage"].SafeToString().Length > 0) { Ispage = Convert.ToBoolean(context.Request["Ispage"]); } jsonModel = CatalogBll.GetPage(ht, Ispage); } catch (Exception ex) { jsonModel = new JsonModel() { errNum = 400, errMsg = ex.Message, retData = "" }; LogService.WriteErrorLog(ex.Message); } }
private void EditCatalog(HttpContext context) { Edu_BookCatalogService CatalogBll = new Edu_BookCatalogService(); try { Edu_BookCatalog entity = new Edu_BookCatalog(); string ID = ""; if (!string.IsNullOrWhiteSpace(context.Request["Id"])) { ID = context.Request["Id"].ToString(); } jsonModel = CatalogBll.GetEntityById(Convert.ToInt32(ID)); entity = (Edu_BookCatalog)(jsonModel.retData); entity.Name = context.Request["Name"].SafeToString(); jsonModel = CatalogBll.Update(entity); } catch (Exception ex) { jsonModel = new JsonModel() { errNum = 400, errMsg = ex.Message, retData = "" }; LogService.WriteErrorLog(ex.Message); } }
private void DelCatalog(HttpContext context) { Edu_BookCatalogService CatalogBll = new Edu_BookCatalogService(); try { jsonModel = CatalogBll.Delete(Convert.ToInt32(context.Request["ID"])); } catch (Exception ex) { jsonModel = new JsonModel() { errNum = 400, errMsg = ex.Message, retData = "" }; LogService.WriteErrorLog(ex.Message); } }
private void AddCatalog(HttpContext context) { Edu_BookCatalogService CatalogBll = new Edu_BookCatalogService(); try { Edu_BookCatalog entity = new Edu_BookCatalog(); entity.BookID = Convert.ToInt32(context.Request["BookID"]); entity.Name = context.Request["Name"].SafeToString(); entity.Pid = Convert.ToInt32(context.Request["Pid"]); jsonModel = CatalogBll.Add(entity); } catch (Exception ex) { jsonModel = new JsonModel() { errNum = 400, errMsg = ex.Message, retData = "" }; LogService.WriteErrorLog(ex.Message); } }