public void onSaveClick()
        {
            if (Todo == null || mContentPage == null)
            {
                return;
            }
            Todo.From = DateFrom.Add(TimeFrom);
            Todo.To   = DateTo.Add(TimeTo);

            if (Todo.From.CompareTo(Todo.To) > 0 ||
                String.IsNullOrEmpty(Todo.Title))
            {
                mContentPage.DisplayAlert("Warning",
                                          "1.Please enter \"Title\"\n" +
                                          "2.Time To > Date From", "OK");
                return;
            }

            App.Database.SaveItemAsync(Todo);
            if (Todo.IsDone == true)
            {
                DependencyService.Get <IAlarm>().CancelAlarm(Todo);
            }
            else
            {
                DependencyService.Get <IAlarm>().SetAlarm(Todo);
            }
            mContentPage.Navigation.PopAsync();
        }
Exemplo n.º 2
0
        public void init()
        {
            result   = "";
            client   = new ServiceReference1.Service1Client();
            DateFrom = DateTime.Now.AddDays(-3).Date;
            DateTo   = DateFrom.AddDays(2).AddMilliseconds(-1);

            tableList.Add(new QueryState
            {
                ID        = 0,
                TableName = TableNames.tablenames["FD"],
                DateFrom  = this.DateFrom.AddDays(-10),
                DateTo    = this.DateTo.AddDays(-5),
                Status    = status.IDLE
            });

            tableList.Add(new QueryState
            {
                ID        = 1,
                TableName = TableNames.tablenames["REF"],
                DateFrom  = this.DateFrom,
                DateTo    = this.DateTo,
                Status    = status.IDLE
            });

            tableEnum        = tableList.AsEnumerable();
            this.initialized = true;
        }
Exemplo n.º 3
0
        public override bool CanBeEquals(Pullenti.Ner.Referent obj, Pullenti.Ner.Core.ReferentsEqualType typ)
        {
            DateRangeReferent dr = obj as DateRangeReferent;

            if (dr == null)
            {
                return(false);
            }
            if (DateFrom != null)
            {
                if (!DateFrom.CanBeEquals(dr.DateFrom, typ))
                {
                    return(false);
                }
            }
            else if (dr.DateFrom != null)
            {
                return(false);
            }
            if (DateTo != null)
            {
                if (!DateTo.CanBeEquals(dr.DateTo, typ))
                {
                    return(false);
                }
            }
            else if (dr.DateTo != null)
            {
                return(false);
            }
            return(true);
        }
Exemplo n.º 4
0
 public IndexModel(IRepository repository)
 {
     DateFrom = DateTime.Now;
     DateTo   = DateFrom.AddYears(1);
     //repo = FakeEventRepository.Instance;// Der skal kun være et objekt af FakeEventRepository
     repo = repository;
 }
Exemplo n.º 5
0
 //implemented methods
 public override void InputFormFields()
 {
     if (Data.TestWindowName != null)
     {
         TestWindowName.Wait(5).SendKeys(Data.TestWindowName);
     }
     if (Data.Subject != null)
     {
         SubjectSelect.Wait(3).SelectByText(Data.Subject);
     }
     if (Data.GradeLow != null)
     {
         GradeFromSelect.Wait(5);
         GradeFromSelect.Wait(5).SelectByText(Data.GradeLow);
     }
     if (Data.GradeHigh != null)
     {
         GradeToSelect.Wait(5);
         GradeToSelect.Wait(5).SelectByText(Data.GradeHigh);
     }
     if (Data.DateFrom != null)
     {
         DateFrom.Wait(5).SendKeys(Data.DateFrom);
     }
     if (Data.DateTo != null)
     {
         DateTo.Wait(5).SendKeys(Data.DateTo);
     }
 }
Exemplo n.º 6
0
 private void pageHeader_Format(object sender, EventArgs e)
 {
     lblWarehouse.Text         = Warehouse.ToString();
     lblWBServiceProvider.Text = WBServiceProvider.ToString();
     lblFromDate.Text          = DateFrom.ToString();
     lblToDate.Text            = DateTo.ToString();
 }
