Exemplo n.º 1
0
    // ================================================================
    //  Events
    // ================================================================
    public void AddIBEntryView()
    {
        IBEntryView newView = Instantiate(ResourcesHandler.Instance.IBEntryView).GetComponent <IBEntryView>();

        newView.Initialize(this, new IBData(CustomDate.FromDateTime(selectedDate), entryViews.Count));
        entryViews.Add(newView);
    }
        public List <CustomDate> MapCustomDate(List <Employee> data)
        {
            var customeDateList = new List <CustomDate>();

            if (data == null)
            {
                return(customeDateList);
            }

            foreach (var employee in data)
            {
                if (employee.CustomDates == null)
                {
                    continue;
                }
                foreach (var customDate in employee.CustomDates)
                {
                    var employeeCustomDate = new CustomDate
                    {
                        Person = new PersonData
                        {
                            PersonNumber = employee.PersonNumber,
                            LastName     = employee.LastName,
                            FirstName    = employee.FirstName
                        },
                        CustomDateTypeName = customDate.CustomDateTypeName,
                        Date = customDate.Date
                    };

                    customeDateList.Add(employeeCustomDate);
                }
            }

            return(customeDateList);
        }
Exemplo n.º 3
0
 public IBData(CustomDate myDate, int myIndex, string belief, string debate)
 {
     this.myDate  = myDate;
     this.myIndex = myIndex;
     this.belief  = belief;
     this.debate  = debate;
 }
Exemplo n.º 4
0
        public ActionResult RemoveCustomDate(int id)
        {
            using (MTCDbContext db = new MTCDbContext())
            {
                var response = new TransactionResult();
                try
                {
                    CustomDate CustomDate = db.CustomDates.Find(id);
                    if (CustomDate != null)
                    {
                        var customScheduleIds = db.CustomSchedules.Where(p => p.CustomDateId == id).Select(p => p.Id).ToList();
                        db.BeatCustomSchedules.RemoveRange(db.BeatCustomSchedules.Where(p => customScheduleIds.Contains(p.CustomScheduleId)));
                        db.CustomSchedules.RemoveRange(db.CustomSchedules.Where(p => p.CustomDateId == id));
                        db.CustomDates.Remove(CustomDate);
                        db.SaveChanges();
                    }

                    response.HasError = false;
                    response.Message  = String.Empty;
                }
                catch (Exception ex)
                {
                    response.HasError = true;
                    response.Message  = ex.InnerException.Message;
                }

                return(Json(response, JsonRequestBehavior.AllowGet));
            }
        }
Exemplo n.º 5
0
 public IBData(CustomDate myDate, int myIndex)
 {
     this.myDate  = myDate;
     this.myIndex = myIndex;
     this.belief  = "";
     this.debate  = "";
 }
Exemplo n.º 6
0
    private static IBData LoadIBData(DateTime date, int index)
    {
        string saveKey        = SaveKeys.IBEntry(CustomDate.FromDateTime(date), index);
        string saveDataString = SaveStorage.GetString(saveKey);

        return(JsonUtility.FromJson <IBData>(saveDataString));
    }
