/// <summary> /// Update Data using LINQ techniques /// </summary> /// <returns></returns> protected bool LinqUpdateData() { ServiceTitle title = (from t in smartDb.ServiceTitles where t.Id == this.TitleID select t).First(); title.Title = this.ContentTitle; title.Description = this.Description; Service serv = (from s in smartDb.Services where s.Id == this.ServiceID select s).First(); serv.CategoryID = this.CategoryID; // Check first if the user add a new image or just keep the old once if (mwcAsyncImageUpload.HasFile == true) serv.ImagePath = this.FullPath; serv.EditedBy_Id = BaseSys.SysUserID; serv.ModifiedDate = DateTime.Now; serv.Slide = this.SlideShow; serv.Show = this.Show; try { smartDb.SubmitChanges(); return true; // Save data and return true } catch { return false; } }
public override int GetHashCode() { unchecked { var hashCode = (ConsumedService != null ? ConsumedService.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (ProvidedService != null ? ProvidedService.GetHashCode() : 0); hashCode = (hashCode * 397) ^ ServiceTitle.GetHashCode(); hashCode = (hashCode * 397) ^ (Methods != null ? Methods.GetHashCode() : 0); return(hashCode); } }
/// <summary> /// Update Data using LINQ techniques /// </summary> /// <returns></returns> protected bool LinqUpdateData() { ServiceTitle title = (from t in smartDb.ServiceTitles where t.Id == this.TitleID select t).First(); title.Title = this.NewsTitle; title.Description = this.Description; Service news = (from n in smartDb.Services where n.Id == this.NewsID select n).First(); // Check first if the user add a new image or just keep the old once if (mwcAsyncImageUpload.HasFile == true) news.ImagePath = this.FullPath; news.EditedBy_Id = BaseSys.SysUserID; news.ModifiedDate = DateTime.Now; news.Show = this.Show; try { smartDb.SubmitChanges(); return true; // Save data and return true } catch { return false; } }
private bool Equals(DiscoveredService other) { return(Equals(ConsumedService, other.ConsumedService) && Equals(ProvidedService, other.ProvidedService) && ServiceTitle.Equals(other.ServiceTitle) && Equals(Methods, other.Methods)); }
public CommandLineOptions(string[] args) { ConfigFile = "cronical.dat"; ServiceName = "Cronical"; ServiceTitle = "Cronical Job Scheduler"; var arglist = args.ToList(); while (arglist.Any()) { var s = arglist.ExtractFirst().ToLower(); switch (s) { case "-d": case "--debug": DebugLogs = true; break; case "--console": RunAsConsole = true; break; case "-c": case "--config": ConfigFileOverride = true; ConfigFile = arglist.ExtractFirstOrDefault(); if (string.IsNullOrEmpty(ConfigFile) || ConfigFile.StartsWith("-")) { throw new Exception("Expected file name to follow on --config"); } break; case "-h": case "--help": case "-?": case "/h": case "/help": DisplayHelp(); throw new OperationCanceledException(); case "--install": InstallService = true; break; case "--remove": RemoveService = true; break; case "--service-name": ServiceName = arglist.ExtractFirstOrDefault(); if (string.IsNullOrEmpty(ServiceName) || ServiceName.StartsWith("-")) { throw new Exception("Expected name to follow after --service-name"); } break; case "--service-title": ServiceTitle = arglist.ExtractFirstOrDefault(); if (string.IsNullOrEmpty(ServiceTitle) || ServiceTitle.StartsWith("-")) { throw new Exception("Expected text to follow after --service-title"); } break; case "--service-desc": ServiceDescription = arglist.ExtractFirstOrDefault(); if (string.IsNullOrEmpty(ServiceDescription) || ServiceDescription.StartsWith("-")) { throw new Exception("Expected name to follow after --service-desc"); } break; default: throw new Exception("Unrecognized option " + s); } } }