Example #1
0
        // GET: Admin/Dashboard
        public ActionResult Index()
        {
            var customerService = new StripeCustomerService();
            var customers       = customerService.List();

            var balanceService = new StripeBalanceService();
            var balance        = balanceService.Get();

            var chargeService = new StripeChargeService();
            var charges       = chargeService.List().Where(c => c.Dispute != null);

            var sc    = customers as StripeCustomer[] ?? customers.ToArray();
            var model = new DashboardViewModel
            {
                CustomerCount           = sc.Count(),
                AccountAvailableBalance = balance.Available.Sum(b => b.Amount),
                AccountPendingBalance   = balance.Pending.Sum(b => b.Amount),
                MonthlyCustomerValue    = sc.Sum(c => c.StripeSubscriptionList.Data.Sum(s => s.StripePlan.Amount)),
                DisputedChargeCount     = charges.Sum(c => c.Dispute.Amount.GetValueOrDefault()),
                TrialCustomerCount      = sc.Count(c => c.StripeSubscriptionList.Data.Any(s => s.Status.Equals("trialing"))),
                ActiveCustomerCount     = sc.Count(c => c.StripeSubscriptionList.Data.Any(s => s.Status.Equals("active"))),
                PastDueCustomerCount    = sc.Count(c => c.StripeSubscriptionList.Data.Any(s => s.Status.Equals("past_due"))),
                CanceledCustomerCount   = sc.Count(c => c.StripeSubscriptionList.Data.Any(s => s.Status.Equals("canceled"))),
                UnpaidCustomerCount     = sc.Count(c => c.StripeSubscriptionList.Data.Any(s => s.Status.Equals("unpaid"))),
            };

            return(View(model));
        }
        static void GetNewCharges(StripeChargeService chargeService, TraceWriter log)
        {
            string lastObjectId = null;
            StripeList <StripeCharge> response = null;

            var greaterThanCreatedFilter = GetLatestCreatedTime();

            log.Info($"Latest Created Time: {greaterThanCreatedFilter}");

            var listOptions = new StripeChargeListOptions()
            {
                Limit   = 100,
                Created = new StripeDateFilter {
                    GreaterThan = greaterThanCreatedFilter
                },
                StartingAfter = lastObjectId
            };

            do
            {
                response = chargeService.List(listOptions);

                foreach (var c in response.Data)
                {
                    var trans = StripeChargeToStripeTransaction(c);
                    UpsertStripeTransaction(trans, log);
                }
                lastObjectId = response.Data.LastOrDefault()?.Id;
                listOptions.StartingAfter = lastObjectId;
                log.Info($"Charge last ObjectId: {lastObjectId}. More responses? {response.HasMore}");
            }while (response.HasMore);
        }
Example #3
0
        public static List <StripeCharge> GetCharges(string StripeCustId, string StripeCardId)
        {
            var chargeService = new StripeChargeService();
            var response      = chargeService.List().Data.Where(c => c.CustomerId == StripeCustId && c.Source.Card.Id == StripeCardId).ToList();

            return(response);
        }
Example #4
0
        public charges_fixture()
        {
            // make sure there's a charge
            Charge = Cache.GetStripeCharge(Cache.ApiKey);

            ChargeListOptions = new StripeChargeListOptions
            {
                IncludeTotalCount = true
            };

            var service = new StripeChargeService(Cache.ApiKey);

            Charges = service.List(ChargeListOptions);

            ChargeUpdateOptions = new StripeChargeUpdateOptions
            {
                Description = "updatd description",
                // setting the updated shipping object to the same object used for the create charge
                // i attempted to just create a new shipping object and set one property,
                // but it threw an error 'name' was not supplied (which was on the original)
                Shipping = Cache.GetStripeChargeCreateOptions().Shipping
            };

            ChargeUpdateOptions.Shipping.Phone = "8675309";

            UpdatedCharge = service.Update(Charge.Id, ChargeUpdateOptions);
        }
