Example #1
0
        public static bool Add(AccessDS.AccessRow dr, string userid)
        {
            bool transuc = false;
            Database db = DALCHelper.GetDatabase();
            using (DbConnection dbConn = db.CreateConnection())
            {
                dbConn.Open();
                DbTransaction dbTran = dbConn.BeginTransaction();
                try
                {
                    DALCHelper.Add(dbTran, db, SP_Add, dr, userid);
                    dbTran.Commit();
                    transuc = true;
                }
                catch
                {
                    transuc = false;
                    dbTran.Rollback();
                    throw;
                }
                finally
                {

                    dbTran.Dispose();
                }
                dbConn.Close();
            }
            return transuc;
        }
Example #2
0
        public static AccessDS List(int FolderID,string UID)
        {
            AccessDS ds = new AccessDS();

            DataTable dt = new DataTable();
            dt.Columns.Add("FolderID");
            dt.Columns.Add("sort_col");
            if (UID != "")
                dt.Columns.Add("UID");

            DataRow dr = dt.NewRow();
            dr["FolderID"] = FolderID;
            dr["sort_col"] = "UID";
            if (UID != "")
                dr["UID"] = UID;

            Database db = DALCHelper.GetDatabase();
            using (DbConnection dbConn = db.CreateConnection())
            {
                DALCHelper.List(db, SP_List, ds, ds.Access.TableName, dr);
                dbConn.Close();
            }

            return ds;
        }
Example #3
0
        public static AccessDS.AccessRow Get(int KeyValue)
        {
            AccessDS ds = new AccessDS();

            DataTable dt = new DataTable();
            dt.Columns.Add(DataKeyName);
            DataRow dr = dt.NewRow();
            dr[DataKeyName] = KeyValue;

            Database db = DALCHelper.GetDatabase();

            using (DbConnection dbConn = db.CreateConnection())
            {
                DALCHelper.List(db, SP_Get, ds, ds.Access.TableName, dr);
                dbConn.Close();

            }

            if (ds.Access.Rows.Count == 1)
            {

                return (AccessDS.AccessRow)ds.Access.Rows[0];
            }
            else
            {
                return null;
            }
        }