コード例 #1
0
        private void UserDialog_Closing(object sender, MaterialDesignThemes.Wpf.DialogClosingEventArgs eventArgs)
        {
            string command = (string)eventArgs.Parameter;

            switch (command)
            {
            case "reset":
                Date1.Date = "";
                Date2.Date = "";
                Date1.Clear();
                Date2.Clear();
                LoadBarChartData();
                break;

            case "confirm":
                LoadBarChartData();
                break;

            case "cancel":
                Dynamics.LastEscapeTime = DateTime.Now;
                break;

            default:
                break;
            }
        }
コード例 #2
0
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     Date1.SetToday();
     Date2.SetToday();
     Time1.SelectedTime = DateTime.Today;
     Time2.SelectedTime = DateTime.Today.AddDays(1).AddSeconds(-1);
     RefreshGrid();
 }
コード例 #3
0
ファイル: CultureSample.cs プロジェクト: strugglesharp/YAXLib
 protected bool Equals(CultureSample other)
 {
     if (Numbers.Where((t, i) => !t.Equals(other.Numbers[i])).Any())
     {
         return(false);
     }
     return(Number1.Equals(other.Number1) && Number2.Equals(other.Number2) && Number3.Equals(other.Number3) &&
            Dec1 == other.Dec1 && Dec2 == other.Dec2 && Date1.Equals(other.Date1) && Date2.Equals(other.Date2));
 }
コード例 #4
0
ファイル: DateFilter.cs プロジェクト: lycilph/Projects
        public bool IsMatch(Post post)
        {
            switch (Operator)
            {
            case DateOperator.Before: return(Date1.CompareTo(post.Date) > 0);

            case DateOperator.Equal: return(Date1.CompareTo(post.Date) == 0);

            case DateOperator.After: return(Date1.CompareTo(post.Date) < 0);

            case DateOperator.Range: return(Date1.CompareTo(post.Date) < 0 && Date2.CompareTo(post.Date) > 0);
            }
            return(false);
        }
コード例 #5
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            Date1.SetToday();
            Date2.SetToday();

            RefreshGrid();
            var list = new List <Data.Good>();

            list.Add(new Data.Good {
                Id = 0, Name = "همه"
            });
            list.AddRange(db.Goods.ToList());
            cmbItems.DataContext = list;
        }
コード例 #6
0
        /// <inheritdoc/>
        public override int GetHashCode()
        {
            // Overflow is fine, just wrap.
            unchecked
            {
                int hash = 17;

                hash *= 23 + DateTime1.GetHashCode();
                hash *= 23 + DateTime2.GetHashCode();
                hash *= 23 + Date1.GetHashCode();
                hash *= 23 + Date2.GetHashCode();

                return(hash);
            }
        }
コード例 #7
0
ファイル: CultureSample.cs プロジェクト: strugglesharp/YAXLib
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = Number1.GetHashCode();
         hashCode = (hashCode * 397) ^ Number2.GetHashCode();
         hashCode = (hashCode * 397) ^ Number3.GetHashCode();
         hashCode = (hashCode * 397) ^ (Numbers?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ Dec1.GetHashCode();
         hashCode = (hashCode * 397) ^ Dec2.GetHashCode();
         hashCode = (hashCode * 397) ^ Date1.GetHashCode();
         hashCode = (hashCode * 397) ^ Date2.GetHashCode();
         return(hashCode);
     }
 }
コード例 #8
0
ファイル: DateTimeTests.cs プロジェクト: Rype69/utilities
        public void ToDateTime()
        {
            // Arrange
            const string Date1 = "28/09/2011";
            const string Date2 = "28/09/2011 15:35";

            // Act
            var result1 = Date1.ToDateTime(103);
            var result2 = Date2.ToDateTime(-1);

            // Assert
            Assert.IsNotNull(result1);
            Assert.AreEqual(Date1, result1.ToString("dd/MM/yyyy"));
            Assert.IsNotNull(result2);
            Assert.AreEqual(Date2, result2.ToString("dd/MM/yyyy HH:mm"));
        }
コード例 #9
0
        public double Calculate()

        {
            var a      = Date1.Split().ToList();
            int aYear  = int.Parse(a[0]);
            int aMonth = int.Parse(a[1]);
            int aDay   = int.Parse(a[2]);
            var b      = Date2.Split().ToList();
            int bYear  = int.Parse(b[0]);
            int bMonth = int.Parse(b[1]);
            int bDay   = int.Parse(b[2]);

            DateTime d1   = new DateTime(aYear, aMonth, aDay);
            DateTime d2   = new DateTime(bYear, bMonth, bDay);
            TimeSpan time = d1 - d2;

            return(Math.Abs(time.TotalDays));
        }
コード例 #10
0
 public  fillDates()
 {
    QueryViewModel qvm=new QueryViewModel()          
    int i=0;
    foreach(var item in Date1.Reverse())
    {
       qvm.displayDate = theDate;
       qvm.Count1  = theCount;
      DateList.Add(qvm);
    }
    int i=0;
    foreach(var item in Date2.Reverse())
    {
       DateList[i].Count2  = theCount;
       i++;
    }
    return DateList
 }
