Example #1
0
 /// <summary>
 /// 更新
 /// </summary>
 /// <param name="pEntity">实体实例</param>
 /// <param name="pTran">事务实例,可为null,如果为null,则不使用事务来更新</param>
 public void Update(T_SuperRetailTraderProfitDetailEntity pEntity, IDbTransaction pTran)
 {
     _currentDAO.Update(pEntity, pTran);
 }
Example #2
0
 /// <summary>
 /// 创建一个新实例
 /// </summary>
 /// <param name="pEntity">实体实例</param>
 public void Create(T_SuperRetailTraderProfitDetailEntity pEntity)
 {
     _currentDAO.Create(pEntity);
 }
Example #3
0
 /// <summary>
 /// 分页根据实体条件查询实体
 /// </summary>
 /// <param name="pQueryEntity">以实体形式传入的参数</param>
 /// <param name="pOrderBys">排序组合</param>
 /// <returns>符合条件的实体集</returns>
 public PagedQueryResult <T_SuperRetailTraderProfitDetailEntity> PagedQueryByEntity(T_SuperRetailTraderProfitDetailEntity pQueryEntity, OrderBy[] pOrderBys, int pPageSize, int pCurrentPageIndex)
 {
     return(_currentDAO.PagedQueryByEntity(pQueryEntity, pOrderBys, pPageSize, pCurrentPageIndex));
 }
Example #4
0
 /// <summary>
 /// 根据实体条件查询实体
 /// </summary>
 /// <param name="pQueryEntity">以实体形式传入的参数</param>
 /// <param name="pOrderBys">排序组合</param>
 /// <returns>符合条件的实体集</returns>
 public T_SuperRetailTraderProfitDetailEntity[] QueryByEntity(T_SuperRetailTraderProfitDetailEntity pQueryEntity, OrderBy[] pOrderBys)
 {
     return(_currentDAO.QueryByEntity(pQueryEntity, pOrderBys));
 }
