public ActionResult NEdit(DBA.Model.RRecord model) { DBA.Model.RRecord model2 = bll.GetModel(model.ID); model2.Str5 = "审核未通过"; bll.Update(model2); return(RedirectToAction("RRecordManage")); }
public JsonResult DelYJ(string ID) { DBA.Model.RRecord model2 = bll.GetModel(Convert.ToInt32(ID)); model2.Str5 = "已处理"; bll.Update(model2); return(Json(true)); }
public DBA.Model.RRecord CountDataRowToModel(DataRow row) { DBA.Model.RRecord model = new DBA.Model.RRecord(); if (row != null) { if (row["ISBN"] != null) { model.ISBN = row["ISBN"].ToString(); } if (row["BookName"] != null) { model.BookName = row["BookName"].ToString(); } if (row["SumNum"] != null) { model.SumNum = row["SumNum"].ToString(); } if (row["SinglePrice"] != null) { model.SinglePrice = row["SinglePrice"].ToString(); } if (row["SumPrice"] != null) { model.SumPrice = row["SumPrice"].ToString(); } } return(model); }
public ActionResult SCreate(string ID) { List <SelectListItem> select1 = new List <SelectListItem>(); select1.Add(new SelectListItem { Text = "请选择", Value = "" }); List <DBA.Model.Category> list = cbll.GetModelList(" Str1='2'"); for (int i = 0; i < list.Count; i++) { select1.Add(new SelectListItem { Text = list[i].CategoryName, Value = list[i].ID.ToString() }); } ; ViewData["CKID"] = new SelectList(select1, "Value", "Text", ""); List <SelectListItem> select2 = new List <SelectListItem>(); select2.Add(new SelectListItem { Text = "请选择", Value = "" }); List <DBA.Model.Category> list2 = cbll.GetModelList(" Str1='3'"); for (int i = 0; i < list2.Count; i++) { select2.Add(new SelectListItem { Text = list2[i].CategoryName, Value = list2[i].ID.ToString() }); } ; ViewData["GHSID"] = new SelectList(select2, "Value", "Text", ""); if (string.IsNullOrEmpty(ID)) { DBA.Model.RRecord model = new DBA.Model.RRecord(); model.CreateUserName = DBA.BLL.Users.GetNowUserName(); return(View(model)); } else { return(View(bll.GetModel(Convert.ToInt32(ID)))); } }
/// <summary> /// 增加一条数据 /// </summary> public int Add(DBA.Model.RRecord model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into RRecord("); strSql.Append("CreateUserName,Time,BookID,ISBN,BookName,CategoryID,Str1,Str2,CKID,GG,GHSID,Str4,Str5,DW)"); strSql.Append(" values ("); strSql.Append("@CreateUserName,@Time,@BookID,@ISBN,@BookName,@CategoryID,@Str1,@Str2,@CKID,@GG,@GHSID,@Str4,@Str5,@DW)"); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@CreateUserName", SqlDbType.NChar, 10), new SqlParameter("@Time", SqlDbType.DateTime), new SqlParameter("@BookID", SqlDbType.Int, 4), new SqlParameter("@ISBN", SqlDbType.NChar, 30), new SqlParameter("@BookName", SqlDbType.NChar, 10), new SqlParameter("@CategoryID", SqlDbType.Int, 4), new SqlParameter("@Str1", SqlDbType.NChar, 10), new SqlParameter("@Str2", SqlDbType.NChar, 10), new SqlParameter("@CKID", SqlDbType.NVarChar, 200), new SqlParameter("@GG", SqlDbType.NVarChar, 200), new SqlParameter("@GHSID", SqlDbType.NVarChar, 200), new SqlParameter("@Str4", SqlDbType.NVarChar, 200), new SqlParameter("@Str5", SqlDbType.NVarChar, 200), new SqlParameter("@DW", SqlDbType.NVarChar, 200) }; parameters[0].Value = model.CreateUserName; parameters[1].Value = model.Time; parameters[2].Value = model.BookID; parameters[3].Value = model.ISBN; parameters[4].Value = model.BookName; parameters[5].Value = model.CategoryID; parameters[6].Value = model.Str1; parameters[7].Value = model.Str2; parameters[8].Value = model.CKID; parameters[9].Value = model.GG; parameters[10].Value = model.GHSID; parameters[11].Value = model.Str4; parameters[12].Value = model.Str5; parameters[13].Value = model.DW; object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters); if (obj == null) { return(0); } else { return(Convert.ToInt32(obj)); } }
public ActionResult Edit(DBA.Model.RRecord model) { model.Time = DateTime.Now; DBA.Model.Goods Goods = bbll.GetModel(model.BookID); //model.CategoryID = Goods.CategoryID; //if (Goods.GoodsKC == null) //{ // Goods.GoodsKC = 0; //} //Goods.GoodsKC = Goods.GoodsKC + Convert.ToInt32(model.Str1); //bbll.Update(Goods); bll.Edit(model); return(RedirectToAction("RRecordManage")); }
public ActionResult YEdit(DBA.Model.RRecord model) { DBA.Model.Goods Goods = bbll.GetModelList(" ISBN='" + model.ISBN + "'").FirstOrDefault(); if (Goods.GoodsKC == null) { Goods.GoodsKC = 0; } Goods.GoodsKC = Goods.GoodsKC + Convert.ToInt32(model.Str1); Goods.GoodsKey = model.Str2; bbll.Update(Goods); DBA.Model.RRecord model2 = bll.GetModel(model.ID); model2.Str5 = "已批准"; bll.Update(model2); return(RedirectToAction("RRecordManage")); }
/// <summary> /// 得到一个对象实体 /// </summary> public DBA.Model.RRecord GetModel(int ID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 ID,CreateUserName,Time,BookID,ISBN,BookName,CategoryID,Str1,Str2,CKID,GG,GHSID,Str4,Str5,DW,isReject from RRecord "); strSql.Append(" where ID=@ID"); SqlParameter[] parameters = { new SqlParameter("@ID", SqlDbType.Int, 4) }; parameters[0].Value = ID; DBA.Model.RRecord model = new DBA.Model.RRecord(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
/// <summary> /// 得到一个对象实体 /// </summary> public DBA.Model.RRecord DataRowToModel(DataRow row) { DBA.Model.RRecord model = new DBA.Model.RRecord(); if (row != null) { if (row["ID"] != null && row["ID"].ToString() != "") { model.ID = int.Parse(row["ID"].ToString()); } if (row["CreateUserName"] != null) { model.CreateUserName = row["CreateUserName"].ToString(); } if (row["Time"] != null && row["Time"].ToString() != "") { model.Time = DateTime.Parse(row["Time"].ToString()); } if (row["BookID"] != null && row["BookID"].ToString() != "") { model.BookID = int.Parse(row["BookID"].ToString()); } if (row["ISBN"] != null) { model.ISBN = row["ISBN"].ToString(); } if (row["BookName"] != null) { model.BookName = row["BookName"].ToString(); } if (row["CategoryID"] != null && row["CategoryID"].ToString() != "") { model.CategoryID = int.Parse(row["CategoryID"].ToString()); } if (row["Str1"] != null) { model.Str1 = row["Str1"].ToString(); } if (row["Str2"] != null) { model.Str2 = row["Str2"].ToString(); } if (row["CKID"] != null) { model.CKID = row["CKID"].ToString(); } if (row["GG"] != null) { model.GG = row["GG"].ToString(); } if (row["GHSID"] != null) { model.GHSID = row["GHSID"].ToString(); } if (row["Str4"] != null) { model.Str4 = row["Str4"].ToString(); } if (row["Str5"] != null) { model.Str5 = row["Str5"].ToString(); } if (row["DW"] != null) { model.DW = row["DW"].ToString(); } if (row["IsReject"] != null) { model.IsReject = row["IsReject"].ToString(); } } return(model); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(DBA.Model.RRecord model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update RRecord set "); strSql.Append("CreateUserName=@CreateUserName,"); strSql.Append("Time=@Time,"); strSql.Append("BookID=@BookID,"); strSql.Append("ISBN=@ISBN,"); strSql.Append("BookName=@BookName,"); strSql.Append("CategoryID=@CategoryID,"); strSql.Append("Str1=@Str1,"); strSql.Append("Str2=@Str2,"); strSql.Append("CKID=@CKID,"); strSql.Append("GG=@GG,"); strSql.Append("GHSID=@GHSID,"); strSql.Append("Str4=@Str4,"); strSql.Append("Str5=@Str5,"); strSql.Append("DW=@DW"); strSql.Append(" where ID=@ID"); SqlParameter[] parameters = { new SqlParameter("@CreateUserName", SqlDbType.NChar, 10), new SqlParameter("@Time", SqlDbType.DateTime), new SqlParameter("@BookID", SqlDbType.Int, 4), new SqlParameter("@ISBN", SqlDbType.NChar, 30), new SqlParameter("@BookName", SqlDbType.NChar, 10), new SqlParameter("@CategoryID", SqlDbType.Int, 4), new SqlParameter("@Str1", SqlDbType.NChar, 10), new SqlParameter("@Str2", SqlDbType.NChar, 10), new SqlParameter("@CKID", SqlDbType.NVarChar, 200), new SqlParameter("@GG", SqlDbType.NVarChar, 200), new SqlParameter("@GHSID", SqlDbType.NVarChar, 200), new SqlParameter("@Str4", SqlDbType.NVarChar, 200), new SqlParameter("@Str5", SqlDbType.NVarChar, 200), new SqlParameter("@DW", SqlDbType.NVarChar, 200), new SqlParameter("@ID", SqlDbType.Int, 4) }; parameters[0].Value = model.CreateUserName; parameters[1].Value = model.Time; parameters[2].Value = model.BookID; parameters[3].Value = model.ISBN; parameters[4].Value = model.BookName; parameters[5].Value = model.CategoryID; parameters[6].Value = model.Str1; parameters[7].Value = model.Str2; parameters[8].Value = model.CKID; parameters[9].Value = model.GG; parameters[10].Value = model.GHSID; parameters[11].Value = model.Str4; parameters[12].Value = model.Str5; parameters[13].Value = model.DW; parameters[14].Value = model.ID; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }