public int Update(OABooksApply model) { StringBuilder builder = new StringBuilder(); builder.Append("update OA_Books_Apply set "); builder.Append("IsExist='" + model.IsExist + "',"); builder.Append("ClassID='" + model.ClassID + "',"); builder.Append("ISBN='" + model.ISBN + "',"); builder.Append("BookTitle='" + model.BookTitle + "',"); builder.Append("PublishingHouse='" + model.PublishingHouse + "',"); builder.Append("Author='" + model.Author + "',"); builder.Append("Copy=" + model.Copy + ","); builder.Append("Price=" + model.Price + ","); builder.Append("IsInStorage='" + model.IsInStorage + "'"); builder.Append(" where ApplyID='" + model.ApplyID + "'"); builder.Append(" and ISBN='" + model.ISBN + "'"); return(publicDbOpClass.ExecSqlString(builder.ToString())); }
public OABooksApply GetModel(Guid ApplyID) { StringBuilder builder = new StringBuilder(); builder.Append("select * "); builder.Append(" ApplyID,ISBN,IsExist,ClassID,BookTitle,PublishingHouse,Author,Copy,Price,IsInStorage "); builder.Append(" from OA_Books_Apply "); builder.Append(" where ApplyID=" + ApplyID); OABooksApply apply = new OABooksApply(); DataSet set = publicDbOpClass.DataSetQuary(builder.ToString()); if (set.Tables[0].Rows.Count <= 0) { return(null); } if (set.Tables[0].Rows[0]["ApplyID"].ToString() != "") { apply.ApplyID = new Guid(set.Tables[0].Rows[0]["ApplyID"].ToString()); } apply.ISBN = set.Tables[0].Rows[0]["ISBN"].ToString(); apply.IsExist = set.Tables[0].Rows[0]["IsExist"].ToString(); if (set.Tables[0].Rows[0]["ClassID"].ToString() != "") { apply.ClassID = int.Parse(set.Tables[0].Rows[0]["ClassID"].ToString()); } apply.BookTitle = set.Tables[0].Rows[0]["BookTitle"].ToString(); apply.PublishingHouse = set.Tables[0].Rows[0]["PublishingHouse"].ToString(); apply.Author = set.Tables[0].Rows[0]["Author"].ToString(); if (set.Tables[0].Rows[0]["Copy"].ToString() != "") { apply.Copy = int.Parse(set.Tables[0].Rows[0]["Copy"].ToString()); } if (set.Tables[0].Rows[0]["Price"].ToString() != "") { apply.Price = decimal.Parse(set.Tables[0].Rows[0]["Price"].ToString()); } apply.IsInStorage = set.Tables[0].Rows[0]["IsInStorage"].ToString(); return(apply); }
public int Add(OABooksApply model) { StringBuilder builder = new StringBuilder(); builder.Append(string.Concat(new object[] { " if not exists(select top 1 ISBN from OA_Books_Apply where ApplyID='", model.ApplyID, "' and ISBN='", model.ISBN, "') " })); builder.Append(" begin "); builder.Append(" insert into OA_Books_Apply( "); builder.Append(" ApplyID,ISBN,IsExist,ClassID,BookTitle,PublishingHouse,Author,Copy,Price,IsInStorage "); builder.Append(" ) "); builder.Append(" values ( "); builder.Append(" '" + model.ApplyID + "', "); builder.Append(" '" + model.ISBN + "', "); builder.Append(" '" + model.IsExist + "', "); builder.Append(" " + model.ClassID + ", "); builder.Append(" '" + model.BookTitle + "', "); builder.Append(" '" + model.PublishingHouse + "', "); builder.Append(" '" + model.Author + "', "); builder.Append(" " + model.Copy + ", "); builder.Append(" " + model.Price + ", "); builder.Append(" '" + model.IsInStorage + "' "); builder.Append(" ) "); builder.Append(" end "); return(publicDbOpClass.ExecSqlString(builder.ToString())); }