2011-06-23 16 views
0

だから、私はLINQクエリによって移入データグリッドを持っている:私はコストセルを変更し、私は順序を変更した場合データグリッドセルの編集イベント

public class dataservice 
{ 
    [OperationContract] 
    public List<LightOrder> GetOrder(string code) 
    { 
     // Add your operation implementation here 
     using (amazonproscoutEntities context = new amazonproscoutEntities()) 
     { 
      return (from c in context.AmazonSKUs 
        where c.MerchantSKU.StartsWith(code) 
        select new LightOrder() 
        { 
         SKU = c.MerchantSKU, 
         productname = c.ItemName, 
         asin = c.ASIN, 
         //ourprice = c.OurPrice, 
         bbprice = c.Price, 
         quantity= c.TotalQty, 
         rank = c.Rank, 

        } 
        ).Take<LightOrder>(500).ToList<LightOrder>(); 

     } 
    } 

    // Add more operations here and mark them with [OperationContract] 
} 
public class LightOrder 
{ 
    public string SKU { get; set; } 
    public string productname { get; set; } 
    public string itemnumber { get; set; } 
    public string asin { get; set; } 
    //public Nullable<decimal> ourprice { get; set; } 
    public string bbprice { get; set; } 
    public string w1 { get; set; } 
    public string w2 { get; set; } 
    public string w3 { get; set; } 
    public string w4 { get; set; } 
    public int quantity { get; set; } 
    public string pendingorder { get; set; } 
    public string afner { get; set; } 
    public string order { get; set; } 
    public string total { get; set; } 
    public string profit { get; set; } 
    public string percent { get; set; } 
    public string rank { get; set; } 

} 

私の質問があり、私はそれが私の合計を伝えたいです私のデータグリッドを失うことなく、またはデータベースに書き込むことで、どうやってそれをやっていくのですか?

答えて

0

一時変数を作成できます。

double tempCost; 
double tempOrder; 
double tempTotal; 
+0

この一時変数はどうしますか?また、各行に何かを追加するため、配列が必要な場合もあります。 –

+0

おそらく、 "OnRowEditing"を使用して、編集中のフィールドから値を取得し、gridviewを再投入する必要があります。 –

関連する問題