Пример #1
0
        public void RepeaterDataBind()
        {
            string strwhere = "where 1=1 ";

            if (date1.Value.Length > 0 && date2.Value.Length > 0)
            {
                strwhere += "and  convert(varchar(100), occ_time, 23)   >= '" + this.date1.Value.Trim() + "' and convert(varchar(100), occ_time, 23)   <= '" + this.date2.Value.Trim() + "' ";
            }
            //if(date1.Value.ToString() == "" && date2.Value.ToString() =="")
            //  {
            //      MessageBox.Show(this, "请选择开始日期和结束日期");
            //      return;
            //  }

            Repeater1.DataSource = oiBll.BusiDaily(strwhere);
            Repeater1.DataBind();

            DataSet ds = oiBll.BusiDaily(strwhere);

            foreach (DataRow row in ds.Tables[0].Rows)
            {
                if (row["fangzu"].ToString() == "")
                {
                    row["fangzu"] = 0;
                }
                fz += Convert.ToDouble(row["fangzu"]);

                if (row["xiaofei"].ToString() == "")
                {
                    row["xiaofei"] = 0;
                }
                xh += Convert.ToDouble(row["xiaofei"]);

                if (row["MoneySum"].ToString() == "")
                {
                    row["MoneySum"] = 0;
                }
                xj += Convert.ToDouble(row["MoneySum"]);
            }
        }