/// <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);
        }
예제 #2
0
        public ServiceResponseData SavePromotionProjectDetail()
        {
            ME_PromotionProjectDetail detailEntity = requestData.GetData <ME_PromotionProjectDetail>(0);
            int res = NewObject <PromotionProjectManagement>().SavePromotionProjectDetail(detailEntity);

            responseData.AddData <int>(res);
            return(responseData);
        }
        public int SavePromotionProjectDetail(ME_PromotionProjectDetail detailEntity)
        {
            detailEntity.OperateID = LoginUserInfo.UserId;

            Action <ClientRequestData> requestAction = ((ClientRequestData request) =>
            {
                request.AddData(detailEntity);
            });
            ServiceResponseData retdata = InvokeWcfService("OPProject.Service", "PromotionProjectController", "SavePromotionProjectDetail", requestAction);
            int res = retdata.GetData <int>(0);

            return(res);
        }
        /// <summary>
        /// 构造方案明细类
        /// </summary>
        /// <param name="promSunID">方案明细id</param>
        /// <returns>方案明细类</returns>
        private ME_PromotionProjectDetail BuildPromotionProjectDetail(int promSunID)
        {
            ME_PromotionProjectDetail detailEntity = new ME_PromotionProjectDetail();

            detailEntity.PromSunID   = promSunID;
            detailEntity.PromID      = PromID;
            detailEntity.CardTypeID  = Convert.ToInt16(cbbCardType.SelectedValue);
            detailEntity.PatientType = Convert.ToInt16(cbbPatType.SelectedValue);
            detailEntity.CostType    = Convert.ToInt16(cbbFeeType.SelectedValue);

            switch (stiDetail.SelectedPanel.Name)
            {
            case "stpTotal":
                detailEntity.PromTypeID     = 1;  //总额优惠
                detailEntity.PromBase       = intBase.Value;
                detailEntity.Prom           = Convert.ToInt16(cbbDiscount.SelectedValue);
                detailEntity.DiscountNumber = intDiscount.Value;
                detailEntity.PromClass      = 0;
                detailEntity.PromPro        = 0;
                break;

            case "stpClass":
                detailEntity.PromTypeID     = 2;  //分类优惠
                detailEntity.Prom           = Convert.ToInt16(cbbDiscountForClass.SelectedValue);
                detailEntity.PromClass      = Convert.ToInt16(cbbClass.SelectedValue);
                detailEntity.DiscountNumber = intDiscountForClass.Value;
                detailEntity.PromPro        = 0;
                break;

            case "stpItem":
                detailEntity.PromTypeID     = 3;  //项目优惠  intDiscountForItem
                detailEntity.Prom           = Convert.ToInt16(cbbDiscountForItem.SelectedValue);
                detailEntity.PromPro        = Convert.ToInt32(((DataRow)tbcItem.SelectedValue).ItemArray[0]);
                detailEntity.DiscountNumber = intDiscountForItem.Value;
                detailEntity.PromClass      = 0;
                break;
            }

            detailEntity.UseFlag     = 1;
            detailEntity.OperateDate = DateTime.Now;
            return(detailEntity);
        }
 /// <summary>
 /// 保存方案明细数据
 /// </summary>
 /// <param name="detailEntity">明细信息</param>
 /// <returns>1成功</returns>
 public int SavePromotionProjectDetail(ME_PromotionProjectDetail detailEntity)
 {
     this.BindDb(detailEntity);
     return(detailEntity.save());
 }