void BindDate()
        {
            List <int>    dayList   = new List <int>();
            List <string> monthList = new List <string>();
            List <string> yearList  = new List <string>();

            for (int i = 1; i <= 31; i++)
            {
                if (i <= 12)
                {
                    monthList.Add(i.ToString());
                }
                dayList.Add(i);
            }

            for (int i = 1990; i < 2010; i++)
            {
                yearList.Add(i.ToString());
            }

            DayList.DataSource = dayList;
            DayList.DataBind();

            MonthList.DataSource = monthList;
            MonthList.DataBind();

            YearList.DataSource = yearList;
            YearList.DataBind();
        }
예제 #2
0
        public bool OneDayAfterAllow()
        {
            var _date       = DayList.Last().Date;
            var daysInMonth = DateTime.DaysInMonth(_date.Year, _date.Month);

            return(!IsBusy && _date.Day < daysInMonth);
        }
예제 #3
0
    public static DayList  Create()
    {
        DayList asset = ScriptableObject.CreateInstance <DayList>();

        AssetDatabase.CreateAsset(asset, "Assets/DayList.asset");
        AssetDatabase.SaveAssets();
        return(asset);
    }
        public void OneDayAfterAction()
        {
            IsBusy = true;

            DayList.RemoveAt(0);

            DayList.Add(EntireMonth[DayList.Last().Date.Day]);

            IsBusy = false;
        }
        public void OneDayBeforeAction()
        {
            IsBusy = true;

            DayList.RemoveAt(DayList.Count - 1);

            DayList.Insert(0, EntireMonth[DayList.First().Date.Day - 2]);

            IsBusy = false;
        }
예제 #6
0
        public void OneDayBeforeAction()
        {
            IsBusy = true;
            DayList.RemoveAt(DayList.Count - 1);
            DayList.Insert(0, new DayOverviewViewModel()
            {
                Date = DayList[0].Date.AddDays(-1)
            });

            IsBusy = false;
        }
예제 #7
0
        public void OneDayAfterAction()
        {
            IsBusy = true;
            var _date = DayList.Last().Date;

            DayList.RemoveAt(0);
            DayList.Add(new DayOverviewViewModel()
            {
                Date = _date.AddDays(+1)
            });

            IsBusy = false;
        }
예제 #8
0
        private void SaveDay()
        {
            DayAdd.WorkoutId = WorkoutAdd.Id;
            if (DayAdd.Id == 0)
            {
                new DayRepository().Save(DayAdd);
                DayList.Add(DayAdd);
            }
            else
            {
                new DayRepository().Update(DayAdd);
                DayList = new ObservableCollection <Day>(new DayRepository().GetAll());
                OnPropertyChanged("DayList");
            }

            //DayAdd = new Day();
            //OnPropertyChanged("DayAdd");
        }
예제 #9
0
 private void MonthList_SelectedIndexChanged(object sender, EventArgs e)
 {
     DayList.Visible = false;
     DayList.ClearSelected();
     DayList.Items.Clear();
     if (MonthList.Text != "")
     {
         if (int.Parse(YearList.Text) == today.Year && int.Parse(MonthList.Text) == 2)
         {
             timeListAdder.Fill_Day(DayList, today.Day);
         }
         else
         {
             timeListAdder.Fill_Day(DayList, validation.Maximum_Days_Month(int.Parse(MonthList.Text), int.Parse(YearList.Text)));
         }
         DayList.Visible = true;
     }
 }
예제 #10
0
        public async Task <JsonResponse> CreateDayList(CreateDayListViewModel model)
        {
            var transact = _context.Database.BeginTransaction();
            var response = new JsonResponse();

            try
            {
                var dayList = new DayList()
                {
                    Name             = model.name,
                    DateAdded        = _dateProvider.GetCurrentDateTime(),
                    SubscriberUserId = _userProvider.GetUserId()
                };

                _context.DayLists.Add(dayList);
                await _context.SaveChangesAsync();

                foreach (var place in model.dayListPlaces)
                {
                    _context.PlaceDayLists.Add(new PlaceDayList()
                    {
                        PlaceId   = place.Id,
                        DayListId = dayList.Id,
                        ZoomLevel = 8
                    });
                }

                await _context.SaveChangesAsync();

                transact.Commit();

                return(response);
            }
            catch
            {
                transact.Rollback();
                response.Success = false;
                response.Errors.Add("An error occurred while writing to the database.");

                return(response);
            }
        }
예제 #11
0
    protected void Page_Load(object sender, EventArgs e)
    {
        uid    = Request.QueryString["Id"];
        action = Request.QueryString["Action"];
        if (!Page.IsPostBack)
        {
            YearList.DataSource = Enumerable.Range(startYear, DateTime.Now.Year - startYear + 1).Reverse();
            YearList.DataBind();
            MonthList.DataSource = Enumerable.Range(1, 12);
            MonthList.DataBind();
        }
        if (action == "create")
        {
        }
        else
        {
        }
        Comment.Visible = false;
        Boolean isLeapYear = IsLeapYear();
        int     year       = int.Parse(YearList.SelectedValue);
        int     month      = int.Parse(MonthList.SelectedValue);
        int     endDate    = 30;

        int[] bigMonth = { 1, 3, 5, 7, 8, 10, 12 };
        if (bigMonth.Contains(month))
        {
            endDate = 31;
        }
        if (month == 2)
        {
            if (isLeapYear == true)
            {
                endDate = 29;
            }
            else
            {
                endDate = 28;
            }
        }
        DayList.DataSource = Enumerable.Range(1, endDate);
        DayList.DataBind();
    }
