コード例 #1
0
        private static void FirstInsertIntegral(Guid companyId, IReposity reposity)
        {
            IntegralParameterView prameter = reposity.GetIntegralParameter();

            if (prameter.IsSignIn)
            {
                IntegralInfo integral = new IntegralInfo
                {
                    CompnayId   = companyId,
                    AccessTime  = DateTime.Now,
                    Integral    = prameter.SignIntegral,
                    IntegralWay = IntegralWay.SignIn,
                    Remark      = "登录奖励"
                };
                reposity.InsertIntegralInfo(integral);
                IntegralCount counts = reposity.GetIntegralCount(companyId);
                IntegralCount count  = new IntegralCount
                {
                    CompnayId = companyId,
                    Integral  = prameter.SignIntegral
                };
                if (counts == null)
                {
                    count.Integral = prameter.SignIntegral;
                    reposity.InsertIntegralCount(count);
                }
                else
                {
                    reposity.UpdateIntegralCount(count);
                }
            }
        }
コード例 #2
0
 public HomeController(IReposity <Student> reposity)
 {
     _reposity = reposity;
 }
コード例 #3
0
        private static void NotSignIn(string username, DateTime?lastTime, DateTime logonTime, Guid companyId, IReposity reposity)
        {
            IntegralParameterView parameter = reposity.GetIntegralParameter();

            if (lastTime != null && lastTime.Value.Date != logonTime.AddDays(-1).Date)
            {
                IntegralCount counts = reposity.GetIntegralCount(companyId);
                if (parameter.IsDrop)
                {
                    if (counts == null)
                    {
                        var count = new IntegralCount
                        {
                            CompnayId = companyId,
                            Integral  = 0
                        };
                        reposity.InsertIntegralCount(count);
                    }
                    else
                    {
                        TimeSpan            day  = logonTime.AddDays(-1).Date - lastTime.Value.Date;
                        IntegralConsumption view = new IntegralConsumption
                        {
                            CompnayId           = companyId,
                            AccountName         = username,
                            AccountNo           = "",
                            AccountPhone        = "",
                            DeliveryAddress     = "",
                            CommodityCount      = 0,
                            CommodityId         = Guid.Empty,
                            CommodityName       = "",
                            ConsumptionIntegral = parameter.SignIntegral,
                            Exchange            = ExchangeState.Processing,
                            ExchangeTiem        = lastTime.Value.Date,
                            ExpressCompany      = "",
                            ExpressDelivery     = "",
                            Reason = "",
                            Remark = "未登录减少积分",
                            Way    = IntegralWay.NotSignIn
                        };
                        int days = parameter.SignIntegral * day.Days < counts.IntegralSurplus ? day.Days : (int)Math.Ceiling(Convert.ToDouble(counts.IntegralSurplus) / Convert.ToDouble(parameter.SignIntegral));
                        reposity.InsertIntegralConsumption(view, days, parameter.SignIntegral, counts.IntegralSurplus);
                        var count = new IntegralCount
                        {
                            CompnayId = companyId,
                            Integral  = -(parameter.SignIntegral * day.Days >= counts.IntegralSurplus ? counts.IntegralSurplus : parameter.SignIntegral * day.Days)
                        };
                        reposity.UpdateIntegralCount(count);
                    }
                }
            }
        }
コード例 #4
0
 public WelcomeViewComponent(IReposity <Student> reposity)
 {
     this.reposity = reposity;
 }