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

📄 selectcustomerform.cs

📁 汽车销售公司ERP进销存系统 汽车销售公司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;
using CallCenter.BusinessInterfaces.MainForms;
namespace CallCenter.BusinessInterfaces.BaseForms {
	/// <summary>
	/// SelectCustomerForm 的摘要说明。
	/// </summary>
	public class SelectCustomerForm : System.Windows.Forms.Form {

		private IList m_customerList;
		private int[] DisplayCol = {1,2,3,4,5,6,8,9};
		//private string customerIds=null;
		
		
		private DevExpress.XtraEditors.PanelControl panel1;
		private DevExpress.XtraEditors.PanelControl panel2;
		private CustomerInfo m_customerInfo=null;
		private DevExpress.XtraEditors.SimpleButton btnEnter;
		private DevExpress.XtraEditors.SimpleButton btnClose;

		public CustomerInfo GetCustomerInfo{
			get{
				return this.m_customerInfo;
			}
		}
		/// <summary>
		/// 必需的设计器变量。
		/// </summary>
		private System.ComponentModel.Container components = null;

		public SelectCustomerForm() {
			//
			// Windows 窗体设计器支持所必需的
			//
			InitializeComponent();
			InitializeListView();
			
			//
			// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
			//
		}
		public SelectCustomerForm(IList customerList):this(){
			m_customerList = customerList;
			RefreshListView(customerList);
		}
		/// <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 DevExpress.XtraEditors.PanelControl();
			this.panel2 = new DevExpress.XtraEditors.PanelControl();
			this.btnEnter = new DevExpress.XtraEditors.SimpleButton();
			this.btnClose = new DevExpress.XtraEditors.SimpleButton();
			((System.ComponentModel.ISupportInitialize)(this.panel1)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.panel2)).BeginInit();
			this.panel2.SuspendLayout();
			this.SuspendLayout();
			// 
			// panel1
			// 
			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, 368);
			this.panel1.TabIndex = 2;
			// 
			// panel2
			// 
			this.panel2.Appearance.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(131)), ((System.Byte)(194)), ((System.Byte)(231)));
			this.panel2.Appearance.Options.UseBackColor = true;
			this.panel2.Controls.Add(this.btnClose);
			this.panel2.Controls.Add(this.btnEnter);
			this.panel2.Dock = System.Windows.Forms.DockStyle.Fill;
			this.panel2.Location = new System.Drawing.Point(0, 368);
			this.panel2.Name = "panel2";
			this.panel2.Size = new System.Drawing.Size(696, 58);
			this.panel2.TabIndex = 3;
			// 
			// btnEnter
			// 
			this.btnEnter.Location = new System.Drawing.Point(440, 16);
			this.btnEnter.Name = "btnEnter";
			this.btnEnter.TabIndex = 2;
			this.btnEnter.Text = "确定";
			this.btnEnter.Click += new System.EventHandler(this.btnEnter_Click);
			// 
			// btnClose
			// 
			this.btnClose.Location = new System.Drawing.Point(528, 16);
			this.btnClose.Name = "btnClose";
			this.btnClose.TabIndex = 3;
			this.btnClose.Text = "关闭";
			this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
			// 
			// SelectCustomerForm
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.ClientSize = new System.Drawing.Size(696, 426);
			this.Controls.Add(this.panel2);
			this.Controls.Add(this.panel1);
			this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
			this.Name = "SelectCustomerForm";
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
			this.Text = "选择用户";
			this.SizeChanged += new System.EventHandler(this.SelectCustomerForm_SizeChanged);
			((System.ComponentModel.ISupportInitialize)(this.panel1)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.panel2)).EndInit();
			this.panel2.ResumeLayout(false);
			this.ResumeLayout(false);

		}
		#endregion

		#region method
		private ListViewHelper cListView=null;
		private void InitializeListView(){

			cListView = new ListViewHelper();
			cListView.BackColor=Color.FromArgb(ShareClass.Rcolor,ShareClass.Gcolor,ShareClass.Bcolor);
			
			cListView.View = View.Details;
			cListView.GridLines = true;
			cListView.FullRowSelect = true;
			cListView.HideSelection = false;
			cListView.Dock=DockStyle.Fill;

			CustomerInfoColumn cusInfoCol = new CustomerInfoColumn();
			
			cListView.InitLV_UserDefined(cusInfoCol,DisplayCol);
			this.panel1.Controls.Add(cListView);
			this.cListView.DoubleClick+=new EventHandler(CustomerListView_DoubleClick);
			this.cListView.SelectedIndexChanged+=new EventHandler(CustomerListView_SelectedIndexChanged);
			
		}
		private void RefreshListView(IList customerList){

			try{
				//customerList = new CustomerBLL().getCustomerByIds(customerIds);
				cListView.Refresh_UserDefine(customerList,new CustomerInfo(),DisplayCol);
			}catch(Exception ex){
				MessageBox.Show(ex.Message,"警告",MessageBoxButtons.OK,MessageBoxIcon.Warning);
			}
		}

		private void Enters(){
			try{
				if(this.cListView.SelectedIndices.Count>0){
					int index=this.cListView.SelectedIndices[0];
					if(m_customerList.Count>=index){
						this.m_customerInfo =(CustomerInfo)m_customerList[index];
						this.DialogResult=DialogResult.Yes;
					}
				}
			}catch(Exception ex){
				MessageBox.Show(ex.Message,"警告",MessageBoxButtons.OK,MessageBoxIcon.Warning);
			}
		}
		#endregion

		#region events
		
		private void CustomerListView_DoubleClick(object sender, EventArgs e) {
			Enters();
		}
		private void CustomerListView_SelectedIndexChanged(object sender, EventArgs e) {
			//			try{
			//				if(this.cListView.SelectedIndices.Count>0){
			//					int index=this.cListView.SelectedIndices[0];
			//					if(m_customerList.Count>=index){
			//						this.m_customerInfo =(CustomerInfo)m_customerList[index];
			//					}
			//				}
			//			}catch(Exception ex){
			//				MessageBox.Show(ex.Message);
			//			}
		}
		private void btnEnter_Click(object sender, System.EventArgs e) {
			Enters();
		}
		private void btnClose_Click(object sender, System.EventArgs e) {
			this.DialogResult=DialogResult.Cancel;
		}
		#endregion

		private void SelectCustomerForm_SizeChanged(object sender, EventArgs e) {
			this.panel1.Height=this.Height-86;
		}

		private void button1_Click(object sender, System.EventArgs e)
		{
			try
			{
				Rectangle rect=new Rectangle();
				rect=Screen.GetWorkingArea(this);
				this.Left=rect.Width;
				this.Top=rect.Y;
				Rectangle rect1=new Rectangle();
				rect1=Screen.GetWorkingArea(this);
				this.Width=rect.Width;
				this.Height=rect.Height;
			}
			catch(Exception ex)
			{
				MessageBox.Show(ex.Message);
			}
		}
	}
}

⌨️ 快捷键说明

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