本文介绍了如何在列表视图中显示日期?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在3月7日创建了一张唱片。但是当我试图检索记录时,它将显示为3月4日。可能是什么问题???



我尝试了什么:



private void FillList()

{

if(listView1.Items.Count> 0)

listView1.Items.Clear() ;





使用(PetaPoco.Database db = new Database(new Db()。Connection))

{



IEnumerable< reportinvoiceitems>项目;



医生医生= db.Single< doctor>(this._doctorId);



/ /以下是我写的查询

string query = String.Format(选择invoiceitem._ROWID_为sr,strftime('%d-%m-%Y',invoice.date)为date,doctor.name as DoctorName,product.name as productname,invoiceitem.range,invoiceitem.id,invoiceitem.quantity,invoiceitem.price,invoiceitem.vat,((invoiceitem.quantity * invoiceitem.price)+((invoiceitem.price) * invoiceitem.quantity)*(invoiceitem.vat / 100)))作为金额,invoiceitem.remark来自invoiceitem内部加入发票上invoiceitem.invoice_id = invoice.id内部联接医生发票.doctor_id = doctor.id内部加入产品发票上.product_id = product.id其中invoice.doctor_id = {0},invoice.date介于{1}和{2}之间,_ docId,_from.ToString(yyyy-MM-dd HH:mm:00 ),_to.AddMinutes(1439).ToString(yyyy-MM-dd HH:mm:00));



items = db.Query< reportinvoiceitems>(查询);



十进制总数= 0;

int v = this._vat;

foreach(项目中的var项目)

{

十进制数量= Convert.ToDecimal(项目。数量)* Convert.ToDecimal(item.Price);

金额=金额+(金额* v / 100);

总计+ =金额;

ListViewItem listViewItem = new ListViewItem(new string [] {item.Sr.ToString(),item.Date,item.ProductName,item.DoctorName,item.Remark,item.Range,item.Quantity,item.Price, item.VAT,item.Amount});

listViewItem.Tag = item;

listView1.Items.Add(listViewItem);

}

label1.Text = doctor.name;

label2.Text = total.ToString();

}



}

I have created a record on date 7th March. But when I'm trying to retrieve the record, it is being displayed as 4th of March. What can be the problem???

What I have tried:

private void FillList()
{
if (listView1.Items.Count > 0)
listView1.Items.Clear();


using (PetaPoco.Database db = new Database(new Db().Connection))
{

IEnumerable<reportinvoiceitems> items;

Doctor doctor = db.Single<doctor>(this._doctorId);

//Following is the Query I've written
string query = String.Format("select invoiceitem._ROWID_ as sr, strftime('%d-%m-%Y', invoice.date) as date,doctor.name as DoctorName ,product.name as productname,invoiceitem.range, invoiceitem.id ,invoiceitem.quantity, invoiceitem.price, invoiceitem.vat, ((invoiceitem.quantity * invoiceitem.price) + ((invoiceitem.price * invoiceitem.quantity) * (invoiceitem.vat / 100))) as amount, invoiceitem.remark from invoiceitem inner join invoice on invoiceitem.invoice_id = invoice.id inner join doctor on invoice.doctor_id = doctor.id inner join product on invoiceitem.product_id = product.id where invoice.doctor_id = {0} and invoice.date between '{1}' and '{2}'", _doctorId, _from.ToString("yyyy-MM-dd HH:mm:00"), _to.AddMinutes(1439).ToString("yyyy-MM-dd HH:mm:00"));

items = db.Query<reportinvoiceitems>(query);

decimal total = 0;
int v = this._vat;
foreach (var item in items)
{
decimal amount = Convert.ToDecimal(item.Quantity) * Convert.ToDecimal(item.Price);
amount = amount + (amount * v / 100);
total += amount;
ListViewItem listViewItem = new ListViewItem(new string[] { item.Sr.ToString(), item.Date, item.ProductName, item.DoctorName, item.Remark, item.Range, item.Quantity, item.Price, item.VAT, item.Amount });
listViewItem.Tag = item;
listView1.Items.Add(listViewItem);
}
label1.Text = doctor.name;
label2.Text = total.ToString();
}

}

推荐答案


这篇关于如何在列表视图中显示日期?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-04 07:48