public ActionResult SubmitTypeForm(BookTypeEntity bookType, int?keyValue) { try { if (keyValue != null) { var bookTypeEntity = bookApp.GetTypeForm(keyValue.Value); bookTypeEntity.ParentID = bookType.ParentID; bookTypeEntity.Name = bookType.Name; bookTypeEntity.SortCode = bookType.SortCode; bookTypeEntity.EnabledMark = bookType.EnabledMark; bookTypeEntity.Remark = bookType.Remark; bookApp.SubmitTypeForm(bookTypeEntity, keyValue); } else { bookType.CreateTime = DateTime.Now; bookType.CreateMan = OperatorProvider.Provider.GetCurrent().UserName; bookApp.SubmitTypeForm(bookType); } return(Success("操作成功")); } catch (Exception ex) { return(Success("操作失败")); } }
private void BookSearch_Search() { BookInfoEntity infoEntity = new BookInfoEntity(); if (!string.IsNullOrWhiteSpace(Request["TypeId"])) { BookTypeBLL typeBLL = new BookTypeBLL(); BookTypeEntity typeEntity = typeBLL.lists(int.Parse(Request["TypeId"])); if (typeEntity == null) { infoEntity.TypeId = 0; } else if (typeEntity.ParentId != 0) { infoEntity.TypeId = int.Parse(Request["TypeId"]); } } if (!string.IsNullOrWhiteSpace(Request["ParentId"])) { infoEntity.SellCount = int.Parse(Request["ParentId"]); } if (!string.IsNullOrWhiteSpace(Request["BookName"])) { infoEntity.BookName = Request["BookName"]; } BookInfoBLL infoBLL = new BookInfoBLL(); int count = 0; List <BookInfoEntity> infolist = infoBLL.list(infoEntity, int.Parse(Request["Pageint"]), int.Parse(Request["Pagesize"]), out count); Response.Write(count + "_" + MyJson.ToJsJson(infolist)); Response.End(); }
public int Add(BookTypeEntity entity) { string sql = @"insert into BookType(TypeName,ParentId) values(@TypeName,@ParentId)"; db.PrepareSql(sql); db.SetParameter("TypeName", entity.TypeName); db.SetParameter("ParentId", entity.ParentId); return(db.ExecNonQuery()); }
public int Update(BookTypeEntity entity) { string sql = "Update BookType set TypeName=@TypeName,ParentId=@ParentId where TypeId=@TypeId"; db.PrepareSql(sql); db.SetParameter("TypeName", entity.TypeName); db.SetParameter("ParentId", entity.ParentId); db.SetParameter("TypeId", entity.TypeId); return(db.ExecNonQuery()); }
private void Book_Add() { BookTypeBLL typeBLL = new BookTypeBLL(); BookTypeEntity typeEntity = new BookTypeEntity(); typeEntity.ParentId = int.Parse(Request["ParentId"]); typeEntity.TypeName = Request["TypeName"]; Response.Write(typeBLL.Add(typeEntity)); Response.End(); }
private void bindate() { if (string.IsNullOrWhiteSpace(Request["TypeId"])) { return; } BookTypeBLL bookType = new BookTypeBLL(); BookTypeEntity typeEntity = bookType.lists(int.Parse(Request["TypeId"])); ViewState["txtName"] = typeEntity.TypeName; ViewState["ParentId"] = typeEntity.ParentId; ViewState["TypeId"] = typeEntity.TypeId; }
private void BookSearch_babaid() { int typid = int.Parse(Request["TypeId"]); BookTypeBLL typeBLL = new BookTypeBLL(); BookTypeEntity typeEntity = typeBLL.lists(typid); if (typeEntity == null) { Response.Write(0); } else { Response.Write(MyJson.ToJsJson(typeEntity)); } Response.End(); }
public List <BookTypeEntity> list(int id) { List <BookTypeEntity> list = new List <BookTypeEntity>(); string sql = "select * from BookType where ParentId=" + id; db.PrepareSql(sql); DataTable dt = db.ExecQuery(); foreach (DataRow item in dt.Rows) { BookTypeEntity entity = new BookTypeEntity(); entity.TypeId = int.Parse(item["TypeId"].ToString()); entity.TypeName = item["TypeName"].ToString(); entity.ParentId = int.Parse(item["ParentId"].ToString()); list.Add(entity); } return(list); }
public BookTypeEntity lists(int id) { string sql = "select * from BookType where TypeId=" + id; db.PrepareSql(sql); DataTable dt = db.ExecQuery(); if (dt.Rows.Count == 0) { return(null); } BookTypeEntity entity = new BookTypeEntity(); entity.TypeId = int.Parse(dt.Rows[0]["TypeId"].ToString()); entity.TypeName = dt.Rows[0]["TypeName"].ToString(); entity.ParentId = int.Parse(dt.Rows[0]["ParentId"].ToString()); return(entity); }
public void SubmitTypeForm(BookTypeEntity bookTypeEntity, int?keyValue = null) { try { if (keyValue == null) { type.Insert(bookTypeEntity); } else { bookTypeEntity.ID = keyValue.Value; type.Update(bookTypeEntity); } } catch (Exception ex) { throw; } }
private void BookSearch_binzije() { int typid = int.Parse(Request["TypeId"]); BookTypeBLL typeBLL = new BookTypeBLL(); BookTypeEntity typeEntity = typeBLL.lists(typid); if (typeEntity == null) { Response.Write(MyJson.ToJsJson(typeBLL.list(0))); } else { if (typeEntity.ParentId == 0) { Response.Write(MyJson.ToJsJson(typeBLL.list(typeEntity.TypeId))); } else { Response.Write(MyJson.ToJsJson(typeBLL.list(typeEntity.ParentId))); } } Response.End(); }
public int Update(BookTypeEntity entity) { return(dal.Update(entity)); }
public int Add(BookTypeEntity entity) { return(dal.Add(entity)); }