Пример #1
0
 private bool CheckInput()
 {
     if (AppSettings.CurrentSetting.EnableWriteCard && GetAccesses != null && GetAccessTimeZones != null)
     {
         //写卡模式每个通道最大支持8个权限组
         List <EntranceInfo> entrances = entranceTree.GetSelectedEntrances();
         foreach (EntranceInfo entrance in entrances)
         {
             EntranceEventArgs args = new EntranceEventArgs {
                 EntranceID = entrance.EntranceID
             };
             //List<AccessInfo> accesses = AccessSetting.Current.GetAccesses(entrance.EntranceID);
             List <AccessInfo> accesses = GetAccesses(this, args);
             if (accesses.Count > 7)
             {
                 MessageBox.Show(string.Format(Resources.Resource1.FrmAccessGroup_AccessMax, entrance.EntranceName));
                 return(false);
             }
             List <AccessTimeZone> accessTimeZones = GetAccessTimeZones(this, args);
             if (TimeZone != null && accessTimeZones.Any(item => item == TimeZone))
             {
                 accessTimeZones.Remove(TimeZone);
             }
             if (accessTimeZones.Count > 3)
             {
                 MessageBox.Show(string.Format(Resources.Resource1.FrmAccessGroup_IntervalMax, entrance.EntranceName));
                 return(false);
             }
         }
     }
     return(true);
 }
Пример #2
0
 private List <AccessInfo> GetAccessesHandler(object sender, EntranceEventArgs e)
 {
     if (GetAccesses != null)
     {
         List <AccessInfo> accesses = GetAccesses(sender, e);
         if (UpdatingItem != null && accesses.Any(item => item == UpdatingItem))
         {
             accesses.Remove(UpdatingItem);
         }
         return(accesses);
     }
     return(new List <AccessInfo>());
 }
Пример #3
0
        private List <AccessTimeZone> GetAccessTimeZonesHandler(object sender, EntranceEventArgs e)
        {
            List <AccessTimeZone> accessTimeZones = new List <AccessTimeZone>();

            foreach (DataGridViewRow row in this.gridView.Rows)
            {
                AccessTimeZone accessTimeZone = row.Tag as AccessTimeZone;
                if (accessTimeZone != null)
                {
                    if (accessTimeZone.AccessEntrances.Any(item => item == e.EntranceID))
                    {
                        accessTimeZones.Add(accessTimeZone);
                    }
                }
            }
            return(accessTimeZones);
        }