Пример #1
0
        /// <summary>
        /// Insert into XMDeductionSetUp
        /// </summary>
        /// <param name="xmdeductionsetup">XMDeductionSetUp</param>
        public void InsertXMDeductionSetUp(XMDeductionSetUp xmdeductionsetup)
        {
            if (xmdeductionsetup == null)
            {
                return;
            }

            if (!this._context.IsAttached(xmdeductionsetup))
            {
                this._context.XMDeductionSetUps.AddObject(xmdeductionsetup);
            }

            this._context.SaveChanges();
        }
Пример #2
0
        /// <summary>
        /// Update into XMDeductionSetUp
        /// </summary>
        /// <param name="xmdeductionsetup">XMDeductionSetUp</param>
        public void UpdateXMDeductionSetUp(XMDeductionSetUp xmdeductionsetup)
        {
            if (xmdeductionsetup == null)
            {
                return;
            }

            if (this._context.IsAttached(xmdeductionsetup))
            {
                this._context.XMDeductionSetUps.Attach(xmdeductionsetup);
            }

            this._context.SaveChanges();
        }
Пример #3
0
        /// <summary>
        /// Insert into XMPremiums
        /// </summary>
        /// <param name="OrderCode">订单号</param>
        /// <param name="WantId">旺旺号</param>
        /// <param name="ActivityExplanation">活动说明</param>
        public int InsertXMPremiums(string OrderCode, string WantId, int PremiumsTypeId, string ActivityExplanation, bool paramIsEvaluation, decimal price, int platformTypeID, int nickID)
        {
            var XMDeductionSetUpService  = IoC.Resolve <IXMDeductionSetUpService>();
            var XMPremiumsDetailsService = IoC.Resolve <IXMPremiumsDetailsService>();
            var XMNickService            = IoC.Resolve <IXMNickService>();
            XMDeductionSetUp  entity     = null;
            List <XMPremiums> CBAList    = GetXMPremiumsListByOrderCode(OrderCode, PremiumsTypeId);

            XMPremiums xMPremiums = new XMPremiums();
            int        UserId     = 0;

            if (HozestERPContext.Current.User != null)
            {
                UserId = HozestERPContext.Current.User.CustomerID;
            }
            else
            {
                string          UserName = "******";
                List <Customer> customer = IoC.Resolve <ICustomerService>().GetCustomerByUsernameList(UserName);

                if (customer.Count > 0)
                {
                    UserId = customer[0].CustomerID;
                }
            }
            if (CBAList.Count > 0)
            {
                xMPremiums = CBAList[0];

                xMPremiums.OrderCode           = OrderCode;
                xMPremiums.WantId              = WantId;
                xMPremiums.ActivityExplanation = ActivityExplanation;
                xMPremiums.UpdatorID           = UserId;//HozestERPContext.Current.User.CustomerID;
                xMPremiums.UpdateTime          = DateTime.Now;
                xMPremiums.IsEvaluation        = paramIsEvaluation;
                UpdateXMPremiums(xMPremiums);
            }
            else
            {
                //财务未审核
                bool FinanceIsAudit = false;
                //项目未审核
                int ManagerStatus = 3;

                var xmNick = XMNickService.GetXMNickByID(nickID);
                if (xmNick != null)
                {
                    entity = XMDeductionSetUpService.GetXMDeductionSetUpByProjectAndPlatformTypeId((int)xmNick.ProjectId, 476, platformTypeID);
                }

                if (entity != null && price != 0)
                {
                    //根据项目限额,平台限额,自动设置审核进度
                    if (price <= entity.Deduction)
                    {
                        FinanceIsAudit = true;
                        //项目审核
                        ManagerStatus = 4;
                    }
                    else if (price > entity.Deduction && price <= entity.Finance)
                    {
                        FinanceIsAudit = true;
                    }
                }
                else if (entity == null && price != 0)
                {
                    //通用
                    var XMDeductionSetUpUsually = XMDeductionSetUpService.GetXMDeductionSetUpByProjectAndPlatformTypeId((int)xmNick.ProjectId, 476, 508);
                    if (XMDeductionSetUpUsually != null)
                    {
                        //根据项目限额,平台限额,自动设置审核进度
                        if (price <= XMDeductionSetUpUsually.Deduction)
                        {
                            FinanceIsAudit = true;
                            //项目审核
                            ManagerStatus = 4;
                        }
                        else if (price > XMDeductionSetUpUsually.Deduction && price <= XMDeductionSetUpUsually.Finance)
                        {
                            FinanceIsAudit = true;
                        }
                    }
                }

                xMPremiums.OrderCode           = OrderCode;
                xMPremiums.WantId              = WantId;
                xMPremiums.PremiumsStatus      = Convert.ToInt32(StatusEnum.PremiumsNoHair);
                xMPremiums.PremiumsTypeId      = PremiumsTypeId;//赠品状态
                xMPremiums.ActivityExplanation = ActivityExplanation;
                xMPremiums.FinanceIsAudit      = FinanceIsAudit;
                xMPremiums.ManagerStatus       = ManagerStatus;
                //xMPremiums.ManagerStatus = Convert.ToInt32(StatusEnum.NotCheck);
                //xMPremiums.DirectorStatus = Convert.ToInt32(StatusEnum.NotCheck);
                xMPremiums.IsSingleRow  = false;
                xMPremiums.IsEnable     = false;
                xMPremiums.IsEvaluation = paramIsEvaluation;
                xMPremiums.CreatorID    = UserId; // HozestERPContext.Current.User.CustomerID;
                xMPremiums.CreateTime   = DateTime.Now;
                xMPremiums.UpdatorID    = UserId; // HozestERPContext.Current.User.CustomerID;
                xMPremiums.UpdateTime   = DateTime.Now;
                InsertXMPremiums(xMPremiums);
            }
            return(xMPremiums.Id);
        }