public IActionResult GetDocumentBySpec([FromBody] SpecForm data) { try { var d = _generator.ConvertJsonToPdf(data.Text); var id = _storage.SaveDocument(d); return(Ok(new { id, error = (string)null })); } catch (DocumentGenerationException e) { return(Ok(new { id = (string)null, error = "GenerationError" })); } catch (Exception e) { _log.Error("Unknown exception", e); return(Ok(new { id = (string)null, error = "UnknownException" })); } }
public static void AddRemoveSpec() { IDbCommand cm; bool Remove = false; ; bool OpenForm = true; try { string s = ""; if (OpenForm) { SpecForm f = new SpecForm(); f.sp = s; f.ShowDialog(); s = f.sp; Remove = f.Rem; } if (s == null) return; DbDataAdapter Adapter = DbProvider.GetDataAdapter("SELECT Spec FROM Spec", ORM.DB_University.connection); DataTable Table = new DataTable(); Adapter.Fill(Table); List<string> v = (from DataRow r in Table.AsEnumerable() select r[0].ToString().Trim().ToLower()).ToList(); if (v.Exists(delegate(string d) { return d == s; })) { if (Remove) { cm = DbProvider.GetCommand("DELETE FROM Spec WHERE Spec='" + s + "'", connection); cm.ExecuteNonQuery(); return; } MessageBox.Show("Entered speciality is already exists", "Exception", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (Remove) return; cm = DbProvider.GetCommand("INSERT INTO Spec VALUES('" + s + "')", connection); cm.ExecuteNonQuery(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
void Aveva.ApplicationFramework.IAddin.Start(ServiceManager serviceManager) { sServiceManager = serviceManager; sCommandManager = (CommandManager)sServiceManager.GetService(typeof(CommandManager)); sCommandBarManager = (CommandBarManager)sServiceManager.GetService(typeof(CommandBarManager)); //Add ExampleCommand to Command Manager SpecForm specForm = new SpecForm(); SpecCommand command1 = new SpecCommand(); command1.specForm = specForm; sCommandManager.Commands.Add(command1); //Create example toolbar menu CommandBar myToolBar = sCommandBarManager.CommandBars.AddCommandBar("SpecCommandBar"); sCommandBarManager.RootTools.AddButtonTool("SpecCommand", "temp", null, "SpecCommand"); myToolBar.Tools.AddTool("SpecCommand"); }
public override void Markslots() { IV3 = new bool[SpecForm.Length]; RandomGender = new bool[SpecForm.Length]; Gender = new byte[SpecForm.Length]; var smslot = new int[0].ToList(); if (SpecForm.Distinct().Count(t => t != 0) == 1) { SpecForm[0] = SpecForm[1]; } for (int i = 0; i < SpecForm.Length; i++) { if (SpecForm[i] == 0) { Gender[i] = FuncUtil.getGenderRatio(BlankGenderRatio); RandomGender[i] = FuncUtil.IsRandomGender(BlankGenderRatio); continue; } PersonalInfo info = PersonalTable.ORAS.getFormeEntry(SpecForm[i] & 0x7FF, SpecForm[i] >> 11); byte genderratio = (byte)info.Gender; IV3[i] = info.EggGroups[0] == 0xF && !(Pokemon.BabyMons.Contains(SpecForm[i] & 0x7FF) && IsORAS); Gender[i] = FuncUtil.getGenderRatio(genderratio); RandomGender[i] = FuncUtil.IsRandomGender(genderratio); if (Static && info.Types.Contains(Pokemon.electric) || Magnet && info.Types.Contains(Pokemon.steel)) // Collect slots { smslot.Add(i); } } StaticMagnetSlot = smslot.Select(s => (byte)s).ToArray(); if (0 == (NStaticMagnetSlot = (ulong)smslot.Count)) { Static = Magnet = false; } if (ModifiedLevel != 0) { ModifiedLevel = SlotLevel.Skip(1).Max(); } _PIDroll_count += ShinyCharm && !IsShinyLocked ? 3 : 1; }