本文整理汇总了C#中bycar.DataAccess.GetSparesDemand方法的典型用法代码示例。如果您正苦于以下问题:C# DataAccess.GetSparesDemand方法的具体用法?C# DataAccess.GetSparesDemand怎么用?C# DataAccess.GetSparesDemand使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bycar.DataAccess
的用法示例。
在下文中一共展示了DataAccess.GetSparesDemand方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Window_Activated
private void Window_Activated(object sender, EventArgs e)
{
try
{
ReportDocument reportDocument = new ReportDocument();
StreamReader reader = new StreamReader(new FileStream(@"Templates\RequestReport.xaml", FileMode.Open, FileAccess.Read));
reportDocument.XamlData = reader.ReadToEnd();
reportDocument.XamlImagePath = System.IO.Path.Combine(Environment.CurrentDirectory, @"Templates\");
reader.Close();
ReportData data = new ReportData();
DataAccess da = new DataAccess();
// Таблица ТОВАРЫ В НАКЛАДНОЙ
DataTable dt = new DataTable("mtable");
// описываем столбцы таблицы
dt.Columns.Add("t1", typeof(string));
dt.Columns.Add("t2", typeof(string));
dt.Columns.Add("t3", typeof(string));
dt.Columns.Add("t4", typeof(string));
dt.Columns.Add("t5", typeof(string));
dt.Columns.Add("t6", typeof(string));
dt.Columns.Add("t7", typeof(string));
dt.Columns.Add("t8", typeof(string));
decimal sum1 = 0;
// забиваем таблицу данными
if (items == null)
{
items = da.GetSparesDemand();
}
int maxLength = 40;
try
{
for (int i = 0; i < items.Count; i++)
{
string nm = items[i].name;
nm = nm.Substring(0, Math.Min(nm.Length, maxLength));
if (items[i].name.Length > maxLength)
nm += "...";
decimal r1 = items[i].q_demand.Value;
decimal r2 = (decimal)items[i].QRest.Value;
decimal r = (r1 - r2);
sum1 += r;
dt.Rows.Add(new object[] {
(i+1).ToString(),
nm,
items[i].BrandName,
items[i].codeShatem,
items[i].code,
items[i].q_demand,
items[i].QRest,
r
});
}
}
catch (Exception exc)
{
Marvin.Instance.Log(exc.Message);
throw exc;
}
string strDate = DateTime.Now.Day.ToString();
string mnth = "";
switch (DateTime.Now.Month)
{
case 1:
mnth = "января";
break;
case 2:
mnth = "февраля";
break;
case 3:
mnth = "марта";
break;
case 4:
mnth = "апреля";
break;
case 5:
mnth = "мая";
break;
case 6:
mnth = "июня";
break;
case 7:
mnth = "июля";
break;
case 8:
mnth = "августа";
break;
case 9:
//.........这里部分代码省略.........
示例2: LoadSpares
private void LoadSpares()
{
decimal sum1 = 0;
DataAccess da = new DataAccess();
items = da.GetSparesDemand();
for (int i = 0; i < items.Count; i++)
{
if (!items[i].QRest.HasValue)
items[i].QRest = 0;
items[i].demand = ((int)items[i].q_demand.Value - (int)items[i].QRest.Value);
sum1 += items[i].demand.Value;
}
dgSpares.DataContext = items;
}