本文整理汇总了C#中System.Globalization.CultureInfo.GetWeekOfYear方法的典型用法代码示例。如果您正苦于以下问题:C# CultureInfo.GetWeekOfYear方法的具体用法?C# CultureInfo.GetWeekOfYear怎么用?C# CultureInfo.GetWeekOfYear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Globalization.CultureInfo
的用法示例。
在下文中一共展示了CultureInfo.GetWeekOfYear方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PripravFormularMesic
private void PripravFormularMesic()
{
panel_Formular.Controls.Clear();
Int16 Rok = (Int16)numericUpDown_Rok.Value;
Int16 Mesic = (Int16)numericUpDown_Mesic.Value;
UzamciUzavreneObdobi(Rok, Mesic);
Calendar Kalendar = new CultureInfo("cs-CZ").Calendar;
Int32 PrvniTyden = Kalendar.GetWeekOfYear(new DateTime(Rok, Mesic, 1), CalendarWeekRule.FirstDay, DayOfWeek.Monday);
Int32 PosledniTyden = Kalendar.GetWeekOfYear(new DateTime(Rok, Mesic, DateTime.DaysInMonth(Rok, Mesic)), CalendarWeekRule.FirstDay, DayOfWeek.Monday);
TableLayoutPanel Formular = new TableLayoutPanel();
Formular.AutoSize = true;
for (int i = PrvniTyden; i <= PosledniTyden; i++)
{
Formular.RowCount++;
Formular.RowStyles.Add(new RowStyle(SizeType.AutoSize));
}
Int32 Tyden;
Int32 AktalniTyden = 0;
Int32 DenTydne;
Label Popisek;
Button Tlacitko;
TextBox Text;
ToolTip toolTip_CtrlEnter;
String SQL = "SELECT D.Datum_D, D.TypDne, D.Svatek FROM TabMzKalendar AS K INNER JOIN TabMzKalendarDny AS D ON D.IDKalendar = K.ID WHERE K.Rok = " + Rok + " AND K.Cislo = '001' AND D.Datum_M = " + Mesic;
IHeQuery Svatky = Helios.OpenSQL(SQL);
for (int Den = 1; Den <= DateTime.DaysInMonth(Rok, Mesic); Den++)
{
DateTime Datum = new DateTime(Rok, Mesic, Den);
Tyden = Kalendar.GetWeekOfYear(Datum, CalendarWeekRule.FirstDay, DayOfWeek.Monday);
if (AktalniTyden != Tyden)
{
TableLayoutPanel TydenTable = new TableLayoutPanel();
TydenTable.AutoSize = true;
TydenTable.Tag = Tyden;
for (int Radek = 0; Radek < 5; Radek++)
{
TydenTable.RowCount++;
TydenTable.RowStyles.Add(new RowStyle(SizeType.AutoSize));
TableLayoutPanel DenTable = new TableLayoutPanel();
DenTable.AutoSize = true;
DenTable.Margin = new Padding(0);
DenTable.CellBorderStyle = TableLayoutPanelCellBorderStyle.Single;
DenTable.Tag = 1;
DenTable.RowCount++;
DenTable.RowStyles.Add(new RowStyle(SizeType.AutoSize));
for (int d = 0; d < 9; d++)
{
DenTable.ColumnCount++;
DenTable.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 70));
}
switch (Radek)
{
case 0:
DenTable.BackColor = System.Drawing.Color.Beige;
Popisek = new Label();
Popisek.Text = "Týden " + Tyden;
Popisek.Dock = DockStyle.Top;
Popisek.Height = 16;
Popisek.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
DenTable.Controls.Add(Popisek, 0, 0);
DenTable.SetColumnSpan(Popisek, 2);
break;
case 1:
Popisek = new Label();
Popisek.Text = "Úsek";
Popisek.Dock = DockStyle.Top;
Popisek.Height = 16;
Popisek.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
DenTable.Controls.Add(Popisek, 0, 0);
Popisek = new Label();
Popisek.Text = "Zakázka";
Popisek.Dock = DockStyle.Top;
Popisek.Height = 16;
Popisek.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
DenTable.Controls.Add(Popisek, 1, 0);
Popisek = new Label();
Popisek.Text = "Činnost";
Popisek.Dock = DockStyle.Top;
Popisek.Height = 16;
Popisek.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
DenTable.Controls.Add(Popisek, 2, 0);
DenTable.SetColumnSpan(Popisek, 7);
break;
case 2:
toolTip_CtrlEnter = new ToolTip();
Text = new TextBox();
Text.Dock = DockStyle.Top;
Text.Height = 16;
Text.TextAlign = HorizontalAlignment.Center;
Text.DoubleClick += VyberStrediska_DblClick;
Text.PreviewKeyDown += AllowKeys;
Text.KeyDown += VyberStredisko_CtrlEnter;
Text.KeyDown += ZpracujKlavesy;
Text.Validating += KontrolaStrediska_Validating;
Text.Enter += PodbarviFocusRadku_Enter;
Text.Tag = ("S" + Tyden + "_1");
toolTip_CtrlEnter.SetToolTip(Text, "CTRL+Enter = výběr úseku");
DenTable.Controls.Add(Text, 0, 0);
Text = new TextBox();
//.........这里部分代码省略.........
示例2: NactiDochazku
private void NactiDochazku()
{
if (panel_Formular.Controls[0] == null)
return;
Int32 CisloZam = 0;
if ((treeView_Zamestnanci.SelectedNode != null) && (!Int32.TryParse(treeView_Zamestnanci.SelectedNode.Name, out CisloZam)))
return;
//textBox_Vyhledavani.Text = treeView_Zamestnanci.SelectedNode.Text;
this.Text = "Docházka - " + treeView_Zamestnanci.SelectedNode.Text;
panel_Formular.Visible = false;
PripravFormularMesic();
String SQL = "SELECT CisloZam, Datum, Stredisko, Zakazka, Cinnost, SUM(Hodiny) FROM TabEGDochazkaDny WHERE CisloZam = " + CisloZam + " AND YEAR(Datum) = " + numericUpDown_Rok.Value + " AND Month(Datum) = " + numericUpDown_Mesic.Value + " GROUP BY CisloZam, Datum, Stredisko, Zakazka, Cinnost ORDER BY Datum, Stredisko, Zakazka, Cinnost";
IHeQuery SQLDochazka = Helios.OpenSQL(SQL);
if (DochazkaDny == null)
DochazkaDny = new List<DochazkaStruct>();
DochazkaDny.Clear();
DochazkaStruct Polozka = new DochazkaStruct();
while (!SQLDochazka.EOF())
{
Polozka.CisloZam = SQLDochazka.FieldValues(0);
Polozka.Datum = SQLDochazka.FieldValues(1);
Polozka.Stredisko = SQLDochazka.FieldValues(2);
Polozka.Zakazka = SQLDochazka.FieldValues(3);
Polozka.Cinnost = SQLDochazka.FieldValues(4);
Polozka.Hodiny = SQLDochazka.FieldValues(5);
DochazkaDny.Add(Polozka);
SQLDochazka.Next();
}
String Stredisko = "";
String Zakazka = "";
Calendar Kalendar = new CultureInfo("cs-CZ").Calendar;
Int32 PrvniTyden = Kalendar.GetWeekOfYear(new DateTime((int)numericUpDown_Rok.Value, (int)numericUpDown_Mesic.Value, 1), CalendarWeekRule.FirstDay, DayOfWeek.Monday);
Int32 Tyden = 0;
Int32 AktualniTyden;
Int32 DenTydne;
Int32 Radek = 0;
TableLayoutPanel TydenTable = null;
foreach (DochazkaStruct item in DochazkaDny)
{
//if (PrvniTyden == 0)
// PrvniTyden = Kalendar.GetWeekOfYear(item.Datum, CalendarWeekRule.FirstDay, DayOfWeek.Monday);
AktualniTyden = Kalendar.GetWeekOfYear(item.Datum, CalendarWeekRule.FirstDay, DayOfWeek.Monday);
DenTydne = (Int32)Kalendar.GetDayOfWeek(item.Datum);
DenTydne = DenTydne == 0 ? 8 : DenTydne + 1;
if (Tyden != AktualniTyden)
{
Stredisko = item.Stredisko;
Zakazka = item.Zakazka;
Tyden = AktualniTyden;
Radek = 0;
TydenTable = (TableLayoutPanel)(((Panel)(((TableLayoutPanel)(panel_Formular.Controls[0])).GetControlFromPosition(0, AktualniTyden - PrvniTyden))).Controls[0]);
((TextBox)(((TableLayoutPanel)(TydenTable.GetControlFromPosition(0, 2))).GetControlFromPosition(0, Radek))).Text = item.Stredisko;
((TextBox)(((TableLayoutPanel)(TydenTable.GetControlFromPosition(0, 2))).GetControlFromPosition(1, Radek))).Text = item.Zakazka;
}
Stredisko = item.Stredisko;
Zakazka = item.Zakazka;
Radek = PridejRadek(AktualniTyden, Stredisko, Zakazka, DenTydne);
((TextBox)(((TableLayoutPanel)(TydenTable.GetControlFromPosition(0, 2))).GetControlFromPosition(DenTydne, Radek))).Text = item.Cinnost;
((TextBox)(((TableLayoutPanel)(TydenTable.GetControlFromPosition(0, 4))).GetControlFromPosition(DenTydne, Radek))).Text = item.Hodiny.ToString();
SectiHodiny(((TextBox)(((TableLayoutPanel)(TydenTable.GetControlFromPosition(0, 4))).GetControlFromPosition(DenTydne, Radek))));
}
panel_Formular.Visible = true;
}
示例3: button_PridejRadky_Click
private void button_PridejRadky_Click(object sender, EventArgs e)
{
Int16 Rok = (Int16)numericUpDown_Rok.Value;
Int16 Mesic = (Int16)numericUpDown_Mesic.Value;
Calendar Kalendar = new CultureInfo("cs-CZ").Calendar;
Int32 PrvniTyden = Kalendar.GetWeekOfYear(new DateTime(Rok, Mesic, 1), CalendarWeekRule.FirstDay, DayOfWeek.Monday);
Int32 PosledniTyden = Kalendar.GetWeekOfYear(new DateTime(Rok, Mesic, DateTime.DaysInMonth(Rok, Mesic)), CalendarWeekRule.FirstDay, DayOfWeek.Monday);
String Stredisko = textBox_Stredisko.Text;
String Zakazka = textBox_Zakazka.Text;
panel_Formular.Visible = false;
for (int i = PrvniTyden; i <= PosledniTyden; i++)
{
PridejRadek(i, Stredisko, Zakazka, null);
}
panel_Formular.Visible = true;
}