Example #5
0
        /// <summary>
        /// 计算超级分销商佣金分润
        /// </summary>
        /// <param name="loggingSessionInfo"></param>
        /// <param name="orderInfo"></param>
        public void CalculateSuperRetailTraderOrder(LoggingSessionInfo loggingSessionInfo, T_InoutEntity orderInfo)
        {
            if (orderInfo != null)
            {
                if (orderInfo.data_from_id == "35" || orderInfo.data_from_id == "36")
                {
                    T_SuperRetailTraderBLL bllSuperRetailTrader = new T_SuperRetailTraderBLL(loggingSessionInfo);
                    DataSet dsAllFather = bllSuperRetailTrader.GetAllFather(orderInfo.sales_user);
                    if (dsAllFather != null && dsAllFather.Tables.Count > 0 && dsAllFather.Tables[0].Rows.Count > 0)
                    {
                        T_SuperRetailTraderProfitConfigBLL bllSuperRetailTraderProfitConfig = new T_SuperRetailTraderProfitConfigBLL(loggingSessionInfo);
                        T_SuperRetailTraderConfigBLL       bllSuperRetailTraderConfig       = new T_SuperRetailTraderConfigBLL(loggingSessionInfo);
                        T_SuperRetailTraderProfitDetailBLL bllSuperRetailTraderProfitDetail = new T_SuperRetailTraderProfitDetailBLL(loggingSessionInfo);

                        VipAmountBLL       bllVipAmount       = new VipAmountBLL(loggingSessionInfo);
                        VipAmountDetailBLL bllVipAmountDetail = new VipAmountDetailBLL(loggingSessionInfo);

                        var entitySuperRetailTraderProfitConfig = bllSuperRetailTraderProfitConfig.QueryByEntity(new T_SuperRetailTraderProfitConfigEntity()
                        {
                            CustomerId = loggingSessionInfo.ClientID, IsDelete = 0, Status = "10"
                        }, null);
                        var entityConfig = bllSuperRetailTraderConfig.QueryByEntity(new T_SuperRetailTraderConfigEntity()
                        {
                            CustomerId = loggingSessionInfo.ClientID, IsDelete = 0
                        }, null).SingleOrDefault();
                        if (entityConfig != null && entitySuperRetailTraderProfitConfig != null)
                        {
                            //佣金比列
                            decimal SkuCommission = Convert.ToDecimal(entityConfig.SkuCommission) * Convert.ToDecimal(0.01);
                            //商品分润比列
                            decimal DistributionProfit = Convert.ToDecimal(entityConfig.DistributionProfit) * Convert.ToDecimal(0.01);


                            foreach (DataRow dr in dsAllFather.Tables[0].Rows)
                            {
                                decimal amount            = 0;
                                string  strAmountSourceId = string.Empty;
                                T_SuperRetailTraderProfitConfigEntity singlProfitConfig = new T_SuperRetailTraderProfitConfigEntity();
                                if (dr["level"].ToString() == "1")    //佣金
                                {
                                    strAmountSourceId = "34";
                                    singlProfitConfig = entitySuperRetailTraderProfitConfig.Where(a => a.Level == Convert.ToInt16(dr["level"].ToString())).SingleOrDefault();
                                    if (singlProfitConfig != null)
                                    {
                                        if (singlProfitConfig.ProfitType == "Percent")
                                        {
                                            amount = Convert.ToDecimal(orderInfo.actual_amount) * SkuCommission;
                                        }
                                    }
                                }
                                else    //分润
                                {
                                    strAmountSourceId = "33";
                                    singlProfitConfig = entitySuperRetailTraderProfitConfig.Where(a => a.Level == Convert.ToInt16(dr["level"].ToString())).SingleOrDefault();
                                    if (singlProfitConfig != null)
                                    {
                                        if (singlProfitConfig.ProfitType == "Percent")
                                        {
                                            amount = Convert.ToDecimal(orderInfo.actual_amount) * Convert.ToDecimal(singlProfitConfig.Profit) * Convert.ToDecimal(0.01);
                                        }
                                    }
                                }
                                if (amount > 0)
                                {
                                    IDbTransaction tran = new JIT.CPOS.BS.DataAccess.Base.TransactionHelper(loggingSessionInfo).CreateTransaction();
                                    try
                                    {
                                        T_SuperRetailTraderProfitDetailEntity entitySuperRetailTraderProfitDetail = new T_SuperRetailTraderProfitDetailEntity()
                                        {
                                            SuperRetailTraderProfitConfigId = singlProfitConfig.SuperRetailTraderProfitConfigId,
                                            SuperRetailTraderID             = new Guid(dr["SuperRetailTraderID"].ToString()),
                                            Level             = Convert.ToInt16(dr["level"].ToString()),
                                            ProfitType        = "Cash",
                                            Profit            = amount,
                                            OrderType         = "Order",
                                            OrderId           = orderInfo.order_id,
                                            OrderDate         = Convert.ToDateTime(orderInfo.order_date),
                                            VipId             = orderInfo.vip_no,
                                            OrderActualAmount = orderInfo.actual_amount,
                                            SalesId           = new Guid(orderInfo.sales_user),
                                            OrderNo           = orderInfo.order_no,
                                            CustomerId        = loggingSessionInfo.ClientID
                                        };


                                        bllSuperRetailTraderProfitDetail.Create(entitySuperRetailTraderProfitDetail, (SqlTransaction)tran);


                                        VipAmountDetailEntity entityVipAmountDetail = new VipAmountDetailEntity();
                                        VipAmountEntity       entityVipAmount       = new VipAmountEntity();
                                        entityVipAmountDetail = new VipAmountDetailEntity
                                        {
                                            VipAmountDetailId = Guid.NewGuid(),
                                            VipId             = dr["SuperRetailTraderID"].ToString(),
                                            Amount            = amount,
                                            UsedReturnAmount  = 0,
                                            EffectiveDate     = DateTime.Now,
                                            DeadlineDate      = Convert.ToDateTime("9999-12-31 23:59:59"),
                                            AmountSourceId    = strAmountSourceId,
                                            ObjectId          = orderInfo.order_id,
                                            CustomerID        = loggingSessionInfo.ClientID,
                                            Reason            = "超级分销商"
                                        };
                                        bllVipAmountDetail.Create(entityVipAmountDetail, (SqlTransaction)tran);

                                        entityVipAmount = bllVipAmount.QueryByEntity(new VipAmountEntity()
                                        {
                                            VipId = dr["SuperRetailTraderID"].ToString(), IsDelete = 0, CustomerID = loggingSessionInfo.ClientID
                                        }, null).SingleOrDefault();
                                        if (entityVipAmount == null)
                                        {
                                            entityVipAmount = new VipAmountEntity
                                            {
                                                VipId                  = dr["SuperRetailTraderID"].ToString(),
                                                BeginAmount            = 0,
                                                InAmount               = amount,
                                                OutAmount              = 0,
                                                EndAmount              = amount,
                                                TotalAmount            = amount,
                                                BeginReturnAmount      = 0,
                                                InReturnAmount         = 0,
                                                OutReturnAmount        = 0,
                                                ReturnAmount           = 0,
                                                ImminentInvalidRAmount = 0,
                                                InvalidReturnAmount    = 0,
                                                ValidReturnAmount      = 0,
                                                TotalReturnAmount      = 0,
                                                IsLocking              = 0,
                                                CustomerID             = loggingSessionInfo.ClientID,
                                                VipCardCode            = ""
                                            };
                                            bllVipAmount.Create(entityVipAmount, tran);
                                        }
                                        else
                                        {
                                            entityVipAmount.InReturnAmount    = (entityVipAmount.InReturnAmount == null ? 0 : entityVipAmount.InReturnAmount.Value) + amount;
                                            entityVipAmount.TotalReturnAmount = (entityVipAmount.TotalReturnAmount == null ? 0 : entityVipAmount.TotalReturnAmount.Value) + amount;

                                            entityVipAmount.ValidReturnAmount = (entityVipAmount.ValidReturnAmount == null ? 0 : entityVipAmount.ValidReturnAmount.Value) + amount;
                                            entityVipAmount.ReturnAmount      = (entityVipAmount.ReturnAmount == null ? 0 : entityVipAmount.ReturnAmount.Value) + amount;

                                            bllVipAmount.Update(entityVipAmount);
                                        }
                                        tran.Commit();
                                    }
                                    catch (Exception)
                                    {
                                        tran.Rollback();
                                        throw;
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        /// <summary>
        /// 计算超级分销商佣金,分润用到的批处理
        /// </summary>
        public void CalculateSuperRetailTraderOrderJob()
        {
            var numCount = 50;

            var customerIDs = CustomerBLL.Instance.GetCustomerList();

            foreach (var customer in customerIDs)
            {
                string connString = customer.Value;
                var    count      = RedisOpenAPI.Instance.CCSuperRetailTraderOrder().GetSuperRetailTraderOrderLength(new CC_Order
                {
                    CustomerID = customer.Key
                });
                if (count.Code != ResponseCode.Success)
                {
                    BaseService.WriteLog("从redis获取待绑定优惠券数量失败");
                    continue;
                }
                if (count.Result <= 0)
                {
                    continue;
                }
                if (count.Result < numCount)
                {
                    numCount = Convert.ToInt32(count.Result);
                }

                DataTable dtProfitDetail = CreateTableProfitDetail();
                DataTable dtAmountDetail = CreateTableAmountDetail();
                DataTable dtAmount       = CreateTableAmount();

                for (var i = 0; i < numCount; i++)
                {
                    var response = RedisOpenAPI.Instance.CCSuperRetailTraderOrder().GetSuperRetailTraderOrder(new CC_Order
                    {
                        CustomerID = customer.Key
                    });
                    if (response.Code == ResponseCode.Success)
                    {
                        var orderInfo = response.Result.OrderInfo.JsonDeserialize <T_InoutEntity>();
                        //var loggingSessionInfo = response.Result.LogSession.JsonDeserialize<LoggingSessionInfo>();
                        var        loggingSessionInfo = CustomerBLL.Instance.GetBSLoggingSession(customer.Key, "1");
                        T_InoutBLL inoutBLL           = new T_InoutBLL(loggingSessionInfo);
                        //inoutBLL.CalculateSuperRetailTraderOrder(loggingSessionInfo, orderInfo);
                        if (orderInfo != null)
                        {
                            if (orderInfo.data_from_id == "35" || orderInfo.data_from_id == "36")
                            {
                                T_SuperRetailTraderBLL bllSuperRetailTrader = new T_SuperRetailTraderBLL(loggingSessionInfo);
                                DataSet dsAllFather = bllSuperRetailTrader.GetAllFather(orderInfo.sales_user);
                                if (dsAllFather != null && dsAllFather.Tables.Count > 0 && dsAllFather.Tables[0].Rows.Count > 0)
                                {
                                    T_SuperRetailTraderProfitConfigBLL bllSuperRetailTraderProfitConfig = new T_SuperRetailTraderProfitConfigBLL(loggingSessionInfo);
                                    T_SuperRetailTraderConfigBLL       bllSuperRetailTraderConfig       = new T_SuperRetailTraderConfigBLL(loggingSessionInfo);
                                    T_SuperRetailTraderProfitDetailBLL bllSuperRetailTraderProfitDetail = new T_SuperRetailTraderProfitDetailBLL(loggingSessionInfo);

                                    VipAmountBLL       bllVipAmount       = new VipAmountBLL(loggingSessionInfo);
                                    VipAmountDetailBLL bllVipAmountDetail = new VipAmountDetailBLL(loggingSessionInfo);

                                    var entitySuperRetailTraderProfitConfig = bllSuperRetailTraderProfitConfig.QueryByEntity(new T_SuperRetailTraderProfitConfigEntity()
                                    {
                                        CustomerId = loggingSessionInfo.ClientID, IsDelete = 0, Status = "10"
                                    }, null);
                                    var entityConfig = bllSuperRetailTraderConfig.QueryByEntity(new T_SuperRetailTraderConfigEntity()
                                    {
                                        CustomerId = loggingSessionInfo.ClientID, IsDelete = 0
                                    }, null).SingleOrDefault();
                                    if (entityConfig != null && entitySuperRetailTraderProfitConfig != null)
                                    {
                                        //佣金比列
                                        decimal SkuCommission = Convert.ToDecimal(entityConfig.SkuCommission) * Convert.ToDecimal(0.01);
                                        //商品分润比列
                                        decimal DistributionProfit = Convert.ToDecimal(entityConfig.DistributionProfit) * Convert.ToDecimal(0.01);


                                        foreach (DataRow dr in dsAllFather.Tables[0].Rows)
                                        {
                                            decimal amount            = 0;
                                            string  strAmountSourceId = string.Empty;
                                            T_SuperRetailTraderProfitConfigEntity singlProfitConfig = new T_SuperRetailTraderProfitConfigEntity();
                                            if (dr["level"].ToString() == "1")      //佣金
                                            {
                                                strAmountSourceId = "34";
                                                singlProfitConfig = entitySuperRetailTraderProfitConfig.Where(a => a.Level == Convert.ToInt16(dr["level"].ToString())).SingleOrDefault();
                                                if (singlProfitConfig != null)
                                                {
                                                    if (singlProfitConfig.ProfitType == "Percent")
                                                    {
                                                        amount = Convert.ToDecimal(orderInfo.actual_amount) * SkuCommission;
                                                    }
                                                }
                                            }
                                            else      //分润
                                            {
                                                strAmountSourceId = "33";
                                                singlProfitConfig = entitySuperRetailTraderProfitConfig.Where(a => a.Level == Convert.ToInt16(dr["level"].ToString())).SingleOrDefault();
                                                if (singlProfitConfig != null)
                                                {
                                                    if (singlProfitConfig.ProfitType == "Percent")
                                                    {
                                                        //amount = Convert.ToDecimal(orderInfo.actual_amount) * DistributionProfit * Convert.ToDecimal(singlProfitConfig.Profit) * Convert.ToDecimal(0.01);
                                                        amount = Convert.ToDecimal(orderInfo.actual_amount) * Convert.ToDecimal(singlProfitConfig.Profit) * Convert.ToDecimal(0.01);
                                                    }
                                                }
                                            }
                                            var vipAmountDetail = bllVipAmountDetail.QueryByEntity(new VipAmountDetailEntity()
                                            {
                                                ObjectId = orderInfo.order_id, AmountSourceId = strAmountSourceId
                                            }, null);
                                            if (vipAmountDetail != null && vipAmountDetail.Length > 0)
                                            {
                                                continue;
                                            }
                                            if (amount > 0)
                                            {
                                                IDbTransaction tran = new JIT.CPOS.BS.DataAccess.Base.TransactionHelper(loggingSessionInfo).CreateTransaction();
                                                try
                                                {
                                                    T_SuperRetailTraderProfitDetailEntity entitySuperRetailTraderProfitDetail = new T_SuperRetailTraderProfitDetailEntity()
                                                    {
                                                        SuperRetailTraderProfitConfigId = singlProfitConfig.SuperRetailTraderProfitConfigId,
                                                        SuperRetailTraderID             = new Guid(dr["SuperRetailTraderID"].ToString()),
                                                        Level             = Convert.ToInt16(dr["level"].ToString()),
                                                        ProfitType        = "Cash",
                                                        Profit            = amount,
                                                        OrderType         = "Order",
                                                        OrderId           = orderInfo.order_id,
                                                        OrderDate         = Convert.ToDateTime(orderInfo.order_date),
                                                        VipId             = orderInfo.vip_no,
                                                        OrderActualAmount = orderInfo.actual_amount,
                                                        SalesId           = new Guid(orderInfo.sales_user),
                                                        OrderNo           = orderInfo.order_no,
                                                        CustomerId        = loggingSessionInfo.ClientID
                                                    };
                                                    bllSuperRetailTraderProfitDetail.Create(entitySuperRetailTraderProfitDetail, (SqlTransaction)tran);

                                                    VipAmountEntity       entityVipAmount       = new VipAmountEntity();
                                                    VipAmountDetailEntity entityVipAmountDetail = new VipAmountDetailEntity();
                                                    entityVipAmountDetail = new VipAmountDetailEntity {
                                                        VipAmountDetailId = Guid.NewGuid(),
                                                        VipId             = dr["SuperRetailTraderID"].ToString(),
                                                        Amount            = amount,
                                                        UsedReturnAmount  = 0,
                                                        EffectiveDate     = DateTime.Now,
                                                        DeadlineDate      = Convert.ToDateTime("9999-12-31 23:59:59"),
                                                        AmountSourceId    = strAmountSourceId,
                                                        ObjectId          = orderInfo.order_id,
                                                        CustomerID        = loggingSessionInfo.ClientID,
                                                        Reason            = "超级分销商",
                                                        IsWithdrawCash    = 0
                                                    };
                                                    bllVipAmountDetail.Create(entityVipAmountDetail, (SqlTransaction)tran);
                                                    //DataRow dr_ProfitDetail = dtProfitDetail.NewRow();
                                                    //dr_ProfitDetail["Id"] = Guid.NewGuid();
                                                    //dr_ProfitDetail["SuperRetailTraderProfitConfigId"] = new Guid(singlProfitConfig.SuperRetailTraderProfitConfigId.ToString());
                                                    //dr_ProfitDetail["SuperRetailTraderID"] = new Guid(dr["SuperRetailTraderID"].ToString());
                                                    //dr_ProfitDetail["Level"] = Convert.ToInt16(dr["level"].ToString());
                                                    //dr_ProfitDetail["ProfitType"] = "Cash";
                                                    //dr_ProfitDetail["Profit"] = amount;
                                                    //dr_ProfitDetail["OrderType"] = "Order";
                                                    //dr_ProfitDetail["OrderId"] = orderInfo.order_id;
                                                    //dr_ProfitDetail["OrderNo"] = orderInfo.order_no;
                                                    //dr_ProfitDetail["OrderDate"] = Convert.ToDateTime(orderInfo.order_date);
                                                    //dr_ProfitDetail["OrderActualAmount"] = orderInfo.actual_amount;
                                                    //dr_ProfitDetail["SalesId"] = new Guid(orderInfo.sales_user);
                                                    //dr_ProfitDetail["VipId"] = orderInfo.vip_no;
                                                    //dr_ProfitDetail["CreateBy"] = loggingSessionInfo.ClientID;
                                                    //dr_ProfitDetail["CreateTime"] = DateTime.Now;
                                                    //dr_ProfitDetail["LastUpdateBy"] = loggingSessionInfo.ClientID;
                                                    //dr_ProfitDetail["LastUpdateTime"] = DateTime.Now;
                                                    //dr_ProfitDetail["CustomerId"] = loggingSessionInfo.ClientID;
                                                    //dr_ProfitDetail["IsDelete"] = 0;

                                                    //dtProfitDetail.Rows.Add(dr_ProfitDetail);

                                                    //DataRow dr_AmountDetail = dtAmountDetail.NewRow();
                                                    //dr_AmountDetail["VipAmountDetailId"] = Guid.NewGuid();
                                                    //dr_AmountDetail["VipId"] = dr["SuperRetailTraderID"].ToString();
                                                    //dr_AmountDetail["VipCardCode"] = "";
                                                    //dr_AmountDetail["UnitID"] = "";
                                                    //dr_AmountDetail["UnitName"] = "";
                                                    //dr_AmountDetail["SalesAmount"] = 0;
                                                    //dr_AmountDetail["Amount"] = amount;
                                                    //dr_AmountDetail["UsedReturnAmount"] = 0;
                                                    //dr_AmountDetail["Reason"] = "超级分销商";
                                                    //dr_AmountDetail["EffectiveDate"] = DateTime.Now;
                                                    //dr_AmountDetail["DeadlineDate"] = Convert.ToDateTime("9999-12-31 23:59:59");
                                                    //dr_AmountDetail["AmountSourceId"] = strAmountSourceId;
                                                    //dr_AmountDetail["ObjectId"] = orderInfo.order_id;
                                                    //dr_AmountDetail["Remark"] = "超级分销商";
                                                    //dr_AmountDetail["IsValid"] = 0;
                                                    //dr_AmountDetail["IsWithdrawCash"] = 0;
                                                    //dr_AmountDetail["CustomerID"] = loggingSessionInfo.ClientID;
                                                    //dr_AmountDetail["CreateTime"] = DateTime.Now;
                                                    //dr_AmountDetail["CreateBy"] = loggingSessionInfo.ClientID;
                                                    //dr_AmountDetail["LastUpdateBy"] = loggingSessionInfo.ClientID;
                                                    //dr_AmountDetail["LastUpdateTime"] = DateTime.Now;
                                                    //dr_AmountDetail["IsDelete"] = 0;
                                                    ////dr_AmountDetail["IsCalculated"] = 1;

                                                    //dtAmountDetail.Rows.Add(dr_AmountDetail);

                                                    entityVipAmount = bllVipAmount.QueryByEntity(new VipAmountEntity()
                                                    {
                                                        VipId = dr["SuperRetailTraderID"].ToString(), IsDelete = 0
                                                    }, null).SingleOrDefault();
                                                    if (entityVipAmount == null)
                                                    {
                                                        entityVipAmount = new VipAmountEntity {
                                                            VipId                  = dr["SuperRetailTraderID"].ToString(),
                                                            BeginAmount            = 0,
                                                            InAmount               = amount,
                                                            OutAmount              = 0,
                                                            EndAmount              = amount,
                                                            TotalAmount            = amount,
                                                            BeginReturnAmount      = 0,
                                                            InReturnAmount         = 0,
                                                            OutReturnAmount        = 0,
                                                            ReturnAmount           = 0,
                                                            ImminentInvalidRAmount = 0,
                                                            InvalidReturnAmount    = 0,
                                                            ValidReturnAmount      = 0,
                                                            TotalReturnAmount      = 0,
                                                            IsLocking              = 0,
                                                            CustomerID             = loggingSessionInfo.ClientID,
                                                            VipCardCode            = ""
                                                        };
                                                        bllVipAmount.Create(entityVipAmount, tran);
                                                        //DataRow dr_Amount = dtAmount.NewRow();
                                                        //dr_Amount["VipId"] = dr["SuperRetailTraderID"].ToString();
                                                        //dr_Amount["VipCardCode"] = "";
                                                        //dr_Amount["BeginAmount"] = 0;
                                                        //dr_Amount["InAmount"] = amount;
                                                        //dr_Amount["OutAmount"] = 0;
                                                        //dr_Amount["EndAmount"] = amount;
                                                        //dr_Amount["TotalAmount"] = amount;
                                                        //dr_Amount["BeginReturnAmount"] = 0;
                                                        //dr_Amount["InReturnAmount"] = 0;
                                                        //dr_Amount["OutReturnAmount"] = 0;
                                                        //dr_Amount["ReturnAmount"] = 0;
                                                        //dr_Amount["ImminentInvalidRAmount"] = 0;
                                                        //dr_Amount["InvalidReturnAmount"] = 0;
                                                        //dr_Amount["ValidReturnAmount"] = 0;
                                                        //dr_Amount["TotalReturnAmount"] = 0;
                                                        //dr_Amount["PayPassword"] = "";
                                                        //dr_Amount["IsLocking"] = 0;
                                                        //dr_Amount["CustomerID"] = loggingSessionInfo.ClientID;
                                                        //dr_Amount["CreateTime"] = DateTime.Now;
                                                        //dr_Amount["CreateBy"] = loggingSessionInfo.ClientID;
                                                        //dr_Amount["LastUpdateBy"] =loggingSessionInfo.ClientID;
                                                        //dr_Amount["LastUpdateTime"] = DateTime.Now;
                                                        //dr_Amount["IsDelete"] = 0;
                                                        //dtAmount.Rows.Add(dr_Amount);
                                                    }
                                                    else
                                                    {
                                                        entityVipAmount.InReturnAmount    = (entityVipAmount.InReturnAmount == null ? 0 : entityVipAmount.InReturnAmount.Value) + amount;
                                                        entityVipAmount.TotalReturnAmount = (entityVipAmount.TotalReturnAmount == null ? 0 : entityVipAmount.TotalReturnAmount.Value) + amount;

                                                        entityVipAmount.ValidReturnAmount = (entityVipAmount.ValidReturnAmount == null ? 0 : entityVipAmount.ValidReturnAmount.Value) + amount;
                                                        entityVipAmount.ReturnAmount      = (entityVipAmount.ReturnAmount == null ? 0 : entityVipAmount.ReturnAmount.Value) + amount;

                                                        bllVipAmount.Update(entityVipAmount);
                                                    }
                                                    tran.Commit();
                                                }
                                                catch (Exception)
                                                {
                                                    tran.Rollback();
                                                    throw;
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                //if (dtAmount.Rows.Count > 0)
                //{
                //    Utils.SqlBulkCopy(connString, dtAmount, "VipAmount");
                //}
                //if (dtAmountDetail.Rows.Count>0 && dtProfitDetail.Rows.Count>0)
                //{
                //    Utils.SqlBulkCopy(connString, dtProfitDetail, "T_SuperRetailTraderProfitDetail");
                //    Utils.SqlBulkCopy(connString, dtAmountDetail, "VipAmountDetail");

                //}
            }
        }