Exemplo n.º 7
0
        private void SetDateFromDateTo(ReportType type)
        {
            switch (type)
            {
            case ReportType.Date:
                DateTo = DateFrom.AddDays(1).AddSeconds(-1);
                break;

            case ReportType.FromDateToDate:
                break;

            case ReportType.Month:
                DateFrom = new DateTime(Convert.ToInt32(itemYear.EditValue), Convert.ToInt32(itemMonth.EditValue), 1);
                DateTo   = DateFrom.AddMonths(1).AddSeconds(-1);
                break;

            case ReportType.Quarter:
                DateFrom = new DateTime(Convert.ToInt32(itemYear.EditValue), Convert.ToInt32(itemQuarter.EditValue),
                                        1);
                DateTo = DateFrom.AddMonths(3).AddSeconds(-1);
                break;

            case ReportType.Year:
                DateFrom = new DateTime(Convert.ToInt32(itemYear.EditValue), 1, 1);
                DateTo   = new DateTime(Convert.ToInt32(itemYear.EditValue), 12, 31, 23, 59, 59);
                break;

            default:
                break;
            }
        }
        public DataSet Select()
        {
            Command = CommandBuilder(@"select L.id, L.name, L.contact, L.contactPerson, L.email, L.password, h.name  as head,
            L.description, L.address, ct.name as city, cn.name as country, l2.name as employee, L.createDate
            from Ledger as L
            left join Head as h on L.headId = h.id
            left join ledger as l2 on l.employeeId = l2.id
            left join City as ct on L.cityid = ct.id 
            left join country as cn on ct.countryId = cn.id where l.id>0");

            if (!string.IsNullOrEmpty(Search))
            {
                Command.CommandText += " and (l.name like @search or l.contact like @search or l.contactPerson like @search or l.email like @search or l.description like @search or l.address like @search)";
                Command.Parameters.AddWithValue("@search", "%" + Search + "%");
            }
            if (HeadId > 0)
            {
                Command.CommandText += " and (h.id like @head)";
                Command.Parameters.AddWithValue("@head", "%" + HeadId + "%");
            }

            if (DateSearch)
            {
                Command.CommandText += " and l.createDate between @date1 and @Date2";
                Command.Parameters.AddWithValue("@date1", DateFrom.ToShortDateString());
                Command.Parameters.AddWithValue("@date2", DateTo.ToShortDateString());
            }

            return(ExecuteDS(Command));
        }
Exemplo n.º 9
0
        public IEnumerable <ValidationResult> Validate(string instanceName, bool isRequired = false)
        {
            var result = new List <ValidationResult>();

            if (DateFrom.YearMax == DateTime.Now.Year)
            {
                result.AddRange(DateFrom.ValidatePastDate($"{instanceName}.{nameof(DateFrom)}", true));
            }
            else
            {
                result.AddRange(DateFrom.Validate($"{instanceName}.{nameof(DateFrom)}", true));
            }

            if (DateTo.YearMax == DateTime.Now.Year)
            {
                result.AddRange(DateTo.ValidatePastDate($"{instanceName}.{nameof(DateTo)}", DateToRequired));
            }
            else
            {
                result.AddRange(DateTo.Validate($"{instanceName}.{nameof(DateTo)}", DateToRequired));
            }

            if ((DateToRequired || !DateTo.IsEmpty()) && (DateTo.ToDate() < DateFrom.ToDate()))
            {
                result.Add(new ValidationResult(string.Empty, new[] { $"{instanceName}.{nameof(DateTo)}" }));
            }

            return(result);
        }
Exemplo n.º 10
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (this.CompanyID.GetCheckedValues().Length == 0)
            {
                Mess.Info("Please select at least one company!");
                CompanyID.ShowPopup();
                return;
            }
            if (this.LocationID.GetCheckedValues().Length == 0)
            {
                Mess.Info("Please select at least one location!");
                LocationID.ShowPopup();
                return;
            }
            if (DateFrom.EditValue == null || DateFrom.DateTime == DateTime.MinValue)
            {
                Mess.Info("Please select a Period From!");
                DateFrom.ShowPopup();
                return;
            }
            if (DateTo.EditValue == null || DateTo.DateTime == DateTime.MinValue)
            {
                Mess.Info("Please select a Period To!");
                DateTo.ShowPopup();
                return;
            }

            this.DialogResult = System.Windows.Forms.DialogResult.Yes;
            this.Close();
        }