Example #5
0
        public charges_fixture()
        {
            // make sure there's a charge
            Charge = Cache.GetStripeCharge(Cache.ApiKey);

            ChargeListOptions = new StripeChargeListOptions();

            var service = new StripeChargeService(Cache.ApiKey);

            Charges = service.List(ChargeListOptions);

            ChargeUpdateOptions = new StripeChargeUpdateOptions
            {
                Description = "updatd description",
                // setting the updated shipping object to the same object used for the create charge
                // i attempted to just create a new shipping object and set one property,
                // but it threw an error 'name' was not supplied (which was on the original)
                Shipping = Cache.GetStripeChargeCreateOptions().Shipping
            };

            ChargeUpdateOptions.Shipping.Phone          = "8675309";
            ChargeUpdateOptions.Shipping.TrackingNumber = "56789";

            UpdatedCharge = service.Update(Charge.Id, ChargeUpdateOptions);

            UncapturedCharge = Cache.GetStripeChargeUncaptured(Cache.ApiKey);

            ChargeCaptureOptions = new StripeChargeCaptureOptions
            {
                Amount = 123,
                StatementDescriptor = "CapturedCharge"
            };
            CapturedCharge = service.Capture(UncapturedCharge.Id, ChargeCaptureOptions);
        }
Example #6
0
        public IEnumerable <StripeCharge> GetCustomerPayments(int limit, string customerId)
        {
            var chargeService = new StripeChargeService();

            return(chargeService.List(new StripeChargeListOptions
            {
                Limit = limit,
                CustomerId = customerId
            }));
        }
Example #7
0
        // Get a charge objects starting from fd to td (both inclusive, in UTC)
        // Returns List of StripeCharge
        public static List <StripeCharge> GetStripeChargeList(DateTime fd, DateTime td)
        {
            List <StripeCharge> chargeItems = new List <StripeCharge>();
            var  chargeService = new StripeChargeService();
            bool noErr         = true;

            // get some filtering
            // '2017-12-13 00:00:00', '2017-12-13 23:59:59'
            var opt = new StripeChargeListOptions();

            opt.Limit             = 20;
            opt.IncludeTotalCount = true;
            opt.Created           = new StripeDateFilter()
            {
                GreaterThanOrEqual = fd, //new DateTime(2017, 12, 13, 0, 0, 0, DateTimeKind.Utc),
                LessThanOrEqual    = td  //new DateTime(2017, 12, 13, 23, 59, 59, DateTimeKind.Utc)
            };

            while (noErr)
            {
                StripeList <StripeCharge> s = null;
                try
                {
                    s = chargeService.List(opt);
                    chargeItems.AddRange(s.Data);
                    if (s.HasMore)
                    {
                        // get the object id of last item, so that next loop will fetch
                        // from that id onwards, until limit..
                        // int count = s.Data.Count;
                        // opt.StartingAfter = s.Data[count - 1].Id;
                        opt.StartingAfter = s.LastOrDefault().Id;
                    }
                    else
                    {
                        noErr = false;
                    }
                }
                catch (StripeException e)
                {
                    StripeExceptionHandler(e);
                    noErr = false;
                }
                catch (Exception exp)
                {
                    Console.WriteLine(exp.Message);
                    noErr = false;
                }
            }

            return(chargeItems);
        }
Example #8
0
        public StripeList <StripeCharge> GetCharges()
        {
            StripeConfiguration.SetApiKey(_stripeConfig.SecretKey);

            var chargeService = new StripeChargeService();

            return(chargeService.List(
                       new StripeChargeListOptions()
            {
                Limit = 30
            }
                       ));
        }
Example #9
0
        public charges_fixture()
        {
            // make sure there's a charge
            Cache.GetStripeCharge(Cache.ApiKey);

            ChargeListOptions = new StripeChargeListOptions
            {
            };

            var service = new StripeChargeService(Cache.ApiKey);

            Charges = service.List(ChargeListOptions);
        }
 public Task <IEnumerable <DomainCharge> > ListAsync(DomainCustomer customer, int count)
 {
     return(Task.Run(() =>
     {
         try
         {
             IEnumerable <StripeCharge> charges = _service.List(count, customer.Id);
             return Task.FromResult(_mapper.Map <IEnumerable <StripeCharge>, IEnumerable <DomainCharge> >(charges));
         }
         catch (StripeException e)
         {
             throw new BillingException(string.Format("Failed to list charges for customer {0}: {1}", customer.Id, e));
         }
     }));
 }
