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

📄 selectspform.cs

📁 c#编写的汽车销售公司erp进销存系统
💻 CS
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;

using CallCenter.BusinessInterfaces.BaseForms.Models;
using CallCenter.BusinessInterfaces;
using CallCenter.BusinessLayer;
using CallCenter.Modules;

namespace CallCenter.BusinessInterfaces.BaseForms {
	/// <summary>
	/// SelectSPForm 的摘要说明。
	/// </summary>
	public class SelectSPForm : System.Windows.Forms.Form {
		private System.Windows.Forms.Panel panel1;
		private System.Windows.Forms.Button btnOK;
		private System.Windows.Forms.Button btnClose;
		/// <summary>
		/// 必需的设计器变量。
		/// </summary>
		private System.ComponentModel.Container components = null;

		private ServiceProviderForm m_SPForm=null;

		private int SelectIndex=0;
		int[] DisplayCol={3,5,6,7,8,12,4};
		private ListViewHelper SPListView =  new ListViewHelper();
		private IList m_SPList;
		private ServiceProviderBLL m_SPBLL=new ServiceProviderBLL();
		private ServiceProviderInfo m_SPInfo = new ServiceProviderInfo();
		private ServiceProviderInfoColumn SPInfoCol = new ServiceProviderInfoColumn();
		public SelectSPForm() {
			//
			// Windows 窗体设计器支持所必需的
			//
			InitializeComponent();
			InitMSPListVewCol();
			//
			// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
			//
		}
		public SelectSPForm(ServiceProviderForm spf,IList list):this(){
			if(list==null){
				return;
			}
			m_SPForm=spf;
			m_SPList=list;
			RereshSPNListView();
		}

		/// <summary>
		/// 清理所有正在使用的资源。
		/// </summary>
		protected override void Dispose( bool disposing ) {
			if( disposing ) {
				if(components != null) {
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows 窗体设计器生成的代码
		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		private void InitializeComponent() {
			this.panel1 = new System.Windows.Forms.Panel();
			this.btnOK = new System.Windows.Forms.Button();
			this.btnClose = new System.Windows.Forms.Button();
			this.SuspendLayout();
			// 
			// panel1
			// 
			this.panel1.AutoScroll = true;
			this.panel1.Dock = System.Windows.Forms.DockStyle.Top;
			this.panel1.Location = new System.Drawing.Point(0, 0);
			this.panel1.Name = "panel1";
			this.panel1.Size = new System.Drawing.Size(696, 416);
			this.panel1.TabIndex = 0;
			// 
			// btnOK
			// 
			this.btnOK.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
			this.btnOK.Location = new System.Drawing.Point(328, 424);
			this.btnOK.Name = "btnOK";
			this.btnOK.Size = new System.Drawing.Size(75, 24);
			this.btnOK.TabIndex = 1;
			this.btnOK.Text = "确定";
			this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
			// 
			// btnClose
			// 
			this.btnClose.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
			this.btnClose.Location = new System.Drawing.Point(488, 424);
			this.btnClose.Name = "btnClose";
			this.btnClose.Size = new System.Drawing.Size(75, 24);
			this.btnClose.TabIndex = 2;
			this.btnClose.Text = "关闭";
			this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
			// 
			// SelectSPForm
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.ClientSize = new System.Drawing.Size(696, 458);
			this.Controls.Add(this.btnClose);
			this.Controls.Add(this.btnOK);
			this.Controls.Add(this.panel1);
			this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
			this.MaximizeBox = false;
			this.MinimizeBox = false;
			this.Name = "SelectSPForm";
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
			this.Text = "选择服务商";
			this.ResumeLayout(false);

		}
		#endregion

		#region Method
		private void InitMSPListVewCol(){
			
			SPListView.Dock=DockStyle.Fill;
			SPListView.InitLV_UserDefined(SPInfoCol,DisplayCol);
			SPListView.Columns[0].Width = 200;
			this.panel1.Controls.Add(SPListView);
			SPListView.DoubleClick+=new EventHandler(SPListView_DoubleClick);
		}
		
		private void SetSPList(){
			if(m_SPList.Count>0){
				for(int i=0;i<SPListView.CheckedIndices.Count;i++){
					SelectIndex = SPListView.CheckedIndices[i];
					ServiceProviderInfo temp_spInfo = (ServiceProviderInfo)m_SPList[SelectIndex];
					m_SPForm.MapSPList.Add(temp_spInfo);
				}
			}
		}
		private void RereshSPNListView(){
			
			if(this.m_SPList!=null){
				SPListView.Refresh_UserDefine(m_SPList,m_SPInfo,DisplayCol);
			}
		}
		#endregion

		private void SPListView_DoubleClick(object sender, EventArgs e) {
			if(this.SPListView.SelectedIndices.Count>0){
				SelectIndex=this.SPListView.SelectedIndices[0];
				ServiceProviderInfo temp_spInfo = (ServiceProviderInfo)m_SPList[SelectIndex];
				m_SPForm.MapSPList.Add(temp_spInfo);
				this.DialogResult = DialogResult.OK;
			}
		}

		private void btnOK_Click(object sender, System.EventArgs e) {
			SetSPList();
			this.DialogResult = DialogResult.OK;
		}

		private void btnClose_Click(object sender, System.EventArgs e) {
			this.DialogResult = DialogResult.Cancel;
		}
	}
}

⌨️ 快捷键说明

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