예제 #1
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_Data_Busi 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_Role_Data_Busis busis = (Sys_Role_Data_Busis)busisData;
                    if (busis.Columns.Count != bv.Value.Columns.Count)
                    {
                        return;
                    }
                    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();
                }
            }
        }
예제 #2
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_Role_Data_Busis busis = (Sys_Role_Data_Busis)busisData;
         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();
     }
 }