예제 #12
0
      public ActionResult Create(DayList d, FormCollection f)
      {
          string clinicid = f["Clinics"].ToString();



          if (clinicid == null)
          {
              return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
          }


          d.ClinicId = int.Parse(clinicid);
          var c = db.Clinics.Find(d.ClinicId);

          if (c.DayLists.ToList().Find(q => q.DayName == d.DayName) != null)
          {
              return(RedirectToAction("YourclinicDaylist"));
          }

          if (ModelState.IsValid)
          {
              db.DayLists.Add(d);
              for (int i = (int)c.StartTime; i < (int)c.EndTime; i++)
              {
                  AvailableTimesList availableTimes = new AvailableTimesList {
                      DayListId = d.Id, Taken = false, Slot_start = (TimeSlots)i
                  };

                  db.AvailableTimesLists.Add(availableTimes);
              }

              db.SaveChanges();

              return(RedirectToAction("YourclinicDaylist"));
          }


          return(View());
      }
예제 #13
0
      public ActionResult Delete(int?id)

      {
          if (id == null)
          {
              return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
          }

          var user = User.Identity.GetUserId();

          DayList day = db.DayLists.Find(id);

          if (day.Clinic.userId == user)
          {
              db.DayLists.Remove(day);
              db.SaveChanges();

              return(RedirectToAction("YourclinicDaylist"));
          }

          return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
      }
 public bool OneDayBeforeAllow()
 {
     return(!IsBusy && DayList.First().Date.Day > 1);
 }
예제 #15
0
 public ByDayToken(DayList dayList) : base(dayList)
 {
 }
예제 #16
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         PhysicsBooking phb1 = new PhysicsBooking();
         string         s    = Request.Params.Get("BookingId");
         if (s != null)
         {
             phb1.Load(s);
         }
         else
         {
             Utility u = new Utility();
             phb1.DayId    = System.Convert.ToInt16(Request.Params.Get("Day"));
             phb1.StaffId  = new Guid(u.Get_StaffID(Request.Params.Get("Staff")));
             phb1.Date     = System.Convert.ToDateTime(Request.Params.Get("Date"));//this is week beginning...
             phb1.Date     = phb1.Date.AddDays(phb1.DayId);
             phb1.PeriodId = u.Get_PeriodId_fromcode(Request.Params.Get("Period"));
             phb1.RoomId   = u.Get_RoomId_fromCode(Request.Params.Get("Room"));
             Group g1 = new Group(); g1.Load(Request.Params.Get("Group"), phb1.Date);
             phb1.GroupId = g1._GroupID;
             s            = Request.Params.Get("Group");
             if (s.StartsWith("10") || s.StartsWith("11"))
             {
                 RadioButtonList1.SelectedIndex = 1;
             }
             if (s.StartsWith("12") || s.StartsWith("13"))
             {
                 RadioButtonList1.SelectedIndex = 2;
             }
             if (s.StartsWith("7") || s.StartsWith("8") || s.StartsWith("9"))
             {
                 RadioButtonList1.SelectedIndex = 0;
             }
         }
         DayList dlist1 = new DayList();
         s = dlist1.FindDayName_fromId(phb1.DayId);
         servercontent.InnerHtml = "<h3>Booking for " + s + " Period " + Request.Params.Get("Period") + " for Group " + Request.Params.Get("Group") + " and Room " + Request.Params.Get("Room") + "</h3>";
         if (phb1.FindBooking())
         {
             Add_Controls(phb1); TextBox_Notes.Text = phb1.Notes;
         }
         ViewState.Add("PhysicsBooking", phb1);
         PhysicsEquipmentItemList list1 = new PhysicsEquipmentItemList();
         list1.LoadList_All();
         foreach (PhysicsEquipmentItem p in list1.m_list)
         {
             ListItem l = new ListItem(p.EquipmentItemCode, p.EquipmentItemId.ToString());
             DropDownList_Items.Items.Add(l);
         }
         UpdateExptList();
         //find previous booking???
         Label2.Visible = false; TextBox_last.Visible = false; Button_AddLast.Visible = false;
         PhysicsBooking     phb2  = new PhysicsBooking(); //for last booking for this group
         PhysicsBookingList list2 = new PhysicsBookingList();
         list2.LoadList_Group(phb1.GroupId);              //these are ordered with lates first...
         foreach (PhysicsBooking b in list2.m_list)
         {
             if (b.Date < phb1.Date)
             {
                 Label2.Visible = true; TextBox_last.Visible = true; Button_AddLast.Visible = true;
                 PhysicsEquipmentItemList list3 = new PhysicsEquipmentItemList();
                 list3.LoadList(b); TextBox_last.Text = "";
                 foreach (PhysicsEquipmentItem i in list3.m_list)
                 {
                     TextBox_last.Text += i.EquipmentItemCode + Environment.NewLine;
                 }
                 ViewState.Add("LastBooking", b);
                 break;
             }
         }
     }
     else
     {
         PhysicsBooking b2 = (PhysicsBooking)ViewState["PhysicsBooking"];
         Add_Controls(b2);
     }
 }
 public bool OneDayAfterAllow()
 {
     return(!IsBusy && DayList.Last().Date.Day < EntireMonth.Last().Date.Day);
 }
예제 #18
0
 private void DeleteDay(Day day)
 {
     new DayRepository().Delete(day);
     DayList.Remove(day);
 }