标签:message 属性 arp from datetime ctr div 获取 时间
#region 定时器事件方法
private void tmMian_Tick(object sender, EventArgs e)
{
//当前日期
sTime.Text = DateTime.Now.ToLongDateString().ToString();
//当前周期
ssTime.Text = DateTime.Now.DayOfWeek.ToString();
//当前时间
sssTime.Text = DateTime.Now.ToLongTimeString().ToString();
}
#endregion
//在主窗体中创建创建一个ShowForm方法,然后在单击打开新窗体中运用,把主窗体属性IsMdiContainer改为True.
#region 显示子窗体方法
private void ShowForm(Form form)
{
//遍历所有子窗体
foreach (Form f in this.MdiChildren)
{
if (form.Text == f.Text)
{
f.Activate();
return;
}
}
form.MdiParent = this;
form.Show();
}
#endregion
//新窗体运用
#region 客户管理
//打开新窗体按钮
private void toolStripButton1_Click(object sender, EventArgs e)
{
//新窗体 frm=new 新窗体();
FrmCtr frm = new FrmCtr();
ShowForm(frm);
}
#endregion
//获取图片路径代码
picHead.Image = Image.FromFile(@"E:\CS构架编程\第六章课程\Work\Car\lmage\客户.gif");
#region 登录按钮
//登录切换用户类型,切换登录(登录失败提示等)
private void btnLogin_Click(object sender, EventArgs e)
{
string s = "";
switch (cboType.Text)
{
case "客户": s = "Customer"; break;
case "经理": s = "Manager"; break;
}
string sql = "select LoginPwd from "+s+" where LoginId=@LoginId";
Object o = DBHelper.ExecteScalar(sql, CommandType.Text,
new SqlParameter[] { new SqlParameter("@LoginId", txtLoginId.Text) });
if(txtLoginId.Text=="")
{
MessageBox.Show("登录账号不能为空!","登录提示");
return;
}
if (txtLoginPwd.Text == "")
{
MessageBox.Show("登录密码不能为空!", "登录提示");
return;
}
if (o == null)
{
MessageBox.Show("你输入的账号与类型不一致!", "登录提示",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else
{
if (o.ToString() == txtLoginPwd.Text)
{
if (s == "Manager")
{
FrmMain frm = new FrmMain();
this.Hide();
frm.Show();
}
if(s== "Customer")
{
FrmCMain frm = new FrmCMain();
this.Hide();
frm.Show();
}
}
else
{
MessageBox.Show("登录失败,密码错误!", "登录提示",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
#endregion
标签:message 属性 arp from datetime ctr div 获取 时间
原文地址:http://www.cnblogs.com/Mr-Deng/p/7922689.html