Example #1
0
        /// <summary>
        /// 刷新
        /// </summary>
        public void m_mthRefresh()
        {
            DataTable dt;

            clsDcl_Charge objCharge = new clsDcl_Charge();

            long l = objCharge.GetDayAccountsInfo(out dt);

            if (l > 0)
            {
                this.lvHistory.Items.Clear();
                string middate = "";
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    string       feedate    = dt.Rows[i]["feedate"].ToString();
                    string       createdate = dt.Rows[i]["createdate"].ToString();
                    ListViewItem lv         = new ListViewItem(Convert.ToString(i + 1));

                    lv.SubItems.Add("成功");
                    lv.SubItems.Add(createdate);
                    lv.SubItems.Add(feedate.Substring(0, 10) + " 00:00:00~" + feedate.Substring(0, 10) + " 23:59:59");
                    lv.SubItems.Add(feedate.Substring(0, 4) + feedate.Substring(5, 2) + feedate.Substring(8, 2));

                    if (i != 0)
                    {
                        DateTime dte1 = Convert.ToDateTime(middate);
                        DateTime dte2 = Convert.ToDateTime(feedate.Substring(0, 10));
                        TimeSpan ts   = dte2.Subtract(dte1);
                        TimeSpan ts1  = new TimeSpan(1, 0, 0, 0);
                        if (ts.Days > 1)
                        {
                            for (int j = 1; j < ts.Days; j++)
                            {
                                dte1 = dte1.Add(ts1);
                                ListViewItem lv1 = new ListViewItem("*");
                                lv1.SubItems.Add("失败");
                                lv1.SubItems.Add(dte1.ToString("yyyy-MM-dd"));
                                lv1.SubItems.Add("*");
                                lv1.SubItems.Add("*");
                                lv1.ForeColor  = Color.Red;
                                lv1.ImageIndex = 1;
                                lv1.Tag        = "failure";
                                this.lvHistory.Items.Add(lv1);
                            }
                        }
                    }
                    lv.ImageIndex = 0;
                    lv.Tag        = "success";
                    this.lvHistory.Items.Add(lv);

                    middate = feedate.Substring(0, 10);
                }
            }
        }