public void Page_LoadTest() { _Default target = new _Default(); // TODO: Initialize to an appropriate value object sender = null; // TODO: Initialize to an appropriate value EventArgs e = null; // TODO: Initialize to an appropriate value target.Page_Load(sender, e); //Assert.Inconclusive("A method that does not return a value cannot be verified."); }
protected void Page_Load(object sender, EventArgs e) { string output; for (int a = 1; a <= 100; a++) { _Default generator = new _Default(); output = generator.getBuckFizz(a); TableRow trow = new TableRow(); TableCell tcell = new TableCell(); Table1.Rows.Add(trow); tcell.Text = output; trow.Cells.Add(tcell); } }
public static void geneticAlgorithm(object sender, EventArgs e, Label totalPrice, Label totalDistance, Label totalChanges, Label orderOfDests) { var population = new Population(); for (var p = 0; p < globals.chromosomeLength; p++) { var chromosome = new Chromosome(); for (var g = 0; g < globals.chromosomeLength; g++) { chromosome.Genes.Add(new Gene(g)); } chromosome.Genes.ShuffleFast(); population.Solutions.Add(chromosome); } var elite = new Elite(8); var crossover = new Crossover(0.8) { CrossoverType = CrossoverType.DoublePointOrdered }; var mutate = new SwapMutate(0.04); var ga = new GeneticAlgorithm(population, objectiveValue); ga.OnRunComplete += ga_OnRunComplete; ga.Operators.Add(elite); ga.Operators.Add(crossover); ga.Operators.Add(mutate); ga.Run(Terminate); globals.order = String.Join(",", globals.orderOfDestinations.ToArray()); totalPrice.Text = Convert.ToString(globals.totalPrice); totalDistance.Text = Convert.ToString(globals.totalDistance); totalChanges.Text = Convert.ToString(globals.totalChanges); orderOfDests.Text = Convert.ToString(globals.order); if (globals.errorOutput == true) { _Default form1 = new _Default(); form1.ErrorMessage(); } }
protected void btnCalc_Click(object sender, EventArgs e) { EmpId = Convert.ToInt32(txtEmpId.Text); EmpName = txtEmpName.Text; EmpBand = drpEmpBand.SelectedItem.ToString(); BaseLoc = drpEmpLocation.SelectedItem.ToString(); Session["EmpId"] = txtEmpId.Text; Session["EmpName"] = txtEmpName.Text; Session["EmpBand"] = drpEmpBand.SelectedItem.ToString(); Session["BaseLoc"] = drpEmpLocation.SelectedItem.ToString(); _Default Obj = new _Default(); Obj.fnCalSalary(EmpBand, BaseLoc); Response.Write("<script>alert('Salary Calculated Successfully')</script>"); Response.Redirect("SalDisplay.aspx"); }
private void btnGenerateKeyPair_Click(object sender, EventArgs e) { _Default defaultPage = (_Default)this.Page; var current = System.Security.Principal.WindowsIdentity.GetCurrent(); using (WindowsImpersonationContext wic = ((WindowsIdentity)Page.User.Identity).Impersonate()) { try { // save crypto keypair PDSUtils.PdsWrapper.GenerateKeyPair(int.Parse(ddlKeySize.SelectedValue)); } catch (AutodiscoverException ex) { labelResult.Text = Messages.Errors_ServiceNotAvailable + " - " + ex.Message; PanelResult.Visible = true; return; } catch (System.ServiceModel.FaultException <ServiceFault> faex) { labelResult.Text = Messages.Errors_CannotResetPassword + " - " + faex.Message; PanelResult.Visible = true; return; } catch (Exception ex) { labelResult.Text = Messages.Errors_CannotResetPassword + " - " + ex.Message; PanelResult.Visible = true; return; } } current = System.Security.Principal.WindowsIdentity.GetCurrent(); // refresh list InitializeKeyList(); }
public static string GetNo1Film() { var d = new _Default(); return(d.GetTopFilm()); }
private void btnRecoverySubmit_Click(object sender, EventArgs e) { this.PanelResult.Visible = false; this.labelResult.Text = string.Empty; this.InitializeControls(); _Default defaultPage = (_Default)this.Page; PasswordInfo data = null; // read configuration if PasswordHistory is visible bool isPasswordHistoryVisible = false; if (ConfigurationManager.AppSettings["AdmPwd.IsPasswordHistoryVisible"] != null && ConfigurationManager.AppSettings["AdmPwd.IsPasswordHistoryVisible"] != string.Empty) { if (!bool.TryParse(ConfigurationManager.AppSettings["AdmPwd.IsPasswordHistoryVisible"].ToString(), out isPasswordHistoryVisible)) { isPasswordHistoryVisible = false; } } var current = System.Security.Principal.WindowsIdentity.GetCurrent(); using (WindowsImpersonationContext wic = ((WindowsIdentity)Page.User.Identity).Impersonate()) { try { data = PDSUtils.PdsWrapper.GetLocalAdminPassword(this.cboForestNames.Text, this.textComputerName.Text, isPasswordHistoryVisible, false); //or false if we don't need password history } catch (AutodiscoverException ex) { this.labelResult.Text = Messages.Errors_ServiceNotAvailable + " - " + ex.Message; this.PanelResult.CssClass = "errorMessage"; this.PanelResult.Visible = true; return; } catch (PDSException ex) { switch (ex.IssueCode) { case IssueType.ComputerNotFound: this.labelResult.Text = Messages.Errors_ADNoComputerFoundException + " " + ex.Message; break; case IssueType.ComputerAmbiguous: this.labelResult.Text = Messages.Errors_MultipleComputerObjectsFound + ": " + ex.Message; break; case IssueType.AccessDenied: this.labelResult.Text = Messages.Errors_NoReadPasswordForUserOnComputerObject + ": " + ex.Message; break; case IssueType.CannotRetrievePassword: this.labelResult.Text = Messages.Errors_CannotRetrievePassword + ": " + ex.Message; break; default: this.labelResult.Text = Messages.Errors_CannotRetrievePassword + ": " + ex.Message; break; } this.PanelResult.CssClass = "errorMessage"; this.PanelResult.Visible = true; return; } catch (Exception ex) { labelResult.Text = Messages.Errors_CannotRetrievePassword + " - " + ex.Message; PanelResult.Visible = true; return; } } current = System.Security.Principal.WindowsIdentity.GetCurrent(); if (!String.IsNullOrEmpty(data.Password)) { this.btnRecoverySubmit.Visible = false; textComputerName.Enabled = false; this.PanelAdminPasswordData.Visible = true; this.textAdminPassword.Text = data.Password; this.textAdminPasswordExpiration.Text = data.ExpirationTimestamp > DateTime.MinValue ? data.ExpirationTimestamp.ToString() : string.Empty; this.textAdminPasswordComputerDN.Text = data.DistinguishedName; if (isPasswordHistoryVisible) { if (data.PasswordHistory.Count > 0) { PanelPasswordHistory.Visible = true; tblPasswordHistoryList.Visible = true; foreach (PasswordHistory pi in data.PasswordHistory) { TableRow rw = new TableRow(); rw.Cells.Add(new TableCell() { Text = pi.Password }); rw.Cells.Add(new TableCell() { Text = pi.ValidSince.ToString() }); rw.Cells.Add(new TableCell() { Text = pi.ValidUntil.ToString() }); tblPasswordHistoryList.Rows.Add(rw); } } else { PanelPasswordHistory.Visible = false; } } defaultPage.ShowBackToNewRequestButton(); this.textUpdateExpirationDateNewValue.Text = DateTime.Now.ToString(); PanelExpirationDateChange.Visible = true; } }
protected void btnUpdateExpirationDate_Click(object sender, EventArgs e) { this.PanelPasswordHistory.Visible = false; _Default defaultPage = (_Default)this.Page; DateTime newExpirationDate; if (!DateTime.TryParse(textUpdateExpirationDateNewValue.Text, out newExpirationDate)) { this.PanelResult.Visible = true; this.labelResult.Text = Messages.RC_NotValidExpirationDate; this.PanelResult.CssClass = "errorMessage"; } else { PasswordResetStatus rslt = null; var current = System.Security.Principal.WindowsIdentity.GetCurrent(); using (WindowsImpersonationContext wic = ((WindowsIdentity)Page.User.Identity).Impersonate()) { try { rslt = PDSUtils.PdsWrapper.ResetLocalAdminPassword(this.cboForestNames.Text, this.textComputerName.Text, newExpirationDate.ToUniversalTime()); } catch (AdmPwd.Types.PDSException ex) { switch (ex.IssueCode) { case IssueType.ComputerNotFound: this.labelResult.Text = Messages.Errors_ADNoComputerFoundException + " " + ex.Message; this.PanelResult.CssClass = "errorMessage"; break; case IssueType.ComputerAmbiguous: this.labelResult.Text = Messages.Errors_MultipleComputerObjectsFound + ": " + ex.Message; break; case IssueType.AccessDenied: this.labelResult.Text = Messages.Errors_NoResetPasswordForUserOnComputerObject + ": " + ex.Message; break; case IssueType.CannotResetPassword: this.labelResult.Text = Messages.Errors_CannotResetPassword + ": " + ex.Message; break; default: this.labelResult.Text = Messages.Errors_CannotResetPassword + ": " + ex.Message; break; } this.PanelResult.CssClass = "errorMessage"; this.PanelResult.Visible = true; defaultPage.ShowBackToNewRequestButton(); return; } catch (Exception ex) { labelResult.Text = Messages.Errors_ServiceNotAvailable + " - " + ex.Message; this.PanelResult.CssClass = "errorMessage"; PanelResult.Visible = true; defaultPage.ShowBackToNewRequestButton(); return; } } current = System.Security.Principal.WindowsIdentity.GetCurrent(); PanelExpirationDateChange.Visible = false; textAdminPasswordExpiration.Text = newExpirationDate.ToString(); this.PanelPasswordHistory.Visible = false; this.PanelResult.Visible = true; this.labelResult.Text = Messages.RC_ExpirationDateUpdated; this.PanelResult.CssClass = "okMessage"; defaultPage.ShowBackToNewRequestButton(); } }
public void _DefaultConstructorTest() { _Default target = new _Default(); Assert.Inconclusive("TODO: Implement code to verify target"); }
public void defaultPageLoad() { _Default x = new _Default(); Assert.AreEqual(x.Page_Load(new object(), new EventArgs()), true); }
public void defaultExists() { _Default x = new _Default(); //Create an instance of Default Webpages Assert.That(x != null); //The page does exist }
protected void Page_Load(object sender, EventArgs e) { _Default connect = new _Default(); connect.CreateConnectRequest("Marcus", "Graduate school", "Georgia Tech", "101"); }