private void cmbPdline_Select(object sender, System.EventArgs e) { try { this.CmbPdLine.Station = Request["Station"]; this.CmbPdLine.Customer = Master.userInfo.Customer; if (this.CmbPdLine.InnerDropDownList.SelectedValue != "") { this.line.Value = this.CmbPdLine.InnerDropDownList.SelectedValue; this.txtDataEntry.Focus(); } else { setPdLineFocus(); } } catch (FisException ex) { writeToAlertMessage(ex.mErrmsg); } catch (Exception ex) { writeToAlertMessage(ex.Message); } }
protected void Page_Load(object sender, EventArgs e) { try { //this.CmbStatus.InnerDropDownList.SelectedIndexChanged += new EventHandler(cmbStatus_Select); this.CmbPdLine.InnerDropDownList.SelectedIndexChanged += new EventHandler(cmbPdline_Select); UserId = Master.userInfo.UserId; Customer = Master.userInfo.Customer; if (!this.IsPostBack) { initLabel(); this.hiddenStation.Value = Request["Station"]; this.pCode.Value = Request["PCode"]; this.CmbPdLine.Station = Request["Station"]; this.CmbPdLine.Customer = Master.userInfo.Customer; setPdLineFocus(); } } catch (FisException ex) { writeToAlertMessage(ex.mErrmsg); } catch (Exception ex) { writeToAlertMessage(ex.Message); } }
static SqlCredential CreateCredential(String username) { // Prompt the user for a password and construct SqlCredential SecureString password = new SecureString(); Console.WriteLine("Enter password for " + username + ": "); ConsoleKeyInfo nextKey = Console.ReadKey(true); while (nextKey.Key != ConsoleKey.Enter) { if (nextKey.Key == ConsoleKey.Backspace) { if (password.Length > 0) { password.RemoveAt(password.Length - 1); // erase the last * as well Console.Write(nextKey.KeyChar); Console.Write(" "); Console.Write(nextKey.KeyChar); } } else { password.AppendChar(nextKey.KeyChar); Console.Write("*"); } nextKey = Console.ReadKey(true); } Console.WriteLine(); Console.WriteLine(); password.MakeReadOnly(); return new SqlCredential(username, password); }
// Gets the length of the root DirectoryInfo or whatever DirectoryInfo markers // are specified for the first part of the DirectoryInfo name. // internal static int GetRootLength(String path) { CheckInvalidPathChars(path); int i = 0; int length = path.Length; if (length >= 1 && (IsDirectorySeparator(path[0]))) { // handles UNC names and directories off current drive's root. i = 1; if (length >= 2 && (IsDirectorySeparator(path[1]))) { i = 2; int n = 2; while (i < length && (!IsDirectorySeparator(path[i]) || --n > 0)) i++; } } else if (length >= 2 && path[1] == Path.VolumeSeparatorChar) { // handles A:\foo. i = 2; if (length >= 3 && (IsDirectorySeparator(path[2]))) i++; } return i; }
static void Main() { int n = int.Parse(Console.ReadLine()); List<string> halfDiamond = new List<string>(); string topHyphen = new String('-', n / 2); string top = topHyphen + "*" + topHyphen; halfDiamond.Add(top); for (int i = 1, j = 1; i <= n/2; i++, j +=2) { string middleLineHyphenOut = new String('-', n / 2 - i); string middleLineHyphenIn = new String('-', j); string middle = middleLineHyphenOut + "*" + middleLineHyphenIn + "*" + middleLineHyphenOut; halfDiamond.Add(middle); } for (int i = 0; i < halfDiamond.Count; i++) { Console.WriteLine(halfDiamond[i]); } for (int k = halfDiamond.Count - 2; k >= 0; k--) { Console.WriteLine(halfDiamond[k]); } }
public static void Main(String[] args) { Environment.ExitCode = 1; bool bResult = true; Console.WriteLine("ReflectionInsensitiveLookup: Test using reflection to do case-insensitive lookup with high chars."); TestClass tc = new TestClass(); Assembly currAssembly = tc.GetType().Module.Assembly; String typeName = tc.GetType().FullName; Type tNormal = currAssembly.GetType(typeName); if (tNormal!=null) { Console.WriteLine("Found expected type."); } else { bResult = false; Console.WriteLine("Unable to load expected type."); } Type tInsensitive = currAssembly.GetType(typeName, false, true); if (tInsensitive!=null) { Console.WriteLine("Found expected insensitive type."); } else { bResult = false; Console.WriteLine("Unable to load expected insensitive type."); } if (bResult) { Environment.ExitCode = 0; Console.WriteLine("Passed!"); } else { Console.WriteLine("Failed!"); } }
public void AppendResultsToFile(String Name, double TotalTime) { FileStream file; file = new FileStream(Name, FileMode.Append, FileAccess.Write); StreamWriter sw = new StreamWriter(file); sw.Write("***************************************\n"); sw.Write("Total | No Subs| %Total |%No Subs| Name\n"); foreach (CNamedTimer NamedTimer in m_NamedTimerArray) { if (NamedTimer.GetTotalSeconds() > 0) { String OutString; OutString = String.Format("{0:0.0000}", NamedTimer.GetTotalSeconds()) + " | " + String.Format("{0:0.0000}", NamedTimer.GetTotalSecondsExcludingSubroutines()) + " | " + String.Format("{0:00.00}", System.Math.Min(99.99, NamedTimer.GetTotalSeconds() / TotalTime * 100)) + "%" + " | " + String.Format("{0:00.00}", NamedTimer.GetTotalSecondsExcludingSubroutines() / TotalTime * 100) + "%" + " | " + NamedTimer.m_Name; OutString += " (" + NamedTimer.m_Counter.ToString() + ")\n"; sw.Write(OutString); } } sw.Write("\n\n"); sw.Close(); file.Close(); }
public FSAString() { state = State.START; fsachar = new FSAChar('\"'); raw = ""; val = ""; }
static void Main() { Console.OutputEncoding = Encoding.Unicode; Console.Write("Please enter the row count:"); int rows = int.Parse(Console.ReadLine()); char symbol = (char)169; int cells = (rows * 2) - 1; int symbolIncrement = 1; int blankcount; int symbolcount; Console.WriteLine("Triangle made of {0}", symbol); for (int r = 0; r < rows; r++) { blankcount = cells - symbolIncrement; symbolcount = cells - blankcount; string blankCells = new String(' ', blankcount / 2); string fullCells = new String(symbol, symbolcount); Console.Write("{0}{1}", blankCells, fullCells); symbolIncrement = symbolIncrement + 2; Console.WriteLine(); } }
protected void Page_Load(object sender, EventArgs e) { try { string configDefaultDB = iConfigDB.GetOnlineDefaultDBName(); DBConnection = CmbDBType.ddlGetConnection(); defaultSelectDB = this.Page.Request["DBName"] != null ? Request["DBName"].ToString().Trim() : configDefaultDB; //lblModelCategory.Visible = !defaultSelectDB.ToUpper().Equals("HPDOCKING"); //ChxLstProductType1.IsHide = defaultSelectDB.ToUpper().Equals("HPDOCKING"); HPDocking_Rep lblModelCategory.Visible = !iConfigDB.CheckDockingDB(defaultSelectDB); ChxLstProductType1.IsHide = iConfigDB.CheckDockingDB(defaultSelectDB); customer = Master.userInfo.Customer; if (!this.IsPostBack) { InitPage(); InitCondition(); } } catch (FisException ex) { showErrorMessage(ex.mErrmsg); } catch (Exception ex) { showErrorMessage(ex.Message); } }
protected void Page_Load(object sender, EventArgs e) { btnGetCNList.ServerClick += new EventHandler(btnGetCNList_ServerClick); btnUpdateCNList.ServerClick += new EventHandler(btnUpdateCNList_ServerClick); msgStatusError = this.GetLocalResourceObject(Pre + "_msgStatusError").ToString(); msgPnoError = this.GetLocalResourceObject(Pre + "_msgPnoError").ToString(); msgCountError = this.GetLocalResourceObject(Pre + "_msgCountError").ToString(); cmdValue = this.GetLocalResourceObject(Pre + "_cmdValue").ToString(); msgWrongCode = this.GetLocalResourceObject(Pre + "_msgWrongCode").ToString(); station = Request["Station"]; userId = Master.userInfo.UserId; customer = Master.userInfo.Customer; placeValue = "'A0','In W/H';'P1','In PdLine';'P0','In P/L Coa Center';'D1','In P/L';'A1','Consumed';'16','Return';'A2','Removal';'A3','Removal';'RE','Return to W/H';'01','Damaged';'02','Lost';'05','Obsolete';'11','Correction';'16','Rerurn'"; if (!this.IsPostBack) { this.TextBox1.Attributes.Add("onkeydown", "onTextBox1KeyDown()"); this.TextBox2.Attributes.Add("onkeydown", "onTextBox2KeyDown()"); InitLabel(); initCNCardChange(); initTableColumnHeader(); //绑定空表格 this.gridview.DataSource = getNullDataTable(); this.gridview.DataBind(); this.drpCNCardChange.Attributes.Add("onchange", "drpOnChange()"); } }
public Boolean addSkillToRecruitee(Guid RecruiteeId, String SkillId) { RecruiteeManager mgr = new RecruiteeManager(); Recruitee rec = Recruitee.createRecruitee(RecruiteeId, null, 0, "", "", "", "", "", "", ""); Recruitee obj = mgr.selectRecruiteeById(rec); return mgr.addSkillToRecruitee(obj, SkillId); }
static void Main(string[] args) { RallyRestApi restApi = new RallyRestApi(webServiceVersion: "v2.0"); String apiKey = "_abc123"; restApi.Authenticate(apiKey, "https://rally1.rallydev.com", allowSSO: false); String[] workspaces = new String[] { "/workspace/12352608129", "/workspace/34900020610" }; foreach (var s in workspaces) { Console.WriteLine(" ______________ " + s + " _________________"); Request typedefRequest = new Request("TypeDefinition"); typedefRequest.Workspace = s; typedefRequest.Fetch = new List<string>() { "ElementName", "Ordinal" }; typedefRequest.Query = new Query("Parent.Name", Query.Operator.Equals, "Portfolio Item"); QueryResult typedefResponse = restApi.Query(typedefRequest); foreach (var t in typedefResponse.Results) { if (t["Ordinal"] > -1) { Console.WriteLine("ElementName: " + t["ElementName"] + " Ordinal: " + t["Ordinal"]); } } } }
protected void Page_Load(object sender, EventArgs e) { try { UserId = Master.userInfo.UserId; this.HiddenUserName.Value = UserId; iFAIModelMaintain = ServiceAgent.getInstance().GetMaintainObjectByName<IFAIModelMaintain>(WebConstant.FAIModelMaintain); if (!this.IsPostBack) { initLabel(); bindTable(null); } } catch (FisException ex) { showErrorMessage(ex.mErrmsg); bindTable(null); } catch (Exception ex) { showErrorMessage(ex.Message); bindTable(null); } ScriptManager.RegisterStartupScript(this.Page, typeof(System.Object), "newIndex", "iSelectedRowIndex = null;resetTableHeight();", true); }
public String removeCurrSymbol(String str) { //loop through a string to remove the currency formatting String newStr = ""; int i = str.Length - 1; Char c = str[i]; //loop through from end to start until we hit a ';', marks the end of the unicode character while (c != ';') { i--; try { //try to set character to i value in string c = str[i]; } catch { //if caught, it must be end of the string //therefore its not a unicode currency symbol, but an actual currency symbol //only need to take first character off string in this case i = 0; c = ';'; } } //increment i by 1 to not count the semi-colon i++; newStr = str.Substring(i, str.Length - i); return newStr; }
// The following return usernames /// <summary> /// Create a game between 2 players /// </summary> /// <param name="Player1"> /// </param> /// <param name="Player2"></param> public Game(String Player1, String Player2) { GameStatus = Status.PENDING; this.Player1 = Player1; this.Player2 = Player2; this.Board = (int[][]) DefaultBoard.Clone (); }
public static object registraSintoma(List<registros> sintomas, List<registros> catalizadore, String fechaRegistro, int minutos, int intensidad) { PacienteDao pd = new PacienteDao(); SintomasDao sd = new SintomasDao(); string usuarioActual = ""; string userid =""; if (Thread.CurrentPrincipal.Identity.IsAuthenticated) { usuarioActual = Thread.CurrentPrincipal.Identity.Name; MembershipUser u = Membership.GetUser(usuarioActual); userid = u.ProviderUserKey.ToString(); } //retorna el iddel episodio List<int> nuevo = new List<int>(); foreach(var data in sintomas){ nuevo.Add(data.ID); } var x = pd.sp_registrar_episodio_paciente(userid, intensidad, minutos); sd.registrarSintomasEpisodioPaciente(x, nuevo); return new { status ="OK", }; }
public void AjaxFileUploadIdentitasLahan_UploadComplete(object sender, AjaxControlToolkit.AjaxFileUploadEventArgs e) { if (Session["userid"] is object) { userid = Session["userid"].ToString(); } //string user = ""; string wilayah = ""; LANDCOMP.generateNUm gn = new LANDCOMP.generateNUm(); gn.Datas(); string _stNomor; string _stDates = DateTime.Today.ToString("yyyyMMdd"); string uploadFolder = Request.PhysicalApplicationPath + "uploadDocument\\"; LANDCOMP.paramz ext = new LANDCOMP.paramz(); ext.setExtension(Path.GetExtension(e.FileName)); if (ext.getExtsion() != ".exe") { _stFAsli = System.IO.Path.GetFileName(e.FileName); _stNomor = gn.GenerateNumber("", 101, 10, _stDates, userid); AjaxFileUploadIdentitasLahan.SaveAs(uploadFolder + _stNomor + ext.getExtsion()); e.PostedUrl = string.Format(e.FileName + "|" + _stNomor + "|" + userid + "|" + wilayah); } }
public static void Main(String[] args) { AttrDemo ad = new AttrDemo(); // we're trying to call a method that has been // tagged as obsolete ad.OldMethod(); }
protected void CreateUserWizard1_CreatedUser(object sender, EventArgs e) { System.Web.Security.MembershipCreateStatus status; System.Web.Security.Membership.CreateUser (CreateUserWizard1.UserName, CreateUserWizard1.Password, CreateUserWizard1.Email, CreateUserWizard1.Question, CreateUserWizard1.Answer, true, out status); str = CreateUserWizard1.Email; string[] temp = CreateUserWizard1.Email.Split( new string[] {"@"}, StringSplitOptions.None); if (temp[1].Equals("learn.senecac.on.ca")) { System.Web.Security.Roles.AddUserToRole (CreateUserWizard1.UserName, "Student"); } else if (temp[1].Equals("senecacollege.ca")) { System.Web.Security.Roles.AddUserToRole (CreateUserWizard1.UserName, "Staff"); } else { System.Web.Security.Roles.AddUserToRole (CreateUserWizard1.UserName, "Public"); } }
protected void Page_Load(object sender, EventArgs e) { try { // cmbPdLine.InnerDropDownList.SelectedIndexChanged += new EventHandler(cmbPdLine_Selected); // cmbPdLine.InnerDropDownList.AutoPostBack = true; if (!Page.IsPostBack) { InitLabel(); UserId = Master.userInfo.UserId; Customer = Master.userInfo.Customer; this.station.Value = Request["Station"]; //this.pCode.Value = Request["PCode"]; setFocus(); } } catch (FisException ee) { writeToAlertMessage(ee.mErrmsg); } catch (Exception ex) { writeToAlertMessage(ex.Message); } }
public PasswordDeriveBytes (byte[] password, byte[] salt, String hashName, int iterations, CspParameters cspParams) { this.IterationCount = iterations; this.Salt = salt; this.HashName = hashName; _password = password; _cspParams = cspParams; }
private void cargarPlantel() { Plantel plantel = new Plantel(); try { plantel = GestorPlantel.getPlantelActual(); } catch (SportingException spEx) { //TODO: poner un lblOutput y mostrar mensaje de error } catch (Exception e) { //TODO: poner un lblOutput y mostrar mensaje de error } temporada = "Plantel temporada "+plantel.Temporada; fotoPlantel = plantel.Foto.PathMedium; infoPlantel = plantel.Info; foreach (Jugador jugador in plantel.Jugadores) { jugadores += jugador.ToString() + ";"; } this.jugadoresPlantel.Value = jugadores; }
public static int Main(String[] args) { int status = 0; Ice.Communicator communicator = null; try { communicator = Ice.Util.initialize(ref args); status = run(args, communicator); } catch(System.Exception ex) { Console.Error.WriteLine(ex); status = 1; } if(communicator != null) { try { communicator.destroy(); } catch(Ice.LocalException ex) { Console.Error.WriteLine(ex); status = 1; } } return status; }
// Creates a marker with the given id, name, and size. // Registers the marker at native code. // Returns a MarkerBehaviour object to receive updates. public MarkerBehaviour CreateMarker(int markerID, String trackableName, float size) { int trackableID = RegisterMarker(markerID, trackableName, size); if (trackableID == -1) { Debug.LogError("Could not create marker with id " + markerID + "."); return null; } // Alternatively instantiate Trackable Prefabs. GameObject markerObject = new GameObject(); MarkerBehaviour newMB = markerObject.AddComponent<MarkerBehaviour>(); Debug.Log("Creating Marker with values: " + "\n MarkerID: " + markerID + "\n TrackableID: " + trackableID + "\n Name: " + trackableName + "\n Size: " + size + "x" + size); newMB.InitializeID(trackableID); newMB.MarkerID = markerID; newMB.TrackableName = trackableName; newMB.transform.localScale = new Vector3(size, size, size); // Add newly created Marker to dictionary. mMarkerBehaviourDict[trackableID] = newMB; return newMB; }
/// <summary> /// <p>Adds a file from the file system to the archive under the specified entry name. /// The new entry in the archive will contain the contents of the file. /// The last write time of the archive entry is set to the last write time of the file on the file system. /// If an entry with the specified name already exists in the archive, a second entry will be created that has an identical name. /// If the specified source file has an invalid last modified time, the first datetime representable in the Zip timestamp format /// (midnight on January 1, 1980) will be used.</p> /// /// <p>If an entry with the specified name already exists in the archive, a second entry will be created that has an identical name.</p> /// /// <p>Since no <code>CompressionLevel</code> is specified, the default provided by the implementation of the underlying compression /// algorithm will be used; the <code>ZipArchive</code> will not impose its own default. /// (Currently, the underlying compression algorithm is provided by the <code>System.IO.Compression.DeflateStream</code> class.)</p> /// </summary> /// /// <exception cref="ArgumentException">sourceFileName is a zero-length string, contains only white space, or contains one or more /// invalid characters as defined by InvalidPathChars. -or- entryName is a zero-length string.</exception> /// <exception cref="ArgumentNullException">sourceFileName or entryName is null.</exception> /// <exception cref="PathTooLongException">In sourceFileName, the specified path, file name, or both exceed the system-defined maximum length. /// For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters.</exception> /// <exception cref="DirectoryNotFoundException">The specified sourceFileName is invalid, (for example, it is on an unmapped drive).</exception> /// <exception cref="IOException">An I/O error occurred while opening the file specified by sourceFileName.</exception> /// <exception cref="UnauthorizedAccessException">sourceFileName specified a directory. -or- The caller does not have the /// required permission.</exception> /// <exception cref="FileNotFoundException">The file specified in sourceFileName was not found. </exception> /// <exception cref="NotSupportedException">sourceFileName is in an invalid format or the ZipArchive does not support writing.</exception> /// <exception cref="ObjectDisposedException">The ZipArchive has already been closed.</exception> /// /// <param name="sourceFileName">The path to the file on the file system to be copied from. The path is permitted to specify /// relative or absolute path information. Relative path information is interpreted as relative to the current working directory.</param> /// <param name="entryName">The name of the entry to be created.</param> /// <returns>A wrapper for the newly created entry.</returns> public static ZipArchiveEntry CreateEntryFromFile(this ZipArchive destination, String sourceFileName, String entryName) { Contract.Ensures(Contract.Result<ZipArchiveEntry>() != null); Contract.EndContractBlock(); return DoCreateEntryFromFile(destination, sourceFileName, entryName, null); }
public static int Main( String[] args ) { try { int[] arr = ThrowAnException (); Console.WriteLine ("Test failed, really!"); return 1; } catch (Exception e) { Console.WriteLine ("Test passed"); return 0; } }
public static void Main(String[] args) { var exe = Assembly.GetExecutingAssembly().Location; var folder = Path.GetDirectoryName(exe); var pfx = Path.Combine(folder, "ClientPrivate.pfx"); var c = new X509Certificate2(File.ReadAllBytes(pfx), "wse2qs"); if (args[0] == "verify") { Console.WriteLine("verifying signature..."); var file = Path.Combine(folder, "SignedExample.xml"); bool b = VerifyXmlFile(file, (RSA)c.PublicKey.Key); Console.WriteLine("signature is " + (b ? "valid" : "not valid!")); if (!b) Environment.Exit(-1); } else if (args[0] == "sign") { Console.WriteLine("generating signature..."); var xmlFile = Path.Combine(folder, "Example.xml"); var sigFile = Path.Combine(folder, "signedExample.xml"); CreateSomeXml(xmlFile); SignXmlFile(xmlFile, sigFile, (RSA)c.PrivateKey); Console.WriteLine("done"); } }
public S(String s){ str = s; str2 = s + str; pad.d1 = pad.d2 = pad.d3 = pad.d4 = pad.d5 = pad.d6 = pad.d7 = pad.d8 = pad.d9 = pad.d10 = pad.d11 = pad.d12 = pad.d13 = pad.d14 = pad.d15 = pad.d16 = pad.d17 = pad.d18 = pad.d19 = pad.d20 = pad.d21 = pad.d22 = pad.d23 = pad.d24 = pad.d25 = pad.d26 = pad.d27 = pad.d28 = pad.d29 = pad.d30 = 3.3; }
public static JProperty ToJSON(this IEnumerable<ChargingSession> ChargingSessions, String JPropertyKey) { #region Initial checks if (JPropertyKey.IsNullOrEmpty()) throw new ArgumentNullException(nameof(JPropertyKey), "The json property key must not be null or empty!"); #endregion return ChargingSessions != null ? new JProperty(JPropertyKey, ChargingSessions.ToJSON()) : new JProperty(JPropertyKey, new JArray()); }
public virtual void CheckChangingDomicile() { string[] tagsOfScenario = ((string[])(null)); TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Check changing domicile", null, ((string[])(null))); #line 15 this.ScenarioInitialize(scenarioInfo); #line hidden bool isScenarioIgnored = default(bool); bool isFeatureIgnored = default(bool); if ((tagsOfScenario != null)) { isScenarioIgnored = tagsOfScenario.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any(); } if ((this._featureTags != null)) { isFeatureIgnored = this._featureTags.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any(); } if ((isScenarioIgnored || isFeatureIgnored)) { testRunner.SkipScenario(); } else { this.ScenarioStart(); #line 16 testRunner.Given("I am on homepage", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given "); #line hidden #line 17 testRunner.When("I change domicile to United Kingdom", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); #line hidden #line 18 testRunner.Then("The page should change to UK Version", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); #line hidden } this.ScenarioCleanup(); }
/// <summary> /// Write the document to the path specified. /// </summary> /// <param name="path">The path to save to.</param> /// <returns>True on success.</returns> public bool SaveFile(string path) { try { /* * Check to see if the on-disk file is more recent * than the file we are about to save. */ if (!applicationManager.ClientProfile.HaveFlag( ClientFlags.EditorDisableFileTimestampCheck) && FileTools.FileIsNewerOnDisk(path, FileTimeStamp)) { if (MessageBox.Show( String.Format("{0}\r\n\r\n{1}\r\n{2}", FilePath, Resources.FileChangedMessage, Resources.FileChangedOverwriteMessage), Resources.FileChangedTitle, MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No) { return false; } } /* * Save the file. */ FileTools.WriteFile(path, scintilla.Text, FileEncoding); scintilla.Modified = false; FileInfo fi = new FileInfo(path); Text = fi.Name; documentFileName = fi.Name; documentFilePath = fi.FullName; documentTimeStamp = DateTime.Now; scintilla.Printing.PrintDocument.DocumentName = fi.Name; string fileDirectory = Path.GetDirectoryName(documentFilePath); if (fileDirectory != Directory.GetCurrentDirectory() && applicationManager.ClientProfile.HaveFlag( ClientFlags.EditorChangeDirectoryOnSave)) Directory.SetCurrentDirectory(fileDirectory); /* * If the file extension has changed we will need to * update the document type and editor language. * This will only switch lexers within the editor - if * the new type uses a different editor it will remain * within the current editor. */ DocumentType documentType = new DocumentType(fi.Extension); string language = documentManager. GetDocumentLanguage(documentType); if (scintilla.ConfigurationManager.Language != language) scintilla.ConfigurationManager.Language = language; /* * Update any filesystem views. */ applicationManager.NotifyFileSystemChange(); return true; } catch (Exception ex) { MessageBox.Show(String.Format("{0}\r\n{1}", Resources.SaveErrorMessage, ex.Message), Resources.SaveErrorTitle, MessageBoxButtons.OK, MessageBoxIcon.Error); return false; } }
/// <summary> /// Load editor settings from a configuration file. /// </summary> /// <param name="documentType">The document type of the file being edited.</param> public void LoadSettings(DocumentType documentType) { string scintillaConfig = Path.Combine( applicationManager.QuickSharpHome, Constants.CONFIG_DIR_NAME); /* * Look for theme specific sub-folder. */ string themePath = applicationManager. GetSelectedThemeProviderKey(); if (!String.IsNullOrEmpty(themePath)) { string themeConfig = Path.Combine( scintillaConfig, themePath); if (Directory.Exists(themeConfig)) scintillaConfig = themeConfig; } /* * Update scintilla if the location exists. */ if (Directory.Exists(scintillaConfig)) scintilla.ConfigurationManager.CustomLocation = scintillaConfig; /* * Apply any lexer aliases. */ Dictionary<String, String> lexerAliasMap = documentManager.LexerAliasMap; foreach (string alias in lexerAliasMap.Keys) if (!scintilla.Lexing.LexerLanguageMap.ContainsKey(alias)) scintilla.Lexing.LexerLanguageMap.Add( alias, lexerAliasMap[alias]); /* * Language will be requested language or default. */ string language = documentManager.GetDocumentLanguage(documentType); scintilla.ConfigurationManager.Language = language; /* * Set config from external files and internal settings. */ scintilla.ConfigurationManager.IsUserEnabled = true; scintilla.UseFont = false; if (_settingsManager.OverrideConfigFiles) { // Line numbers scintilla.Margins.Margin0.Type = MarginType.Number; scintilla.Margins.Margin0.Width = _settingsManager.LineNumberMarginSize; // Bookmarks scintilla.NativeInterface.SendMessageDirect( ScintillaNet.Constants.SCI_MARKERDEFINE, Constants.BOOKMARK_MARKER, ScintillaNet.Constants.SC_MARK_SMALLRECT); scintilla.NativeInterface.SendMessageDirect( ScintillaNet.Constants.SCI_MARKERSETFORE, Constants.BOOKMARK_MARKER, 0); scintilla.NativeInterface.SendMessageDirect( ScintillaNet.Constants.SCI_MARKERSETBACK, Constants.BOOKMARK_MARKER, GetColor(Color.LightGreen)); scintilla.Margins.Margin1.Type = MarginType.Symbol; scintilla.Margins.Margin1.Width = 8; // Folding scintilla.Margins.Margin2.Type = MarginType.Symbol; scintilla.Margins.Margin2.Width = 16; // Not used scintilla.Margins.Margin3.Width = 0; scintilla.Margins.Margin3.Type = MarginType.Back; scintilla.Indentation.ShowGuides = _settingsManager.ShowIndentationGuides; scintilla.Indentation.TabWidth = _settingsManager.TabSize; scintilla.Indentation.UseTabs = _settingsManager.UseTabs; scintilla.Indentation.BackspaceUnindents = _settingsManager.BackspaceUnindents; scintilla.Folding.IsEnabled = _settingsManager.ShowFolding; scintilla.Folding.Flags = _settingsManager.Flags; scintilla.Folding.MarkerScheme = _settingsManager.MarkerScheme; string fontName = Fonts.ValidateFontName(_settingsManager.FontName); float fontSize = Fonts.ValidateFontSize(_settingsManager.FontSize); scintilla.Font = new Font(fontName, fontSize); scintilla.UseFont = true; } /* * Global settings (not covered by config files) */ scintilla.IsBraceMatching = _settingsManager.MatchBraces; scintilla.LineWrap.Mode = _settingsManager.WordWrap ? WrapMode.Word : WrapMode.None; scintilla.Printing.PageSettings.ColorMode = _settingsManager.PrintingColorMode; }
public static String ComputeDisplayName(RuntimeAssemblyName a) { if (a.Name == String.Empty) { throw new FileLoadException(); } StringBuilder sb = new StringBuilder(); if (a.Name != null) { sb.AppendQuoted(a.Name); } if (a.Version != null) { sb.Append(", Version="); sb.Append(a.Version.ToString()); } String cultureName = a.CultureName; if (cultureName != null) { if (cultureName == String.Empty) { cultureName = "neutral"; } sb.Append(", Culture="); sb.AppendQuoted(cultureName); } byte[] pkt = a.PublicKeyOrToken; if (pkt != null) { if (0 != (a.Flags & AssemblyNameFlags.PublicKey)) { pkt = ComputePublicKeyToken(pkt); } if (pkt.Length > PUBLIC_KEY_TOKEN_LEN) { throw new ArgumentException(); } sb.Append(", PublicKeyToken="); if (pkt.Length == 0) { sb.Append("null"); } else { foreach (byte b in pkt) { sb.Append(b.ToString("x2", CultureInfo.InvariantCulture)); } } } if (0 != (a.Flags & AssemblyNameFlags.Retargetable)) { sb.Append(", Retargetable=Yes"); } AssemblyContentType contentType = ExtractAssemblyContentType(a.Flags); if (contentType == AssemblyContentType.WindowsRuntime) { sb.Append(", ContentType=WindowsRuntime"); } // NOTE: By design (desktop compat) AssemblyName.FullName and ToString() do not include ProcessorArchitecture. return(sb.ToString()); }
private string FormQuery() { return Select + String.Format(WhereTemplate, WherePredicate) + OrderBy; }
// Методы // Создание матрицы с помощью файла public void OpenFromFileToDataTransfer(string filename, ref History_message ourHistory) { StreamReader f = null; try { f = new StreamReader(filename); } catch { ourHistory = ourHistory.Add("При открытии файла произошла ошибка " + filename); return; } int N; double V; Category Type; double[] PackedForm; bool success; success = Int32.TryParse(f.ReadLine().Trim(), out N); if (!success) { ourHistory = ourHistory.Add("Неверный формат размерности"); f.Close(); return; } if (N <= 1) { ourHistory = ourHistory.Add("Размерность должна быть больше 1"); f.Close(); return; } DataTransfer.data[0] = N; success = Double.TryParse(f.ReadLine().Trim(), out V); if (!success) { ourHistory = ourHistory.Add("Неверный формат значения V"); f.Close(); return; } DataTransfer.data[1] = V; success = Category.TryParse(f.ReadLine().Trim(), out Type); if (!success || Type == Category.none) { ourHistory = ourHistory.Add("Неверный формат типа"); f.Close(); return; } DataTransfer.data[2] = Type; PackedForm = new double[N * (N + 1) / 2]; int k = 0; Matrix Temp = new Matrix('_', N, V, Type, null); for (int i = 0; i < N; i++) { string line = f.ReadLine(); if (line == null) { ourHistory = ourHistory.Add("Недостаточно строк в файле"); f.Close(); return; } line = line.Trim(); line = System.Text.RegularExpressions.Regex.Replace(line, @"\s+", " "); string[] splittedStroka = line.Split(' '); for (int j = 0; j < N; j++) { String strElement; try { strElement = splittedStroka[j]; } catch { ourHistory = ourHistory.Add("Недостаточно значений в строке " + (4 + i).ToString()); f.Close(); return; } success = Double.TryParse(strElement, out V); if (!success) { ourHistory = ourHistory.Add("Обнаружено значение, не являющееся числом: " + strElement + " в строке " + (4 + i).ToString()); f.Close(); return; } else { if (Operations.isV(i, j, Temp)) { if ((double)DataTransfer.data[1] == V) { // пропустить } else { ourHistory = ourHistory.Add("Ожидалось значение V, равное " + ((double)DataTransfer.data[1]).ToString() + ", а получено значение V, равное " + V.ToString() + " в строке: " + (4 + i).ToString()); f.Close(); return; } } else { if (Math.Abs(V) <= 1E-12) { V = 0; } PackedForm[k] = V; k++; } } } success = false; try { String _ = splittedStroka[N]; } catch { success = true; } if (!success) { ourHistory = ourHistory.Add("Имеются лишние значения в строке " + (4 + i).ToString()); f.Close(); return; } } if (f.ReadLine() != null) { ourHistory = ourHistory.Add("Имеются лишние строки в конце файла"); f.Close(); return; } DataTransfer.data[3] = PackedForm; f.Close(); }
public override string ToString() { return String.Format("Voice({0})", voiceNum); }
public ModelDescription GetOrCreateModelDescription(Type modelType) { if (modelType == null) { throw new ArgumentNullException("modelType"); } Type underlyingType = Nullable.GetUnderlyingType(modelType); if (underlyingType != null) { modelType = underlyingType; } ModelDescription modelDescription; string modelName = ModelNameHelper.GetModelName(modelType); if (GeneratedModels.TryGetValue(modelName, out modelDescription)) { if (modelType != modelDescription.ModelType) { throw new InvalidOperationException( String.Format( CultureInfo.CurrentCulture, "A model description could not be created. Duplicate model name '{0}' was found for types '{1}' and '{2}'. " + "Use the [ModelName] attribute to change the model name for at least one of the types so that it has a unique name.", modelName, modelDescription.ModelType.FullName, modelType.FullName)); } return(modelDescription); } if (DefaultTypeDocumentation.ContainsKey(modelType)) { return(GenerateSimpleTypeModelDescription(modelType)); } if (modelType.IsEnum) { return(GenerateEnumTypeModelDescription(modelType)); } if (modelType.IsGenericType) { Type[] genericArguments = modelType.GetGenericArguments(); if (genericArguments.Length == 1) { Type enumerableType = typeof(IEnumerable <>).MakeGenericType(genericArguments); if (enumerableType.IsAssignableFrom(modelType)) { return(GenerateCollectionModelDescription(modelType, genericArguments[0])); } } if (genericArguments.Length == 2) { Type dictionaryType = typeof(IDictionary <,>).MakeGenericType(genericArguments); if (dictionaryType.IsAssignableFrom(modelType)) { return(GenerateDictionaryModelDescription(modelType, genericArguments[0], genericArguments[1])); } Type keyValuePairType = typeof(KeyValuePair <,>).MakeGenericType(genericArguments); if (keyValuePairType.IsAssignableFrom(modelType)) { return(GenerateKeyValuePairModelDescription(modelType, genericArguments[0], genericArguments[1])); } } } if (modelType.IsArray) { Type elementType = modelType.GetElementType(); return(GenerateCollectionModelDescription(modelType, elementType)); } if (modelType == typeof(NameValueCollection)) { return(GenerateDictionaryModelDescription(modelType, typeof(string), typeof(string))); } if (typeof(IDictionary).IsAssignableFrom(modelType)) { return(GenerateDictionaryModelDescription(modelType, typeof(object), typeof(object))); } if (typeof(IEnumerable).IsAssignableFrom(modelType)) { return(GenerateCollectionModelDescription(modelType, typeof(object))); } return(GenerateComplexTypeModelDescription(modelType)); }
internal void ReplaceState(GameState state) { if (State != null) { State.Dispose(); States.Pop(); } state.Game = this; States.Push(state); Trace.TraceInformation("Game.ReplaceState({0}) {1}", state.GetType().Name, String.Join(" | ", States.Select(s => s.GetType().Name).ToArray())); }
internal void PopState() { State.Dispose(); States.Pop(); Trace.TraceInformation("Game.PopState() {0}", String.Join(" | ", States.Select(s => s.GetType().Name).ToArray())); }
internal void PushState(GameState state) { state.Game = this; States.Push(state); Trace.TraceInformation("Game.PushState({0}) {1}", state.GetType().Name, String.Join(" | ", States.Select(s => s.GetType().Name).ToArray())); }
public virtual object WriteSampleObjectUsingFormatter(MediaTypeFormatter formatter, object value, Type type, MediaTypeHeaderValue mediaType) { if (formatter == null) { throw new ArgumentNullException("formatter"); } if (mediaType == null) { throw new ArgumentNullException("mediaType"); } object sample = String.Empty; MemoryStream ms = null; HttpContent content = null; try { if (formatter.CanWriteType(type)) { ms = new MemoryStream(); content = new ObjectContent(type, value, formatter, mediaType); formatter.WriteToStreamAsync(type, value, ms, content, null).Wait(); ms.Position = 0; StreamReader reader = new StreamReader(ms); string serializedSampleString = reader.ReadToEnd(); if (mediaType.MediaType.ToUpperInvariant().Contains("XML")) { serializedSampleString = TryFormatXml(serializedSampleString); } else if (mediaType.MediaType.ToUpperInvariant().Contains("JSON")) { serializedSampleString = TryFormatJson(serializedSampleString); } sample = new TextSample(serializedSampleString); } else { sample = new InvalidSample(String.Format( CultureInfo.CurrentCulture, "Failed to generate the sample for media type '{0}'. Cannot use formatter '{1}' to write type '{2}'.", mediaType, formatter.GetType().Name, type.Name)); } } catch (Exception e) { sample = new InvalidSample(String.Format( CultureInfo.CurrentCulture, "An exception has occurred while using the formatter '{0}' to generate sample for media type '{1}'. Exception message: {2}", formatter.GetType().Name, mediaType.MediaType, UnwrapException(e).Message)); } finally { if (ms != null) { ms.Dispose(); } if (content != null) { content.Dispose(); } } return sample; }
static string ProcessCommands(string[] commands, NetConnection sender) { try { string stringBuffer = String.Empty; string messageToSender = String.Empty; NetOutgoingMessage outMsg = server.CreateMessage(); if (commands.Length > 1 && commands[0] == "nick") { string nickName = commands[1]; if (!String.IsNullOrWhiteSpace(nickName)) { UpdateUIDMap(sender.RemoteUniqueIdentifier, nickName); stringBuffer += sender.RemoteUniqueIdentifier + " (" + sender.RemoteEndpoint.Address + ")" + " has changed name to " + uidNameMap[sender.RemoteUniqueIdentifier] + Environment.NewLine; } } else if (commands.Length > 2 && commands[0] == "random") { int min, max; if (Int32.TryParse(commands[1], out min) && Int32.TryParse(commands[2], out max)) { stringBuffer += "Random number generated between " + min + " and " + max + ": " + rnd.Next(min, max) + Environment.NewLine; } } else if (commands.Length > 0 && commands[0] == "random") { stringBuffer += "Random number generated: " + rnd.Next() + Environment.NewLine; } else if (commands.Length > 2 && commands[0] == "kick") { // kicks a user with UID if (commands[2] == adminCode) { foreach (NetConnection connection in server.Connections) { if (connection.RemoteUniqueIdentifier.ToString() == commands[1]) { //connection.Deny("kicked"); connection.Disconnect("kicked"); stringBuffer += uidNameMap[connection.RemoteUniqueIdentifier] + " has been kicked by " + uidNameMap[sender.RemoteUniqueIdentifier] + Environment.NewLine; break; } } } } else if (commands.Length > 1 && commands[0] == "real") { foreach (NetConnection connection in server.Connections) { string nick = uidNameMap[connection.RemoteUniqueIdentifier]; if (nick == commands[1]) { messageToSender += "===== QUERY RESULT =====" + Environment.NewLine + "UID: " + connection.RemoteUniqueIdentifier + Environment.NewLine + "Nick: " + nick + Environment.NewLine + "IP: " + connection.RemoteEndpoint.Address + Environment.NewLine + "Port: " + connection.RemoteEndpoint.Port + Environment.NewLine + "===== END OF RESULT =====" + Environment.NewLine; } } } else if (commands.Length > 0 && commands[0] == "list") { messageToSender += "===== ONLINE USERS =====" + Environment.NewLine; foreach (NetConnection connection in server.Connections) { long uid = connection.RemoteUniqueIdentifier; messageToSender += uid + ": " + uidNameMap[uid] + Environment.NewLine; } messageToSender += "TOTAL: " + server.ConnectionsCount + Environment.NewLine + "===== END OF QUERY =====" + Environment.NewLine; } // send a message to sender, if messageToSender is not empty if (!String.IsNullOrEmpty(messageToSender)) { outMsg.Write(messageToSender); outMsg.Encrypt(algo); server.SendMessage(outMsg, sender, NetDeliveryMethod.ReliableOrdered); } return(stringBuffer); } catch (Exception exc) { Console.WriteLine("Error on command " + commands + " sent by " + sender.RemoteUniqueIdentifier + Environment.NewLine + exc.ToString()); return(String.Empty); } }
public IEnumerable <IValidationIssue> ValidateModelAndPermissions(RootModel model, String username, CalculationTicket ticket) { #warning Make use of the username. return(this.ValidateModel(model, ticket)); }
private void SendNotification(String ttName, String portfolioName, ChangingPsto.Changeset pstoChangeset, ChangingTtbbv.Changeset ttbbvChangeset, ChangingTtbpt.Changeset ttbptChangeset, IDataManager manager, SecurityRepository securityRepository, BasketRepository basketRepository, PortfolioRepository portfolioRepository, string userEmail) { try { MailMessage mail = new MailMessage(); mail.IsBodyHtml = false; var pstoChanges = this.pstoChangesetApplier.PrepareToSend(pstoChangeset, manager, securityRepository, portfolioRepository, portfolioName); var ttbbvChanges = this.ttbbvChangesetApplier.PrepareToSend(ttbbvChangeset, manager, securityRepository, basketRepository, ttName); var ttbptChanges = this.ttbptChangesetApplier.PrepareToSend(ttbptChangeset, manager, securityRepository, basketRepository, ttName, portfolioName); mail.Body = "The following Asset Allocation changes were made to the Global Active Accounts:\n" + (ttbbvChangeset != null ? String.Join("\n", ttbbvChanges) : "\n") + (ttbptChangeset != null ? String.Join("\n", ttbptChanges) : "\n") + (pstoChangeset != null ? String.Join("\n", pstoChanges) : ""); mail.Subject = "Targeting: Asset Allocation Changes"; MailSender.SendTargetingAlert(mail, userEmail); } catch (Exception e) { throw new EmailNotificationException("See inner exception for details.", e); } }
// GET: Agencies public async Task <ActionResult> Index(string sortOrder, string currentFilter, string searchString, int?page) { //return View(await agencys.ToListAsync()); ViewBag.NameSortParm = String.IsNullOrEmpty(sortOrder) ? "Name_desc" : ""; ViewBag.ContactPersonSortParm = sortOrder == "ContactPerson" ? "ContactPerson_desc" : "ContactPerson"; ViewBag.EmailSortParm = sortOrder == "Email" ? "Email_desc" : "Email"; ViewBag.PhoneNumberSortParm = sortOrder == "Phone" ? "Phone_desc" : "Phone"; //ViewBag.SubscriptionSortParm = sortOrder == "Subscription" ? "Subscription_desc" : "Subscription"; ViewBag.AmountSortParm = sortOrder == "Amount" ? "Amount_desc" : "Amount"; ViewBag.PaidSortParm = sortOrder == "Paid" ? "Paid_desc" : "Paid"; IQueryable <AgencyViewModel> agencysData = from agencys in db.Agencys.Include(a => a.Subscription) select new AgencyViewModel() { AgencyID = agencys.AgencyID, Name = agencys.Name, ContactPerson = agencys.ContactPerson, Email = agencys.Email, Phone = agencys.Phone, //Subscription = agencys.Subscription.Name, Amount = agencys.Subscription.Amount, Paid = agencys.Subscription.Paid }; //Paging if (searchString != null) { page = 1; } else { searchString = currentFilter; } ViewBag.CurrentFilter = searchString; //Filtering if (!String.IsNullOrEmpty(searchString)) { agencysData = agencysData.Where (s => s.Name.ToString().ToUpper().Contains(searchString.ToUpper()) || s.ContactPerson.ToString().ToUpper().Contains(searchString.ToUpper()) ); } switch (sortOrder) { case "Name_desc": agencysData = agencysData.OrderByDescending(s => s.Name); break; case "ContactPerson": agencysData = agencysData.OrderBy(s => s.ContactPerson); break; case "ContactPerson_desc": agencysData = agencysData.OrderByDescending(s => s.ContactPerson); break; case "Email": agencysData = agencysData.OrderBy(s => s.Email); break; case "Email_desc": agencysData = agencysData.OrderByDescending(s => s.Email); break; case "Phone": agencysData = agencysData.OrderBy(s => s.Phone); break; case "Phone_desc": agencysData = agencysData.OrderByDescending(s => s.Phone); break; //case "Subscription": // agencysData = agencysData.OrderBy(s => s.Subscription); // break; //case "Subscription_desc": // agencysData = agencysData.OrderByDescending(s => s.Subscription); // break; case "Amount": agencysData = agencysData.OrderBy(s => s.Amount); break; case "Amount_desc": agencysData = agencysData.OrderByDescending(s => s.Amount); break; case "Paid": agencysData = agencysData.OrderBy(s => s.Paid); break; case "Paid_desc": agencysData = agencysData.OrderByDescending(s => s.Paid); break; default: agencysData = agencysData.OrderBy(s => s.Name); break; } int pageSize = 15; int pageNumber = (page ?? 1); return(View(await agencysData.ToPagedListAsync(pageNumber, pageSize))); }
private void UpdateEditor() { /* * Update the Show Whitespace, Word Wrap and Read Only menu settings. */ ToolStripMenuItem whitespaceMenuItem = _mainForm.GetMenuItemByName( Constants.UI_EDIT_MENU_VIEW_WHITESPACE); if (whitespaceMenuItem != null) whitespaceMenuItem.Checked = (scintilla.WhiteSpace.Mode == WhiteSpaceMode.VisibleAlways); ToolStripMenuItem wordwrapMenuItem = _mainForm.GetMenuItemByName( Constants.UI_EDIT_MENU_WORD_WRAP); if (wordwrapMenuItem != null) wordwrapMenuItem.Checked = (scintilla.LineWrap.Mode == WrapMode.Word); ToolStripMenuItem readonlyMenuItem = _mainForm.GetMenuItemByName( Constants.UI_EDIT_MENU_SET_READ_ONLY); if (readonlyMenuItem != null) readonlyMenuItem.Checked = scintilla.IsReadOnly; /* * Check the timestamp and prompt for reload if out of date. */ if (!applicationManager.ClientProfile.HaveFlag( ClientFlags.EditorDisableFileTimestampCheck)) { /* * An advanced timestamp will play havoc with the change detection. * Annoy the user until they save the file with a current timestamp! */ if (FileTools.FileIsNewerOnDisk(FilePath, DateTime.Now)) { MessageBox.Show(String.Format("{0}:\r\n{1}", Resources.FileFutureDateMessage1, Resources.FileFutureDateMessage2), Resources.FileFutureDateTitle, MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (FileTools.FileIsNewerOnDisk(FilePath, FileTimeStamp)) { if (MessageBox.Show( String.Format("{0}\r\n\r\n{1}\r\n{2}", FilePath, Resources.FileChangedMessage, Resources.FileChangedReloadMessage), Resources.FileChangedTitle, MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { /* * Bug: clicking a button on the dialog causes the editor to begin * highlighting text. The mouse click on the dialog button seems to * get passed through to the active editor and begins the highlighting * operation. */ Reload(); } } } }
public static void Log(string message, params object[] args) { Log(String.Format(message, args)); }
public virtual void RegisterUser(string email, string password, string code, string token, string message, string[] exampleTags) { string[] tagsOfScenario = exampleTags; System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary(); argumentsOfScenario.Add("Email", email); argumentsOfScenario.Add("Password", password); argumentsOfScenario.Add("Code", code); argumentsOfScenario.Add("Token", token); argumentsOfScenario.Add("Message", message); TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Register user", null, tagsOfScenario, argumentsOfScenario, this._featureTags); #line 5 this.ScenarioInitialize(scenarioInfo); #line hidden bool isScenarioIgnored = default(bool); bool isFeatureIgnored = default(bool); if ((tagsOfScenario != null)) { isScenarioIgnored = tagsOfScenario.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any(); } if ((this._featureTags != null)) { isFeatureIgnored = this._featureTags.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any(); } if ((isScenarioIgnored || isFeatureIgnored)) { testRunner.SkipScenario(); } else { this.ScenarioStart(); #line 6 testRunner.Given(string.Format("I send request to register a new user with \'{0}\' as email and I enter \'{1}\' as pa" + "ssword and save response as \'responseSave\'", email, password), ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given "); #line hidden #line 7 testRunner.Then(string.Format("response \'responseSave\' has code \'{0}\' and token \'{1}\' and \'{2}\'", code, token, message), ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); #line hidden } this.ScenarioCleanup(); }
public void NumeroDepôtSendKey(String numero) { NumeroDepôtInput.Clear(); Thread.Sleep(3000); NumeroDepôtInput.SendKeys(numero); }
public virtual void ChangePageLanguageToDeutsch() { string[] tagsOfScenario = ((string[])(null)); TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Change page language to Deutsch", null, ((string[])(null))); #line 3 this.ScenarioInitialize(scenarioInfo); #line hidden bool isScenarioIgnored = default(bool); bool isFeatureIgnored = default(bool); if ((tagsOfScenario != null)) { isScenarioIgnored = tagsOfScenario.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any(); } if ((this._featureTags != null)) { isFeatureIgnored = this._featureTags.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any(); } if ((isScenarioIgnored || isFeatureIgnored)) { testRunner.SkipScenario(); } else { this.ScenarioStart(); #line 4 testRunner.Given("I am on homepage", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given "); #line hidden #line 5 testRunner.When("I click change language button", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); #line hidden #line 6 testRunner.Then("I should see text \"Globale Themen\" on page", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); #line hidden #line 7 testRunner.And("I should see text \"Dienstleistungen in Ihrer Region\" on page", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); #line hidden #line 8 testRunner.And("I should see text \"Investment Views und Finanzmarktdaten\" on page", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); #line hidden } this.ScenarioCleanup(); }
public virtual void GetListOfUsers() { string[] tagsOfScenario = ((string[])(null)); System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary(); TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Get List of users", null, tagsOfScenario, argumentsOfScenario, this._featureTags); #line 14 this.ScenarioInitialize(scenarioInfo); #line hidden bool isScenarioIgnored = default(bool); bool isFeatureIgnored = default(bool); if ((tagsOfScenario != null)) { isScenarioIgnored = tagsOfScenario.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any(); } if ((this._featureTags != null)) { isFeatureIgnored = this._featureTags.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any(); } if ((isScenarioIgnored || isFeatureIgnored)) { testRunner.SkipScenario(); } else { this.ScenarioStart(); #line 15 testRunner.Given("I send a Get request to get the list of users and save response as \'responseSave\'" + "", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given "); #line hidden #line 16 testRunner.Then("response \'responseSave\' has code \'200\' with a list of users", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); #line hidden } this.ScenarioCleanup(); }
// Modify this to provide custom model name mapping. public static string GetModelName(Type type) { ModelNameAttribute modelNameAttribute = type.GetCustomAttribute <ModelNameAttribute>(); if (modelNameAttribute != null && !String.IsNullOrEmpty(modelNameAttribute.Name)) { return(modelNameAttribute.Name); } string modelName = type.Name; if (type.IsGenericType) { // Format the generic type name to something like: GenericOfAgurment1AndArgument2 Type genericType = type.GetGenericTypeDefinition(); Type[] genericArguments = type.GetGenericArguments(); string genericTypeName = genericType.Name; // Trim the generic parameter counts from the name genericTypeName = genericTypeName.Substring(0, genericTypeName.IndexOf('`')); string[] argumentTypeNames = genericArguments.Select(t => GetModelName(t)).ToArray(); modelName = String.Format(CultureInfo.InvariantCulture, "{0}Of{1}", genericTypeName, String.Join("And", argumentTypeNames)); } return(modelName); }
public void NumeroInputSendKey(String numero) { NumeroInput.SendKeys(numero); }
public virtual void CheckSearchFunction() { string[] tagsOfScenario = ((string[])(null)); TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Check search function", null, ((string[])(null))); #line 10 this.ScenarioInitialize(scenarioInfo); #line hidden bool isScenarioIgnored = default(bool); bool isFeatureIgnored = default(bool); if ((tagsOfScenario != null)) { isScenarioIgnored = tagsOfScenario.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any(); } if ((this._featureTags != null)) { isFeatureIgnored = this._featureTags.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any(); } if ((isScenarioIgnored || isFeatureIgnored)) { testRunner.SkipScenario(); } else { this.ScenarioStart(); #line 11 testRunner.Given("I am on homepage", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given "); #line hidden #line 12 testRunner.When("I search for \"invest\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); #line hidden #line 13 testRunner.Then("I should see text \"invest\" in search results", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); #line hidden } this.ScenarioCleanup(); }
public void CodeInputSendKey(String code) { CodeInput.SendKeys(code); }
public void DateInputSendKey(String date) { DateprioriteInput.Click(); Thread.Sleep(3000); DateprioriteInput.SendKeys(date); }
public override StudyItemList Query(QueryParameters queryParams, IApplicationEntity targetServer) { Platform.CheckForNullReference(queryParams, "queryParams"); Platform.CheckForNullReference(targetServer, "targetServer"); var selectedServer = targetServer.ToServiceNode(); //.NET strings are unicode, therefore, so is all the query data. const string utf8 = "ISO_IR 192"; var requestCollection = new DicomAttributeCollection { SpecificCharacterSet = utf8 }; requestCollection[DicomTags.SpecificCharacterSet].SetStringValue(utf8); requestCollection[DicomTags.QueryRetrieveLevel].SetStringValue("STUDY"); requestCollection[DicomTags.StudyInstanceUid].SetStringValue(""); requestCollection[DicomTags.PatientId].SetStringValue(queryParams["PatientId"]); requestCollection[DicomTags.AccessionNumber].SetStringValue(queryParams["AccessionNumber"]); requestCollection[DicomTags.PatientsName].SetStringValue(queryParams["PatientsName"]); requestCollection[DicomTags.ReferringPhysiciansName].SetStringValue(queryParams["ReferringPhysiciansName"]); requestCollection[DicomTags.StudyDate].SetStringValue(queryParams["StudyDate"]); requestCollection[DicomTags.StudyTime].SetStringValue(""); requestCollection[DicomTags.StudyDescription].SetStringValue(queryParams["StudyDescription"]); requestCollection[DicomTags.PatientsBirthDate].SetStringValue(""); requestCollection[DicomTags.ModalitiesInStudy].SetStringValue(queryParams["ModalitiesInStudy"]); requestCollection[DicomTags.NumberOfStudyRelatedInstances].SetStringValue(""); requestCollection[DicomTags.InstanceAvailability].SetEmptyValue(); // must not be included in request requestCollection[DicomTags.PatientSpeciesDescription].SetStringValue(GetString(queryParams, "PatientSpeciesDescription")); var codeValue = GetString(queryParams, "PatientSpeciesCodeSequenceCodeValue"); var codeMeaning = GetString(queryParams, "PatientSpeciesCodeSequenceCodeMeaning"); if (codeValue != null || codeMeaning != null) { var codeSequenceMacro = new CodeSequenceMacro { CodingSchemeDesignator = "", CodeValue = codeValue, CodeMeaning = codeMeaning }; requestCollection[DicomTags.PatientSpeciesCodeSequence].AddSequenceItem(codeSequenceMacro.DicomSequenceItem); } requestCollection[DicomTags.PatientBreedDescription].SetStringValue(GetString(queryParams, "PatientBreedDescription")); codeValue = GetString(queryParams, "PatientBreedCodeSequenceCodeValue"); codeMeaning = GetString(queryParams, "PatientBreedCodeSequenceCodeMeaning"); if (codeValue != null || codeMeaning != null) { var codeSequenceMacro = new CodeSequenceMacro { CodingSchemeDesignator = "", CodeValue = codeValue, CodeMeaning = codeMeaning }; requestCollection[DicomTags.PatientBreedCodeSequence].AddSequenceItem(codeSequenceMacro.DicomSequenceItem); } requestCollection[DicomTags.ResponsiblePerson].SetStringValue(GetString(queryParams, "ResponsiblePerson")); requestCollection[DicomTags.ResponsiblePersonRole].SetStringValue(""); requestCollection[DicomTags.ResponsibleOrganization].SetStringValue(GetString(queryParams, "ResponsibleOrganization")); IList <DicomAttributeCollection> results = Query(selectedServer, requestCollection); StudyItemList studyItemList = new StudyItemList(); foreach (DicomAttributeCollection result in results) { StudyItem item = new StudyItem(result[DicomTags.StudyInstanceUid].GetString(0, ""), selectedServer); //TODO: add DicomField attributes to the StudyItem class (implement typeconverter for PersonName class). item.PatientsBirthDate = result[DicomTags.PatientsBirthDate].GetString(0, ""); item.AccessionNumber = result[DicomTags.AccessionNumber].GetString(0, ""); item.StudyDescription = result[DicomTags.StudyDescription].GetString(0, ""); item.StudyDate = result[DicomTags.StudyDate].GetString(0, ""); item.StudyTime = result[DicomTags.StudyTime].GetString(0, ""); item.PatientId = result[DicomTags.PatientId].GetString(0, ""); item.PatientsName = new PersonName(result[DicomTags.PatientsName].GetString(0, "")); item.ReferringPhysiciansName = new PersonName(result[DicomTags.ReferringPhysiciansName].GetString(0, "")); item.ModalitiesInStudy = DicomStringHelper.GetStringArray(result[DicomTags.ModalitiesInStudy].ToString()); DicomAttribute attribute = result[DicomTags.NumberOfStudyRelatedInstances]; if (!attribute.IsEmpty && !attribute.IsNull) { item.NumberOfStudyRelatedInstances = attribute.GetInt32(0, 0); } item.SpecificCharacterSet = result.SpecificCharacterSet; item.InstanceAvailability = result[DicomTags.InstanceAvailability].GetString(0, ""); if (String.IsNullOrEmpty(item.InstanceAvailability)) { item.InstanceAvailability = "ONLINE"; } item.PatientSpeciesDescription = result[DicomTags.PatientSpeciesDescription].GetString(0, ""); var patientSpeciesCodeSequence = result[DicomTags.PatientSpeciesCodeSequence]; if (!patientSpeciesCodeSequence.IsNull && patientSpeciesCodeSequence.Count > 0) { var codeSequenceMacro = new CodeSequenceMacro(((DicomSequenceItem[])result[DicomTags.PatientSpeciesCodeSequence].Values)[0]); item.PatientSpeciesCodeSequenceCodingSchemeDesignator = codeSequenceMacro.CodingSchemeDesignator; item.PatientSpeciesCodeSequenceCodeValue = codeSequenceMacro.CodeValue; item.PatientSpeciesCodeSequenceCodeMeaning = codeSequenceMacro.CodeMeaning; } item.PatientBreedDescription = result[DicomTags.PatientBreedDescription].GetString(0, ""); var patientBreedCodeSequence = result[DicomTags.PatientBreedCodeSequence]; if (!patientBreedCodeSequence.IsNull && patientBreedCodeSequence.Count > 0) { var codeSequenceMacro = new CodeSequenceMacro(((DicomSequenceItem[])result[DicomTags.PatientBreedCodeSequence].Values)[0]); item.PatientBreedCodeSequenceCodingSchemeDesignator = codeSequenceMacro.CodingSchemeDesignator; item.PatientBreedCodeSequenceCodeValue = codeSequenceMacro.CodeValue; item.PatientBreedCodeSequenceCodeMeaning = codeSequenceMacro.CodeMeaning; } item.ResponsiblePerson = new PersonName(result[DicomTags.ResponsiblePerson].GetString(0, "")); item.ResponsiblePersonRole = result[DicomTags.ResponsiblePersonRole].GetString(0, ""); item.ResponsibleOrganization = result[DicomTags.ResponsibleOrganization].GetString(0, ""); studyItemList.Add(item); } AuditHelper.LogQueryIssued(selectedServer.AETitle, selectedServer.ScpParameters.HostName, EventSource.CurrentUser, EventResult.Success, SopClass.StudyRootQueryRetrieveInformationModelFindUid, requestCollection); return(studyItemList); }
/// <summary> /// Copies the current image to the selected file in /// Emf (vector), or a variety of Bitmap formats. /// </summary> /// <param name="DefaultFileName"> /// Accepts a default file name for the file dialog (if "" or null, default is not used) /// </param> /// <returns> /// The file name saved, or "" if cancelled. /// </returns> /// <remarks> /// Note that <see cref="SaveAsBitmap" /> and <see cref="SaveAsEmf" /> methods are provided /// which allow for Bitmap-only or Emf-only handling of the "Save As" context menu item. /// </remarks> public String SaveAs(String DefaultFileName) { if (_masterPane != null) { SaveFileDialog.Filter = "Emf Format (*.emf)|*.emf|" + "PNG Format (*.png)|*.png|" + "Gif Format (*.gif)|*.gif|" + "Jpeg Format (*.jpg)|*.jpg|" + "Tiff Format (*.tif)|*.tif|" + "Bmp Format (*.bmp)|*.bmp"; if (DefaultFileName != null && DefaultFileName.Length > 0) { String ext = System.IO.Path.GetExtension(DefaultFileName).ToLower(); switch (ext) { case ".emf": SaveFileDialog.FilterIndex = 1; break; case ".png": SaveFileDialog.FilterIndex = 2; break; case ".gif": SaveFileDialog.FilterIndex = 3; break; case ".jpeg": case ".jpg": SaveFileDialog.FilterIndex = 4; break; case ".tiff": case ".tif": SaveFileDialog.FilterIndex = 5; break; case ".bmp": SaveFileDialog.FilterIndex = 6; break; } //If we were passed a file name, not just an extension, use it if (DefaultFileName.Length > ext.Length) { SaveFileDialog.FileName = DefaultFileName; } } if (SaveFileDialog.ShowDialog() == DialogResult.OK) { Stream myStream = SaveFileDialog.OpenFile(); if (myStream != null) { if (SaveFileDialog.FilterIndex == 1) { myStream.Close(); SaveEmfFile(SaveFileDialog.FileName); } else { ImageFormat format = ImageFormat.Png; switch (SaveFileDialog.FilterIndex) { case 2: format = ImageFormat.Png; break; case 3: format = ImageFormat.Gif; break; case 4: format = ImageFormat.Jpeg; break; case 5: format = ImageFormat.Tiff; break; case 6: format = ImageFormat.Bmp; break; } ImageRender().Save(myStream, format); //_masterPane.GetImage().Save( myStream, format ); myStream.Close(); } return(SaveFileDialog.FileName); } } } return(""); }