Beispiel #1
0
        public override ProfileStatus Check(out string reason, System.Collections.Generic.IEnumerable <Feature> features, System.Collections.Generic.IEnumerable <string> scopes)
        {
            reason = string.Empty;


            StringBuilder sb     = new StringBuilder();
            ProfileStatus status = ProfileStatus.NotSupported;

            sb.AppendLine(string.Format("Check profile support for {0}", Name));

            bool scopePresent = scopes.Contains(Scope);

            sb.AppendLine(string.Format("Scope {0}: \t\t{1}", Scope, scopePresent ? "PRESENT" : "NOT PRESENT"));

            if (!scopePresent)
            {
                sb.AppendFormat("Profile not supported");
            }
            else
            {
                bool profileOk = true;
                bool supported;

                Action <Feature, string> checkNextMandatory = new Action <Feature, string>(
                    (feature, displayName) =>
                {
                    supported = features.Contains(feature);
                    LogMandatory(sb, displayName, supported);
                    profileOk = profileOk && supported;
                });

                Action <Feature, string> checkNextOptional = new Action <Feature, string>(
                    (feature, displayName) =>
                {
                    supported = features.Contains(feature);
                    LogOptional(sb, displayName, supported);
                });

                checkNextMandatory(Feature.MediaService, "Media");
                checkNextOptional(Feature.PTZService, "PTZ");

                if (profileOk)
                {
                    status = ProfileStatus.Supported;
                }
                else
                {
                    status = ProfileStatus.Failed;
                }
            }
            reason = sb.ToString();
            return(status);
        }
        public void AddToTemp(System.Collections.Generic.IEnumerable <string> EntityIDs)
        {
            // 將課程加入課程待處理
            // 取得目前課程待處理內ID
            List <string> TempCourseIDList = K12.Presentation.NLDPanels.Course.TempSource;

            if (EntityIDs == null)
            {
                foreach (CourseSubjectNameDb csnb in RATList)
                {
                    if (!TempCourseIDList.Contains(csnb.課程系統編號))
                    {
                        TempCourseIDList.Add(csnb.課程系統編號);
                    }
                }
            }
            else
            {
                foreach (CourseSubjectNameDb csnb in RATList)
                {
                    if (EntityIDs.Contains(csnb.課程系統編號))
                    {
                        if (!TempCourseIDList.Contains(csnb.課程系統編號))
                        {
                            TempCourseIDList.Add(csnb.課程系統編號);
                        }
                    }
                }
            }

            // 加入課程處理
            K12.Presentation.NLDPanels.Course.AddToTemp(TempCourseIDList);
        }
Beispiel #3
0
        public static string IfControllerIn(this HtmlHelper helper, System.Collections.Generic.IEnumerable <string> controllerNames, string s)
        {
            string controllerName = helper.ViewContext.RouteData.Values["controller"] as string;
            string result;

            if (controllerNames.Contains(controllerName))
            {
                result = helper.Encode(s);
            }
            else
            {
                result = "";
            }
            return(result);
        }
        /// <summary>
        /// Удалить системные замещения.
        /// </summary>
        /// <param name="users">Список пользователей, для которых надо создать замещение.</param>
        /// <param name="manager">Руководитель.</param>
        public static void DeleteSystemSubstitutions(System.Collections.Generic.IEnumerable <IUser> users, IUser manager)
        {
            var deletedSubstitutions = Substitutions.GetAll()
                                       .Where(s => s.Substitute.Equals(manager) &&
                                              users.Contains(s.User) &&
                                              s.IsSystem == true)
                                       .ToList();

            foreach (var user in users)
            {
                var deletedSubstitution = deletedSubstitutions.FirstOrDefault(s => s.User.Equals(user));
                if (deletedSubstitution != null)
                {
                    Substitutions.Delete(deletedSubstitution);
                }
            }
        }
Beispiel #5
0
    public DataTable GetValidAccess(List <AccessListStruct> AccessList, SearchFilterCollection sFilterCols, string SortString, int PageSize, int CurrentPage)
    {
        DataTable        dt          = new DataTable();
        UsersDataContext dataContext = new UsersDataContext();
        string           WhereCond   = Tools.GetCondition(sFilterCols);

        if (HttpContext.Current.Session["UserCode"] != null)
        {
            //AccessListStruct s=new AccessListStruct("Edit",
            ArrayList EditAccess = new ArrayList();
            ArrayList ViewAccess = new ArrayList();

            for (int i = 0; i < AccessList.Count; i++)
            {
                if (AccessList[i].AccessName == "EDIT")
                {
                    EditAccess.Add(AccessList[i].FieldName);
                }
                else if (AccessList[i].AccessName == "VIEW")
                {
                    ViewAccess.Add(AccessList[i].FieldName);
                }
            }
            //string[] EditAccess = HttpContext.Current.Session["Edit"].ToString().Split(',');
            //string[] ViewAccess = HttpContext.Current.Session["View"].ToString().Split(',');
            string[] arrEditAccess = (string[])EditAccess.ToArray(typeof(string));
            string[] arrViewAccess = (string[])ViewAccess.ToArray(typeof(string));
            System.Collections.Generic.IEnumerable <String> AllAccess = arrEditAccess.Union(arrViewAccess);
            if (AllAccess.Count <string>() > 0)
            {
                var ListResult = from v in dataContext.Resources
                                 orderby v.Ordering
                                 where (v.HCResourceTypeCode.Equals(1) || v.HCResourceTypeCode.Equals(2)) &&
                                 (AllAccess.Contains(v.ResName))
                                 select v

                ;
                dt = new Converter <Resources>().ToDataTable(ListResult);
            }
        }
        return(dt);
    }
Beispiel #6
0
 public async Task <ActionResult <System.Collections.Generic.ICollection <Pet> > > FindPetsByStatus([FromQuery] System.Collections.Generic.IEnumerable <PetStatus> status)
 {
     return(PetData.Instance.Dic.Values.Where(d => status.Contains(d.Status)).ToArray());
 }