Example #11
0
        // GET: Admin/Charges
        public ActionResult Index()
        {
            var chargeService = new StripeChargeService();
            var charges       = chargeService.List().Select(c =>
                                                            new ChargeListViewModel
            {
                Id           = c.Id,
                Amount       = c.Amount,
                Created      = c.Created,
                CustomerName = c.Customer.Email,
                Paid         = c.Paid,
                Refunded     = c.Refunded,
                Status       = c.Status
            });

            return(View(charges));
        }
Example #12
0
        public JsonResult SubscriptionTransactionHistoryQuery(string inputDirection = null, string trxId = null)
        {
            //GET STRIPE CUSTOMER ID/TOKEN
            StripeIdRequest customerId = _userService.GetStripeCustomerId(_userService.GetCurrentUserId());

            //IF WE'VE CHARGED THIS CUSTOMER BEFORE, THEN SEND A REQUEST TO STRIPE FOR USER'S TRANSACTION
            //HISTORY. WE ALSO HAVE PAGINATION OPTIONS TOWARDS THE END OF THIS CONDITIONAL. THE WAY STRIPE'S PAGINATION
            //WORKS IS THAT THEY ALLOW YOU TO GET DATA AFTER A CERTAIN ID, OR BEFORE. SO WHEN WE PERFORM THIS REQUEST
            //WE ARE PASSING IN A TRANSACTION ID AND AN INPUT DIRECTION.
            if (customerId.Token != null)
            {
                var chargeService = new StripeChargeService();

                StripeChargeListOptions opts = new StripeChargeListOptions
                {
                    Limit      = 100,
                    CustomerId = customerId.Token
                };

                if (!string.IsNullOrEmpty(trxId) && inputDirection == "next")
                {
                    opts.StartingAfter = trxId; //LAST TRANSACTION NUMBER FROM SET
                }
                if (!string.IsNullOrEmpty(trxId) && inputDirection == "prev")
                {
                    opts.EndingBefore = trxId; //FIRST TRANSACTION NUMBER FROM SET
                }
                StripeList <StripeCharge> chargeItems = chargeService.List(opts);
                return(Json(chargeItems, JsonRequestBehavior.AllowGet));
            }
            //IF WE'VE NEVER CHARGED THE CURRENT USER BEFORE, YOU WOULDN'T HAVE ANY HISTORY, SO RETURN ERROR
            else
            {
                return(Json(new { message = "You have no transaction history!" }, JsonRequestBehavior.AllowGet));
            }
        }