Exemplo n.º 7
0
        public JsonResult GetCustomDateDetailsForAward(int awardId)
        {
            CustomDate customDateDetails = _customDateService.CustomDateDetailsForAward(awardId);

            if (customDateDetails == null)
            {
                customDateDetails                  = new CustomDate();
                customDateDetails.Year             = DateTime.Now.Year;
                customDateDetails.Month            = DateTime.Now.Month;
                customDateDetails.IsApplicable     = true;
                customDateDetails.MonthsToSubtract = 0;
            }
            customDateDetails.Award = _awardService.GetAwardById(awardId);

            var details = new
            {
                AwardName        = customDateDetails.Award.Name,
                Year             = customDateDetails.Year,
                Month            = customDateDetails.Month,
                MonthName        = CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(customDateDetails.Month.Value),
                IsApplicable     = customDateDetails.IsApplicable,
                MonthsToSubtract = customDateDetails.MonthsToSubtract
            };

            return(Json(details, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 8
0
    void Init()
    {
        if (yearContent.childCount > 0)
        {
            return;
        }

        Debug.Log("Init()");
        customDate = new CustomDate(1, 1, 2020);

        Text temp;

        // Init Years
        for (int i = 0; i < numberOfYears; i++)
        {
            temp      = Instantiate(text, yearContent);
            temp.text = startingYear + i + "";
        }

        // Init Months
        for (int i = 0; i < 12; i++)
        {
            temp = Instantiate(text, monthContent);

            if (i + 1 < 10)
            {
                temp.text = "0" + (1 + i);
            }
            else
            {
                temp.text = (1 + i) + "";
            }
        }

        // Init Days
        for (int i = 0; i < 31; i++)
        {
            temp = Instantiate(text, dayContent);

            if (i + 1 < 10)
            {
                temp.text = "0" + (1 + i);
            }
            else
            {
                temp.text = (1 + i) + "";
            }
        }

        if (last3Days == null)
        {
            last3Days = new List <Transform>();

            for (int i = 28; i < 31; i++)
            {
                last3Days.Add(dayContent.GetChild(i));
            }
        }
    }
Exemplo n.º 9
0
        public void isWeekend_Saturday_ReturnsTrue()
        {
            string date = "20Mar2019(sat)";

            bool result = CustomDate.isWeekend(date);

            Assert.IsTrue(result);
        }
Exemplo n.º 10
0
        public void isWeekend_Friday_ReturnsFalse()
        {
            string date = "20Mar2019(fri)";

            bool result = CustomDate.isWeekend(date);

            Assert.IsFalse(result);
        }
Exemplo n.º 11
0
 public ActionResult Index(CustomDate model)
 {
     if (ModelState.IsValid)
     {
         CustomDateUtility cdu = new CustomDateUtility();
         ViewBag.message = "Total number of days is " + cdu.CalculateDifferenceInDays(model.FromDate, model.ToDate);
     }
     return(View(model));
 }
 static ServiceStackSerializer()
 {
     // use custom serialization only for our own types
     JsConfig <CustomDate> .SerializeFn            = c => c;
     JsConfig <CustomDate> .DeSerializeFn          = s => CustomDate.Parse(s);
     JsConfig <CustomDateTime> .SerializeFn        = c => c;
     JsConfig <CustomDateTime> .DeSerializeFn      = s => CustomDateTime.Parse(s);
     JsConfig <CustomDateTimeSpace> .SerializeFn   = c => c;
     JsConfig <CustomDateTimeSpace> .DeSerializeFn = s => CustomDateTimeSpace.Parse(s);
 }
Exemplo n.º 13
0
        private static DailySteamUserInfo GetTodayInfo(SteamUser user, CustomDate nowCustomDate)
        {
            DailySteamUserInfo today =
                user.DailyInfos.FirstOrDefault(k => k.CustomDate == nowCustomDate);

            if (today != null)
            {
                return(today);
            }

            user.DailyInfos.Add(new DailySteamUserInfo(nowCustomDate));
            today = user.DailyInfos.First(k => k.CustomDate == nowCustomDate);
            return(today);
        }
Exemplo n.º 14
0
        //private void SetRate()
        //{
        //    string currentDate = GetCustomDate(DateTime.Now);
        //    var nowDateInfo = GetDate(currentDate);
        //    var dateInfo = GetDate(UserConfig.StartTime);
        //    var offsetY = dateInfo.Year;
        //    var offsetM = dateInfo.Month;
        //    while (offsetY < nowDateInfo.Year ||
        //           offsetY == nowDateInfo.Year && offsetM <= nowDateInfo.Month)
        //    {
        //        string key = GetCustomDate(new DateInfo(offsetY, offsetM));

        //        double total = UserConfig.SteamUsers.Select(k =>
        //            (double)k.DailyInfos[key].SupportedYuan / k.DailyInfos[key].OnlineTime).Sum();
        //        foreach (var user in UserConfig.SteamUsers)
        //        {
        //            user.DailyInfos[key].Rate =
        //                ((double)user.DailyInfos[key].SupportedYuan / user.DailyInfos[key].OnlineTime) / total;
        //        }

        //        offsetM++;
        //        if (offsetM == 13)
        //        {
        //            offsetM = 1;
        //            offsetY += 1;
        //        }
        //    }
        //}

        private static void UpdateDisconnectInfo(SteamUser user)
        {
            user.LastDisconnect = DateTime.Now;
            user.IsOnline       = false;
            var date = new CustomDate(DateTime.Now);
            var time = user.LastDisconnect - user.LastConnect;

            if (time != null)
            {
                DailySteamUserInfo todayinfo = GetTodayInfo(user, date);
                todayinfo.OnlineTime += time.Value.TotalMinutes;
            }

            Console.WriteLine($"OFFLINE: {user.CurrentName} ({user.SteamUid}) {user.LastDisconnect}");
        }
Exemplo n.º 15
0
        public void IndexPostTest()
        {
            // Arrange
            HomeController controller = new HomeController();
            var            date       = new CustomDate("20/02/2010", "19/06/2019");

            // Act
            ViewResult result = (ViewResult)controller.Index(date);

            // Assert
            if (result != null)
            {
                Assert.AreEqual("Total number of days is 3405", (string)controller.ViewBag.message);
            }
        }
Exemplo n.º 16
0
        private void onClickTakeNewCustomDate(object sender, RoutedEventArgs e)
        {
            if (CustomDate.Show() == Dialogs.CustomDefaultDialog.DialogResult.Ok)
            {
                ItemCustom = Client.Server.ConnectProvider.SendStatInfo(
                    CustomDate.GetStartDate(),
                    CustomDate.GetFinalDate()
                    );

                label_CustomDate.Text = $"{ItemCustom.StartDate.ToShortDateString()} - {ItemCustom.FinalDate.ToShortDateString()}";
                SetStatInfo(ItemCustom);

                DeactiveActiveButton();
                this.Page = StatisticPage.Custom;
                ActiveDeactiveButton();
            }
        }
Exemplo n.º 17
0
        private void RunMissingDayFix()
        {
            Task.Run(() =>
            {
                while (true)
                {
                    Random rnd = new Random();
                    foreach (var user in UserConfig.SteamUsers)
                    {
                        var date      = new CustomDate(DateTime.Now);
                        var startDate = CustomDate.Parse(UserConfig.StartTime);
                        //var startDate = new CustomDate(DateTime.Now.AddDays(-2));
                        var y = startDate.Year;
                        var m = startDate.Month;
                        var d = startDate.Day;
                        while (y < date.Year ||
                               y == date.Year && m < date.Month ||
                               y == date.Year && m == date.Month && d <= date.Day)
                        {
                            _ = GetTodayInfo(user, new CustomDate(y, m, d));
                            //var sb = GetTodayInfo(user, new CustomDate(y, m, d));
                            //sb.HurtList.Add(new WeaponCell("Chrome Shotgun", rnd.Next(1, 101)));
                            //sb.HurtTimesList.Add(new WeaponCell("Chrome Shotgun", rnd.Next(1, 30)));
                            //sb.DamageList.Add(new WeaponCell("Chrome Shotgun", rnd.Next(1, 101)));
                            //sb.DamageTimesList.Add(new WeaponCell("Chrome Shotgun", rnd.Next(1, 30)));
                            //sb.OnlineTime = rnd.NextDouble() * 100;
                            //sb.SupportedYuan = rnd.Next(10);

                            var dt = new DateTime(y, m, d).AddDays(1);
                            y      = dt.Year;
                            m      = dt.Month;
                            d      = dt.Day;
                        }
                    }

                    SaveConfig();
                    Thread.Sleep((int)TimeSpan.FromDays(1).TotalMilliseconds);
                }
            });
        }
Exemplo n.º 18
0
        public void exhibit_should_display_correct_date_in_ce()
        {
            var contentItemPdf = new ContentItem
            {
                Title       = RandomString.GetRandomString(1, 200),
                Caption     = RandomString.GetRandomString(1, 200),
                MediaSource = RandomUrl.GetRandomWebUrl(),
                MediaType   = "pdf",
                Attribution = RandomString.GetRandomString(1, 200),
                Uri         = RandomUrl.GetRandomPdfUrl(),
                Order       = 0
            };
            CustomDate date = RandomDate.GetRandomDate(1900);

            _newExhibit = new Exhibit
            {
                Title        = RandomString.GetRandomString(1, 200),
                ContentItems = new Collection <ContentItem> {
                    contentItemPdf
                },

                Month       = date.MonthName,
                Day         = date.Day.ToString(CultureInfo.InvariantCulture),
                Year        = ExhibitHelper.GetCoordinateFromYmd(date.Year, date.MonthNumber, date.Day),
                Timeline_ID = new Guid("bdc1ceff-76f8-4df4-ba72-96b353991314")
            };
            ApiHelper.CreateExhibitByApi(_newExhibit);
            HomePageHelper.OpenSandboxPage();
            ExhibitHelper.NavigateToExhibit(_newExhibit);
            string displayDate = ExhibitHelper.GetExhibitDisplayDate(_newExhibit);

            StringAssert.Contains(displayDate, "CE");
            StringAssert.Contains(displayDate, date.Year.ToString(CultureInfo.InvariantCulture));
            StringAssert.Contains(displayDate, _newExhibit.Day);
            if (GitHubIssueWatcher.IssueStatus.IsIssueResolved("1024"))
            {
                StringAssert.Contains(displayDate, DateTime.ParseExact(_newExhibit.Month, "MMMM", CultureInfo.InvariantCulture).Month.ToString(CultureInfo.InvariantCulture));
            }
        }
Exemplo n.º 19
0
        public void SetStatisticPage(StatisticPage Page)
        {
            if (this.Page == Page)
            {
                return;
            }

            if (Page == StatisticPage.Year)
            {
                if (ItemYear == null)
                {
                    ItemYear       = Client.Server.ConnectProvider.SendStatInfo(DateTime.Now.AddDays(-365), DateTime.Now);
                    ItemYearUpdate = DateTime.Now;
                }
                else
                {
                    if (DateTime.Now > ItemYearUpdate.AddMinutes(10))
                    {
                        ItemYear       = Client.Server.ConnectProvider.SendStatInfo(DateTime.Now.AddDays(-365), DateTime.Now);
                        ItemYearUpdate = DateTime.Now;
                    }
                }

                label_YearDate.Text = $"{ItemYear.StartDate.ToShortDateString()} - {ItemYear.FinalDate.ToShortDateString()}";
                SetStatInfo(ItemYear);
            }

            if (Page == StatisticPage.Month)
            {
                if (ItemMonth == null)
                {
                    ItemMonth       = Client.Server.ConnectProvider.SendStatInfo(DateTime.Now.AddDays(-30), DateTime.Now);
                    ItemMonthUpdate = DateTime.Now;
                }
                else
                {
                    if (DateTime.Now > ItemMonthUpdate.AddMinutes(10))
                    {
                        ItemMonth       = Client.Server.ConnectProvider.SendStatInfo(DateTime.Now.AddDays(-30), DateTime.Now);
                        ItemMonthUpdate = DateTime.Now;
                    }
                }

                label_MonthDate.Text = $"{ItemMonth.StartDate.ToShortDateString()} - {ItemMonth.FinalDate.ToShortDateString()}";
                SetStatInfo(ItemMonth);
            }

            if (Page == StatisticPage.Week)
            {
                if (ItemWeek == null)
                {
                    ItemWeek       = Client.Server.ConnectProvider.SendStatInfo(DateTime.Now.AddDays(-7), DateTime.Now);
                    ItemWeekUpdate = DateTime.Now;
                }
                else
                {
                    if (DateTime.Now > ItemWeekUpdate.AddMinutes(10))
                    {
                        ItemWeek       = Client.Server.ConnectProvider.SendStatInfo(DateTime.Now.AddDays(-7), DateTime.Now);
                        ItemWeekUpdate = DateTime.Now;
                    }
                }

                label_WeekDate.Text = $"{ItemWeek.StartDate.ToShortDateString()} - {ItemWeek.FinalDate.ToShortDateString()}";
                SetStatInfo(ItemWeek);
            }

            if (Page == StatisticPage.Day)
            {
                if (ItemDay == null)
                {
                    ItemDay       = Client.Server.ConnectProvider.SendStatInfo(DateTime.Now.AddDays(-1), DateTime.Now);
                    ItemDayUpdate = DateTime.Now;
                }
                else
                {
                    if (DateTime.Now > ItemDayUpdate.AddMinutes(10))
                    {
                        ItemDay       = Client.Server.ConnectProvider.SendStatInfo(DateTime.Now.AddDays(-1), DateTime.Now);
                        ItemDayUpdate = DateTime.Now;
                    }
                }

                label_DayDate.Text = $"{ItemDay.StartDate.ToShortDateString()} - {ItemDay.FinalDate.ToShortDateString()}";
                SetStatInfo(ItemDay);
            }

            if (Page == StatisticPage.Custom)
            {
                if (ItemCustom == null)
                {
                    if (CustomDate.Show() == Dialogs.CustomDefaultDialog.DialogResult.Ok)
                    {
                        ItemCustom = Client.Server.ConnectProvider.SendStatInfo(
                            CustomDate.GetStartDate(),
                            CustomDate.GetFinalDate()
                            );
                    }
                    else
                    {
                        return;
                    }
                }

                label_CustomDate.Text = $"{ItemCustom.StartDate.ToShortDateString()} - {ItemCustom.FinalDate.ToShortDateString()}";
                SetStatInfo(ItemCustom);
            }

            DeactiveActiveButton();

            this.Page = Page;
            ActiveDeactiveButton();
        }
Exemplo n.º 20
0
        public ActionResult Radio_check(Showuserdetails c1, String tokenlist, string title, string description, string link)
        {
            List <string> tokens = tokenlist.Split(',').ToList <string>();

            tokens.Reverse();

            dataConnect dc = new dataConnect();

            int i = 0;

            //SENXEX and NIFTY both are  down for the first time

            for (i = 0; i < tokens.Count(); i++)
            {
                AddNotificationData obj1 = new AddNotificationData();
                obj1.startTransaction();

                Showuserdetails u = new Showuserdetails();
                u = dc.getUserDetails(tokens[i]);
                Responce             res = new Responce();
                Req_NotificationData req = new Req_NotificationData();

                //req.baseobject.notificationcode = Constants.Notification_CUSTOM_GENERAL;

                //title = "SENXEX and NIFTY both are  down for the first time";
                //description = "Read More....";
                //link = "http://www.cantechletter.com/wp-content/uploads/2013/05/charging-bull-new-york-400x314.jpg";


                req.userid           = (u.ud.uid).ToString();
                req.insertDT         = CustomDate.getTodayDate();
                req.notificationcode = Constants.Notification_CUSTOM_GENERAL;
                req.message          = title;


                CustomNotificationModel model = new CustomNotificationModel();
                model.title            = title;
                model.notificationcode = Constants.Notification_CUSTOM_GENERAL;
                model.description      = description;
                model.link             = link;
                model.parent           = "marketview";

                string json = new JavaScriptSerializer().Serialize(model);

                req.custom = json;
                req.os     = u.ut.os;
                req.token  = tokens[i];

                VSMService1 service1 = new VSMService1();
                obj1.execute(req, res);

                int r = res.result;

                if (r == 0)
                {
                    obj1.rollbackTransaction();
                }
                else
                {
                    obj1.commitTransaction();
                }
            }

            return(RedirectToAction("AllUsers"));
        }
Exemplo n.º 21
0
 public override string ToString()
 {
     return(CustomDate.ToString());
 }
Exemplo n.º 22
0
 // Entries
 public static string IBEntry(CustomDate date, int index)
 {
     return("data_ib_"
            + date.Year + "_" + date.Month + "_" + date.Day
            + "_" + index);
 }
Exemplo n.º 23
0
        public ActionResult SaveCustomDate(ScheduleDateViewModel model)
        {
            using (MTCDbContext db = new MTCDbContext())
            {
                CustomDate CustomDate = null;
                bool       isNew      = false;
                if (model.Id > 0)
                {
                    CustomDate = db.CustomDates.Find(model.Id);
                }
                else
                {
                    CustomDate           = new CustomDate();
                    CustomDate.CreatedOn = DateTime.Now;
                    CustomDate.CreatedBy = HttpContext.User.Identity.Name;
                    isNew = true;
                }

                if (model.Times != null)
                {
                    foreach (var time in model.Times)
                    {
                        if (db.CustomSchedules.Any(p => p.CustomDateId == CustomDate.Id && p.ScheduleName == time.ScheduleName))
                        {
                            var CustomSchedule = db.CustomSchedules.FirstOrDefault(p => p.CustomDateId == CustomDate.Id && p.ScheduleName == time.ScheduleName);
                            CustomSchedule.StartTime  = TimeSpan.Parse(time.StartTime);
                            CustomSchedule.EndTime    = TimeSpan.Parse(time.EndTime);
                            CustomSchedule.ModifiedBy = HttpContext.User.Identity.Name;
                            CustomSchedule.ModifiedOn = DateTime.Now;
                        }
                        else
                        {
                            db.CustomSchedules.Add(new CustomSchedule
                            {
                                CustomDateId = CustomDate.Id,
                                ScheduleId   = Guid.NewGuid(),
                                ScheduleName = time.ScheduleName,
                                StartTime    = TimeSpan.Parse(time.StartTime),
                                EndTime      = TimeSpan.Parse(time.EndTime),
                                CreatedBy    = HttpContext.User.Identity.Name,
                                ModifiedBy   = HttpContext.User.Identity.Name,
                                CreatedOn    = DateTime.Now,
                                ModifiedOn   = DateTime.Now
                            });
                        }
                    }
                }


                CustomDate.Name         = model.Name;
                CustomDate.Abbreviation = model.Abbreviation;
                CustomDate.Date         = model.Date;
                CustomDate.EndDate      = model.EndDate;

                CustomDate.ModifiedOn = DateTime.Now;
                CustomDate.ModifiedBy = HttpContext.User.Identity.Name;

                if (isNew)
                {
                    db.CustomDates.Add(CustomDate);
                }

                db.SaveChanges();

                return(Json(true, JsonRequestBehavior.AllowGet));
            }
        }
Exemplo n.º 24
0
        private bool DetectFriendlyFire(string source)
        {
            const string blackKey1 = ": [l4d_ff_tracker.smx] STEAM_";
            const string blackKey2 = " => ";

            var blackI1 = source.IndexOf(blackKey1, StringComparison.Ordinal);

            if (blackI1 == -1)
            {
                return(false);
            }
            var blackI2 = source.IndexOf(blackKey2, StringComparison.Ordinal);

            if (blackI2 == -1)
            {
                return(false);
            }
            var  steamUid = source.Substring(blackKey1.Length + blackI1 - 6, blackI2 - (blackKey1.Length + blackI1 - 6));
            var  user     = UserConfig.SteamUsers.FirstOrDefault(k => k.SteamUid == steamUid && k.IsOnline);
            bool isValid  = false;

            if (user == null)
            {
                return(false);
            }

            var       info      = source.Substring(blackI2 + 4);
            var       infoArray = info.Split(" [").Select(k => k.Trim(']')).ToArray();
            string    botOrUid  = infoArray[0];
            string    weapon    = infoArray[1];
            int       damage    = int.Parse(infoArray[2].Split(' ')[0]);
            bool      isBot     = botOrUid == "BOT";
            SteamUser user2     = null;

            if (!isBot)
            {
                user2 = UserConfig.SteamUsers.FirstOrDefault(k => k.SteamUid == botOrUid && k.IsOnline);
                if (user2 != null)
                {
                    isValid = true;
                }
            }
            else
            {
                Console.WriteLine($"FF: {user.CurrentName} =({weapon})> BOT [{damage} HP]");
            }

            if (!isValid)
            {
                return(false);
            }
            var nowCustomDate             = new CustomDate(DateTime.Now);
            DailySteamUserInfo user1Today = GetTodayInfo(user, nowCustomDate);  //user1 today info (create if not exist)
            DailySteamUserInfo user2Today = GetTodayInfo(user2, nowCustomDate); //user2 today info

            GetWeapon(weapon, user1Today.WeaponInfos).Damage += damage;         //1 damage (create if not exist)
            GetWeapon(weapon, user2Today.WeaponInfos).Hurt   += damage;         //2 hurt

            GetWeapon(weapon, user1Today.WeaponInfos).DamageTimes += 1;         //1 damage count
            GetWeapon(weapon, user2Today.WeaponInfos).HurtTimes   += 1;         //2 hurt count

            Console.WriteLine($"FF: {user.CurrentName} =({weapon})> {user2.CurrentName} [{damage} HP]");

            return(true);
        }
Exemplo n.º 25
0
 public void OnDateSet(CustomDate date)
 {
     selectedDate  = date;
     dateText.text = date.GetDate();
 }