コード例 #1
0
 public void RemoveRecord(System.Collections.Generic.List<int> DelList, DAO dao, string DBNo, string sysLinkName, string CacheKey = null)
 {
     if (DelList == null || DelList.Count == 0) return;
     if (Default_sql != null)
     {
         object busisData = null;
         YueMES.Base.Dal.DTO.TryGetCache(Default_sql, DBNo, out busisData);
         Sys_Roles busis = (Sys_Roles)busisData;
         lock (_lock)
         {
             foreach (var id in DelList)
             {
                 DataRow[] drs = busis.Select(string.Format("ID={0}", id));
                 if (drs.Length == 0) continue;
                 busis.Rows.Remove(drs[0]);
             }
             busis.AcceptChanges();
         }
     }
 }
コード例 #2
0
        public void UpdateRecord(System.Collections.Generic.List<int> UpdList, DAO dao, string DBNo, string sysLinkName, string CacheKey = null)
        {
            if (UpdList == null || UpdList.Count == 0) return;
            string sql = "";
            StringBuilder sbd = new StringBuilder();
            foreach (var id in UpdList)
            {
                sbd.Append(id);
                sbd.Append(",");
            }

            sql = string.Format("select * from Sys_Role where ID in({0})", sbd.ToString(0, sbd.Length - 1));


            BooleanValue<DataTable> bv = dao.GetDataTable(sql);

            if (bv.Success && bv.Value.Rows.Count > 0)
            {
                if (Default_sql != null)
                {
                    object busisData = null;
                    YueMES.Base.Dal.DTO.TryGetCache(Default_sql, DBNo, out busisData);
                    Sys_Roles busis = (Sys_Roles)busisData;
                    if (busis.Columns.Count != bv.Value.Columns.Count) return;
                    lock (_lock)
                    {
                        foreach (var id in UpdList)
                        {
                            DataRow[] drs = busis.Select(string.Format("ID={0}", id));
                            if (drs.Length == 0) continue;
                            busis.Rows.Remove(drs[0]);
                        }
                        foreach (DataRow row in bv.Value.Rows)
                        {
                            busis.LoadDataRow(row, true);
                        }
                        busis.AcceptChanges();
                    }
                }
            }
        }