private void 租赁网站_Click(object sender, EventArgs e) { //租赁网站 WebForm form = new WebForm(WebFormCategory.租赁网站); form.Show(this); }
private static bool ProcessWebForm_ToFile(BaseController controller, WebForm webForm, Page page) { if (controller == null) { throw new ArgumentNullException("controller"); } StoreFront storeFront = controller.CurrentStoreFrontOrThrow; if (!controller.ModelState.IsValid) { return(false); } string subject = BuildFormSubject(controller, webForm, page); string bodyText = BuildFormBodyText(controller, webForm, page, false); string virtualDir = storeFront.StoreFrontVirtualDirectoryToMap(controller.Request.ApplicationPath) + "\\Forms\\" + webForm.Name.ToFileName(); string fileDir = controller.Server.MapPath(virtualDir); if (!System.IO.Directory.Exists(fileDir)) { System.IO.Directory.CreateDirectory(fileDir); } string fileName = DateTime.UtcNow.ToFileSafeString() + System.Guid.NewGuid().ToString() + ".txt"; System.IO.File.AppendAllText(fileDir + "\\" + fileName, bodyText); return(true); }
public override void Serialize(GenericWriter writer) { base.Serialize(writer); var version = writer.SetVersion(4); switch (version) { case 4: writer.Write(FallbackAccount); goto case 3; case 3: writer.Write(CreditBonus); goto case 2; case 2: WebForm.Serialize(writer); goto case 1; case 1: writer.Write(TierFactor); goto case 0; case 0: { writer.Write(ShowHistory); writer.Write(MoneySymbol); } break; } }
public static bool ActivateWebForm(this SystemAdminBaseController controller, int webFormId) { WebForm webForm = controller.GStoreDb.WebForms.FindById(webFormId); if (webForm == null) { controller.AddUserMessage("Activate Web Form Failed!", "Web Form not found by id: " + webFormId, AppHtmlHelpers.UserMessageType.Danger); return(false); } if (webForm.IsActiveDirect()) { controller.AddUserMessage("Web Form is already active.", "Web Form is already active. id: " + webFormId, AppHtmlHelpers.UserMessageType.Info); return(false); } webForm.IsPending = false; webForm.StartDateTimeUtc = DateTime.UtcNow.AddMinutes(-1); webForm.EndDateTimeUtc = DateTime.UtcNow.AddYears(100); controller.GStoreDb.WebForms.Update(webForm); controller.GStoreDb.SaveChanges(); controller.AddUserMessage("Activated Web Form", "Activated Web Form '" + webForm.Name.ToHtml() + "' [" + webForm.WebFormId + "]" + " - Client '" + webForm.Client.Name.ToHtml() + "' [" + webForm.Client.ClientId + "]", AppHtmlHelpers.UserMessageType.Info); return(true); }
public ActionResult Create(WebForm webForm) { Client client = GStoreDb.Clients.FindById(webForm.ClientId); if (client.WebForms.Any(wf => wf.Name.ToLower() == webForm.Name.ToLower())) { ModelState.AddModelError("Name", "A Web Form with the name '" + webForm.Name + "' already exists. Change the name here or edit the conflicting web form."); } if (ModelState.IsValid) { webForm = GStoreDb.WebForms.Create(webForm); webForm.UpdateAuditFields(CurrentUserProfileOrThrow); webForm = GStoreDb.WebForms.Add(webForm); GStoreDb.SaveChanges(); AddUserMessage("Web Form Created", "Web Form '" + webForm.Name.ToHtml() + "' [" + webForm.WebFormId + "] Created Successfully", UserMessageType.Success); return(RedirectToAction("Index")); } int?clientId = null; if (webForm.ClientId != default(int)) { clientId = webForm.ClientId; } this.BreadCrumbsFunc = htmlHelper => this.WebFormBreadcrumb(htmlHelper, webForm.ClientId, webForm); return(View(webForm)); }
private void AuthButton_Click(object sender, EventArgs e) { WebForm.WebFormAuth(webBrowserGTRF, userNameTextBox.Text, userPasswordTextBox.Text, captchaTextBox.Text); WaitForPageCompleted(); if (!WebForm.CheckForAuthSuccess(webBrowserGTRF)) { webBrowserGTRF.Navigate("http://oed.gtrf.ru/auth"); WaitForPageCompleted(); MessageBox.Show( "Проверьте правильность заполнения данных аутентификации и правильность ввода кода с картинки", "Ошибка аутентификации", MessageBoxButtons.OK, MessageBoxIcon.Warning); captchaTextBox.Text = String.Empty; WebForm.LoadCaptchaImage(webBrowserGTRF, captchaPictureBox, WaitForPageCompleted); return; } SetAuthSuccessControls(); if (_excelLoaded) { startSendingButton.Enabled = true; } }
public ActionResult FieldCreate(WebFormField webFormField) { if (webFormField.WebFormId == default(int)) { return(HttpBadRequest("Web Form id is 0")); } IGstoreDb db = GStoreDb; WebForm webForm = db.WebForms.FindById(webFormField.WebFormId); if (webForm == null) { return(HttpNotFound("Web Form not found. Web Form id: " + webFormField.WebFormId)); } if (webForm.WebFormFields.Any(f => f.Name.ToLower() == (webFormField.Name ?? "").ToLower())) { ModelState.AddModelError("Name", "A field with the name '" + webFormField.Name + "' already exists. Choose a new name or edit the original."); } if (ModelState.IsValid) { webFormField.ClientId = webForm.ClientId; webFormField.WebFormId = webForm.WebFormId; webFormField.DataTypeString = webFormField.DataType.ToDisplayName(); webFormField = GStoreDb.WebFormFields.Add(webFormField); GStoreDb.SaveChanges(); AddUserMessage("Web Form Field Created", "Web Form Field '" + webFormField.Name.ToHtml() + "' [" + webFormField.WebFormFieldId + "] created successfully", UserMessageType.Success); return(RedirectToAction("FieldIndex", new { id = webFormField.WebFormId })); } webFormField.WebForm = webForm; this.BreadCrumbsFunc = htmlHelper => this.WebFormFieldBreadcrumb(htmlHelper, webFormField); return(View(webFormField)); }
public ActionResult DeleteConfirmed(int id) { try { WebForm target = GStoreDb.WebForms.FindById(id); if (target == null) { //webForm not found, already deleted? overpost? throw new ApplicationException("Error deleting Web Form. Web Form not found. It may have been deleted by another user. Web Form Id: " + id); } List <WebFormField> fieldsToDelete = target.WebFormFields.ToList(); foreach (WebFormField webFormField in fieldsToDelete) { GStoreDb.WebFormFields.Delete(webFormField); } bool deleted = GStoreDb.WebForms.DeleteById(id); GStoreDb.SaveChanges(); if (deleted) { AddUserMessage("Web Form Deleted", "Web Form [" + id + "] was deleted successfully.", UserMessageType.Success); } else { AddUserMessage("Deleting Web Form Failed!", "Deleting Web Form Failed. Web Form Id: " + id, UserMessageType.Danger); } } catch (Exception ex) { throw new ApplicationException("Error deleting Web Form. See inner exception for errors. Related child tables may still have data to be deleted. Web Form Id: " + id, ex); } return(RedirectToAction("Index")); }
public ActionResult Edit(int?id, string Tab, string SortBy, bool?SortAscending, int?webFormFieldId) { if (!id.HasValue) { return(HttpBadRequest("WebFormId = null")); } Client client = CurrentClientOrThrow; WebForm webForm = client.WebForms.Where(p => p.WebFormId == id.Value).SingleOrDefault(); if (webForm == null) { AddUserMessage("Web Form not found", "Sorry, the Web Form you are trying to edit cannot be found. Web Form id: [" + id.Value + "] for Client '" + client.Name.ToHtml() + "' [" + client.ClientId + "]", UserMessageType.Danger); return(RedirectToAction("Manager")); } //attempt sort so it can show if sort is unknown webForm.WebFormFields.AsQueryable().ApplySort(this, SortBy, SortAscending); WebFormEditAdminViewModel viewModel = new WebFormEditAdminViewModel(CurrentStoreFrontOrThrow, CurrentUserProfileOrThrow, webForm, Tab, true, false, false, sortBy: SortBy, sortAscending: SortAscending); if (webFormFieldId.HasValue) { ViewData.Add("WebFormFieldId", webFormFieldId.Value); } return(View("Edit", viewModel)); }
protected void Page_PreRender(object sender, EventArgs e) { if (WebForm != null) { WebForm.ShowHideNextButton(false); } }
public void FillFieldsFromViewModel(WebForm webFormToUpdate, WebFormFieldEditAdminViewModel[] webFormFields) { this.WebForm = webFormToUpdate; this.WebFormFields = webFormToUpdate.WebFormFields; this.webFormFieldPostData = webFormFields; this._webFormFieldViewModels = null; }
private void 网上银行_Click(object sender, EventArgs e) { //网上银行 WebForm form = new WebForm(WebFormCategory.网上银行); form.Show(this); }
protected void Page_PreRender(object sender, EventArgs e) { if (Purchasable == null) { PurchaseSummary.Visible = false; GeneralErrorMessage.Visible = true; WebForm.EnableDisableNextButton(false); return; } PurchaseSummary.Visible = true; GeneralErrorMessage.Visible = false; Shipping.Visible = Purchasable.RequiresShipping; PurchaseDiscounts.DataSource = Purchasable.Discounts; PurchaseDiscounts.DataBind(); PurchaseItems.DataSource = Purchasable.Items; PurchaseItems.DataBind(); QuoteId.Value = Purchasable.Quote.Id.ToString(); if (Purchasable.RequiresShipping && Purchasable.ShipToAddress != null) { ShippingCity.Text = Purchasable.ShipToAddress.City; ShippingCountry.Text = Purchasable.ShipToAddress.Country; ShippingName.Text = Purchasable.ShipToAddress.Name; ShippingPostalCode.Text = Purchasable.ShipToAddress.PostalCode; ShippingStateProvince.Text = Purchasable.ShipToAddress.StateOrProvince; ShippingAddressLine1.Text = Purchasable.ShipToAddress.Line1; ShippingAddressLine2.Text = Purchasable.ShipToAddress.Line2; } }
public static void SetDefaultsForNew(this WebFormField webFormField, WebForm webForm) { if (webForm != null) { webFormField.WebForm = webForm; webFormField.WebFormId = webForm.WebFormId; webFormField.ClientId = webForm.ClientId; webFormField.Order = webForm.WebFormFields.Count == 0 ? 100 : webForm.WebFormFields.Max(wf => wf.Order) + 10; webFormField.Name = "New Field"; bool nameIsDirty = webForm.WebFormFields.Any(wf => wf.Name.ToLower() == webFormField.Name.ToLower()); int counter = 1; do { counter++; webFormField.Name = "New Field " + counter; nameIsDirty = webForm.WebFormFields.Any(wf => wf.Name.ToLower() == webFormField.Name.ToLower()); } while (nameIsDirty); webFormField.LabelText = webFormField.Name; webFormField.Description = webFormField.Name; } webFormField.Watermark = webFormField.Name; webFormField.Description = webFormField.Name; webFormField.DataType = GStoreValueDataType.SingleLineText; webFormField.DataTypeString = webFormField.DataType.ToDisplayName(); webFormField.IsPending = false; webFormField.EndDateTimeUtc = DateTime.UtcNow.AddYears(100); webFormField.StartDateTimeUtc = DateTime.UtcNow.AddMinutes(-1); }
private static void SetPortalName(WebForm form, int languageCode) { var portalName = languageCode.ToString(CultureInfo.InvariantCulture); var portals = PortalCrmConfigurationManager.GetPortalCrmSection().Portals; if (portals.Count <= 0) { return; } var found = false; foreach (var portal in portals) { var portalContext = portal as PortalContextElement; if (portalContext != null && portalContext.Name == portalName) { found = true; } } if (found) { form.PortalName = portalName; } }
public void Should_BePossibleTo_SaveAndCompareWithDump_WithOverlengthDumpName_WhenAllElementsSelected() { var customForm = new WebForm(); customForm.SetElementsForDump(WebForm.ElementsFilter.AllElements); var maxElementNameLength = (int)customForm.Dump.GetType().GetMethod("GetMaxNameLengthOfDumpElements", BindingFlags.Instance | BindingFlags.NonPublic).Invoke(customForm.Dump, new object[] { }); var imageExtensioLength = ((ImageFormat)customForm.Dump.GetType().GetProperty("ImageFormat", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(customForm.Dump)).Extension.Length; var maxLength = (int)customForm.Dump.GetType().GetProperty("MaxFullFileNameLength", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(customForm.Dump); var pathToDumpLength = PathToDumps.Length; var dumpName = new string('A', maxLength - pathToDumpLength - maxElementNameLength - imageExtensioLength); var overlengthDumpName = dumpName + "_BCDE"; var overlengthPathToDump = CleanUpAndGetPathToDump(overlengthDumpName); var pathToDump = CleanUpAndGetPathToDump(dumpName); Assert.DoesNotThrow(() => customForm.Dump.Save(overlengthDumpName)); overlengthPathToDump.Refresh(); DirectoryAssert.DoesNotExist(overlengthPathToDump); pathToDump.Refresh(); DirectoryAssert.Exists(pathToDump); Assert.That(customForm.Dump.Compare(dumpName), Is.EqualTo(0), "Some elements should be failed to take image, but difference should be around zero"); }
private static List <WebForm> SetWebFormList(DataTable WebModuleTable) { try { List <WebForm> WebFormList = new List <WebForm>(); foreach (DataRow dr in WebModuleTable.Rows) { WebForm theWebForm = new WebForm(); theWebForm.WebFormID = int.Parse(dr["WebFormID"].ToString()); theWebForm.ModuleID = int.Parse(dr["ModuleID"].ToString()); theWebForm.WebFormName = dr["WebFormName"].ToString(); theWebForm.WebFormURL = dr["WebFormURL"].ToString(); theWebForm.WebFormImageURL = dr["WebFormImageURL"].ToString(); theWebForm.ModuleName = dr["ModuleName"].ToString(); theWebForm.CompanyCode = dr["CompanyCode"].ToString(); theWebForm.IsActive = bool.Parse(dr["IsActive"].ToString()); theWebForm.IsDeleted = bool.Parse(dr["IsDeleted"].ToString()); theWebForm.WebFormDescription = dr["WebFormDescription"].ToString(); WebFormList.Add(theWebForm); } return(WebFormList); } catch (Exception ex) { throw (new Exception(MethodBase.GetCurrentMethod().DeclaringType.ToString() + "." + (new System.Diagnostics.StackFrame()).GetMethod().Name, ex)); } }
protected void Page_PreRender(object sender, EventArgs e) { if (Purchasable == null) { WebForm.EnableDisableNextButton(false); } }
private static void InitializeWebUIElement(Form newForm, WebForm mainWebForm) { //Call the initialized event newForm.OnInitialized(); var halfWidth = Document.ClientWidth / 2; var halfHeight = Document.ClientHeight / 2; var newFormHalfWidth = newForm.Size.Width / 2; var newFormHalfHeight = newForm.Size.Height / 2; newForm.Location = new Point(halfWidth - newFormHalfWidth, halfHeight - newFormHalfHeight); //Center the form newForm.Focus(); JQuery.FromSelector(".winform").ZIndex(1); mainWebForm.InternalJQElement.ZIndex(1000); if (newForm.FormBorderStyle == FormBorderStyle.Sizable) { newForm.UnderlyingWebForm.InternalJQElement.ResizableAnimated(); } mainWebForm.InternalJQElement.AddClass("winform"); mainWebForm.InternalJQElement.Draggable(); //Add a close button var btnClose = new AnchorElement { Href = "#", Class = "close webform-close-btn", Style = "color: #000000;", TextContent = "×" }; btnClose.Click += (s, e) => CloseForm(newForm); mainWebForm.InternalJQElement.Append(btnClose); }
private void 生活助手_Click(object sender, EventArgs e) { //生活助手 WebForm form = new WebForm(WebFormCategory.生活助手); form.Show(this); }
public void Should_BePossibleTo_CompareWithDump_WithCustomName_WhenDifferenceIsZero() { var form = new WebForm(); form.Dump.Save("Zero diff"); Assert.That(form.Dump.Compare("Zero diff"), Is.EqualTo(0), "Difference with current page should be around zero"); }
protected void Page_PreRender(object sender, EventArgs args) { if (WebForm.CurrentSessionHistory == null) { return; } var currentStepId = WebForm.CurrentSessionHistory.CurrentStepId; if (currentStepId == Guid.Empty) { return; } var dataAdapterDependencies = new PortalConfigurationDataAdapterDependencies(PortalName, Request.RequestContext); var serviceContext = dataAdapterDependencies.GetServiceContext(); var step = serviceContext.CreateQuery("adx_webformstep") .FirstOrDefault(e => e.GetAttributeValue <Guid>("adx_webformstepid") == currentStepId); if (step == null) { return; } if (step.GetAttributeValue <EntityReference>("adx_nextstep") == null) { WebForm.ShowHideNextButton(false); } }
public List <WebForm> GetNotification() { try { /*get all reservation that is time up and sort by datemodified*/ var list = _dbContext.reservations.Where(x => x.Status == Status.Timeup).OrderByDescending(x => x.DateModified); //create form to return to administrator List <WebForm> result = new List <WebForm>(); foreach (var run in list) { string mac_address = _dbContext.vacancies.FirstOrDefault(x => x.Id_vacancy == run.Id_vacancy).Mac_address; string location = _dbContext.lockerMetadatas.FirstOrDefault(x => x.Mac_address == mac_address).Location; WebForm tmp = new WebForm() { Status = run.Status, Id_booking = run.Id_reserve, Id_user = run.Id_account, Location = location, DateModified = run.DateModified }; result.Add(tmp); } return(result.ToList()); } catch (Exception) { //error return(null); } }
private static bool ProcessWebForm_ToEmail(BaseController controller, WebForm webForm, Page page) { if (controller == null) { throw new ArgumentNullException("controller"); } StoreFrontConfiguration storeFrontConfiguration = controller.CurrentStoreFrontConfigOrThrow; UserProfile userProfile = controller.CurrentUserProfileOrNull; string toEmail = page.WebFormEmailToAddress; if (string.IsNullOrWhiteSpace(toEmail)) { toEmail = storeFrontConfiguration.RegisteredNotify.Email; } string toName = page.WebFormEmailToName; if (string.IsNullOrWhiteSpace(toName)) { toName = storeFrontConfiguration.RegisteredNotify.FullName; } string subject = BuildFormSubject(controller, webForm, page); string bodyText = BuildFormBodyText(controller, webForm, page, false); string bodyHtml = bodyText.ToHtmlLines(); return(controller.SendEmail(toEmail, toName, subject, bodyText, bodyHtml)); }
private void TRS_Click(object sender, EventArgs e) { WebForm form = new WebForm(); form.MdiParent = this; form.Show(); }
protected MvcHtmlString WebFormFieldsBreadcrumb(HtmlHelper htmlHelper, WebForm webForm, bool ShowAsLink = false) { return(new MvcHtmlString( WebFormBreadcrumb(htmlHelper, webForm.ClientId, webForm, true).ToHtmlString() + " -> " + (ShowAsLink ? htmlHelper.ActionLink("Fields", "FieldIndex", "WebFormSysAdmin", new { id = webForm.WebFormId }, null).ToHtmlString() : "Fields") )); }
public static string BodyTextCustomFieldsOnly(BaseController controller, WebForm webForm) { if (controller == null) { throw new ArgumentNullException("controller"); } return(BuildFormBodyText(controller, webForm, null, true)); }
public void Should_BePossibleTo_SaveAndCompareWithDump_WithCustomName_WhenAllElementsSelected() { var customForm = new WebForm(); customForm.SetElementsForDump(WebForm.ElementsFilter.AllElements); Assert.DoesNotThrow(() => customForm.Dump.Save("All elements")); Assert.That(customForm.Dump.Compare("All elements"), Is.EqualTo(0), "Some elements should be failed to take image, but difference should be around zero"); }
public void Should_BePossibleTo_CompareWithDump_WithCustomName_WhenElementSetDiffers() { var customForm = new WebForm(); customForm.Dump.Save("Set differs"); customForm.SetElementsForDump(WebForm.ElementsFilter.ElementsInitializedAsDisplayed); Assert.That(customForm.Dump.Compare("Set differs"), Is.GreaterThan(0), "Difference with current page should be greater than zero if element set differs"); }
public new void SetUp() { var form = new WebForm(); AqualityServices.Application.Driver.Navigate().GoToUrl(HoversURL); form.ClickOnContent(); form.WaitUntilPresent(); }
public void Input_Test() { // Given var model = SP.Resolve<IModel>(); model.Name = "NEXON"; model.Age = 36; var webform = new WebForm<IModel>(model); // When var html = webform.InputTextFor(o => o.Name); Console.WriteLine(html); // Then Assert.IsTrue(html.ToString().Contains("name")); Assert.IsTrue(html.ToString().Contains("type")); Assert.IsTrue(html.ToString().Contains("value")); }
public void ShouldSubmitWebFormWithButton() { var url = "http://mysite.com/webform2.aspx"; var expected = "success"; Factory.Register(url, expected); var fields = new Dictionary<string, string>(); var buttons = new Dictionary<string, string>(); buttons.Add("login", "Entrar"); var form = new WebForm { Action = url, Method = "POST", Fields = fields, Buttons = buttons, Cookies = new CookieCollection() }; var response = form.Submit("login"); Assert.IsNotNull(response); Assert.AreEqual(expected, response); }
// TODO: test post to relative url... private void AssertGoogleForm(WebForm form, bool absolute) { Assert.IsNotNull(form); if(absolute) { Assert.AreEqual("http://www.google.com/search", form.Action); } else { Assert.AreEqual("/search", form.Action); } Assert.AreEqual("GET", form.Method); Assert.AreEqual(5, form.Fields.Count); Assert.AreEqual(2, form.Buttons.Count); Assert.AreEqual("pt-BR", form.Fields["hl"]); Assert.IsNullOrEmpty(form.Id); Assert.IsNull(form.Id); Assert.AreEqual("f", form.Name); Assert.IsNullOrEmpty(form.EncType); }
private void nISTToolStripMenuItem_Click(object sender, EventArgs e) { WebForm webForm = new WebForm(); webForm.Show(); }