/// <summary> /// Validate the object. /// </summary> /// <exception cref="Microsoft.Rest.ValidationException"> /// Thrown if validation fails /// </exception> public virtual void Validate() { if (Xcode != null) { Xcode.Validate(); } if (Javascript != null) { Javascript.Validate(); } if (Xamarin != null) { Xamarin.Validate(); } if (Android != null) { Android.Validate(); } if (Uwp != null) { Uwp.Validate(); } if (Testcloud != null) { Testcloud.Validate(); } }
protected ContentResult CloseFrameDialog(DialogCloseOption option) { var ret = ""; var builder = new TagBuilder("script"); builder.MergeAttribute("type", "text/javascript"); if (Request["ReloadURL"] != null && Request["ReloadID"] != null) { ret += "parent." + Javascript.RemoteFunc(new RemoteOption { URL = Request["ReloadURL"], Update = Request["ReloadID"] }); } builder.InnerHtml += ret + ";"; if (option.Message != null) { builder.InnerHtml += "alert(\"" + option.Message + "\");"; } if (option.RunJS == null) { option.RunJS = Request.Params.Get("RunJS"); } if (!string.IsNullOrEmpty(option.RunJS)) { builder.InnerHtml += "parent." + option.RunJS + ";"; } //builder.InnerHtml += "parent.Core.dialog.closeBox();"; return(Content(builder.ToString())); }
/// <summary> /// JS Callback /// </summary> public void Pull() { Javascript.Run("getSelectedFiles();", files => { ProjectManager.Instance.Pull(); }); }
/// <summary> /// Button to open a dialog /// </summary> /// <param name="html"></param> /// <param name="name"></param> /// <param name="url"></param> /// <returns></returns> public static String ButtonToRemoteDialogHaveReload(this HtmlHelper html, string name, string url, string reloadID, string reloadURL) { url = Javascript.addParamToURL(url, "reloadID", reloadID); url = Javascript.addParamToURL(url, "reloadURL", reloadURL); return(String.Format(@"<input type='button' value='{0}' onclick=""Core.openDialog('{1}')"" />", name, url)); }
protected void btnSave_Click(object sender, EventArgs e) { GCTransaction gc = (from tr in db.GCTransactions where tr.GCNumber == Request.QueryString["gcId"] select tr).FirstOrDefault(); //chk if modified gc number from prev if (txtGCNumber.Text != hfGCNumber.Value) { var gcs = (from gctran in db.GCTransactions where gctran.GCNumber == txtGCNumber.Text.Trim() select gctran).ToList(); if (gcs.Count > 0) { //show duplicate gc Javascript.ShowModal(this, this, "duplicateGCModal"); } else { gc.GCNumber = txtGCNumber.Text; } } gc.DateIssued = Convert.ToDateTime(txtDateIssued.Text); gc.GCType = ddlGCType.SelectedItem.Text; if (txtExpirationDate.Text != String.Empty) { gc.ExpirationDate = Convert.ToDateTime(txtExpirationDate.Text); } else { gc.ExpirationDate = null; } gc.Remarks = txtRemarks.Text; //gc.RequestedBy = txtRequestedBy.Text; //chk if rooms if (gc.RoomId != null) { gc.RoomId = Convert.ToInt32(ddlRooms.SelectedValue); gc.WithBreakfast = Convert.ToBoolean(rblRoomBreakfast.SelectedValue); gc.HeadCount = Convert.ToInt32(txtRoomHeadCount.Text); } else if (gc.DiningId != null) { gc.DiningId = Convert.ToInt32(ddlDining.SelectedValue); gc.DiningTypeId = Convert.ToInt32(ddlDiningType.SelectedValue); gc.HeadCount = Convert.ToInt32(txtDiningHeadCount.Text); } db.SubmitChanges(); //audit trail DBLogger.Log("Update", "Updated GC", gc.GCNumber); Response.Redirect("~/gcapproval/default.aspx"); }
protected void btnApprove_Click(object sender, EventArgs e) { //chk gc var gc = (from g in db.GCTransactions where g.GCNumber == Request.QueryString["gcId"] select g).FirstOrDefault(); gc.ApprovedBy = Guid.Parse(Membership.GetUser().ProviderUserKey.ToString()); //check if cancelled if (gc.StatusGC == "Cancelled") { Javascript.ShowModal(this, this, "cancelledGCModal"); } else { gc.StatusGC = "Waiting"; gc.ApprovalStatus = "Approved"; db.SubmitChanges(); //audit trail DBLogger.Log("Update", "Approved GC", gc.GCNumber); Response.Redirect("~/gcapproval/default.aspx"); } }
/// <summary> /// Quit application. /// </summary> public static void Quit() { // don't show shutdown question message _continueQuitting = true; // show shutdown notify Javascript.Run("showShutdownMessage();"); // save configuration SMCConfiguration.Save(); // shutdown application from thread var wait = new Thread(() => { // shutdown working downloader Instance.SMCDownloader.ShutDownDownloader(); // wait Thread.Sleep(800); // shutdown application Instance.Invoke((MethodInvoker) delegate { Instance.Hide(); Browser.Dispose(); Cef.Shutdown(); Process.GetCurrentProcess().Kill(); }); }); wait.Start(); }
protected void Page_Load(object sender, EventArgs e) { Session["target"] = "/Pages/Garagiste/PriseCharge"; if (Request.QueryString["param1"] != null) { sinistreId = Int32.Parse(Request.QueryString["param1"].ToString()); sinis = usr.Sinistres.Find(sinistreId); PopulateSinistreFields(sinis); LoadDevis(); LoadImagesApresReparation(); LoadFactures(); if (sinis.BonsDeSortie != null) { divUploadBonDeSortie.Visible = true; } else { divUploadBonDeSortie.Visible = false; } //loadBonDeSortie(); PopulateTableBonDeSortie(); } else { Response.Redirect("ListeSinistre.aspx"); } //populateSinistreFields(); Javascript.ConsoleLog(sinistreId.ToString()); }
protected void Button_UploadPhotoAfterReparation_Click(object sender, EventArgs e) { ImageSinistre img = new ImageSinistre(); if (FileUpload_PhotoAfterReparation.HasFile) { string path = Server.MapPath("../../UploadedFiles/Images/"); img.ImageName = FileUpload_PhotoAfterReparation.FileName; img.ImageLink = guid + FileUpload_PhotoAfterReparation.FileName; img.Status = "Apres"; img.Extension = System.IO.Path.GetExtension(FileUpload_PhotoAfterReparation.FileName); img.DateImage = DateTime.Now.ToString("dd-MM-yyyy"); sinis.Images.Add(img); FileUpload_PhotoAfterReparation.SaveAs(path + img.ImageLink); try { usr.SaveChanges(); Page_Load(sender, e); } catch (Exception ex) { var rootCause = ex.GetBaseException(); Javascript.ConsoleLog(rootCause.Message); } usr.SaveChanges(); } }
protected void btnUpdate_Click(object sender, EventArgs e) { var user = (from us in dbUser.UserProfiles where us.UserId == Guid.Parse(lblUserId.Text) select us).FirstOrDefault(); user.FirstName = txtEditFirstName.Text; user.MiddleName = txtEditMiddleName.Text; user.LastName = txtEditLastName.Text; user.PositionId = Convert.ToInt32(ddlEditPosition.SelectedValue); //save to db dbUser.SubmitChanges(); //update roles Roles.RemoveUserFromRoles(lblUserName.Text, Roles.GetRolesForUser(lblUserName.Text)); Roles.AddUserToRole(lblUserName.Text, ddlRoles.SelectedItem.Text); //re-load gridview this.gvUsers.DataBind(); //audit trail DBLogger.Log("Update", "Updated User Details", user.User.UserName); //close modal Javascript.HideModal(this, this, "editRole"); }
private static string CreateLink(this HtmlHelper html, DialogSubmitOption option) { var url = option.URL; // check if has ReloadID and ReloadURL param var param = html.ViewContext.RequestContext.HttpContext.Request.Params; if (param.Get("ReloadID") != null && param.Get("ReloadURL") != null) { url = Javascript.addParamToURL(url, "ReloadID", param.Get("ReloadID")); url = Javascript.addParamToURL(url, "ReloadURL", param.Get("ReloadURL")); } var onClick = String.Format("$.post('{0}', $(this).parents('form').serialize(), Core.DialogCallback)", url); if (option.CausesValidation) { onClick = string.Format("if ($(this).parents('form').valid()) {{{0}}}", onClick); } if (option.ConfirmMessage != null) { onClick = String.Format("if ({0}){{{1}}}", String.Format(@"confirm(""{0}"")", option.ConfirmMessage), onClick); } else if (option.CallBefore != null) { onClick = String.Format("if ({0}){{{1}}}", option.CallBefore, onClick); } return(onClick); }
public void Button_EnregistrerSinistre_Click(object sender, EventArgs e) { Javascript.ConsoleLog("clicked Ajout sinistre"); Exam.Domain.Entities.Sinistre s = new Exam.Domain.Entities.Sinistre(); s.Conducteur = _S_Conducteur.Text; s.DateSinistre = _S_DateSinistre.Text; s.NumeroPermis = _S_NumPermis.Text; s.DateDePermis = _S_DatePermis.Text; int idExpert, idContrat; idExpert = Int32.Parse(DropDownList_SinistreListeExpert.SelectedItem.Value); idContrat = Int32.Parse(DropDownList_Immatriculation.SelectedItem.Value); Javascript.ConsoleLog(idExpert.ToString()); Javascript.ConsoleLog(idContrat.ToString()); UserAccount Expert = usr.Users.Find(idExpert); s.GarageExperts.Add(Expert); s.Contrat = usr.Contrats.Find(idContrat); s.Phase = "Affectation Garage"; s.Etat = "En cours"; Javascript.ConsoleLog(s.Contrat.Souscripteur.Nom); usr.Sinistres.Add(s); usr.SaveChanges(); this.Page_Load(sender, e); }
protected void btnGenerate_Click(object sender, EventArgs e) { try { for (var i = 0; i < lbSygmaCenterNo.Items.Count; i++) { string centerValue; if (lbSygmaCenterNo.Items[0].Value == "0" && lbSygmaCenterNo.Items[0].Selected && i < (lbSygmaCenterNo.Items.Count - 1)) { centerValue = lbSygmaCenterNo.Items[i + 1].Value; GetSelectedCenters(centerValue); } else if (lbSygmaCenterNo.Items[i].Selected) { centerValue = lbSygmaCenterNo.Items[i].Value; GetSelectedCenters(centerValue); } } var reportHasRecords = BuildExcelReport("7", Convert.ToDateTime(txtStartDate.Text), Convert.ToDateTime(txtEndDate.Text), SygmaCenterNo); // 7 – Report Id, Startdate, Enddate if (!reportHasRecords) { Javascript.Notify("No Records available for the selected input!!!"); } } catch (ThreadAbortException) { } catch (Exception exp) { throw new Exception("Error generating report", exp); } }
/// <summary> /// Draws processing message on window. /// </summary> /// <param name="title">Title of window.</param> /// <param name="message">Message of window.</param> public static void DrawProcessingMessage(string title, string message) { ResetProcessingMessage(); Javascript.Run( $"setActiveProcessingWindow({(string.IsNullOrEmpty(title) || string.IsNullOrEmpty(message) ? "false" : "true")}," + $" '{title}', '{message}');"); }
protected void Button_AjouterGarantie_Click(object sender, EventArgs e) { Javascript.ConsoleLog("ajout garantie"); ContratGarantie cg = new ContratGarantie(); cg.ContratId = Int32.Parse(DropDownList_ListeContrat.SelectedItem.Value); cg.GarantieId = Int32.Parse(DropDownList_ListeGarantie.SelectedItem.Value); Javascript.ConsoleLog("Contrat AssureId: " + cg.ContratId + " | Garantie AssureId: " + cg.GarantieId); int i = 0; Int32.TryParse(TextBox_Capital.Text, out i); cg.Capital = i; Int32.TryParse(TextBox_Franchise.Text, out i); cg.Franchise = i; //Checking if contratGarantie already exist try { u.ContratsGarantie.Add(cg); u.SaveChanges(); } catch { Response.Write("<script>alert('Garantie existe deja pour ce contrat');</script>"); } }
protected void Page_Load(object sender, EventArgs e) { if (Session != null) { Javascript.ConsoleLog("Connected User" + Session["userId"] + ": " + Session["FirstName"] + " " + Session["LastName"] + " has role " + Session["Role"]); } }
/// <summary> /// render select list 2 columns /// </summary> /// <param name="html"></param> /// <param name="name"></param> /// <param name="selectList"></param> /// <param name="attribute"></param> /// <returns></returns> public static String SelectList2Column(this HtmlHelper html, String name, IEnumerable <SelectListItem> selectList, Object attribute, int width) { var items = Json.EncodeDictionary(selectList.ToDictionary(item => item.Value, item => item.Text)); var selectedItems = Json.Encode(selectList.Where(item => item.Selected).Select(item => item.Value).ToArray()); var itemsStr = items.Substring(0, items.Length); var selectedItemsStr = selectedItems.Substring(0, selectedItems.Length); var htmlID = name.Replace(".", "_") + "Container"; var containertag = new TagBuilder("div"); containertag.MergeAttribute("id", htmlID); var script = String.Format(@"new SelectList2Column({{ htmlID: {0}, name: {1}, items: {2}, selectedItems: {3}, width: {4} }}).render();", Json.Encode(htmlID), Json.Encode(name), itemsStr, selectedItemsStr, width ); return(containertag.ToString() + Javascript.AddToJavascriptTag(script)); }
protected void Button_EnregistrerVehicule_Click(object sender, EventArgs e) { Vehicule V = new Vehicule(); V.Matricule = TextBox_Immatriculation.Text; V.Genre = TextBox_Genre.Text; V.Usage = TextBox_Usage.Text; V.Constructeur = TextBox_Constructeur.Text; V.Marque = TextBox_Marque.Text; V.Couleur = TextBox_Couleur.Text; V.Constructeur = TextBox_Constructeur.Text; V.NumeroDeSerie = TextBox_NumSerie.Text; V.DPMC = TextBox_DPMC.Text; V.Carrosserie = TextBox_Carroserie.Text; int i = 0; Int32.TryParse(TextBox_NbPlace.Text, out i); V.NombreDePlace = i; Int32.TryParse(TextBox_NbrDebout.Text, out i); V.NombreDebout = i; V.Energie = TextBox_Energie.Text; Int32.TryParse(TextBox_Puissane.Text, out i); V.PuissanceFiscale = i; Int32.TryParse(TextBox_Cylindree.Text, out i); V.Cylindree = i; Int32.TryParse(TextBox_Poidvide.Text, out i); V.PoidVide = i; Int32.TryParse(TextBox_ChargeUtile.Text, out i); V.CHargeUtile = i; Int32.TryParse(TextBox_PTAC.Text, out i); V.PTAC = i; Int32.TryParse(TextBox_Remorque.Text, out i); V.NumeroRemorque = i; V.TypeRemorque = TextBox_TypeRemorque.Text; Int32.TryParse(TextBox_PoidVideRemorque.Text, out i); V.PoidVideRemorque = i; Int32.TryParse(TextBox_ChargeUtileRemorque.Text, out i); V.ChargeUtileRemorque = i; V.Organisme = TextBox_Organisme.Text; Int32.TryParse(TextBox_Duree.Text, out i); V.Duree = i; Int32.TryParse(TextBox_Valeurvénal.Text, out i); V.ValeurVenale = i; Int32.TryParse(TextBox_ValeuràNeuf.Text, out i); V.ValeurANeuf = i; Int32.TryParse(TextBox_Classe.Text, out i); V.Classe = i; V.Companie = TextBox_Compagnie.Text; V.DateReleve = TextBox_DateReleve.Text; V.Delegation = true; var jsonSerialiser = new JavaScriptSerializer(); var json = jsonSerialiser.Serialize(V); Javascript.ConsoleLog(json); u.Vehicules.Add(V); u.SaveChanges(); }
public void onOptions() { MainWindow.Instance.Invoke((MethodInvoker) delegate { // show options window Javascript.Run("showOptionsWindow();"); }); }
public void onQuitRequest() { MainWindow.Instance.Invoke((MethodInvoker) delegate { // show shutdown question Javascript.Run("showQuitQuestionMessage();"); }); }
public void Button_EnregistrerAssure_Click(object sender, EventArgs e) { Exam.Domain.Entities.Assure a = new Exam.Domain.Entities.Assure(); Addresse A = new Addresse(); Contact C = new Contact(); int i = 0; a.TypeAssure = Radio_TypeAssure.SelectedItem.Value.ToString(); a.TypeIdentifiant = _A_TypeIdentifiant.Text; Int32.TryParse(_A_Numero.Text, out i); a.NumeroIdentifiant = i; a.DateDelivreIdentifiant = _A_DelivreeLe.Text; a.Nom = _A_NomAssure.Text; a.Prenom = _A_Prenom.Text; a.DateDeNaissance = _A_DateNaissance.Text; a.LieuDeNaissance = _A_LieuNaissance.Text; a.Sexe = DropDownList_SexAssure.SelectedItem.Value.ToString(); a.SituationFamiliale = _A_SituationFamiliale.Text; a.Profession = _A_Profession.Text; a.NumeroPermis = _A_NumPermis.Text; a.DateDelivrePermis = _A_DatePermis.Text; A.Adresse = TextBox_AddresseAssure.Text; A.Ville = TextBox_VilleAssure.Text; i = 0; Int32.TryParse(TextBox_CodePostalAssure.Text, out i); A.CodePostal = i; Int32.TryParse(TextBox_TelephoneAssure.Text, out i); C.Telephone = i; i = 0; Int32.TryParse(TextBox_MobileAssure.Text, out i); C.Mobile = i; i = 0; Int32.TryParse(TextBox_FaxAssure.Text, out i); C.Fax = i; C.Email = TextBox_MailAssure.Text; i = 0; a.Addresse = A; a.Contact = C; UserAccount assu = new UserAccount() { Email = a.Contact.Email, FirstName = a.Prenom, LastName = a.Nom, PhoneNumber = (int)a.Contact.Mobile, Role = "Assure", Password = "******", ConfirmPassword = "******" }; u.Users.Add(assu); u.SaveChanges(); a.UserAccount = assu; u.Assures.Add(a); u.SaveChanges(); Javascript.ConsoleLog("clicked Assuré add"); Page_Load(sender, e); }
public void FullPageScreenshotWithCssStitching() { Eyes.ForceFullPageScreenshot = true; Eyes.StitchMode = StitchModes.CSS; GoToPricingPage(); Eyes.Open(Driver, AppName, TestCaseName, Resolution1080P); Javascript.ExecuteScript("window.scrollTo(0, document.body.scrollHeight)"); Eyes.Check("CssStitching", Target.Window().Fully()); }
public object Get(Javascript unused) { Response.AddHeader("Content-Type", "text/javascript"); // Check the query string to see if we should return the minified version // of the javascript; default value will be 'true' if it isn't there var minify = int.Parse(Request.QueryString.Get("minify") ?? "1") == 1; return GenerateFile("js", minify); }
/// <summary> /// Link Delete For List /// </summary> /// <param name="html"></param> /// <param name="option"></param> /// <returns></returns> public static String LinkDeleteForList(this HtmlHelper html, RemoteOption option) { var builder = new TagBuilder("span"); builder.MergeAttribute("class", "ui-state-error-text"); builder.InnerHtml += Javascript.LinkToRemote("", "ui-icon ui-icon-closethick", option); return(builder.ToString()); }
// private private void UpdateView() { Javascript.Run("selectProject('" + CurrentProject.ProjectName + "', false);"); var diff = CurrentProject.BuildDiff(); var filesJs = diff.Aggregate("", (current, file) => current + ("addFileChange('" + file.FileName + "', " + (int)file.DiffType) + ");"); Javascript.Run(filesJs); Javascript.Run("setChangeCount('" + CurrentProject.ProjectName + "', " + diff.Length + ");"); }
private void MainWindow_FormClosing(object sender, FormClosingEventArgs e) { if (!_continueQuitting) { e.Cancel = true; // show shutdown question Javascript.Run("showQuitQuestionMessage();"); } }
public string GetLogoutJavascriptCode(string userName) { UserClientStore.CheckNotNull(nameof(UserClientStore)); var userClients = UserClientStore.GetUserClients(userName); var logoutNotifyUrls = userClients.Where(p => !p.LogoutNotifyUrl.IsNullOrWhiteSpace()).Select(p => p.LogoutNotifyUrl).ToList(); return(Javascript.GetLogoutCode(logoutNotifyUrls)); }
private void data_ok(object data, jquery.JQuery.Ajax.SuccessTextStatus textStatus, jquery.JQuery.jqXHR <object> jqXHR) { Javascript.debugger(); var model = data.As <AdvertisingOnline.AnonymousModel.StaffManagerModelView>(); var editDialog = new EditStaffDialog(); EditStaffDialog._Id = model.Id; editDialog.model = model; editDialog.CreateModalDialog(); }
protected override async Task OnAfterRenderAsync() { var fileContent = await gitHubService.ReadTextFileAsync("articles/app-service/toc.yml"); var toc = (BlazorAzureDoc.Client.Utils.Convert.FromYamlToObject(fileContent)).ToList <TocEntry>(); var vis = BlazorAzureDoc.Client.Utils.Convert.FromTocEntryToNodesEdges(toc); await Javascript.LoadVis("vis-network", vis.nodes, vis.edges); }
protected void Button_EnregistrerSinistre_Click(object sender, EventArgs e) { Javascript.ConsoleLog("ajout sinistre clicked"); Exam.Domain.Entities.Sinistre s = new Exam.Domain.Entities.Sinistre(); s.Conducteur = _S_Conducteur.Text; s.Nature = _S_Nature.Text; int i = 0; Int32.TryParse(RadioButtonList_Indemnite.SelectedValue, out i); s.Indemnise = Convert.ToBoolean(i); s.IDA = Convert.ToBoolean(Int32.Parse(RadioButtonList_IDA.SelectedValue)); s.GarantieSinistre = DropDownList_SinistreGarantieSinistre.SelectedItem.Text; s.NumeroPermis = _S_NumPermis.Text; s.DateDePermis = _S_DatePermis.Text; i = 0; Int32.TryParse(_S_PartResp.Text, out i); s.PartDeResponsabilite = i; i = 0; Int32.TryParse(_S_MontantInd.Text, out i); s.MontantIndemnisation = i; s.CompagnieAdverse = _S_CompagnieAdv.Text; s.DateSinistre = _S_DateSinistre.Text; s.DateIndemnisation = _S_DateIndm.Text; s.VehiculeAdverse = _S_VehiculeAdverse.Text; int idGarage, idExpert, idContrat; idGarage = Int32.Parse(DropDownList_SinistreGaragiste.SelectedItem.Value); idExpert = Int32.Parse(DropDownList_SinistreListeExpert.SelectedItem.Value); idContrat = Int32.Parse(DropDownList_Immatriculation.SelectedItem.Value); Javascript.ConsoleLog(idGarage.ToString()); Javascript.ConsoleLog(idExpert.ToString()); Javascript.ConsoleLog(idContrat.ToString()); UserAccount Garagiste = u.Users.Find(idGarage); Javascript.ConsoleLog("Garagiste : " + Garagiste.FirstName + Garagiste.LastName + Garagiste.Role); UserAccount Expert = u.Users.Find(idExpert); Javascript.ConsoleLog("Expert : " + Expert.FirstName + Expert.LastName + Expert.Role); if (RadioButtonList_Garage.SelectedValue.Equals("1")) { s.GarageExperts.Add(Garagiste); } s.GarageExperts.Add(Expert); s.Contrat = u.Contrats.Find(idContrat); Javascript.ConsoleLog(s.Contrat.Souscripteur.Nom); s.Phase = "Expertise"; u.Sinistres.Add(s); u.SaveChanges(); }
private void ChangeToEuroAndUpdateColor() { //take the first element with class name et_pb_sum and update the value to what's specified Javascript.ExecuteScript( "document.getElementsByClassName('et_pb_sum')[0].innerText = \"€0\";"); var element = Driver.FindElement(By.TagName("h1")); //Executes some javascript that updates the color of the h1 element on the page to the color specified Javascript.ExecuteScript( "arguments[0].setAttribute('style', 'color:#f9ca33!important')", element); }