コード例 #11
0
ファイル: Event.cs プロジェクト: LeeActon/BarringtonTree
        public String DateString()
        {
            String dateString = null;

            if (Date1 != null)
            {
                if ((Date2 != null) && !Date2.Julian)
                {
                    dateString = String.Format("BET {0} AND {1}", Date1.ToString(), Date2.ToString());
                }
                else
                {
                    dateString = Date1.ToString();
                }
            }

            return(dateString);
        }
コード例 #12
0
        public async void SaveChanges()
        {
            if (Date1 < Date2)
            {
                bool confirmed = await JsRunTime.InvokeAsync <bool>("confirm", "Are you sure you want to make these changes?");

                if (confirmed)
                {
                    string tasks = "";
                    foreach (var item in results.Where(i => i.IsJobSelected == true))
                    {
                        tasks += "'" + item.TASK_ID + "'" + ",";
                        item.ScheduledDownTime = Date1.ToString() + " - " + Date2.ToString();
                    }
                    tasks = tasks.TrimEnd(',');
                    string insertSql = "update " + OracleTableNames.JobService + " set service_suspend_start = to_date('" + Date1.ToString() + "','MM/DD/YYYY HH:MI:SS AM')," +
                                       " service_suspend_stop = to_date('" + Date2.ToString() + "','MM/DD/YYYY HH:MI:SS AM')  where task_id in (" + tasks + ")";
                    var sqlString = new StringContent(insertSql, Encoding.UTF8, "text/plain");
                    await HttpClient.PostAsync(ServiceEndpoints.EXECUTE_SQL_POST, sqlString);
                    await GetData();

                    GetStatus();
                    ClearSelected();
                    Date1 = DateTime.Now;
                    Date2 = DateTime.Now;
                }
                else
                {
                    GetStatus();
                    Date1 = DateTime.Now;
                    Date2 = DateTime.Now;
                }
            }
            else
            {
                FontColor = "red";
                Message   = "Start Time must be less than End Time";
                GetStatus();
            }
            await GetData();

            GetStatus();
            StateHasChanged();
        }
コード例 #13
0
ファイル: Function.cs プロジェクト: Jaysonh1985/CalcEngine
        public string Output(string jparameters, List <CategoryViewModel> jCategory, int GroupID, int ItemID, dynamic variable, string DataType)
        {
            JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer();

            CalculationCSharp.Areas.Configuration.Models.ConfigFunctions Config = new CalculationCSharp.Areas.Configuration.Models.ConfigFunctions();
            ArrayBuildingFunctions ArrayBuilder = new ArrayBuildingFunctions();

            string[] Parts = null;
            //Returns Array
            Parts = ArrayBuilder.InputArrayBuilder(variable, jCategory, GroupID, ItemID);
            string Output = null;

            //Loop through the array to calculate each value in array
            foreach (string part in Parts)
            {
                dynamic InputA = Config.VariableReplace(jCategory, part, GroupID, ItemID);
                if (DataType == "Date")
                {
                    DateTime Date1;
                    DateTime.TryParse(InputA, out Date1);
                    Output = Output + Convert.ToString(Date1.ToShortDateString()) + "~";
                }
                else if (DataType == "Decimal")
                {
                    Int16 Int1;
                    Int16.TryParse(InputA, out Int1);
                    Output = Output + Convert.ToString(Int1) + "~";
                }
                else
                {
                    Output = Output + Convert.ToString(InputA) + "~";
                }
            }
            Output = Output.Remove(Output.Length - 1);
            return(Convert.ToString(Output));
        }
コード例 #14
0
 public void VerifyDate1()
 {
     Date1String = Date1.ToString("g");
 }
コード例 #15
0
ファイル: Zodie.cs プロジェクト: lorenaanghel/CNATema2
 public void ChangeYear(DateTime dt)
 {
     Date1 = Date1.AddYears(dt.Year - Date1.Year);
     Date2 = Date2.AddYears(dt.Year - Date2.Year);
 }
コード例 #16
0
 public bool Find(string toFind)
 {
     return(DateType.ToString() == toFind ||
            Date1.ToString() == toFind);
 }
