123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135 |
- using DataUpload.Model;
- using Newtonsoft.Json;
- using Newtonsoft.Json.Linq;
- using RDIFramework.Utilities;
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Configuration;
- using System.Data;
- using System.Drawing;
- using System.IO;
- using System.Linq;
- using System.Net;
- using System.Text;
- using System.Threading;
- using System.Windows.Forms;
- namespace DataUpload
- {
- public partial class ManyFormSearch : Form
- {
- public string dbMeter = ConfigurationManager.AppSettings["DBMeter"];
- IDbProvider dbHelper
- {
- get
- {
- var DbDefine = DbFactoryProvider.GetProvider(CurrentDbType.Access, dbMeter);
- return DbDefine;
- }
- }
- public delegate void SetListViewData(string sql, string type, string start, string end);
- public event SetListViewData FillListView;
- private string areaId = null;
- public ManyFormSearch()
- {
- InitializeComponent();
- }
- private void lBox_area_SelectedValueChanged(object sender, EventArgs e)
- {
- txt_area.Text = "";
- areaId = "";
- List<String> list = new List<String>();
- List<String> areaList = new List<String>();
- if (lBox_area.SelectedValue != null && lBox_area.SelectedValue.ToString() != "1")
- {
- for (int i = 0; i < lBox_area.SelectedItems.Count; i++)
- {
- DataRowView rowView = lBox_area.SelectedItems[i] as DataRowView;
- areaList.Add(rowView["小区名称"].ToString());
- list.Add(rowView["AreaID"].ToString());
- }
- areaId = String.Join(",", list.ToArray());
- txt_area.Text = String.Join(",", areaList.ToArray());
- }
- }
- private void FormSearch_Load(object sender, EventArgs e)
- {
- var sql = "Select * From Bsc_AreaInfo";
- DataTable dt = dbHelper.Fill(sql);
- lBox_area.ValueMember = "AreaID";
- lBox_area.DisplayMember = "小区名称";
- lBox_area.DataSource = dt;
- lBox_area.SelectedIndex = 0;
- lBox_area.SelectedItems.Clear();
- }
-
- private void btnOK_Click(object sender, EventArgs e)
- {
- this.btnOK.Enabled = false;
- var sql = "Select * From View_MeterList Where 1=1 and userNo is not null and userNo <> ''and 表地址 is not null and 表地址 <> '' ";
- //小区
- if (!string.IsNullOrEmpty(txt_area.Text))
- {
- sql += " and AreaNo in (" + areaId + ")";
- }
- string type = "1";
- sql += " Order by 小区名称,Right('0000' + [楼宇编号], 4),Right('0000' + [单元编号], 4),Right('0000' + [门牌编号], 4),UserNo,MeterID";
- string start, end;
- if (FillListView != null)
- {
- MyParam myParam = new MyParam()
- {
- SQL = sql,
- Type = type
- };
- this.Close();
- //new Thread(new ParameterizedThreadStart(LoadData)).Start(myParam);
- FillListView(myParam.SQL, myParam.Type, myParam.Start, myParam.End);
- }
-
- }
- private void LoadData(object obj)
- {
- MyParam p = obj as MyParam;
- FillListView(p.SQL, p.Type, p.Start, p.End);
- }
- private void btnCancel_Click(object sender, EventArgs e)
- {
- this.Close();
- }
- private class MyParam
- {
- public string SQL { get; set; }
- public string Type { get; set; }
- public string Start { get; set; }
- public string End { get; set; }
- }
- private void txt_area_TextChanged(object sender, EventArgs e)
- {
- }
- private void lBox_area_SelectedIndexChanged(object sender, EventArgs e)
- {
- }
- private void groupBox2_Enter(object sender, EventArgs e)
- {
- }
- }
- }
|