示例#1
0
        /// <summary>
        /// Insert into XMCashBackApplication
        /// </summary>
        /// <param name="xmcashbackapplication">XMCashBackApplication</param>
        public void InsertXMCashBackApplication(XMCashBackApplication xmcashbackapplication)
        {
            if (xmcashbackapplication == null)
            {
                return;
            }

            if (!this._context.IsAttached(xmcashbackapplication))
            {
                this._context.XMCashBackApplications.AddObject(xmcashbackapplication);
            }

            this._context.SaveChanges();
        }
示例#2
0
        /// <summary>
        /// Update into XMCashBackApplication
        /// </summary>
        /// <param name="xmcashbackapplication">XMCashBackApplication</param>
        public void UpdateXMCashBackApplication(XMCashBackApplication xmcashbackapplication)
        {
            if (xmcashbackapplication == null)
            {
                return;
            }

            if (this._context.IsAttached(xmcashbackapplication))
            {
                this._context.XMCashBackApplications.Attach(xmcashbackapplication);
            }

            this._context.SaveChanges();
        }
示例#3
0
        /// <summary>
        /// 新增
        /// </summary>
        /// <param name="OrderCode">订单号</param>
        /// <param name="WantNo">旺旺号</param>
        /// <param name="BuyerName">姓名</param>
        /// <param name="CashBackMoney">金额</param>
        /// <param name="BuyerAlipayNo">收款账号</param>
        /// <param name="ApplicationTypeId">申请类型:返现、赔付</param>
        /// <param name="Dmoney">返现设置—金额(小于不需要运营审核,大于需运营审核)</param>
        /// <param name="Finance">财务限额</param>
        public int InsertXMCashBackApplication(string OrderCode, string WantNo, string BuyerName, decimal CashBackMoney, string BuyerAlipayNo, int ApplicationTypeId, decimal Dmoney, decimal Finance)
        {
            int inst = 0;//返回操作结果
            List <XMCashBackApplication> CBAList  = GetXMCashBackApplicationByOrderCode(OrderCode, ApplicationTypeId);
            List <XMCashBackApplication> CBAList2 = CBAList.Where(p => p.ManagerStatus.Value == 3 && p.CashBackStatus.Value == 0).ToList();
            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 (CBAList2.Count > 0)
            {
                XMCashBackApplication xmcashbackapplicationNew = new XMCashBackApplication();

                xmcashbackapplicationNew = CBAList[0];

                xmcashbackapplicationNew.ApplicationTypeId = ApplicationTypeId;
                xmcashbackapplicationNew.OrderCode         = OrderCode;
                xmcashbackapplicationNew.WantNo            = WantNo;
                xmcashbackapplicationNew.BuyerName         = BuyerName;
                //判断 返现金额 小于项目限额,财务限额,自动审核
                if (CashBackMoney <= Dmoney)
                {
                    xmcashbackapplicationNew.ManagerStatus  = Convert.ToInt32(StatusEnum.AlreadyCheck);
                    xmcashbackapplicationNew.FinanceIsAudit = true;
                    xmcashbackapplicationNew.ManagerPeople  = UserId;// HozestERPContext.Current.User.CustomerID;
                    xmcashbackapplicationNew.ManagerTime    = DateTime.Now;
                }
                //返现金额 大于项目限额 小于 财务限额,项目未审核,财务审核
                else if (CashBackMoney > Dmoney && CashBackMoney <= Finance)
                {
                    xmcashbackapplicationNew.ManagerStatus  = Convert.ToInt32(StatusEnum.NotCheck);
                    xmcashbackapplicationNew.FinanceIsAudit = true;
                }
                //返现金额 大于项目限额 大于 财务限额,都不审核
                else
                {
                    xmcashbackapplicationNew.ManagerStatus  = Convert.ToInt32(StatusEnum.NotCheck);
                    xmcashbackapplicationNew.FinanceIsAudit = false;
                }
                xmcashbackapplicationNew.CashBackMoney = CashBackMoney;
                xmcashbackapplicationNew.BuyerAlipayNo = BuyerAlipayNo;
                xmcashbackapplicationNew.UpdatorID     = UserId;// HozestERPContext.Current.User.CustomerID;
                xmcashbackapplicationNew.UpdateTime    = DateTime.Now;
                UpdateXMCashBackApplication(xmcashbackapplicationNew);
                inst = 1;
            }
            else if (CBAList.Count > 0)
            {
            }
            else
            {
                XMCashBackApplication xmcashbackapplication = new XMCashBackApplication();
                xmcashbackapplication.ApplicationTypeId = ApplicationTypeId;
                xmcashbackapplication.OrderCode         = OrderCode;
                xmcashbackapplication.WantNo            = WantNo;
                xmcashbackapplication.BuyerName         = BuyerName;
                xmcashbackapplication.CashBackMoney     = CashBackMoney;
                xmcashbackapplication.BuyerAlipayNo     = BuyerAlipayNo;
                xmcashbackapplication.CashBackStatus    = Convert.ToInt32(StatusEnum.NotCashBack);

                //判断 返现金额 小于项目限额,财务限额,自动审核
                if (CashBackMoney <= Dmoney)
                {
                    xmcashbackapplication.ManagerStatus  = Convert.ToInt32(StatusEnum.AlreadyCheck);
                    xmcashbackapplication.FinanceIsAudit = true;
                    xmcashbackapplication.ManagerPeople  = UserId;// HozestERPContext.Current.User.CustomerID;
                    xmcashbackapplication.ManagerTime    = DateTime.Now;
                }
                //返现金额 大于项目限额 小于 财务限额,项目未审核,财务审核
                else if (CashBackMoney > Dmoney && CashBackMoney <= Finance)
                {
                    xmcashbackapplication.ManagerStatus  = Convert.ToInt32(StatusEnum.NotCheck);
                    xmcashbackapplication.FinanceIsAudit = true;
                }
                //返现金额 大于项目限额 大于 财务限额,都不审核
                else
                {
                    xmcashbackapplication.ManagerStatus  = Convert.ToInt32(StatusEnum.NotCheck);
                    xmcashbackapplication.FinanceIsAudit = false;
                }

                //判断 返现金额 大于 设置返现金额 需运营审核
                //if (CashBackMoney > Dmoney)
                //{
                //    xmcashbackapplication.ManagerStatus = Convert.ToInt32(StatusEnum.NotCheck);
                //}
                //else
                //{
                //    xmcashbackapplication.ManagerStatus = Convert.ToInt32(StatusEnum.AlreadyCheck);
                //    xmcashbackapplication.ManagerPeople = HozestERPContext.Current.User.CustomerID;
                //    xmcashbackapplication.ManagerTime = DateTime.Now;
                //}
                xmcashbackapplication.IsEnable   = false;
                xmcashbackapplication.CreatorID  = UserId; // HozestERPContext.Current.User.CustomerID;
                xmcashbackapplication.CreateTime = DateTime.Now;
                xmcashbackapplication.UpdatorID  = UserId; // HozestERPContext.Current.User.CustomerID;
                xmcashbackapplication.UpdateTime = DateTime.Now;
                InsertXMCashBackApplication(xmcashbackapplication);
                inst = 1;
            }
            return(inst);
        }