using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.ServiceModel.Security; using System.Web.Security; using HLWebOKBAdminPlugin.OKBAdministrationService; using HLWebOKBAdminPlugin.Helpers; namespace HLWebOKBAdminPlugin.Models { public class AlgorithmClassModel { public String SelectedSubMenu { get; set; } public IList AlgorithmClasses { get { return AlgorithmClassGetAll(); } set { ;} } public AlgorithmClass AlgorithmClass { get; set; } public AlgorithmClassModel() { AlgorithmClass = new AlgorithmClass(); }//AlgorithmClassModel //***************************************Algorithm Class******************************************** private IList PlatformsGetAll() { AdministrationServiceClient adminClient = Admin.GetClientFactory(); IList platformList = new List(); if (adminClient != null) { Platform[] platforms = adminClient.GetPlatforms(); foreach (Platform pl in platforms) { platformList.Add(pl); } }//if (adminClient != null) return platformList; }//ProblemClassGetAll private IList ProblemClassGetAll() { AdministrationServiceClient adminClient = Admin.GetClientFactory(); IList problemClassList = new List(); if (adminClient != null) { ProblemClass[] problemClasses = adminClient.GetProblemClasses(); foreach (ProblemClass pc in problemClasses) { problemClassList.Add(pc); } }//if (adminClient != null) return problemClassList; }//ProblemClassGetAll //get all algorithm classes private IList AlgorithmClassGetAll() { AdministrationServiceClient adminClient = Admin.GetClientFactory(); IList algorithmClassList = new List(); if (adminClient != null) { AlgorithmClass[] algorithmClasses = adminClient.GetAlgorithmClasses(); foreach (AlgorithmClass ac in algorithmClasses) { algorithmClassList.Add(ac); } }//if (adminClient != null) return algorithmClassList; }//AlgorithmClassGetAll private long AddAlgorithmClass(AlgorithmClass algorithmClass) { AdministrationServiceClient adminClient = Admin.GetClientFactory(); if (adminClient != null) { return adminClient.AddAlgorithmClass(algorithmClass); } return 0; }//AddAlgorithmClass public void DeleteAlgorithmClass(long id) { AdministrationServiceClient adminClient = Admin.GetClientFactory(); if (adminClient != null) { adminClient.DeleteAlgorithmClass(id); } }//DeleteAlgorithmClass public long SaveAlgorithmClass(AlgorithmClass algorithmClass) { AdministrationServiceClient adminClient = Admin.GetClientFactory(); if (adminClient != null) { if (algorithmClass.Id == 0) { return AddAlgorithmClass(algorithmClass); } else { AlgorithmClass ac = adminClient.GetAlgorithmClass(algorithmClass.Id); if (ac != null) { adminClient.UpdateAlgorithmClass(algorithmClass); return algorithmClass.Id; } } } return 0; }//SaveAlgorithmClass } }