Beispiel #1
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            var sqlstr = "UpdatePwd";
            var con    = new SqlConnection(WmsLogin.WmsConstring);
            var cmd    = new SqlCommand(sqlstr, con)
            {
                CommandType = CommandType.StoredProcedure
            };

            cmd.Parameters.AddWithValue("@uName", utxtUser.Text);
            cmd.Parameters.AddWithValue("@uPassword", WmsFunction.GetMd5Hash(utxtPassword.Text));
            cmd.Parameters.AddWithValue("@uPwd", WmsFunction.GetMd5Hash(utxtPwd.Text));
            try
            {
                con.Open();
            }
            catch (Exception ex)
            {
                MessageBox.Show(@"发生异常" + ex.Message, @"Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (cmd.ExecuteNonQuery() < 1)
            {
                MessageBox.Show(@"修改失败", @"Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                MessageBox.Show(@"修改成功", @"Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                DialogResult = DialogResult.OK;
            }
        }
Beispiel #2
0
        private void BwmMain_Load(object sender, EventArgs e)
        {
            Text = @"条码+移动采集的产品信息化管理系统                    @" + Properties.Settings.Default.Company;
            //显示主窗体
            var bwmMainChild = new WmsMainChild {
                MdiParent = this
            };

            bwmMainChild.Show();
            //设置状态栏显示内容
            uStatusBar.Panels[4].MarqueeInfo.Start();
            WmsFunction.GridFilter_Customizer();
            uStatusBar.Panels["tssl_Lname"].Text = @"操作员:" + WmsLogin.Lname;

            uStatusBar.Panels["tssl_Lserver"].Text = @"BarServer:" + WmsLogin.Server;

            uStatusBar.Panels["cCompany"].Text = Properties.Settings.Default.Company;
            //获取角色权限
            GetMenuAuthority();
            if (WmsLogin.Lname.Equals("Demo"))
            {
                uExplorerBar.Groups["维护中心"].Visible = true;
                uExplorerBar.Groups["维护中心"].Items["用户管理"].Visible   = true;
                uExplorerBar.Groups["维护中心"].Items["角色权限管理"].Visible = true;
            }
        }
Beispiel #3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="cKey"></param>
 /// <returns></returns>
 public static string GetMenuClass(string cKey)
 {
     using (var cmd = new SqlCommand(@"select cClass from BFunction WHERE cFunction=@cFunction"))
     {
         cmd.Parameters.AddWithValue("@cFunction", cKey);
         var wf = new WmsFunction(Properties.Settings.Default.BCGM_2014ConnectionString);
         return(wf.ReturnFirstSingle(cmd));
     }
 }
Beispiel #4
0
        /// <summary>
        /// 是否有权限操作
        /// </summary>
        /// <returns></returns>
        private bool CanOperator(string cKey)
        {
            var cmd = new SqlCommand("select * from RoleFunction where rCode=@rCode and fCode=@fCode and isnull(bRight,0)=1");

            cmd.Parameters.AddWithValue("@rCode", WmsLogin.Lrole);
            cmd.Parameters.AddWithValue("@fCode", cKey);
            var wf = new WmsFunction(WmsLogin.WmsConstring);

            return(wf.BoolExistTable(cmd));
        }
Beispiel #5
0
        private void BaseRoleFunction_Load(object sender, EventArgs e)
        {
            uGridRole_Function.DisplayLayout.ValueLists.Add("roleList");
            uGridRole_Function.DisplayLayout.ValueLists.Add("functionList");
            //设置连接并载入数据
            roleFunctionTableAdapter.Connection.ConnectionString = WmsLogin.WmsConstring;
            bFunctionTableAdapter.Connection.ConnectionString = WmsLogin.WmsConstring;
            bRoleTableAdapter.Connection.ConnectionString = WmsLogin.WmsConstring;
            bFunctionTableAdapter.Fill(baseDs.BFunction);

            var wf=new WmsFunction(WmsLogin.WmsConstring);
            uGridRole.DataSource = wf.GetSqlTable("SELECT * from View_RoleAndUser");

            SetFunctionDropDownList();
            //SetRoleDropDownList();
        }
Beispiel #6
0
        private void BaseRoleFunction_Load(object sender, EventArgs e)
        {
            uGridRole_Function.DisplayLayout.ValueLists.Add("roleList");
            uGridRole_Function.DisplayLayout.ValueLists.Add("functionList");
            //设置连接并载入数据
            roleFunctionTableAdapter.Connection.ConnectionString = WmsLogin.WmsConstring;
            bFunctionTableAdapter.Connection.ConnectionString    = WmsLogin.WmsConstring;
            bRoleTableAdapter.Connection.ConnectionString        = WmsLogin.WmsConstring;
            bFunctionTableAdapter.Fill(baseDs.BFunction);

            var wf = new WmsFunction(WmsLogin.WmsConstring);

            uGridRole.DataSource = wf.GetSqlTable("SELECT * from View_RoleAndUser");

            SetFunctionDropDownList();
            //SetRoleDropDownList();
        }
Beispiel #7
0
        private void uExplorerBar_ItemClick(object sender, ItemEventArgs e)
        {
            var cClass = WmsFunction.GetMenuClass(e.Item.Key);

            if (string.IsNullOrEmpty(cClass))
            {
                return;
            }
            var f = ExistForm(e.Item.Key);

            if (f == null)
            {
                MenuDoubleClick(cClass);
            }
            else
            {
                f.Activate();
            }
        }
        private void biDelete_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (MessageBox.Show(@"确认删除吗?", @"是否", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
            {
                return;
            }
            if (uGridDepart.ActiveRow != null && uGridDepart.ActiveRow.Index > -1)
            {
                var cmd = new SqlCommand("SELECT * FROM buser where uDepartment=@uDepartment");
                cmd.Parameters.AddWithValue("@uDepartment", uGridDepart.ActiveRow.Cells["cDepCode"].Value);
                var wf = new WmsFunction(WmsLogin.WmsConstring);
                if (wf.BoolExistTable(cmd))
                {
                    MessageBox.Show(@"该部门已经被使用,不允许删除");
                    return;
                }

                uGridDepart.ActiveRow.Delete(false);
                biSave.Enabled = true;
            }
        }
        private void biDelete_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (MessageBox.Show(@"确认删除吗?", @"是否", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
            {
                return;
            }
            if (uGridDepart.ActiveRow != null && uGridDepart.ActiveRow.Index > -1)
            {
                var cmd = new SqlCommand("SELECT * FROM buser where uDepartment=@uDepartment");
                cmd.Parameters.AddWithValue("@uDepartment", uGridDepart.ActiveRow.Cells["cDepCode"].Value);
                var wf = new WmsFunction(WmsLogin.WmsConstring);
                if (wf.BoolExistTable(cmd))
                {
                    MessageBox.Show(@"该部门已经被使用,不允许删除");
                    return;
                }

                uGridDepart.ActiveRow.Delete(false);
                biSave.Enabled = true;
            }
        }
Beispiel #10
0
        private void OK_Login()
        {
            if (string.IsNullOrEmpty(WmsConstring))
            {
                MessageBox.Show(@"服务器填写错误,或者服务器端未配置正确!", @"注意", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }


            lblLogin.Image = Properties.Resources.LoginForm_login_btn_click;

            if (string.IsNullOrEmpty(utxtUser.Text.Trim()) || string.IsNullOrEmpty(utxtPassword.Text))
            {
                MessageBox.Show(@"用户名和密码必填!", @"注意", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            //记住账套信息
            if (utxtAccount.Value == null || WmsConstring == null)
            {
                MessageBox.Show(@"账套、服务器选择有误!", @"注意", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            var con = new SqlConnection(WmsConstring);
            var cmd = new SqlCommand
            {
                Connection  = con,
                CommandText =
                    "select uName,uRole,uCode from BUser where (uName=@uName or uCode=@uName) and uPassword=@uPassword"
            };

            cmd.Parameters.Clear();
            cmd.Parameters.AddWithValue("@uName", utxtUser.Text);
            cmd.Parameters.AddWithValue("@uPassword", WmsFunction.GetMd5Hash(utxtPassword.Text));
            con.Open();
            var dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);

            if (dr.Read()) //直接登陆
            {
                Account = utxtAccount.Text;
                Server  = utxtServer.Text;
                Properties.Settings.Default.cUser    = utxtUser.Text;
                Properties.Settings.Default.cServer  = Server;
                Properties.Settings.Default.cAccount = Account;
                Properties.Settings.Default.Save();

                Lname = dr["uName"].ToString(); //把登陆名和登陆服务器保存到静态变量中
                Ltime = udDate.DateTime;
                Lrole = dr["uRole"].ToString();
                LCode = dr["uCode"].ToString();
                dr.Close();
                Hide();
                var bmsloading = new WmsLoading();
                bmsloading.ShowDialog();
            }
            else
            {
                MessageBox.Show(@"用户名或密码错误,请联系管理员!", @"Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Beispiel #11
0
 private void BMSLoading_Load(object sender, EventArgs e)
 {
     timerLoading.Enabled = true;
     WmsFunction.GridFilter_Customizer();
 }
Beispiel #12
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="cKey"></param>
 /// <returns></returns>
 public static string GetMenuClass(string cKey)
 {
     using (var cmd = new SqlCommand(@"select cClass from BFunction WHERE cFunction=@cFunction"))
     {
         cmd.Parameters.AddWithValue("@cFunction", cKey);
         var wf = new WmsFunction(Properties.Settings.Default.BCGM_2014ConnectionString);
         return wf.ReturnFirstSingle(cmd);
     }
 }
Beispiel #13
0
 /// <summary>
 /// 是否有权限操作
 /// </summary>
 /// <returns></returns>
 private bool CanOperator(string cKey)
 {
     var cmd = new SqlCommand("select * from RoleFunction where rCode=@rCode and fCode=@fCode and isnull(bRight,0)=1");
     cmd.Parameters.AddWithValue("@rCode", WmsLogin.Lrole);
     cmd.Parameters.AddWithValue("@fCode", cKey);
     var wf = new WmsFunction(WmsLogin.WmsConstring);
     return wf.BoolExistTable(cmd);
 }