Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/phiree/namename
Browse files Browse the repository at this point in the history
  • Loading branch information
phiree committed Jun 2, 2012
2 parents 72216fd + 651e4bf commit e925630
Show file tree
Hide file tree
Showing 6 changed files with 103 additions and 60 deletions.
1 change: 1 addition & 0 deletions ShopClient/Cash.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

42 changes: 42 additions & 0 deletions ShopClient/Cash.cs
Expand Up @@ -6,14 +6,56 @@
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using NameName.DAL;
using NameName.Model;


namespace ShopClient namespace ShopClient
{ {
public partial class Cash : Form public partial class Cash : Form
{ {
public Cash() public Cash()
{ {
ClientLogin();
InitializeComponent(); 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();
}
}
}
} }
} }
1 change: 1 addition & 0 deletions ShopClient/Login.cs
Expand Up @@ -42,6 +42,7 @@ private void Login_Load(object sender, EventArgs e)
private void btnClear_Click(object sender, EventArgs e) private void btnClear_Click(object sender, EventArgs e)
{ {
tbxPwd.Text = string.Empty; tbxPwd.Text = string.Empty;

} }


private void button4_Click(object sender, EventArgs e) private void button4_Click(object sender, EventArgs e)
Expand Down
80 changes: 40 additions & 40 deletions ShopClient/Program.cs
Expand Up @@ -17,55 +17,55 @@ static void Main()
{ {
Application.EnableVisualStyles(); Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false); Application.SetCompatibleTextRenderingDefault(false);
//InitClient();
Application.Run(new ShopSelect()); Application.Run(new Cash());
} }
/// <summary> /// <summary>
/// 之前是否已经选择过. /// 之前是否已经选择过.
/// 是:读取配置信息 直接打开登录界面 /// 是:读取配置信息 直接打开登录界面
/// 否:打开选择页面 /// 否:打开选择页面
/// </summary> /// </summary>
private static void InitClient() //private static void InitClient()
{ //{
bool HasSelected = false; // bool HasSelected = false;
string strShopId = Properties.Settings.Default.ShopId; // string strShopId = Properties.Settings.Default.ShopId;
Application.Run(new ShopSelect()); // Application.Run(new ShopSelect());
return; // return;
if (string.IsNullOrEmpty(strShopId)) // if (string.IsNullOrEmpty(strShopId))
{ // {
HasSelected = false; // HasSelected = false;


} // }
else // else
{ // {


Guid shopId; // Guid shopId;
Guid.TryParse(strShopId, out shopId); // Guid.TryParse(strShopId, out shopId);
if (shopId != Guid.Empty) // if (shopId != Guid.Empty)
{ // {
ShopInfo shop = new DALShopInfo().GetByShopID(shopId); // ShopInfo shop = new DALShopInfo().GetByShopID(shopId);
if (shop == null) // if (shop == null)
{ // {
HasSelected = false; // HasSelected = false;
} // }
else // else
{ // {
HasSelected = true; // HasSelected = true;
GlobalValue.ShopID = shop.ShopID; // GlobalValue.ShopID = shop.ShopID;
Application.Run(new Login()); // Application.Run(new Login());
} // }
} // }
else // else
{ // {
HasSelected = false; // HasSelected = false;
} // }
} // }
if (!HasSelected) // if (!HasSelected)
{ // {
Application.Run(new ShopSelect()); // Application.Run(new ShopSelect());


} // }


} //}
} }
} }
32 changes: 16 additions & 16 deletions ShopClient/ShopSelect.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions ShopClient/ShopSelect.cs
Expand Up @@ -46,7 +46,7 @@ public void LoadShops(AreaInfo area, TabPage tp)


GridBuilder<ShopInfo> g = new GridBuilder<ShopInfo>(d, new Size(100, 100), tp, 10, 20, 20); GridBuilder<ShopInfo> g = new GridBuilder<ShopInfo>(d, new Size(100, 100), tp, 10, 20, 20);
g.OnBindButtonClick += new GridBuilder<ShopInfo>.BindButtonClick(g_OnBindButtonClick); g.OnBindButtonClick += new GridBuilder<ShopInfo>.BindButtonClick(g_OnBindButtonClick);
g.BuildButtons(); g.BuildButtons();
} }


void g_OnBindButtonClick(Button b) void g_OnBindButtonClick(Button b)
Expand All @@ -62,9 +62,8 @@ void btn_Click(object sender, EventArgs e)
P.Settings.Default.Save(); P.Settings.Default.Save();


GlobalValue.ShopID = shop.ShopID; GlobalValue.ShopID = shop.ShopID;

this.Close();
new UserSelect().ShowDialog(); new UserSelect().ShowDialog();

} }


private void ShopSelect_Load(object sender, EventArgs e) private void ShopSelect_Load(object sender, EventArgs e)
Expand All @@ -79,7 +78,7 @@ private void label1_Click(object sender, EventArgs e)


private void button1_Click(object sender, EventArgs e) private void button1_Click(object sender, EventArgs e)
{ {
this.Close(); Application.Exit();
} }
} }
} }

0 comments on commit e925630

Please sign in to comment.