如何在实体框架中更新行 [英] How to update row in entity framework
问题描述
0
下来投票
最爱
i我正在制作pos软件,现在我的客户要求的是他们在列表框中添加2项2次所以它只是显示一次,但这个项目的数量增加我正在努力,但我不知道如何处理数量。
0
down vote
favorite
i am making a pos software and now my clients request is when they add 1 items 2 times in listbox so it's just show one time but quantity of this item increase i am working on this but i dont know how to work on quantity.
Button b = (Button)sender;
tblProduct tp = (tblProduct)b.Tag;
string product = tp.productName;
lbProductsToBuy.Text = tp.ToString();
products.Add(tp);
total += (decimal)tp.productPrice;
var duplicates = products.GroupBy(i => i.productName)
.Where(x => x.Count() > 0)
.Select(val => val.Key);
foreach (var item in duplicates)
{
}
and listbox format is
try
{
string ProductName = ((tblProduct)e.ListItem).productName;
string Price = "Rs: " + String.Format("{0:}", ((tblProduct)e.ListItem).productPrice);
string ProductNamePadded = ProductName.PadRight(33);
e.Value = ProductNamePadded+Price;
}
catch
{
}
look在这个问题的形象
\http://imgur.com/a/1DhiV
我尝试过:
0
下来投票
最爱
i我正在制作一个pos软件,现在我的客户要求的是当他们在列表框中添加2个项目2次,所以它只显示一次但这个项目的数量增加我正在研究这个但我不知道如何处理数量。
look at this image of issue
\http://imgur.com/a/1DhiV
What I have tried:
0
down vote
favorite
i am making a pos software and now my clients request is when they add 1 items 2 times in listbox so it's just show one time but quantity of this item increase i am working on this but i dont know how to work on quantity.
Button b = (Button)sender;
tblProduct tp = (tblProduct)b.Tag;
string product = tp.productName;
lbProductsToBuy.Text = tp.ToString();
products.Add(tp);
total += (decimal)tp.productPrice;
var duplicates = products.GroupBy(i => i.productName)
.Where(x => x.Count() > 0)
.Select(val => val.Key);
foreach (var item in duplicates)
{
}
and listbox format is
try
{
string ProductName = ((tblProduct)e.ListItem).productName;
string Price = "Rs: " + String.Format("{0:}", ((tblProduct)e.ListItem).productPrice);
string ProductNamePadded = ProductName.PadRight(33);
e.Value = ProductNamePadded+Price;
}
catch
{
}
推荐答案
duplicates.Select(c => { c.value = txtbox.Text; return c; }).ToList()
这篇关于如何在实体框架中更新行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!