/// <summary> /// 复制优惠方案 /// </summary> /// <param name="promID">方案id</param> /// <param name="operateID">操作人id</param> /// <returns>1成功</returns> public int CopypPromotionProject(int promID, int operateID) { int resFlag = 0; //获取方案主表信息 DataTable dtHead = NewObject <IOPPromotionProject>().GetPromotionProject(promID); ME_PromotionProjectHead headEntity = new ME_PromotionProjectHead(); headEntity = ConvertExtend.ToObject <ME_PromotionProjectHead>(dtHead, 0); Random rd = new Random(); headEntity.PromName = headEntity.PromName + "-复制" + rd.Next(1, 999); headEntity.UseFlag = 0; headEntity.PromID = 0; headEntity.OperateDate = DateTime.Now; headEntity.OperateID = operateID; this.BindDb(headEntity); resFlag = headEntity.save(); //保存主表,获取ID //获取明细表信息 DataTable dtDetail = NewObject <IOPPromotionProject>().GetPromotionProjectDetail(promID); for (int i = 0; i < dtDetail.Rows.Count; i++) { ME_PromotionProjectDetail detailEntity = new ME_PromotionProjectDetail(); detailEntity = ConvertExtend.ToObject <ME_PromotionProjectDetail>(dtDetail, i); detailEntity.PromSunID = 0; detailEntity.PromID = headEntity.PromID; detailEntity.OperateDate = DateTime.Now; detailEntity.OperateID = operateID; this.BindDb(detailEntity); resFlag = detailEntity.save(); } return(resFlag); }
/// <summary> /// 保存头表信息 /// </summary> /// <param name="headEntity">头信息</param> /// <returns>1成功</returns> public int SaveHeadInfo(ME_PromotionProjectHead headEntity) { this.BindDb(headEntity); return(headEntity.save()); }