Exemplo n.º 11
0
        public DataSet Select()
        {
            Command = CommandBuilder(@"select pi.id, pi.title, pi.datetime, pi.image,
                             p.name as product from ProductImage as pi
                             left join Product as p on pi.productId=p.id where pi.id>0");

            if (!string.IsNullOrEmpty(Title))
            {
                Command.CommandText += " and pi.title like @title";
                Command.Parameters.AddWithValue("@title", "%" + Title + "%");
            }

            if (ProductId > 0)
            {
                Command.CommandText += " and p.id like @product";
                Command.Parameters.AddWithValue("@product", ProductId);
            }

            if (DateSearch)
            {
                Command.CommandText += " and pi.datetime between @date1 and @Date2";
                Command.Parameters.AddWithValue("@date1", DateFrom.ToShortDateString());
                Command.Parameters.AddWithValue("@date2", DateTo.ToShortDateString());
            }

            return(ExecuteDS(Command));
        }
Exemplo n.º 12
0
        private string BuildSubtitle()
        {
            string dateFormat = "dd.MM.yyyy HH:mm";

            StringBuilder text = new StringBuilder("Период: ");

            text.Append(DateFrom.ToString(dateFormat) + " - ");
            text.Append(DateTo.ToString(dateFormat));

            text.Append(", подразделение: ");
            text.Append(SelectedUnit.Name);

            if (LicensePlate.Trim().Length > 0)
            {
                text.Append(", номер т/с: ");
                text.Append(LicensePlate.Trim());
            }

            if (Cargo.Trim().Length > 0)
            {
                text.Append(", груз: ");
                text.Append(Cargo.Trim());
            }

            return(text.ToString());
        }
Exemplo n.º 13
0
 public void PrevDay(object o = null)
 {
     DateFrom = DateFrom.AddDays(-1);
     DateTo   = DateTo.AddDays(-1);
     ((DatePicker)o).UpdateLayout();
     UpdateView();
 }
Exemplo n.º 14
0
        public override string ToString(bool shortVariant, Pullenti.Morph.MorphLang lang = null, int lev = 0)
        {
            if (IsRelative && !shortVariant)
            {
                StringBuilder res = new StringBuilder();
                res.Append(this.ToString(true, lang, lev));
                Pullenti.Ner.Date.Internal.DateRelHelper.AppendToString2(this, res);
                return(res.ToString());
            }
            string fr = (DateFrom == null ? null : DateFrom._ToString(shortVariant, lang, lev, 1));
            string to = (DateTo == null ? null : DateTo._ToString(shortVariant, lang, lev, 2));

            if (fr != null && to != null)
            {
                return(string.Format("{0} {1}", fr, (DateTo.Century > 0 && DateTo.Year == 0 ? to : to.ToLower())));
            }
            if (fr != null)
            {
                return(fr.ToString());
            }
            if (to != null)
            {
                return(to);
            }
            return(string.Format("{0} ? по ?", (lang.IsUa ? 'з' : 'с')));
        }
Exemplo n.º 15
0
        public override string ToString()
        {
            var typeNames = new Dictionary <int, string> {
                { 0, "" }, { 1, "Bef. " }, { 2, "" }, { 3, "Abt. " }, { 4, "Cal. " }, { 5, "Bet. " }, { 6, "From " }, { 7, "Aft. " }
            };
            var rangeJoin = new Dictionary <int, string> {
                { 5, " - " }, { 6, " to " }
            };

            if (!IsValid)
            {
                return(DatePhrase);
            }

            var result = typeNames[(int)DateType];

            result += DateFrom.ToString();

            if (DateType == GenDateType.Between || DateType == GenDateType.FromTo)
            {
                result += rangeJoin[(int)DateType] + DateTo;
            }

            return(result);
        }
Exemplo n.º 16
0
 private void buttonGo_Click(object sender, EventArgs e)
 {
     if (textBoxYear.Text != "")
     {
         if (CorrectDate(textBoxYear.Text.ToString()) == true)
         {
             date = textBoxYear.Text.ToString();
             if (CheckDate(date) == true)
             {
                 MessageBox.Show("Дата входит в диапазон", "Отлично", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
             else
             {
                 MessageBox.Show("Дата не входит в диапазон", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
         else
         {
             date = DateFrom.ToString();
             MessageBox.Show("Неверный формат введеной даты", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
     else
     {
         date = DateFrom.ToString();
         MessageBox.Show("Не введена дата. Пожалуйста, заполните поле даты", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
        private void SaveDateSession()
        {
            List <string> list = Session["ReportSession"] as List <string>;

            list[0] = DateFrom.ToString("yyyy-MM-dd");
            list[1] = DateTo.ToString("yyyy-MM-dd");
            Session["ReportSession"] = list;
        }
Exemplo n.º 18
0
 private void pageHeader_Format(object sender, EventArgs e)
 {
     lblWarehouse.Text = Warehouse.ToString();
     lblShed.Text      = Shed.ToString();
     lblLIC.Text       = LIC.ToString();
     lblFromDate.Text  = DateFrom.ToString();
     lblToDate.Text    = DateTo.ToString();
 }
Exemplo n.º 19
0
        public XmlElement ToXmlElement(XmlHelper helper)
        {
            var xmlElement = helper.CreateElement(nameof(MonthYearPeriodModel).Replace("Model", string.Empty));

            xmlElement.AppendChild(helper.CreateElement(nameof(DateFrom), DateFrom.ToXmlElement(helper)));
            xmlElement.AppendChild(helper.CreateElement(nameof(DateTo), DateTo.ToXmlElement(helper)));
            return(xmlElement);
        }
Exemplo n.º 20
0
 private void UpdateEndDisplayDate()
 {
     EndDateDisplay = DateFrom.AddDays(1);
     if (DateTo != null && DateTo < EndDateDisplay)
     {
         DateTo = EndDateDisplay;
     }
 }
Exemplo n.º 21
0
        private string GetValueForPeriodCell()
        {
            var dateFormat = new GetDateFormat().GetDateFormaDotNetById(DateFormatId);
            //value = DateTime.Parse(value).ToString(dateFormat, );
            var valueForPeriodCell = "Period: " + DateFrom.ToString(dateFormat, CultureInfo.InvariantCulture) + " - " + DateTo.ToString(dateFormat, CultureInfo.InvariantCulture);

            return(valueForPeriodCell);
        }
Exemplo n.º 22
0
 private void UpdateFromDisplayDate()
 {
     EndDateDisplay = DateFrom.AddDays(1);
     if (DateTo < EndDateDisplay)
     {
         DateTo = DateFrom.AddDays(10);
     }
 }
 //implemented methods
 public override void ClearForm()
 {
     TestWindowName.Clear();
     SubjectSelect.Wait(3).SelectByText("All subjects");
     GradeFromSelect.Wait(5).SelectByText("");
     GradeToSelect.Wait(5).SelectByText("");
     DateFrom.Clear();
     DateTo.Clear();
 }
 private void Search()
 {
     Income       = _reportService.GetIncome(DateFrom, DateTo);
     Outcome      = _reportService.GetOutcome(DateFrom, DateTo);
     Previous     = _reportService.GetCurrentMoney(DateFrom.AddDays(-1));
     TotalIncome  = Income.Sum(x => x.Money);
     TotalOutcome = Outcome.Sum(x => x.Money);
     Remaining    = TotalIncome - TotalOutcome;
     Current      = Previous + Remaining;
 }
Exemplo n.º 25
0
        private void RefreshDocument()
        {
            PersonList = Person.LoadList(database, DateFrom, DateFrom.AddMonths(1).AddDays(-1), true, 1, "");

            Document.Blocks.Clear();

            Template template = Template.Open(Settings.Default.ListTemplate);

            template.FillDocument(this);
        }
Exemplo n.º 26
0
 public override string ToString()
 {
     return($"[Type={Type}, " +
            $"DateFrom={DateFrom.ToString(CultureInfo.CurrentCulture)}, " +
            $"DateTo={DateTo.ToString(CultureInfo.CurrentCulture)}, " +
            $"Span={Span.ToString()}, " +
            $"HasTime={HasTime}, " +
            $"StartIndex={StartIndex}, " +
            $"EndIndex={EndIndex}]");
 }
Exemplo n.º 27
0
 public IDictionary <string, string> ToQueryStrings()
 {
     return(new Dictionary <string, string>()
     {
         { "to", DateTo.ToString("yyyy-MM-dd") },
         { "from", DateFrom.ToString("yyyy-MM-dd") },
         { "page", Page?.ToString() },
         { "size", Size?.ToString() },
     });
 }
Exemplo n.º 28
0
 private string CreateDateString()
 {
     return(IsValid
         ? string.Join("", new List <string> {
         "1", DateFrom.ToSortString(), ((int)DateType).ToString(), DateTo.ToSortString()
     })
         : string.Join("", new List <string> {
         "2", DatePhrase
     }));
 }
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine($"{EmpID}");
            sb.AppendLine($"{ProjectID}");
            sb.AppendLine($"{DateFrom.ToString("yyyy-MM-dd")}");
            sb.AppendLine($"{DateTo.ToString("yyyy-MM-dd")}");

            return(sb.ToString());
        }
Exemplo n.º 30
0
 public void FixDates()
 {
     if (DateFrom < DateTime.Now)
     {
         DateFrom = DateTime.Now;
     }
     if (DateTo < DateFrom)
     {
         DateTo = DateFrom.AddDays(180);
     }
 }