Exemplo n.º 1
0
        private void addNewPlan_Click(object sender, RoutedEventArgs e)
        {
            bool validationLocationClear = true;
            bool validationDateClear = true;
            //check location not blank
            if (String.IsNullOrEmpty(planLocation.Text))
            {
                Flyout myFlyout = Resources["validationFlyout"] as Flyout;
                myFlyout.ShowAt(planLocation);
                if(validationLocationClear == true)
                {
                    validationLocationClear = false;
                }
            }
            else
            {
                validationLocationClear = true;
            }
            //Check End Date > Start Date
            if(planStartDate.Date.DateTime.Date > planEndDate.Date.DateTime.Date)
            {
                Flyout dateValidationFlyout = Resources["endDateValidation"] as Flyout;
                dateValidationFlyout.ShowAt(planStartDate);
                if(validationDateClear == true)
                {
                    validationDateClear = false;
                }
            }
            else
            {
                validationDateClear = true;
            }

            if(validationLocationClear == true & validationDateClear ==true)
            {
                if (String.IsNullOrEmpty(planBudget.Text))
                {
                    planBudget.Text = "0";
                }
                
                Plans plan = new Plans(planStartDate.Date.DateTime, planEndDate.Date.DateTime,
                    planLocation.Text, Convert.ToDouble(planBudget.Text));

                Sqlite sqlData = new Sqlite();
                sqlData.conn.Insert(plan);
                //plan.SetPlanDetails(planStartDate.Date.DateTime, planEndDate.Date.DateTime, planLocation.Text, Convert.ToDouble(planBudget.Text));
                Frame.Navigate(typeof(PlanDetails), plan);
            }
        }
Exemplo n.º 2
0
        //public static ObservableCollection<Days> getDayList(DateTime startDate, DateTime endDate)
        //{
        //    var dayList = new ObservableCollection<Days>();

        //    //int maxDay = CalculateMaxDay(startDate, endDate);
        //    //for (int i = 1; i <= maxDay; i++)
        //    //{
        //    //dayList.Add(new Days("No Activities on this day!", "Day " +i.ToString()));
        //    //}

        //    return dayList;

        //}

        public static TableQuery<Days> getDayList(Plans p)
        {

            Sqlite sqlData = new Sqlite();

            var queryDay = from d in sqlData.conn.Table<Days>()
                           where d.PlanID_FK.Equals(p.PlanID)
                           select d;
            //int maxDay = CalculateMaxDay(startDate, endDate);
            //for (int i = 1; i <= maxDay; i++)
            //{
            //dayList.Add(new Days("No Activities on this day!", "Day " +i.ToString()));
            //}

            return queryDay;


        }