Beispiel #1
0
        public string UpdataPrivilege(UserGroup ug, OleDbConnection conn)
        {
            OleDbTransaction trans  = conn.BeginTransaction();
            string           strSql = "update UserGroup set GroupName=? where GroupID=?";

            try
            {
                eQuery = OleDbHlper.ExecuteNonQuery(strSql, conn, CommandType.Text, trans,
                                                    new OleDbParameter("@GroupName", OleDbType.VarWChar)
                {
                    Value = ug.GroupName
                },
                                                    new OleDbParameter("@GroupID", OleDbType.Integer)
                {
                    Value = ug.GroupID
                });
                trans.Commit();
                return("修改成功!");
            }
            catch (Exception ex)
            {
                trans.Rollback();
                return(ex.ToString());
            }
        }
Beispiel #2
0
        public string MultiselectDelPrivilege(List <int> listPrivilegeID, OleDbConnection conn)
        {
            OleDbTransaction trans = conn.BeginTransaction();

            for (int i = 0; i < listPrivilegeID.Count(); i++)
            {
                int    PrivilegeID = Convert.ToInt32(listPrivilegeID[i]);
                string strSql      = "delete from UserGroup where GroupID=?";
                try
                {
                    OleDbHlper.ExecuteNonQuery(strSql, conn, CommandType.Text, trans,
                                               new OleDbParameter("@GroupID", OleDbType.Integer)
                    {
                        Value = PrivilegeID
                    });
                }
                catch (Exception ex)
                {
                    trans.Rollback();
                    return(ex.Message);
                }
            }
            trans.Commit();
            return("删除成功!");
        }
Beispiel #3
0
 public string DeletePrivilege(int PrivilegeID, OleDbConnection conn, OleDbTransaction trans = null)
 {
     trans = conn.BeginTransaction();
     try
     {
         string strSql = "delete from UserGroup where GroupID=?";
         eQuery = OleDbHlper.ExecuteNonQuery(strSql, conn, CommandType.Text, trans,
                                             new OleDbParameter("@GroupID", OleDbType.Integer)
         {
             Value = PrivilegeID
         });
         trans.Commit();
         return("添加成功!");
     }
     catch (Exception)
     {
         trans.Rollback();
         return("失败");
     }
 }
Beispiel #4
0
        public string CreatePrivilege(string PrivilegeName, OleDbConnection conn)
        {
            OleDbTransaction trans  = conn.BeginTransaction();
            string           strSql = "insert into UserGroup values(?)";

            try
            {
                eQuery = OleDbHlper.ExecuteNonQuery(strSql, conn, CommandType.Text, trans,
                                                    new OleDbParameter("@PrivilegeName", OleDbType.VarWChar)
                {
                    Value = PrivilegeName
                });
                trans.Commit();
                return("添加成功!");
            }
            catch (Exception ex)
            {
                trans.Rollback();
                return(ex.ToString());
            }
        }