static void Main(string[] args) { IImposto iss = new ISS(); IImposto icms = new ICMS(); var orcamento = new Orcamento(500.0); var calculador = new CalculadorDeImpostos(); calculador.RealizaCalculo(orcamento, iss); calculador.RealizaCalculo(orcamento, icms); }
static void Main(string[] args) { Imposto iss = new ISS(); Imposto icms = new ICMS(); Imposto iccc = new ICCC(); Orcamento orcamento = new Orcamento(5000); CalculadorDeImpostos calculador = new CalculadorDeImpostos(); calculador.RealizaCalculo(orcamento, iccc); Console.ReadKey(); }
void OnTriggerEnter(Collider c) { if (c.CompareTag("JunkDestroyer")) { Destroy(gameObject); } else if (c.CompareTag("ISS") && !isTractored && !hasHit) { hasHit = true; ISS.Hit((int)Mathf.Floor(rigidbody.mass * 10), gameObject); Destroy(gameObject); } else if (c.CompareTag("Goal")) { if (Goal.activationType == Goal.ActivationType.Junk || (Goal.activationType == Goal.ActivationType.Fired && wasFired)) { Tutorial.AdvanceTutorial(); Destroy(gameObject); } } }
static void Main(string[] args) { Console.WriteLine("Hello World!"); ITax iss = new ISS(); ITax icms = new ICMS(); ITax iccc = new ICCC(); Console.WriteLine(BudgetCalculator.Calculate(new Budget { value = 2500 }, iss)); Console.WriteLine(BudgetCalculator.Calculate(new Budget { value = 2500 }, iss)); Console.WriteLine(BudgetCalculator.Calculate(new Budget { value = 1000 }, iccc)); Console.WriteLine(BudgetCalculator.Calculate(new Budget { value = 3000 }, iccc)); Console.WriteLine(BudgetCalculator.Calculate(new Budget { value = 3001 }, iccc)); }
/// <summary> /// Import the tuning parameters /// </summary> //public void Import(XDocument xmlDoc, Dictionary<string, TuningParams> list, Dictionary<string, bool> tuningParamTrendLookup, ISS.Logger.Interfaces.ILogger log, // List<ControlSystemComponent> components, List<ControlSystemTuningPropertyValue> controlSystemTuningPropertyValues, List<ControlSystemTuningProperty> controlSystemTuningProperties) //public void Import(XDocument xmlDoc, Dictionary<string, TuningParams> list, Dictionary<string, bool> tuningParamTrendLookup, ISS.Logger.Interfaces.ILogger log) public void Import(XDocument xmlDoc, Dictionary<string, TuningParams> list, Dictionary<string, bool> tuningParamTrendLookup, ISS.Logger.Interfaces.ILogger log, Dictionary<int, String> components, List<TempTuningPropertyValue> controlSystemTuningPropertyValues, Dictionary<int, String> controlSystemTuningProperties) { IEnumerable<ImportMask> masks = from m in xmlDoc.Descendants("Mask") let elementNameElement = m.Element("ElementName") where elementNameElement != null let paranNameElement = m.Element("ParamName") where paranNameElement != null select new ImportMask { ElementNameMask = elementNameElement.Value, ParamNameMask = paranNameElement.Value }; ignoreImportMasks = new List<ImportMask>(masks.ToList()); ConvertMasksToRegularExpressions(); List<string> ignoredItems = new List<string>(); List<string> warnings = new List<string>(); List<string> processedItems = new List<string>(); // // Import // using (var cee = new CmsEntities()) { cee.Configuration.AutoDetectChangesEnabled = false; cee.Configuration.ValidateOnSaveEnabled = false; int importCount = 0; foreach (var kvp in list) { string componentName = kvp.Key; ControlSystemComponent component = cee.ControlSystemComponents.Include("ControlSystemComponentType").FirstOrDefault(x => x.Name == componentName); //Check if the Component is ignored - this shoudl return true only if a Component is ignored and ParamName is set to * if (MatchesIgnoreMask(componentName, string.Empty)) { //log.Info(" [" + componentName + "] IGNORED DUE TO MASK MATCH"); ignoredItems.Add(" [" + componentName + "] IGNORED DUE TO MASK MATCH"); continue; } if (!components.ContainsValue(componentName)) { // log warning //log.Warning("","Component not found in database [" + componentName + "]"); warnings.Add("Component not found in database [" + componentName + "]"); } else { //log.Info("Component name: " + componentName); foreach (var tpkvp in kvp.Value) { string propertyName = tpkvp.Key; double propertyValue = tpkvp.Value; if (propertyName.Length > 0) { if (MatchesIgnoreMask(componentName, propertyName)) { //log.Info(" [" + componentName + ", " + propertyName + "] IGNORED DUE TO MASK MATCH"); ignoredItems.Add(" [" + componentName + ", " + propertyName + "] IGNORED DUE TO MASK MATCH"); } else { // Next lookup will never fail bool trend; if (tuningParamTrendLookup.TryGetValue(propertyName, out trend)) { if (trend) { // trend used to be column on a tuning parameter in the old CMS // in new CMS it is on ControlSystemTuningPropertyValue } else { int componentId = components.FirstOrDefault(x => x.Value.ToLower() == componentName.ToLower()).Key; int propertyId = controlSystemTuningProperties.FirstOrDefault(x => x.Value.ToLower() == propertyName.ToLower()).Key; if (componentId == 0 || propertyId == 0) { if (componentId == 0) { //log.Warning("", c warnings.Add(String.Format("could not recognise Component '{0}'", componentName)); } else { //log.Warning("", "could not recognise c '{0}'", propertyName); warnings.Add(String.Format("could not recognise Property '{0}'", propertyName)); } continue; } //Check whether the Tuning Property actualy exist for this component var controlSystemComponentTypeTuningProperty = cee.ControlSystemComponentTypeTuningProperties.FirstOrDefault( x => x.ControlSystemComponentTypeId == component.ControlSystemComponentTypeId && x.ControlSystemTuningPropertyId == propertyId); if (controlSystemComponentTypeTuningProperty == null) { //log.Warning("", "Tuning Property '{0}' does not exist for Component '{1}' ComponentType '{2}'" // , propertyName, componentName, component.ControlSystemComponentType.Name); warnings.Add(String.Format("Tuning Property '{0}' does not exist for Component '{1}' ComponentType '{2}'" , propertyName, componentName, component.ControlSystemComponentType.Name)); continue; } var tuningPropertyValue = controlSystemTuningPropertyValues.FirstOrDefault(x => x.ComponentId == componentId && x.Propertyid == propertyId); if (tuningPropertyValue == null) { //This doesnt have entry so create it string sqlInsert = string.Format("INSERT INTO control.ControlSystemTuningPropertyValue " + "(ControlSystemComponentId, ControlSystemTuningPropertyId,PcsValue, Value, Imported, Trended, Reportable) VALUES " + "({0},{1},'{2}','{2}', 1, 0, 0)", componentId, propertyId, propertyValue); cee.Database.ExecuteSqlCommand(sqlInsert); //log.Verbose(sqlInsert); //log.Info("Component '{0}' TuningProperty '{1}' = {2} Imported into PCS VALUE and VALUE (reason: Record didn't Exist)", // componentName, propertyName, propertyValue); processedItems.Add(String.Format("Component '{0}' TuningProperty '{1}' = {2} Imported into PCS VALUE and VALUE (reason: Record didn't Exist)", componentName, propertyName, propertyValue)); controlSystemTuningPropertyValues.Add(new TempTuningPropertyValue { ComponentId = componentId, Propertyid = propertyId, Value = propertyValue.ToString() }); importCount++; } else { if (tuningPropertyValue.Trended) { // log warning //log.Warning("", "Component '{0}' TuningProperty '{1}' is a TREND and is ignored", // componentName, propertyName, propertyValue); warnings.Add(String.Format("Component '{0}' TuningProperty '{1}' is a TREND and is ignored", componentName, propertyName, propertyValue)); } else { if (tuningPropertyValue.Value == null) { //If current Value is null update the Value and PcsValue string sqlUpdate = string.Format("UPDATE control.ControlSystemTuningPropertyValue SET pcsvalue = '{0}', value = '{0}'" + " WHERE ControlSystemComponentId = {1} " + " AND ControlSystemTuningPropertyId = {2}", propertyValue, componentId, propertyId); cee.Database.ExecuteSqlCommand(sqlUpdate); //log.Verbose(sqlUpdate); //log.Info("Component '{0}' TuningProperty '{1}' = {2} Imported into PCS VALUE and VALUE (reason: VALUE was null)", // componentName, propertyName, propertyValue); processedItems.Add(String.Format("Component '{0}' TuningProperty '{1}' = {2} Imported into PCS VALUE and VALUE (reason: VALUE was null)", componentName, propertyName, propertyValue)); } else { //Update just PcsValue as Value already exist string sqlUpdate = string.Format("UPDATE control.ControlSystemTuningPropertyValue SET pcsvalue = '{0}'" + " WHERE ControlSystemComponentId = {1} " + " AND ControlSystemTuningPropertyId = {2}", propertyValue, componentId, propertyId); cee.Database.ExecuteSqlCommand(sqlUpdate); //log.Verbose(sqlUpdate); //log.Info("Component '{0}' TuningProperty '{1}' = {2} Imported into PCS VALUE", // componentName, propertyName, propertyValue); processedItems.Add(String.Format("Component '{0}' TuningProperty '{1}' = {2} Imported into PCS VALUE", componentName, propertyName, propertyValue)); } importCount++; } } } } } } } } } log.Warning("", String.Format("Ignored items ({0}) \t\t\t- Double click for more details. {1}{1}{2}", ignoredItems.Count, Environment.NewLine, string.Join(Environment.NewLine, ignoredItems.ToArray()))); log.Warning("", String.Format("Warnings ({0}) \t\t\t- Double click for more details. {1}{1}{2}", warnings.Count, Environment.NewLine, string.Join(Environment.NewLine, warnings.ToArray()))); log.Info(String.Format("Imported ({0}) \t\t\t- Double click for more details. {1}{1}{2}", processedItems.Count, Environment.NewLine, string.Join(Environment.NewLine, processedItems.ToArray()))); log.Info("*** Saving changes ... ***"); cee.SaveChanges(); } }
public void Update() { hasexploded = LoadOnClick.explode; if (hasexploded == false) { Merge(); } if (DefaultTrackableEventHandler1.Cassini) { //Obj.enabled = true; //Canvas.enabled = true; Butobj.SetActive(true); if (hasexploded) { CassiniExplode.SetActive(true); Cassini.SetActive(false); } } else if (DefaultTrackableEventHandler1.Apollo) { //Obj.enabled = true; //Canvas.enabled = true; Butobj.SetActive(true); if (hasexploded) { ApolloExplode.SetActive(true); Apollo.SetActive(false); } } else if (DefaultTrackableEventHandler1.Curiosity) { //Obj.enabled = true; //Canvas.enabled = true; Butobj.SetActive(true); if (hasexploded) { CuriosityExplode.SetActive(true); Curiosity.SetActive(false); } } else if (DefaultTrackableEventHandler1.ISS) { //Obj.enabled = true; //Canvas.enabled = true; if (hasexploded) { ISSExplode.SetActive(true); ISS.SetActive(false); } } else if (DefaultTrackableEventHandler1.Galileo) { //Obj.enabled = true; //Canvas.enabled = true; Butobj.SetActive(true); if (hasexploded) { GalileoExplode.SetActive(true); Galileo.SetActive(false); } } else if (DefaultTrackableEventHandler1.HST) { //Obj.enabled = true; //Canvas.enabled = true; Butobj.SetActive(true); if (hasexploded) { HSTExplode.SetActive(true); HST.SetActive(false); } } else if (DefaultTrackableEventHandler1.Messenger) { //Obj.enabled = true; //Canvas.enabled = true; Butobj.SetActive(true); if (hasexploded) { MessengerExplode.SetActive(true); Messenger.SetActive(false); } } else if (DefaultTrackableEventHandler1.PSLV) { //Obj.enabled = true; //Canvas.enabled = true; Butobj.SetActive(true); if (hasexploded) { PSLVExplode.SetActive(true); PSLV.SetActive(false); } } else if (DefaultTrackableEventHandler1.Chandrayaan) { //Obj.enabled = true; //Canvas.enabled = true; Butobj.SetActive(true); if (hasexploded) { ChandrayaanExplode.SetActive(true); Chandrayaan.SetActive(false); } } else if (DefaultTrackableEventHandler1.Mangalyaan) { //Obj.enabled = true; //Canvas.enabled = true; Butobj.SetActive(true); if (hasexploded) { MangalyaanExplode.SetActive(true); Mangalyaan.SetActive(false); } } else if (DefaultTrackableEventHandler.earth == true) { Butobj.SetActive(true); if (hasexploded) { EarthExplode.SetActive(true); Earth.SetActive(false); } } else { //Obj.enabled = false; //Canvas.enabled = false; Butobj.SetActive(false); CassiniExplode.SetActive(false); ApolloExplode.SetActive(false); CuriosityExplode.SetActive(false); ISSExplode.SetActive(false); GalileoExplode.SetActive(false); HSTExplode.SetActive(false); MessengerExplode.SetActive(false); PSLVExplode.SetActive(false); ChandrayaanExplode.SetActive(false); MangalyaanExplode.SetActive(false); EarthExplode.SetActive(false); } }