Esempio n. 1
0
        public static bool Save(List <RightLkFunctionGroup> insertList, List <RightLkFunctionGroup> deleteList, List <RightLkFunctionGroup> updateList)
        {
            using (var conn = new SqlConnection(Conn.getConn()))
            {
                if (conn.State != ConnectionState.Open)
                {
                    conn.Open();
                }

                using (var trans = conn.BeginTransaction())
                {
                    foreach (var item in insertList)
                    {
                        var result = Insert(item, conn, trans);
                        if (result)
                        {
                            continue;
                        }

                        trans.Rollback();
                        return(false);
                    }
                    foreach (var item in updateList)
                    {
                        var result = Update(item, conn, trans);
                        if (result)
                        {
                            continue;
                        }

                        trans.Rollback();
                        return(false);
                    }
                    foreach (var item in deleteList)
                    {
                        var result = Delete(item, conn, trans);
                        if (result)
                        {
                            continue;
                        }

                        RightDal.Delete(item, conn, trans);

                        trans.Rollback();
                        return(false);
                    }

                    trans.Commit();
                }

                if (conn.State != ConnectionState.Closed)
                {
                    conn.Close();
                }
            }

            return(true);
        }
Esempio n. 2
0
 public static bool DeleteRight(Right right)
 {
     return(RightDal.Delete(right));
 }