⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mainform.cs

📁 移动通讯部门的多区域电话号码分类和统计模块
💻 CS
📖 第 1 页 / 共 2 页
字号:
			// ClassImportPath
			// 
			this.ClassImportPath.Location = new System.Drawing.Point(95, 163);
			this.ClassImportPath.Name = "ClassImportPath";
			this.ClassImportPath.Size = new System.Drawing.Size(121, 21);
			this.ClassImportPath.TabIndex = 11;
			this.ClassImportPath.Text = "";
			// 
			// ImportBut02
			// 
			this.ImportBut02.Location = new System.Drawing.Point(216, 18);
			this.ImportBut02.Name = "ImportBut02";
			this.ImportBut02.Size = new System.Drawing.Size(56, 23);
			this.ImportBut02.TabIndex = 5;
			this.ImportBut02.Text = "导入";
			this.ImportBut02.Click += new System.EventHandler(this.ImportBut02_Click);
			// 
			// Browse02
			// 
			this.Browse02.Location = new System.Drawing.Point(216, 45);
			this.Browse02.Name = "Browse02";
			this.Browse02.Size = new System.Drawing.Size(56, 23);
			this.Browse02.TabIndex = 12;
			this.Browse02.Text = "浏览";
			this.Browse02.Click += new System.EventHandler(this.Browse02_Click);
			// 
			// label5
			// 
			this.label5.Location = new System.Drawing.Point(7, 52);
			this.label5.Name = "label5";
			this.label5.Size = new System.Drawing.Size(80, 16);
			this.label5.TabIndex = 4;
			this.label5.Text = "营业部编码:";
			// 
			// area_code
			// 
			this.area_code.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
			this.area_code.Location = new System.Drawing.Point(88, 45);
			this.area_code.Name = "area_code";
			this.area_code.Size = new System.Drawing.Size(120, 23);
			this.area_code.TabIndex = 5;
			// 
			// Form1
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.ClientSize = new System.Drawing.Size(296, 266);
			this.Controls.Add(this.ClassImportPath);
			this.Controls.Add(this.opera_name_list);
			this.Controls.Add(this.groupBox2);
			this.Controls.Add(this.label4);
			this.Controls.Add(this.BaseImportPath);
			this.Controls.Add(this.Browse01);
			this.Controls.Add(this.label1);
			this.Controls.Add(this.Area_Name_list);
			this.Controls.Add(this.groupBox1);
			this.Name = "Form1";
			this.Text = "Form1";
			this.Load += new System.EventHandler(this.Form1_Load);
			this.groupBox1.ResumeLayout(false);
			this.groupBox2.ResumeLayout(false);
			this.ResumeLayout(false);

		}
		#endregion

		/// <summary>
		/// 应用程序的主入口点。
		/// </summary>
		[STAThread]
		static void Main() 
		{
			Application.Run(new Form1());
		}

		private void Form1_Load(object sender, System.EventArgs e)
		{
			Area_Name_list.Items.Clear();
			ReadAreaName();
			opera_name_list.Items.Clear();
			ClassOperaName();
		}

		void ReadAreaName()
		{
			
			string SqlCmd ="select count(*) from Area_T";				
			int nCount = DBCount(SqlCmd);
			if (nCount > 0)
			{
				for(int i=0;i<nCount;i++)
				{
					Area_Name_list.Items.Add(Get_Area_Name(i));	
				}
			}
			
		}

		void ClassOperaName()
		{
			
			string SqlCmd ="select count(*) from Opera_T";				
			int nCount = DBCount(SqlCmd);
			if (nCount > 0)
			{
				for(int i=0;i<nCount;i++)
				{
					opera_name_list.Items.Add(Get_Oprea_Name(i));	
				}
			}
			
		}

		private int DBCount(string SqlCmd)
		{
			int Num=0;
			string DBConnect= IniReadValue("DB参数","服务名",currentpath);
			try
			{
				SqlConnection SQLConn = new SqlConnection(DBConnect);
				SqlCommand myComm = new SqlCommand(SqlCmd,SQLConn);
				if (SQLConn.State.ToString().Equals("Closed"))
				{
					SQLConn.Open();
					SqlDataReader dr=myComm.ExecuteReader();	
					if(dr.Read())
					{	
						Num=Convert.ToInt16(dr.GetValue(0).ToString());
					}
					else
					{
						Num = 0;
					}	
				}
				SQLConn.Close();
			}
			catch(Exception )
			{
				//WrErrLog("SimCheckNum 数据库连接异常!",ex.Message);
			}
			return Num;
		}

		private string Get_Area_Name(int i)
		{

			string IdResult="";
			string DBConnectS= IniReadValue("DB参数","服务名",currentpath);
			SqlConnection oSQLConn = new SqlConnection();
			oSQLConn.ConnectionString=DBConnectS;;
			string sqlcommand ="select area_name from Area_T" ;
			SqlDataAdapter drtoday=new SqlDataAdapter(sqlcommand,oSQLConn);
			DataSet DataSetnew=new DataSet();
			if (oSQLConn.State.ToString().Equals("Closed"))
			{
				oSQLConn.Open();
			}
			drtoday.Fill(DataSetnew,"Area_Name");
			DataTable dt3=DataSetnew.Tables["Area_Name"];
			if(dt3.Rows.Count>0)
			{	
				IdResult=dt3.Rows[i]["area_Name"].ToString().Trim();
			}
			return IdResult;
		}

		private string Get_Oprea_Name(int i)
		{
			string IdResult="";
			string DBConnectS= IniReadValue("DB参数","服务名",currentpath);
			SqlConnection oSQLConn = new SqlConnection();
			oSQLConn.ConnectionString=DBConnectS;;
			string sqlcommand ="SELECT opera_name FROM Opera_T" ;
			SqlDataAdapter dr=new SqlDataAdapter(sqlcommand,oSQLConn);
			DataSet DataSet=new DataSet();
			if (oSQLConn.State.ToString().Equals("Closed"))
			{
				oSQLConn.Open();
			}
			dr.Fill(DataSet,"Opera_Name");
			DataTable dt=DataSet.Tables["Opera_Name"];
			if(dt.Rows.Count>0)
			{	
				IdResult=dt.Rows[i]["opera_Name"].ToString().Trim();
			}
			return IdResult;
		}

		private string Get_Area_Code(string area_n)
		{
			string IdResult="";
			string DBConnectS= IniReadValue("DB参数","服务名",currentpath);
			SqlConnection oSQLConn = new SqlConnection();
			oSQLConn.ConnectionString=DBConnectS;;
			string sqlcommand ="SELECT area_code FROM Area_T WHERE (area_name = '" + area_n + "')" ;
			SqlDataAdapter dr=new SqlDataAdapter(sqlcommand,oSQLConn);
			DataSet DataSet=new DataSet();
			if (oSQLConn.State.ToString().Equals("Closed"))
			{
				oSQLConn.Open();
			}
			dr.Fill(DataSet,"Opera_Name");
			DataTable dt=DataSet.Tables["Opera_Name"];
			if(dt.Rows.Count>0)
			{	
				IdResult=dt.Rows[0]["area_code"].ToString().Trim();
			}
			return IdResult;
		}

		private void Area_Name_list_SelectedIndexChanged(object sender, System.EventArgs e)
		{
			area_code.Text = Get_Area_Code(Area_Name_list.SelectedItem.ToString());
		}

		private void Browse01_Click(object sender, System.EventArgs e)
		{
			this.folderBrowserDialog1.SelectedPath = this.BaseImportPath.Text;
			if (this.folderBrowserDialog1.ShowDialog() == DialogResult.OK)
			{
				this.BaseImportPath.Text = this.folderBrowserDialog1.SelectedPath;
			}
		}

		private void Browse02_Click(object sender, System.EventArgs e)
		{
			this.folderBrowserDialog1.SelectedPath = this.ClassImportPath.Text;
			if (this.folderBrowserDialog1.ShowDialog() == DialogResult.OK)
			{
				this.ClassImportPath.Text = this.folderBrowserDialog1.SelectedPath;
			}
		}

		private void ImportBut02_Click(object sender, System.EventArgs e)
		{
		
		}

		private void ImportBut01_Click(object sender, System.EventArgs e)
		{
		
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -