From 651e4bf1c3a19c347bc651b8d411596d7fb16963 Mon Sep 17 00:00:00 2001 From: qiji Date: Sat, 2 Jun 2012 19:21:46 +0800 Subject: [PATCH] OK --- ShopClient/Cash.Designer.cs | 1 + ShopClient/Cash.cs | 42 ++++++++++++++++ ShopClient/Login.cs | 1 + ShopClient/Program.cs | 80 +++++++++++++++---------------- ShopClient/ShopSelect.Designer.cs | 32 ++++++------- ShopClient/ShopSelect.cs | 7 ++- 6 files changed, 103 insertions(+), 60 deletions(-) diff --git a/ShopClient/Cash.Designer.cs b/ShopClient/Cash.Designer.cs index 95484b0..ce1410b 100644 --- a/ShopClient/Cash.Designer.cs +++ b/ShopClient/Cash.Designer.cs @@ -48,6 +48,7 @@ private void InitializeComponent() this.Controls.Add(this.label1); this.Name = "Cash"; this.Text = "Cash"; + this.Load += new System.EventHandler(this.Cash_Load); this.ResumeLayout(false); this.PerformLayout(); diff --git a/ShopClient/Cash.cs b/ShopClient/Cash.cs index e47aefb..b6b0fc8 100644 --- a/ShopClient/Cash.cs +++ b/ShopClient/Cash.cs @@ -6,6 +6,8 @@ using System.Linq; using System.Text; using System.Windows.Forms; +using NameName.DAL; +using NameName.Model; namespace ShopClient { @@ -13,7 +15,47 @@ public partial class Cash : Form { public Cash() { + ClientLogin(); InitializeComponent(); } + + private void Cash_Load(object sender, EventArgs e) + { + + } + + private void ClientLogin() + { + + + string strShopId = Properties.Settings.Default.ShopId; + + if (string.IsNullOrEmpty(strShopId)) + { + new ShopSelect().ShowDialog(); + } + else + { + Guid shopId; + Guid.TryParse(strShopId, out shopId); + if (shopId != Guid.Empty) + { + ShopInfo shop = new DALShopInfo().GetByShopID(shopId); + if (shop == null) + { + new ShopSelect().ShowDialog(); + } + else + { + GlobalValue.ShopID = shop.ShopID; + new UserSelect().ShowDialog(); + } + } + else + { + new ShopSelect().ShowDialog(); + } + } + } } } diff --git a/ShopClient/Login.cs b/ShopClient/Login.cs index e6f6b87..fde801b 100644 --- a/ShopClient/Login.cs +++ b/ShopClient/Login.cs @@ -41,6 +41,7 @@ private void Login_Load(object sender, EventArgs e) private void btnClear_Click(object sender, EventArgs e) { tbxPwd.Text = string.Empty; + } private void button4_Click(object sender, EventArgs e) diff --git a/ShopClient/Program.cs b/ShopClient/Program.cs index ba57580..5a33505 100644 --- a/ShopClient/Program.cs +++ b/ShopClient/Program.cs @@ -17,55 +17,55 @@ static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); - //InitClient(); - Application.Run(new ShopSelect()); + + Application.Run(new Cash()); } /// /// 之前是否已经选择过. /// 是:读取配置信息 直接打开登录界面 /// 否:打开选择页面 /// - private static void InitClient() - { - bool HasSelected = false; - string strShopId = Properties.Settings.Default.ShopId; - Application.Run(new ShopSelect()); - return; - if (string.IsNullOrEmpty(strShopId)) - { - HasSelected = false; + //private static void InitClient() + //{ + // bool HasSelected = false; + // string strShopId = Properties.Settings.Default.ShopId; + // Application.Run(new ShopSelect()); + // return; + // if (string.IsNullOrEmpty(strShopId)) + // { + // HasSelected = false; - } - else - { + // } + // else + // { - Guid shopId; - Guid.TryParse(strShopId, out shopId); - if (shopId != Guid.Empty) - { - ShopInfo shop = new DALShopInfo().GetByShopID(shopId); - if (shop == null) - { - HasSelected = false; - } - else - { - HasSelected = true; - GlobalValue.ShopID = shop.ShopID; - Application.Run(new Login()); - } - } - else - { - HasSelected = false; - } - } - if (!HasSelected) - { - Application.Run(new ShopSelect()); + // Guid shopId; + // Guid.TryParse(strShopId, out shopId); + // if (shopId != Guid.Empty) + // { + // ShopInfo shop = new DALShopInfo().GetByShopID(shopId); + // if (shop == null) + // { + // HasSelected = false; + // } + // else + // { + // HasSelected = true; + // GlobalValue.ShopID = shop.ShopID; + // Application.Run(new Login()); + // } + // } + // else + // { + // HasSelected = false; + // } + // } + // if (!HasSelected) + // { + // Application.Run(new ShopSelect()); - } + // } - } + //} } } diff --git a/ShopClient/ShopSelect.Designer.cs b/ShopClient/ShopSelect.Designer.cs index 59d8c0a..8804576 100644 --- a/ShopClient/ShopSelect.Designer.cs +++ b/ShopClient/ShopSelect.Designer.cs @@ -31,7 +31,7 @@ private void InitializeComponent() this.tabControl1 = new System.Windows.Forms.TabControl(); this.tabPage1 = new System.Windows.Forms.TabPage(); this.panel1 = new System.Windows.Forms.Panel(); - this.button1 = new System.Windows.Forms.Button(); + this.btnExit = new System.Windows.Forms.Button(); this.label1 = new System.Windows.Forms.Label(); this.tabControl1.SuspendLayout(); this.panel1.SuspendLayout(); @@ -42,7 +42,7 @@ private void InitializeComponent() this.tabControl1.Controls.Add(this.tabPage1); this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill; this.tabControl1.Location = new System.Drawing.Point(0, 64); - this.tabControl1.Margin = new System.Windows.Forms.Padding(6, 6, 6, 6); + this.tabControl1.Margin = new System.Windows.Forms.Padding(6); this.tabControl1.Multiline = true; this.tabControl1.Name = "tabControl1"; this.tabControl1.SelectedIndex = 0; @@ -52,7 +52,7 @@ private void InitializeComponent() // tabPage1 // this.tabPage1.Location = new System.Drawing.Point(4, 34); - this.tabPage1.Margin = new System.Windows.Forms.Padding(6, 6, 6, 6); + this.tabPage1.Margin = new System.Windows.Forms.Padding(6); this.tabPage1.Name = "tabPage1"; this.tabPage1.Size = new System.Drawing.Size(768, 339); this.tabPage1.TabIndex = 0; @@ -61,7 +61,7 @@ private void InitializeComponent() // // panel1 // - this.panel1.Controls.Add(this.button1); + this.panel1.Controls.Add(this.btnExit); this.panel1.Controls.Add(this.label1); this.panel1.Dock = System.Windows.Forms.DockStyle.Top; this.panel1.Location = new System.Drawing.Point(0, 0); @@ -69,17 +69,17 @@ private void InitializeComponent() this.panel1.Size = new System.Drawing.Size(776, 64); this.panel1.TabIndex = 3; // - // button1 + // btnExit // - this.button1.Dock = System.Windows.Forms.DockStyle.Right; - this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.button1.Location = new System.Drawing.Point(701, 0); - this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(75, 64); - this.button1.TabIndex = 3; - this.button1.Text = "退出"; - this.button1.UseVisualStyleBackColor = true; - this.button1.Click += new System.EventHandler(this.button1_Click); + this.btnExit.Dock = System.Windows.Forms.DockStyle.Right; + this.btnExit.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btnExit.Location = new System.Drawing.Point(701, 0); + this.btnExit.Name = "btnExit"; + this.btnExit.Size = new System.Drawing.Size(75, 64); + this.btnExit.TabIndex = 3; + this.btnExit.Text = "退出"; + this.btnExit.UseVisualStyleBackColor = true; + this.btnExit.Click += new System.EventHandler(this.button1_Click); // // label1 // @@ -101,7 +101,7 @@ private void InitializeComponent() this.Controls.Add(this.tabControl1); this.Controls.Add(this.panel1); this.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.Margin = new System.Windows.Forms.Padding(6, 6, 6, 6); + this.Margin = new System.Windows.Forms.Padding(6); this.MaximizeBox = false; this.Name = "ShopSelect"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; @@ -118,7 +118,7 @@ private void InitializeComponent() private System.Windows.Forms.TabControl tabControl1; private System.Windows.Forms.TabPage tabPage1; private System.Windows.Forms.Panel panel1; - private System.Windows.Forms.Button button1; + private System.Windows.Forms.Button btnExit; private System.Windows.Forms.Label label1; } } diff --git a/ShopClient/ShopSelect.cs b/ShopClient/ShopSelect.cs index 3d0f3b9..917a7e0 100644 --- a/ShopClient/ShopSelect.cs +++ b/ShopClient/ShopSelect.cs @@ -46,7 +46,7 @@ public void LoadShops(AreaInfo area, TabPage tp) GridBuilder g = new GridBuilder(d, new Size(100, 100), tp, 10, 20, 20); g.OnBindButtonClick += new GridBuilder.BindButtonClick(g_OnBindButtonClick); - g.BuildButtons(); + g.BuildButtons(); } void g_OnBindButtonClick(Button b) @@ -62,9 +62,8 @@ void btn_Click(object sender, EventArgs e) P.Settings.Default.Save(); GlobalValue.ShopID = shop.ShopID; - + this.Close(); new UserSelect().ShowDialog(); - } private void ShopSelect_Load(object sender, EventArgs e) @@ -79,7 +78,7 @@ private void label1_Click(object sender, EventArgs e) private void button1_Click(object sender, EventArgs e) { - this.Close(); + Application.Exit(); } } }