?? selectcustomerform.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 + -