using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.ServiceModel.Security; using System.Web.Security; namespace HLWebPluginHost.Models { public class AlgorithmClassModel { public int NumOfClasses { get; set; } public List AlgorithmClassList { get; set; } public List AlgorithmClassGetAll() { //returns list of algorithm classes OKBService.OKBServiceClient sc = new OKBService.OKBServiceClient(); sc.ClientCredentials.UserName.UserName = Membership.GetUser().UserName; sc.ClientCredentials.UserName.Password = HttpContext.Current.Session["pwd"].ToString(); sc.ClientCredentials.ServiceCertificate.Authentication.CertificateValidationMode = X509CertificateValidationMode.None; var agcList = new List(); OKBService.AlgorithmClass[] ac = sc.GetAlgorithmClasses(); foreach (OKBService.AlgorithmClass a in ac) { agcList.Add(a); }//foreach return agcList; }//AlgorithmClassGetAll //Add AlgorithmClass table entry public bool AddAlgorithmClass(string name, string description) { //get service client OKBService.OKBServiceClient sc = new OKBService.OKBServiceClient(); sc.ClientCredentials.UserName.UserName = Membership.GetUser().UserName; sc.ClientCredentials.UserName.Password = HttpContext.Current.Session["pwd"].ToString(); sc.ClientCredentials.ServiceCertificate.Authentication.CertificateValidationMode = X509CertificateValidationMode.None; OKBService.AlgorithmClass ac = new OKBService.AlgorithmClass(); ac.Id = 8; ac.Name = name; ac.Description = description; sc.AddAlgorithmClass(ac); return true; }//AddAlgorithmClass } }