zoukankan      html  css  js  c++  java
  • case

    日期间隔计算
    // Returns the number of days between the current 
    // date/time and hiredDate
    TimeSpan ts = DateTime.Now.Subtract(employee.HireDate);
    return ts.Days.ToString("#,##0");



    //GridView的页脚中显示统计信息
    // 类范围,累积合计的变量……
     2decimal _totalUnitPrice = 0m;
     3int _totalNonNullUnitPriceCount = 0;
     4int _totalUnitsInStock = 0;
     5int _totalUnitsOnOrder = 0;
    protected void ProductsInCategory_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                // Reference the ProductsRow via the e.Row.DataItem property
                Northwind.ProductsRow product = (Northwind.ProductsRow)((System.Data.DataRowView)e.Row.DataItem).Row;
                //……增加累积合计……
                // Increment the running totals (if they're not NULL!)
                if (!product.IsUnitPriceNull())
                {
                    _totalUnitPrice += product.UnitPrice;
                    _totalNonNullUnitPriceCount++;
                }

                if (!product.IsUnitsInStockNull())
                    _totalUnitsInStock += product.UnitsInStock;

                if (!product.IsUnitsOnOrderNull())
                    _totalUnitsOnOrder += product.UnitsOnOrder;
            }
            else if (e.Row.RowType == DataControlRowType.Footer)
            {
                /// 确定平均单价
                decimal avgUnitPrice = _totalUnitPrice / (decimal)_totalNonNullUnitPriceCount;

                //// 在相应的单元格中显示统计数据 Display the summary data in the appropriate cells
                e.Row.Cells[1].Text = "Avg.: " + avgUnitPrice.ToString("c");
                e.Row.Cells[2].Text = "Total: " + _totalUnitsInStock.ToString();
                e.Row.Cells[3].Text = "Total: " + _totalUnitsOnOrder.ToString();
            }
        }

  • 相关阅读:
    showModalDialog()、showModelessDialog()方法使用详解
    Oracle 8i在GNU/Linux上的安装笔记
    TURBOLinux 7.0下安装Oracle 8.1.7.0.1 release 3
    [Oracle]初识Oracle8i(8.0.5)
    (三)
    退出win不保存设置
    Windows 2000/NT/XP管理员密码丢失解决方法
    DCOM错误:DefaultLaunchPermssion 访问被拒绝
    找到一些工具
    O/R MAP 和 ObjectSpaces 资料
  • 原文地址:https://www.cnblogs.com/zwl12549/p/677577.html
Copyright © 2011-2022 走看看