• 未上报数据


      public DataTable GetWeekDatas()
            {
                string[] fields = { "Province", "City", "UserName", "RealName", "Mobile", "UpdateWeek" };
                DataTable result = new DataTable();
                DataRow dr;
                for (int i = 0; i < fields.Length; i++)
                {
                    result.Columns.Add(fields[i]);

                }
                DataRepotHelper dbHelper = new DataRepotHelper();
                //     string tableID = this.ddlWeekTable.SelectedValue;
                DateTime currentDate = new DateTime(2013, 6, 15);
                DateTime startDate = new DateTime(2012, 12, 29);
                //  DateTime.Compare(currentDate, startDate);

                string[] tableids = { "08" };


                while (DateTime.Compare(currentDate, startDate) >= 0)
                {
                    for (int m = 0; m < tableids.Length; m++)
                    {
                        string updateWeek = GetWeekCode(startDate);
                        string sql = string.Format(@"select d.Name as Province,e.Name as City, u.UserName,u.RealName,u.Mobile,'{0}' as UpdateWeek from Sys_OilDepotInfo  as a left join (select  * from Sys_ReportData_08 where UpdateWeek='{1}') as b on a.ID=b.objectID left join Rel_User_SurveyTable as r
    on a.ID=r.objectID left join sys_user as u on r.userID=u.Id left join dic_district as  d on u.ProvinceID=d.ID left join dic_district as e on u.CityID=e.ID
    where  u.isValid=1  and r.TableID='{2}'  and b.ID is NULL", updateWeek, updateWeek, tableids[m]);
                        DataTable dt = dbHelper.GetDataTable(sql);
                        if (dt != null)
                        {
                            for (int j = 0; j < dt.Rows.Count; j++)
                            {
                                dr = result.NewRow();
                                for (int k = 0; k < fields.Length; k++)
                                {
                                    dr[fields[k]] = dt.Rows[j][fields[k]];
                                }
                                DataView dv = result.DefaultView;
                                dv.RowFilter = " UpdateWeek='" + updateWeek + "' and userName='" + dr["userName"].ToString() + "' and RealName='" + dr["RealName"].ToString() + "'";
                                if (dv.Count <= 0)
                                {
                                    result.Rows.Add(dr);
                                }
                            }
                        }
                    }
                    startDate = startDate.AddDays(7);
                }
                return result;
            }   

  • 相关阅读:
    CSS 3中细线边框如何实现?
    【SPL标准库专题(1)】 SPL简介
    【PSR规范专题(5)】PSR-4 改进后的自动加载规范
    【PSR规范专题(4)】PSR-3 日志接口规范
    【PSR规范专题(3)】PSR-2 代码风格规范
    【PSR规范专题(2)】PSR-1 基本代码规范
    YII框架的依赖注入容器与服务定位器简述
    PHP 反射机制Reflection
    【Apache运维基础(5)】Apache的Rewrite攻略(2)
    【Apache运维基础(4)】Apache的Rewrite攻略(1)
  • 原文地址:https://www.cnblogs.com/peace-lee/p/3160959.html
Copyright © 2020-2023  润新知