Beispiel #1
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));
        }
        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 #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);
 }