/// <summary> /// 获取商品编码并更新数据库最新单据值 /// </summary> /// <returns></returns> public string GoodsCode(SqlTransaction Tran) { List <Hi.Model.SYS_SysCode> l = new Hi.BLL.SYS_SysCode().GetList("top 1 *", "isnull(dr,0)=0 and compId=" + this.CompID + " and codeName='P" + this.CompID + "'", " codevalue desc", Tran); if (l.Count > 0) { l[0].CodeValue = (l[0].CodeValue.ToInt(0) + 1).ToString(); l[0].ts = DateTime.Now; l[0].modifyuser = this.UserID; new Hi.BLL.SYS_SysCode().Update(l[0], Tran); return(l[0].CodeName + l[0].CodeValue.PadLeft(6, '0')); } else { Hi.Model.SYS_SysCode model5 = new Hi.Model.SYS_SysCode(); model5.CompID = this.CompID; model5.CodeName = "P" + this.CompID; model5.CodeValue = "1"; model5.ts = DateTime.Now; model5.dr = 0; model5.modifyuser = this.UserID; new Hi.BLL.SYS_SysCode().Add(model5, Tran); return("P" + this.CompID + "1".PadLeft(6, '0')); } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Hi.Model.SYS_SysCode model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(Hi.Model.SYS_SysCode model) { return(dal.Add(model)); }