C# 登录界面代码_Login

WCFC大雨餐饮管理系统经典版.BLL系统维护.frm_XiTongWeiHu.frm_XiTongWeiHuClient myfrm_XiTongWeiHuClient = new BLL系统维护.frm_XiTongWeiHu.frm_XiTongWeiHuClient();
        private void btn_DengLu_Click(object sender, EventArgs e)
        {
            #region 查询登录信息是否正确
            StaticPublicObject.StaticPublicObject.dtQuanXian = new DataTable();
            StaticPublicObject.StaticPublicObject.UserName = txt_DengLuMingCheng.Text.Trim();
            StaticPublicObject.StaticPublicObject.PassWord = txt_DengLuMiMa.Text.Trim();
            //根据"登录名称"和"登录密码"判断某个用户是否存在
            DataTable dtYongHu = myfrm_XiTongWeiHuClient.btn_DengLu_Click_SelectYuanGong(StaticPublicObject.StaticPublicObject.UserName, StaticPublicObject.StaticPublicObject.PassWord).Tables[0];
            //根据"登录名称"判断用户是否存在
            DataTable dtDengLuMingCheng = myfrm_XiTongWeiHuClient.btn_DengLu_Click_SelectYuanGongDengLuMingCheng(StaticPublicObject.StaticPublicObject.UserName).Tables[0];
            //if ((int)dtYongHu.Rows[0][0] > 0)
            if (StaticPublicObject.StaticPublicObject.UserName == "")//若"登录名称"为空
            {
                MessageBox.Show("[登录名称]还没有填写呢!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (dtDengLuMingCheng.Rows.Count > 0)//根据"登录名称"判断用户是否存在,若存在用户
            {
                if (dtYongHu.Rows.Count > 0)//根据"登录名称"和"登录密码"判断某个用户是否存在,若存在用户
                {
                    if (StaticPublicObject.StaticPublicObject.UserName.Equals(dtYongHu.Rows[0][2].ToString()))
                    {
                        this.Hide();
                        frm_Main myfrm_Main = new frm_Main();
                        myfrm_Main.Show();
                        #region 查询权限
                        try
                        {
                            StaticPublicObject.StaticPublicObject.strUserName = dtYongHu.Rows[0][1].ToString().Trim();
                            StaticPublicObject.StaticPublicObject.UserID = Convert.ToInt32(dtYongHu.Rows[0][0]);
                            StaticPublicObject.StaticPublicObject.dtQuanXian = myfrm_XiTongWeiHuClient.btn_DengLu_Click_SelectQuanXian(StaticPublicObject.StaticPublicObject.UserID).Tables[0];
                        }
                        catch { }
                        #endregion
                    }
                    else
                    {
                        MessageBox.Show("[登录名称]不存在,请重新填写!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
                else
                {
                    MessageBox.Show("[登录密码]不正确,请重新填写!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            else
            {
                MessageBox.Show("[登录名称]不存在,请重新填写!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            #endregion
        }


 

你可能感兴趣的:(C#,.Net,C/S架构,数据库,编程语言)