using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;


public class Class_TotalCost
{
    private String Str_UserName = String.Empty;
    private float flt_TotalCost = 0;

    public Class_TotalCost(String _Str_UserName)
    {
        Str_UserName = _Str_UserName;
    }


    public void UDF_TotalCost()
    {
        float flt_Sum = 0;
        LSCTamiratDataContext db = new LSCTamiratDataContext();     
            var Query = from Row in db.xtblShowFactors  
                        where Row.DriverUserName.Trim() ==  Str_UserName.Trim()
                        select new
                        {
                            Row.TotalCost
                        };
            foreach (var Row in Query)
            {
                flt_Sum += float.Parse(Row.TotalCost.ToString());
            }

            flt_TotalCost = flt_Sum;
    }

    public float flt_TotalSum
    {
        get
        {
            return flt_TotalCost;
        }
    }

}