Example #13
0
        public ActionResult verifyPayments()
        {
            try
            {
                var getStripes = (from s in db.stripes
                                  join p in db.properties on s.PropertyID equals p.PropertyID
                                  join c in db.companies on p.CompanyID equals c.CompanyID
                                  where c.Active == 1
                                  select s).ToList();

                foreach (var stripe in getStripes)
                {
                    // Villa Nueva for test
                    StripeConfiguration.SetApiKey(stripe.SecretKey);

                    // Get Payments for a month date range
                    DateTime today         = DateTime.Now;
                    var      chargeService = new StripeChargeService();
                    StripeList <StripeCharge> chargeItems = chargeService.List(
                        new StripeChargeListOptions()
                    {
                        Limit   = 1000,
                        Created = new StripeDateFilter
                        {
                            GreaterThanOrEqual = today.AddMonths(-1),
                            LessThanOrEqual    = today
                        }
                    }
                        );

                    foreach (var item in chargeItems)
                    {
                        if (item.Refunded)
                        {
                            // Remove it from tenant ledger if there
                            int tenantID = 0;
                            if (!string.IsNullOrEmpty(item.CustomerId))
                            {
                                var getStripeCustomer = db.stripe_customer.Where(x => x.StripeCustomer == item.CustomerId).FirstOrDefault();
                                if (getStripeCustomer != null)
                                {
                                    tenantID = (int)getStripeCustomer.TenantID;
                                }
                            }
                            else
                            {
                                TenantModel tm = new TenantModel();
                                tenantID = tm.getTenantID(item.Description);
                            }
                            double     amount = (double)item.Amount / 100;
                            SourceType source = item.Source.Type;
                            if (source.ToString() == "Card")
                            {
                                amount = (amount - 0.3) * 0.971;
                            }
                            else
                            {
                                double achAmount = amount * 0.008;
                                if (achAmount > 5)
                                {
                                    amount -= 5;
                                }
                                else
                                {
                                    amount -= achAmount;
                                }
                            }
                            amount = Math.Round(amount, 2);
                            Decimal paidAmount           = (decimal)amount;
                            var     getTenantTransaction = (from tt in db.tenanttransactions
                                                            where tt.TenantID == tenantID &&
                                                            tt.TenantTransactionDate == item.Created.Date &&
                                                            tt.TransactionAmount == paidAmount &&
                                                            (tt.Comment == "Tenant Payment - Online ACH Payment" || tt.Comment == "Tenant Payment - Online Tenant Credit Card Payment" || tt.Comment == "Tenant Payment via ACH" || tt.Comment == "Tenant Payment via Credit Card")
                                                            select tt).FirstOrDefault();

                            if (getTenantTransaction != null)
                            {
                                Decimal transactionAmount = getTenantTransaction.TransactionAmount;

                                // Send PM Email
                                var    getTenant = db.tenants.Where(x => x.TenantID == tenantID).FirstOrDefault();
                                var    getUnit   = db.units.Find(getTenant.UnitID);
                                Email  email     = new Email();
                                string ToEmail   = "";
                                ToEmail = email.getPropertyManagerEmail((int)getTenant.PropertyID);
                                if (string.IsNullOrEmpty(ToEmail))
                                {
                                    ToEmail = email.getAdminEmail((int)getTenant.PropertyID);
                                }

                                string emailBody = "The payment of " + string.Format("{0:C}", transactionAmount) + " made on " + item.Created.Date.ToString("MM/dd/yyyy") + " was deleted from ";
                                emailBody += "tenant: " + getTenant.TenantFName + " " + getTenant.TenantLName + ". Unit: " + getUnit.UnitName + ".\n\n";
                                emailBody += "Reason: Refunded";
                                string subject = "Tenant Payment Refunded";

                                int checkRegisterID = getTenantTransaction.CheckRegisterID;
                                var getCR           = db.checkregisters.Find(checkRegisterID);
                                if (getCR != null)
                                {
                                    db.checkregisters.Remove(getCR);
                                }

                                db.tenanttransactions.Remove(getTenantTransaction);
                                db.SaveChanges();

                                email.sendEmail(ToEmail, "*****@*****.**", subject, emailBody);
                            }
                        }
                    }
                }

                SendUsEmail emailOK = new SendUsEmail();
                emailOK.sendAlert("Just run Verify payments", "Verify Payments");
                return(new HttpStatusCodeResult(HttpStatusCode.OK));
            } catch (Exception any)
            {
                SendUsEmail email = new SendUsEmail();
                email.sendError(any.ToString(), "Error Verify Refunded Payments");
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
        }
Example #14
0
        public charges_fixture()
        {
            // make sure there's a charge
            Charge = Cache.GetStripeCharge(Cache.ApiKey);

            ChargeListOptions = new StripeChargeListOptions();

            var service = new StripeChargeService(Cache.ApiKey);

            Charges = service.List(ChargeListOptions);

            ChargeUpdateOptions = new StripeChargeUpdateOptions
            {
                Description = "updatd description",
                // setting the updated shipping object to the same object used for the create charge
                // i attempted to just create a new shipping object and set one property,
                // but it threw an error 'name' was not supplied (which was on the original)
                Shipping = Cache.GetStripeChargeCreateOptions().Shipping
            };

            ChargeUpdateOptions.Shipping.Phone          = "8675309";
            ChargeUpdateOptions.Shipping.TrackingNumber = "56789";

            UpdatedCharge = service.Update(Charge.Id, ChargeUpdateOptions);

            UncapturedCharge = Cache.GetStripeChargeUncaptured(Cache.ApiKey);

            ChargeCaptureOptions = new StripeChargeCaptureOptions
            {
                Amount = 123,
                StatementDescriptor = "CapturedCharge"
            };
            CapturedCharge = service.Capture(UncapturedCharge.Id, ChargeCaptureOptions);

            // Create a charge with Level 3 data
            var chargeLevel3Options = Cache.GetStripeChargeCreateOptions();

            chargeLevel3Options.Amount = 11700;
            chargeLevel3Options.Level3 = new StripeChargeLevel3Options
            {
                CustomerReference  = "customer 1",
                MerchantReference  = "1234",
                ShippingFromZip    = "90210",
                ShippingAddressZip = "94110",
                ShippingAmount     = 700,
                LineItems          = new List <StripeChargeLevel3LineItemOptions>
                {
                    new StripeChargeLevel3LineItemOptions
                    {
                        DiscountAmount     = 200,
                        ProductCode        = "1234",
                        ProductDescription = "description 1",
                        Quantity           = 2,
                        TaxAmount          = 200,
                        UnitCost           = 1000,
                    },
                    new StripeChargeLevel3LineItemOptions
                    {
                        DiscountAmount     = 300,
                        ProductCode        = "1235",
                        ProductDescription = "description 2",
                        Quantity           = 3,
                        TaxAmount          = 300,
                        UnitCost           = 3000,
                    },
                },
            };
            Level3Charge = service.Create(chargeLevel3Options);
        }
Example #15
0
        private bool CancelStripeSubscription(UserInfo userInfo)
        {
            var      customerService = new StripeCustomerService();
            DateTime?periodEnd;
            DateTime?periodStart;

            try
            {
                //cancels subscription at the end of the current period
                StripeSubscription stripeSubscription = customerService.CancelSubscription(userInfo.PaymentCustomerId);

                //save profile ID and profile status with user info
                userInfo.Subscribed            = false;
                userInfo.PaymentCustomerStatus = stripeSubscription.Status;
                periodEnd   = stripeSubscription.PeriodEnd;
                periodStart = stripeSubscription.PeriodStart;

                db.Entry(userInfo).State = EntityState.Modified;
            }
            catch (Exception e)
            {
                Utilities.LogAppError("Subscription cancel failed: " + e.Message);
                return(false);
            }

            try
            {
                //get the most recent charge
                var chargeService = new StripeChargeService();
                IEnumerable <StripeCharge> response = chargeService.List(1, 0, userInfo.PaymentCustomerId);

                if ((response != null) && (response.Count() > 0))
                {
                    StripeCharge charge = response.ElementAt(0);

                    //refund the charge (if paid)
                    if ((charge != null) && charge.Paid.HasValue && charge.Paid.Value)
                    {
                        int daysIntoPeriod = 0;

                        if (DateTime.Today.Date > periodStart.Value)
                        {
                            daysIntoPeriod = DateTime.Today.Date.Subtract(periodStart.Value).Days;
                        }

                        int   numDaysInPeriod   = periodEnd.Value.Date.Subtract(periodStart.Value.Date).Days;
                        float ratePerDayInCents = charge.AmountInCents.Value / numDaysInPeriod;

                        float amountOwed = daysIntoPeriod * ratePerDayInCents;

                        int?refundAmount = 0;

                        //round amount to nearest int
                        refundAmount = charge.AmountInCents.Value - Convert.ToInt32(amountOwed);

                        StripeCharge stripeCharge = chargeService.Refund(charge.Id, refundAmount);
                    }
                }
            }
            catch (Exception e)
            {
                Utilities.LogAppError("Refund failed: " + e.Message);
                return(false);
            }

            return(true);
        }
Example #16
0
        private void FrmProcessing_Shown(object sender, EventArgs e)
        {
            Cursor = Cursors.WaitCursor;
            Error  = null;

            var thread = new Thread(new ThreadStart(delegate
            {
                var api          = Properties.Settings.Default.StripeKey;
                var tokenService = new StripeTokenService(api);
                try
                {
                    var description = Description + " for ";
                    var tokenData   = new StripeTokenCreateOptions
                    {
                        CardNumber          = CardNumber,
                        CardExpirationMonth = CardMonth,
                        CardExpirationYear  = CardYear,
                        CardCvc             = CardCVC
                    };

                    if (Person != null)
                    {
                        tokenData.CardAddressLine1   = Person.Address1;
                        tokenData.CardAddressLine2   = Person.Address2;
                        tokenData.CardAddressCity    = Person.City;
                        tokenData.CardAddressState   = Person.State;
                        tokenData.CardAddressZip     = Person.ZipCode;
                        tokenData.CardAddressCountry = Person.Country;
                        tokenData.CardName           = Person.Name;
                        description += Person.Name + " (#" + Person.PeopleID + ")";
                    }
                    else
                    {
                        tokenData.CardName = PayeeName;
                        description       += PayeeName;
                    }

                    var token = tokenService.Create(tokenData);

                    var chargeData = new StripeChargeCreateOptions
                    {
                        TokenId       = token.Id,
                        Description   = description,
                        AmountInCents = Convert.ToInt32(Amount * 100),
                        Currency      = "usd"
                    };
                    var chargeService = new StripeChargeService(api);

                    if (!FirstTry)
                    {
                        // Double-check to see if we already have a charge recently that matches the details of this. Helps with dealing
                        // with timeout scenarios to prevent double-charges.
                        var lastCharges = chargeService.List(20, 0, null);
                        foreach (var charge in lastCharges)
                        {
                            if (charge.StripeCard.Last4 == CardNumber.Substring(CardNumber.Length - 4) &&
                                charge.StripeCard.ExpirationMonth.PadLeft(2, '0') == CardMonth &&
                                charge.StripeCard.ExpirationYear.Substring(2) == CardYear &&
                                charge.AmountInCents == Convert.ToInt32(Amount * 100) &&
                                charge.Description == "Purchases for " + Person.Name + " (#" + Person.PeopleID + ")")
                            {
                                Charge = charge;
                                break;
                            }
                        }
                    }

                    if (Charge == null)
                    {
                        Charge = chargeService.Create(chargeData);
                    }
                }
                catch (StripeException ex)
                {
                    Error = ex;
                }
                _processingDone = true;
            }));

            thread.Start();

            while (!_processingDone)
            {
                Application.DoEvents();
            }

            Cursor       = Cursors.Default;
            DialogResult = DialogResult.OK;
        }
Example #17
0
        /// <summary>
        /// As long as payments continue the users account will not expire
        /// </summary>
        private void CheckForNewPayments()
        {
            // retrieve all events for the past day and proceed to process
            // subscription cancellations.

            using (var db = InitializeSettings.DbFactory)
            {
                var data = db.Query <Majorsilence.Vpn.Poco.DatabaseInfo>("SELECT * FROM DatabaseInfo");

                if (data.Count() != 1)
                {
                    throw new Majorsilence.Vpn.Logic.Exceptions.InvalidDataException("Incorrect data in DatabaseInfo table.  To many or too few rows.");
                }


                Helpers.SslSecurity.Callback();

                var eventService = new StripeChargeService(Majorsilence.Vpn.Logic.Helpers.SiteInfo.StripeAPISecretKey);
                var options      = new StripeChargeListOptions()
                {
                    Limit   = 1000,
                    Created = new StripeDateFilter
                    {
                        GreaterThanOrEqual = data.First().LastDailyProcess
                    }
                };


                IEnumerable <StripeCharge> response = eventService.List(options);

                foreach (var evt in response)
                {
                    //if (evt.LiveMode == false)
                    //{
                    //    continue;
                    //}

                    // A new payment has been made.

                    string stripeCustomerId = evt.CustomerId;


                    //var users = db.Select<Majorsilence.Vpn.Poco.Users>(q => q.PaymentExpired == false);
                    var user = db.Query <Majorsilence.Vpn.Poco.Users>("SELECT * FROM Users WHERE StripeCustomerAccount=@StripeCustomerAccount",
                                                                      new { StripeCustomerAccount = stripeCustomerId });

                    if (user == null || user.Count() != 1)
                    {
                        var ex = new Majorsilence.Vpn.Logic.Exceptions.InvalidDataException("Cannot find stripe customer data in users table.  Stripe Customer Account: " +
                                                                                            stripeCustomerId);

                        Majorsilence.Vpn.Logic.Helpers.Logging.Log(ex);
                        InitializeSettings.Email.SendMail_BackgroundThread("Error running DailyProcessing: " + ex.Message,
                                                                           "Error running DailyProcessing", Majorsilence.Vpn.Logic.Helpers.SiteInfo.AdminEmail, true, null,
                                                                           Email.EmailTemplates.Generic);

                        continue;
                    }

                    int userid = user.First().Id;
                    var pay    = new Payments.Payment(userid);

                    // amount in cents
                    pay.SaveUserPayment((decimal)(evt.Amount / 100.0m), evt.Created, Helpers.SiteInfo.MonthlyPaymentId);

                    Majorsilence.Vpn.Logic.ActionLog.Log_BackgroundThread("Payment made", userid);
                }



                data.First().LastDailyProcess = DateTime.UtcNow;

                db.Update(data.First());
            }
        }