public authorityItem GetAuthByEmail(string email) { ac = new AuthorityController(); authorityItem result = ac.GetAuthByEmail(email); return(result); }
public authorityItem[] GetAuthsBySolved(string num) { try { logger.LogMethod("jo", "GetAuthsBySolved", "Enter"); List <authorityItem> list = new List <authorityItem>(); key = num + "GetAuthsBySolved"; if (CachingConfig.CachingEnabled) { list = (List <authorityItem>)WCFCache.Current[key]; if (list != null) { logger.LogMethod("jo", "GetAuthsBySolved", "Cache found"); return(list.ToArray()); } } list = new List <authorityItem>(); context = new SocialCopsEntities(); int pts = Convert.ToInt32(num); List <Authority> auths = (from a in context.Authorities where a.numResolved >= pts orderby a.numResolved descending select a).ToList(); foreach (Authority auth in auths) { authorityItem temp = new authorityItem(); temp.authId = auth.authId; temp.authName = auth.authName; temp.authAddress = auth.authAddress; temp.email = auth.email; temp.phone = Convert.ToInt32(auth.phone); temp.numPending = (int)auth.numPending; temp.numResolved = (int)auth.numResolved; temp.latitude = temp.latitude; temp.longitude = temp.longitude; temp.website = auth.website; temp.profilePic = auth.profilePic; temp.flag = (int)auth.flag; temp.date = auth.date; temp.city = auth.city; temp.state = auth.state; temp.country = auth.country; temp.pincode = auth.pincode; list.Add(temp); } Cache.Cache.AddToCache(key, list); logger.LogMethod("jo", "GetAuthsBySolved", "Exit"); return(list.ToArray()); } catch (Exception ex) { error.ErrorDetails = ex.Message.ToString(); error.ErrorMessage = "Something happened. Sorry."; error.Result = false; logger.LogMethod("jo", "GetAuthsBySolved", ex.Message.ToString()); throw new FaultException <Bug>(error, ex.Message.ToString()); } }
public authorityItem GetAuthById(string id) { ac = new AuthorityController(); authorityItem result = ac.GetAuthById(id); return(result); }
public authorityItem GetAuthByEmail(string email) { try { logger.LogMethod("jo", "GetAuthByEmail", "Enter"); //List<authorityItem> list = new List<authorityItem>(); authorityItem temp = new authorityItem(); key = email + "GetAuthByEmail"; if (CachingConfig.CachingEnabled) { temp = (authorityItem)WCFCache.Current[key]; if (temp != null) { logger.LogMethod("jo", "GetAuthByEmail", "Cache found"); return(temp); } } temp = new authorityItem(); context = new SocialCopsEntities(); //int aid = Convert.ToInt32(id); List <Authority> auths = (from a in context.Authorities where a.email == email orderby a.date descending select a).ToList(); if (auths.Count == 0) { error.ErrorMessage = "The auth doesn't exist."; error.ErrorDetails = "The auth doesn't exist."; error.Result = false; logger.LogMethod("jo", "GetAuthByEmail", "The auth doesn't exist."); throw new FaultException <Bug>(error); } foreach (Authority auth in auths) { //authorityItem temp = new authorityItem(); temp.authId = auth.authId; temp.authName = auth.authName; temp.authAddress = auth.authAddress; temp.email = auth.email; temp.phone = Convert.ToInt32(auth.phone); temp.numPending = (int)auth.numPending; temp.numResolved = (int)auth.numResolved; temp.latitude = temp.latitude; temp.longitude = temp.longitude; temp.website = auth.website; temp.profilePic = auth.profilePic; temp.flag = (int)auth.flag; temp.date = auth.date; temp.city = auth.city; temp.state = auth.state; temp.country = auth.country; temp.pincode = auth.pincode; //list.Add(temp); } Cache.Cache.AddToCache(key, temp); logger.LogMethod("jo", "GetAuthByEmail", "Exit"); return(temp); } catch (Exception ex) { error.ErrorDetails = ex.Message.ToString(); error.ErrorMessage = "Something happened. Sorry."; error.Result = false; logger.LogMethod("jo", "GetAuthByEmail", ex.Message.ToString()); throw new FaultException <Bug>(error, ex.Message.ToString()); } }