コード例 #17
0
        private void button2_Click(object sender, EventArgs e)
        {
            Excel.Application ex = new Microsoft.Office.Interop.Excel.Application();
            ex.Visible             = true;
            ex.SheetsInNewWorkbook = 12;
            Excel.Workbook workBook = ex.Workbooks.Add(Type.Missing);
            ex.DisplayAlerts = false;
            var currentYear1 = DateTime.Now.Year;

            for (int i = 0; i < 12; i++)
            {
                Excel.Worksheet sheet = (Excel.Worksheet)ex.Worksheets.get_Item(i + 1);
                sheet.StandardWidth = 3;
                sheet.Name          = months[i];
                sheet.Cells[1, 1]   = String.Format("Номер отеля | День");
                if (months[i] == "01" || months[i] == "03" || months[i] == "05" || months[i] == "07" || months[i] == "08" || months[i] == "10" || months[i] == "12")
                {
                    for (int j = 2; j < 33; j++)
                    {
                        sheet.Cells[j] = String.Format("{0}", j - 1);
                    }
                    for (int j = 2; j < 17; j++)
                    {
                        sheet.Cells[j, 1] = String.Format("{0}", j - 1);
                    }
                }
                if (months[i] == "02")
                {
                    for (int j = 2; j < 31; j++)
                    {
                        sheet.Cells[j] = String.Format("{0}", j - 1);
                    }
                    for (int j = 2; j < 17; j++)
                    {
                        sheet.Cells[j, 1] = String.Format("{0}", j - 1);
                    }
                }
                if (months[i] == "04" || months[i] == "06" || months[i] == "09" || months[i] == "11")
                {
                    for (int j = 2; j < 32; j++)
                    {
                        sheet.Cells[j] = String.Format("{0}", j - 1);
                    }
                    for (int j = 2; j < 17; j++)
                    {
                        sheet.Cells[j, 1] = String.Format("{0}", j - 1);
                    }
                }
            }
            SQLiteConnection sql = new SQLiteConnection(@"Data Source=D:\VS\Diplom\Guest.sqlite");

            sql.Open();
            int           count = 0;
            SQLiteCommand sc4   = new SQLiteCommand("select count (*) as '" + count + "'from Гости", sql); //кол-во строк в таблице

            count = Convert.ToInt32(sc4.ExecuteScalar());

            int[]         b    = new int[count]; //получение id
            int           o    = 0;
            SQLiteCommand sc3  = new SQLiteCommand("select id from Гости", sql);
            var           mas1 = sc3.ExecuteReader();

            while (mas1.Read())
            {
                b[o] = Convert.ToInt32(mas1["id"]);
                o++;
            }
            string Date1, Date2, Number = "";

            for (int j = 0; j < count; j++)
            {
                SQLiteCommand sc  = new SQLiteCommand("select Дата_Заезда from Гости where id='" + b[j] + "'", sql);
                SQLiteCommand sc1 = new SQLiteCommand("select Дата_Выезда from Гости where id='" + b[j] + "'", sql);
                SQLiteCommand sc2 = new SQLiteCommand("select Номер_Комнаты from Гости where id= '" + b[j] + "'", sql);
                Date1  = sc.ExecuteScalar().ToString();
                Date2  = sc1.ExecuteScalar().ToString();
                Number = sc2.ExecuteScalar().ToString();
                var currentYear = DateTime.Now.Date;

                string[] words = Date1.Split(new char[] { '.' }, StringSplitOptions.RemoveEmptyEntries); //разделение даты
                string   Day = words[0]; string Month = words[1]; string Year = words[2];

                words = Date2.Split(new char[] { '.' }, StringSplitOptions.RemoveEmptyEntries);
                string          Day1 = words[0]; string Month1 = words[1]; string Year1 = words[2];
                Excel.Worksheet sheet = (Excel.Worksheet)ex.Worksheets.get_Item(Month);
                if (listBox2.SelectedItem.ToString() == currentYear1.ToString())
                {
                    if (Month == Month1)
                    {
                        ((Excel.Worksheet)ex.Application.ActiveWorkbook.Sheets[Month]).Select();
                        Excel.Range range2 = ex.get_Range(ex.Cells[Convert.ToInt32(Number) + 1, Convert.ToInt32(Day) + 1], ex.Cells[Convert.ToInt32(Number) + 1, Convert.ToInt32(Day1) + 1]);
                        range2.Interior.Color = ColorTranslator.ToOle(Color.Blue);
                    }
                    else
                    {
                        string h = Day1;
                        for (int a = Convert.ToInt32(Month); a <= Convert.ToInt32(Month1); a++)
                        {
                            if (a != Convert.ToInt32(Month1))
                            {
                                if (a == 01 || a == 03 || a == 05 || a == 07 || a == 08 || a == 10 || a == 12)
                                {
                                    Day1 = "31";
                                }
                                else if (a == 02)
                                {
                                    Day1 = "29";
                                }
                                else if (a == 04 || a == 06 || a == 09 || a == 11)
                                {
                                    Day1 = "30";
                                }
                            }
                            ((Excel.Worksheet)ex.Application.ActiveWorkbook.Sheets[a]).Select();
                            Excel.Range range2 = ex.get_Range(ex.Cells[Convert.ToInt32(Number) + 1, Convert.ToInt32(Day) + 1], ex.Cells[Convert.ToInt32(Number) + 1, Convert.ToInt32(Day1) + 1]);
                            range2.Interior.Color = ColorTranslator.ToOle(Color.Blue);
                            Day1 = h;
                        }
                    }
                }
            }
            sql.Close();
        }