/// <summary> /// 当物品新增时,在记录表中添加一条物品状态为“正常”的记录,用作统计功能 /// </summary> /// <param name="goods">物品对象</param> /// <param name="userid">录入人</param> /// <returns></returns> public string AddGoodsRecordWhenNewGoodsAdd(B_Goods goods, string userid) { var tran = Utility.Database.BeginDbTransaction(); B_GoodsStatusRecord goodsRecordInfor = new B_GoodsStatusRecord(); goodsRecordInfor.goodsId = goods.id;//物品Id goodsRecordInfor.recordDate = DateTime.Now.ToString();//录入时间 goodsRecordInfor.recordMan = userid;//录入人名称 goodsRecordInfor.originalGoodsStatus = goods.wpzt;//原来物品状态 goodsRecordInfor.originalProtectMan = goods.bgry;//原来保管人员 goodsRecordInfor.originalUseDepartment = goods.sybm;//原来使用部门 goodsRecordInfor.isDelete = 0; goodsRecordInfor.useDepartment = goods.sybm;//使用部门 goodsRecordInfor.goodsStatus = "1";//物品状态为正常状态 goodsRecordInfor.protectMan = goods.bgry;//保管人员 goodsRecordInfor.statusRemark = "新增记录";//备注 Utility.Database.Insert(goodsRecordInfor, tran); Utility.Database.Commit(tran); return Utility.JsonMsg(true, "保存数据成功"); }
public string DeleteGoodsRecord(string id, string userid) { //var tran = Utility.Database.BeginDbTransaction(); //StringBuilder strinBuilder = new StringBuilder(); //var userInfo = ComClass.GetUserInfo(userid); //try //{ // strinBuilder.AppendFormat("update B_GoodsStatusRecord set isDelete = 1,deleteMan='{0}',deleteDate='{1}' where id={2}", userid, DateTime.Now, id); // Utility.Database.ExecuteNonQuery(strinBuilder.ToString(), tran); // Utility.Database.Commit(tran); // return Utility.JsonMsg(true, "删除除数据成功"); //} //catch (Exception e) //{ // Utility.Database.Rollback(tran); // return Utility.JsonMsg(false, "删除除数据失败!异常信息: " + e.Message); //} var tran = Utility.Database.BeginDbTransaction(); try { StringBuilder strinBuilder = new StringBuilder(); B_GoodsStatusRecord goodsStatusRecord = new B_GoodsStatusRecord(); goodsStatusRecord.Condition.Add("id=" + id); Utility.Database.Delete(goodsStatusRecord); Utility.Database.Commit(tran); return Utility.JsonMsg(true, "删除除数据成功"); } catch (Exception e) { Utility.Database.Rollback(tran); return Utility.JsonMsg(false, "删除除数据失败!异常信息: " + e.Message); } }
public string GetB_GoodsStatusRecordModel(string content) { B_GoodsStatusRecord model = new B_GoodsStatusRecord(); List<B_GoodsStatusRecord> list = new List<B_GoodsStatusRecord>(); list.Add(model); return JsonConvert.SerializeObject( list); }
public string GetData(string content) { GetDataModel model = new GetDataModel(); B_Goods goodsEnt = new B_Goods(); B_GoodsStatusRecord goodStatusRecordEnt = new B_GoodsStatusRecord(); model.dataEdit = Utility.Database.QueryObject<B_Goods>(goodsEnt); model.dataGoodsStatusRecordEdit = Utility.Database.QueryObject<B_GoodsStatusRecord>(goodStatusRecordEnt); return JsonConvert.SerializeObject( model); }
/// <summary> /// 通过物品id删除物品记录 /// </summary> /// <param name="id">物品ID</param> public void DeleteGoodsRecordListByGoodsId(string id) { B_GoodsStatusRecord goodsReocrd = new B_GoodsStatusRecord(); var tran = Utility.Database.BeginDbTransaction(); goodsReocrd.Condition.Add("goodsId="+id); Utility.Database.Delete(goodsReocrd); Utility.Database.Commit(tran); }