Exemplo n.º 1
0
 public static void ClearInputButton(HtmlInputButton btn,string[] clearAtrr)
 {
     foreach (string s in clearAtrr)
     {
         btn.Attributes.Remove(s);
     }
 }
 protected override void InitConfirmButton(System.Web.UI.HtmlControls.HtmlInputButton confirmButton)
 {
     confirmButton.Value = "日志(L)";
     confirmButton.Attributes["accesskey"] = "L";
     confirmButton.Attributes["onclick"]   = string.Format("$find(\"{0}\").openLogView();", this.ClientID);
     confirmButton.Attributes["category"]  = Define.DefaultCulture;
 }
Exemplo n.º 3
0
 public void buttonStyleWhite(HtmlInputButton button, string message)
 {
     button.Visible = true;
     button.Style.Add("background-color", "white");
     button.Style.Add("color", "red");
     button.Value = message;
 }
Exemplo n.º 4
0
        private void AddActions(HtmlGenericControl container)
        {
            using (HtmlGenericControl actions = new HtmlGenericControl("div"))
            {
                actions.Attributes.Add("class", "actions");

                using (HtmlGenericControl buttons = new HtmlGenericControl("div"))
                {
                    buttons.Attributes.Add("class", "ui buttons");

                    using (HtmlInputButton cancelButton = new HtmlInputButton())
                    {
                        cancelButton.Attributes.Add("class", "ui red button");
                        cancelButton.Value = Titles.Cancel;

                        buttons.Controls.Add(cancelButton);
                    }

                    using (HtmlInputButton verifyButton = new HtmlInputButton())
                    {
                        verifyButton.ID = "VerifyButton";
                        verifyButton.Attributes.Add("class", "ui green button");
                        verifyButton.Value = Titles.Verify;
                        verifyButton.Attributes.Add("title", "CTRL + RETURN");
                        buttons.Controls.Add(verifyButton);
                    }

                    actions.Controls.Add(buttons);
                }

                container.Controls.Add(actions);
            }
        }
 private void Page_Load(object sender, System.EventArgs e)
 {
     System.Web.UI.HtmlControls.HtmlForm frm = (HtmlForm)FindControl("Form1");
     GHTTestBegin(frm);
     //False
     GHTSubTestBegin("Causes validation = false");
     try
     {
         System.Web.UI.HtmlControls.HtmlInputButton btn = new System.Web.UI.HtmlControls.HtmlInputButton();
         btn.CausesValidation = false;
         GHTActiveSubTest.Controls.Add(btn);
     }
     catch (Exception ex)
     {
         GHTSubTestUnexpectedExceptionCaught(ex);
     }
     //true
     GHTSubTestBegin("Causes validation = true");
     try
     {
         System.Web.UI.HtmlControls.HtmlInputButton btn = new System.Web.UI.HtmlControls.HtmlInputButton();
         btn.CausesValidation = true;
         GHTActiveSubTest.Controls.Add(btn);
     }
     catch (Exception ex)
     {
         GHTSubTestUnexpectedExceptionCaught(ex);
     }
     GHTTestEnd();
 }
		protected override void CreateChildControls()
		{
			Page.ClientScript.RegisterClientScriptBlock(GetType(), "ShowLocationSelectionDialog", CreateShowDialogScript());

			if (ValueControl == null)
				CreateValueControl();

			DisplayControl = new TextBox();
			DisplayControl.ID = "Display";
			DisplayControl.Enabled = false;

			CopyWebAttributes(DisplayControl);
			Controls.Add(DisplayControl);

			HtmlInputButton openDialogButton = new HtmlInputButton();
			if (!Enabled)
				openDialogButton.Attributes.Add("disabled", "disabled");

			openDialogButton.Value = "...";
			openDialogButton.Attributes.Add("class", "epismallbutton");
			openDialogButton.Attributes.Add("onclick", string.Format(
				"ShowLocationSelectionDialog('{0}', document.getElementById('{1}').value, '{2}', '{3}', '{4}', '{5}', '{6}');",
				UriSupport.ResolveUrlBySettings(ControlPath),
				ValueControl.ClientID,
				DisplayControl.ClientID,
				ValueControl.ClientID,
				ContentLanguage.PreferredCulture.Name,
				DialogWidth,
				DialogHeight
			));

			Controls.Add(openDialogButton);
		}
		private void Page_Load(object sender, System.EventArgs e) 
		{
			System.Web.UI.HtmlControls.HtmlForm frm = (HtmlForm)FindControl("Form1");
			GHTTestBegin(frm);
			//False
			GHTSubTestBegin("Causes validation = false");
			try 
			{
				System.Web.UI.HtmlControls.HtmlInputButton btn = new System.Web.UI.HtmlControls.HtmlInputButton();
				btn.CausesValidation = false;
				GHTActiveSubTest.Controls.Add(btn);
			}
			catch (Exception ex) 
			{
				GHTSubTestUnexpectedExceptionCaught(ex);
			}
			//true
			GHTSubTestBegin("Causes validation = true");
			try 
			{
				System.Web.UI.HtmlControls.HtmlInputButton btn = new System.Web.UI.HtmlControls.HtmlInputButton();
				btn.CausesValidation = true;
				GHTActiveSubTest.Controls.Add(btn);
			}
			catch (Exception ex) 
			{
				GHTSubTestUnexpectedExceptionCaught(ex);
			}
			GHTTestEnd();
		}
        protected override Control AddEditor(Control container)
        {
            // Register the javascript needed for the control.
            container.Page.JavaScript(Engine.ManagementPaths.ResolveResourceUrl("~/Scripts/underscore-min.js"));
            container.Page.JavaScript(Engine.ManagementPaths.ResolveResourceUrl("~/Scripts/backbone-min.js"));
            LoadControlScripts(container);
            var control = new Control();
            var textBox = new TextBox {CssClass = "textEditor", ID = Name};
            textBox.ID = textBox.ID;
            control.Controls.Add(textBox);

            var csButton = new HtmlInputButton();

            csButton.Attributes["value"] = ButtonText;
            csButton.Attributes["class"] = string.Format("{0}-selector-button", ButtonClassPrefix);
            csButton.Attributes["data-app-path"] = HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority) + HttpContext.Current.Request.ApplicationPath;
            csButton.Attributes["data-image-control-id"] = textBox.ClientID;
            if (PropertyMap != null)
                csButton.Attributes["data-property-map"] = PropertyMapToJson();
            SetCustomAttributes(container, csButton);
            control.Controls.Add(csButton);

            container.Controls.Add(control);
            return control;
        }
        private void doInterface(int report_no)
        {
            Heading.InnerText = theReports[report_no].Title;

            this.ReportList.Visible = false;

            HtmlTable theTable = new HtmlTable();

            theTable.Width = "100%";
            theTable.ID    = "tbl_interface";

            foreach (Item item in theReports[report_no].Interface)
            {
                HtmlTableRow  tblRow    = new HtmlTableRow();
                HtmlTableCell labelCell = new HtmlTableCell("th");
                HtmlTableCell dataCell  = new HtmlTableCell();

                //Label
                labelCell.Controls.Add(new LiteralControl(item.Name));

                //Field
                switch (item.Type)
                {
                case "list":
                    System.Web.UI.WebControls.TextBox theListCtrl = new System.Web.UI.WebControls.TextBox();
                    theListCtrl.ID       = item.Name.Replace(" ", "_");
                    theListCtrl.TextMode = System.Web.UI.WebControls.TextBoxMode.MultiLine;
                    theListCtrl.Rows     = 10;
                    dataCell.Controls.Add(theListCtrl);
                    break;

                default:
                    System.Web.UI.WebControls.TextBox theTextCtrl = new System.Web.UI.WebControls.TextBox();
                    theTextCtrl.ID = item.Name.Replace(" ", "_");
                    dataCell.Controls.Add(theTextCtrl);
                    break;
                }

                tblRow.Cells.Add(labelCell);
                tblRow.Cells.Add(dataCell);
                theTable.Rows.Add(tblRow);
            }

            System.Web.UI.HtmlControls.HtmlInputButton btnSubmit = new System.Web.UI.HtmlControls.HtmlInputButton("submit");
            btnSubmit.Value = "Do It !";

            HtmlTableRow  btnRow       = new HtmlTableRow();
            HtmlTableCell btnlabelcell = new HtmlTableCell();
            HtmlTableCell btndatacell  = new HtmlTableCell();

            btnlabelcell.Controls.Add(new LiteralControl());
            btndatacell.Controls.Add(btnSubmit);
            btnRow.Cells.Add(btnlabelcell);
            btnRow.Cells.Add(btndatacell);
            theTable.Rows.Add(btnRow);

            this.ReportForm.Controls.Add(theTable);
        }
Exemplo n.º 10
0
 private void AddSaveButton(HtmlGenericControl div)
 {
     using (HtmlInputButton button = new HtmlInputButton())
     {
         button.ID = "SaveButton";
         button.Value = Titles.Save;
         button.Attributes.Add("class", "ui small blue button");
         div.Controls.Add(button);
     }
 }
 private void CreateBackupButton(HtmlGenericControl container)
 {
     using (HtmlInputButton backupButton = new HtmlInputButton())
     {
         backupButton.Attributes.Add("class", "ui red button disabled loading");
         backupButton.Value = Titles.BackupNow;
         backupButton.ID = "BackupButton";
         container.Controls.Add(backupButton);
     }
 }
Exemplo n.º 12
0
 private void CreateFlagButton(HtmlGenericControl container)
 {
     using (HtmlInputButton flagButton = new HtmlInputButton())
     {
         flagButton.ID = "FlagButton";
         flagButton.Value = Titles.Flag;
         flagButton.Attributes.Add("class", "ui button");
         container.Controls.Add(flagButton);
     }
 }
Exemplo n.º 13
0
        private void CreatePrintButton(HtmlGenericControl container)
        {
            using (HtmlInputButton printButton = new HtmlInputButton())
            {
                printButton.ID = "PrintButton";
                printButton.Value = Titles.Print;
                printButton.Attributes.Add("class", "ui button");

                container.Controls.Add(printButton);
            }
        }
Exemplo n.º 14
0
        private void CreateUploadButton(HtmlGenericControl container)
        {
            using (HtmlInputButton uploadButton = new HtmlInputButton())
            {
                uploadButton.ID = "UploadButton";
                uploadButton.Value = Titles.Upload;
                uploadButton.Attributes.Add("class", "ui small blue button");

                container.Controls.Add(uploadButton);
            }
        }
Exemplo n.º 15
0
        private void CreateUndoButton(HtmlGenericControl container)
        {
            using (HtmlInputButton undoButton = new HtmlInputButton())
            {
                undoButton.ID = "UndoButton";
                undoButton.Value = Titles.Undo;
                undoButton.Attributes.Add("class", "ui small red button");

                container.Controls.Add(undoButton);
            }
        }
Exemplo n.º 16
0
        private void CreateSaveButton(Control container)
        {
            using (HtmlInputButton saveButton = new HtmlInputButton())
            {
                saveButton.ID = "SaveButton";
                saveButton.Attributes.Add("class", "small ui button red");
                saveButton.Value = Titles.Save;

                container.Controls.Add(saveButton);
            }
        }
Exemplo n.º 17
0
        private static void AddSaveButton(HtmlGenericControl container)
        {
            using (HtmlInputButton saveButton = new HtmlInputButton())
            {
                saveButton.ID = "SaveButton";
                saveButton.Attributes.Add("class", "small ui red button");
                saveButton.Value = Titles.Save;

                container.Controls.Add(saveButton);
            }
        }
Exemplo n.º 18
0
        private void AddCancelButton(HtmlGenericControl p)
        {
            using (HtmlInputButton button = new HtmlInputButton())
            {
                button.ID = "CancelButton";
                button.CausesValidation = false;
                button.Value = Titles.Cancel;
                button.Attributes.Add("class", "ui red small submit button");

                p.Controls.Add(button);
            }
        }
Exemplo n.º 19
0
        private void CreatSaveButton(HtmlGenericControl container)
        {
            using (HtmlInputButton saveButton = new HtmlInputButton())
            {
                saveButton.ID = "SaveButton";
                saveButton.Attributes.Add("class", "ui small green button");
                saveButton.Value = Titles.Save;
                saveButton.Visible = this.ShowSaveButton;

                container.Controls.Add(saveButton);
            }
        }
        private void LoadServices()
        {
            ConnectorDataContext db = new ConnectorDataContext();

            Stopwatch w = Stopwatch.StartNew();
            List<ServiceInstance> sInstance = db.ServiceInstances.Where(s => s.Service.name != "SocialTFS").ToList();
            w.Stop();
            ILog log = LogManager.GetLogger("QueryLogger");
            log.Info(" Elapsed time: " + w.Elapsed + ", select all service instances different from 'SocialTFS' to load them");

            foreach (var item in sInstance)
            {
                HtmlTableCell name = new HtmlTableCell();
                HtmlTableCell service = new HtmlTableCell();
                HtmlTableCell host = new HtmlTableCell();
                HtmlTableCell edit = new HtmlTableCell();
                HtmlTableCell delete = new HtmlTableCell();

                name.InnerText = item.name;
                service.InnerText = item.Service.name;
                host.InnerText = item.host;

                IService iService = ServiceFactory.getService(item.Service.name);

                if (iService.GetPrivateFeatures().Contains(FeaturesType.MoreInstance) || iService.GetPrivateFeatures().Contains(FeaturesType.Labels))
                {
                    HtmlInputButton editBT = new HtmlInputButton();
                    editBT.Attributes.Add("title", "Edit " + item.name);
                    editBT.Attributes.Add("class", "edit");
                    editBT.Value = item.id.ToString();
                    edit.Attributes.Add("class", "center");
                    edit.Controls.Add(editBT);
                }

                HtmlInputButton deleteBT = new HtmlInputButton();
                deleteBT.Attributes.Add("title", "Delete " + item.name);
                deleteBT.Attributes.Add("class", "delete");
                deleteBT.Value = item.id.ToString();
                delete.Attributes.Add("class", "center");
                delete.Controls.Add(deleteBT);

                HtmlTableRow tr = new HtmlTableRow();
                tr.ID = "Row" + item.id;
                tr.Cells.Add(name);
                tr.Cells.Add(service);
                tr.Cells.Add(host);
                tr.Cells.Add(edit);
                tr.Cells.Add(delete);

                ServiceTable.Rows.Add(tr);
            }
        }
Exemplo n.º 21
0
        private void CreateAddButton(HtmlGenericControl container)
        {
            if (!string.IsNullOrWhiteSpace(this.AddNewUrl))
            {
                using (HtmlInputButton addButton = new HtmlInputButton())
                {
                    addButton.ID = "AddNewButton";
                    addButton.Value = Titles.AddNew;
                    addButton.Attributes.Add("class", "ui button");
                    addButton.Attributes.Add("onclick", "window.location='" + this.ResolveUrl(this.AddNewUrl) + "'");

                    container.Controls.Add(addButton);
                }
            }
        }
Exemplo n.º 22
0
        private void AddButton(TableRow row)
        {
            using (TableCell cell = this.GetCell())
            {
                using (HtmlInputButton addButton = new HtmlInputButton())
                {
                    addButton.ID = "AddButton";
                    addButton.Value = Titles.Add;
                    addButton.Attributes.Add("class", "ui small red button");

                    cell.Controls.Add(addButton);
                }

                row.Controls.Add(cell);
            }
        }
Exemplo n.º 23
0
        private static void CreateActionField(TableRow row)
        {
            using (TableCell cell = new TableCell())
            {
                using (HtmlInputButton addButton = new HtmlInputButton())
                {
                    addButton.ID = "AddButton";
                    addButton.Attributes.Add("class", "small ui button blue");
                    addButton.Value = Titles.Add;
                    addButton.Attributes.Add("title", "Ctrl + Return");

                    cell.Controls.Add(addButton);
                }
                row.Cells.Add(cell);
            }
        }
Exemplo n.º 24
0
        protected virtual void Dispose(bool disposing)
        {
            if (!disposing)
            {
                return;
            }

            if (this.currentPeriodDateTextBox != null)
            {
                this.currentPeriodDateTextBox.Dispose();
                this.currentPeriodDateTextBox = null;
            }

            if (this.previousPeriodDateTextBox != null)
            {
                this.previousPeriodDateTextBox.Dispose();
                this.previousPeriodDateTextBox = null;
            }

            if (this.factorInputText != null)
            {
                this.factorInputText.Dispose();
                this.factorInputText = null;
            }

            if (this.showButton != null)
            {
                this.showButton.Dispose();
                this.showButton = null;
            }

            if (this.printButton != null)
            {
                this.printButton.Dispose();
                this.printButton = null;
            }

            if (this.grid != null)
            {
                this.grid.RowDataBound -= this.Grid_RowDataBound;
                this.grid.DataBound -= this.Grid_DataBound;
                this.grid.Dispose();
                this.grid = null;
            }

            this.disposed = true;
        }
Exemplo n.º 25
0
        private void AddButton()
        {
            using (HtmlGenericControl div = new HtmlGenericControl())
            {
                div.TagName = "div";
                div.Attributes.Add("class", "vpad16");

                using (HtmlInputButton reorderButton = new HtmlInputButton())
                {
                    reorderButton.Attributes.Add("class", "ui positive button");
                    reorderButton.Attributes.Add("onclick", "ReorderInputButtonClick()");
                    reorderButton.Value = Titles.PlaceReorderRequests;
                    div.Controls.Add(reorderButton);
                    this.Placeholder1.Controls.Add(div);
                }
            }
        }
Exemplo n.º 26
0
        public bool IsInExport = false;         // Added by Icyer 2006/12/26 @ YHI	标识是否导出操作,如果是导出则不用计算总数

        public WebQueryHelperNew(
            HtmlInputButton queryButton,
            HtmlInputButton exportButton,
            WebDataGrid grid,
            PagerSizeSelector selector,
            PagerToolBar toolBar,
            ControlLibrary.Web.Language.LanguageComponent languageComponent,
            DataTable source)
        {
            dtSource = source;
            //variable
            this.cmdQuery           = queryButton;
            this.cmdGridExport      = exportButton;
            this.gridWebGrid        = grid;
            this.pagerSizeSelector  = selector;
            this.pagerToolBar       = toolBar;
            this.languageComponent1 = languageComponent;
            //export
            this.excelExporter      = new BenQGuru.eMES.Web.Helper.ExcelExporter();
            this.excelExporter.Page = this.gridWebGrid.Page;
            this.excelExporter.FormatExportRecordHandle  = new FormatExportRecordDelegate(this.FormatExportRecord);
            this.excelExporter.LoadExportDataHandle      = new LoadExportDataDelegate(this.LoadDataSource);
            this.excelExporter.LanguageComponent         = this.languageComponent1;
            this.excelExporter.GetColumnHeaderTextHandle = new GetColumnHeaderTextDelegate(GetColumnHeaderText);
            //register event
            if (this.cmdQuery != null)
            {
                this.cmdQuery.ServerClick += new EventHandler(cmdQuery_ServerClick);
            }
            if (this.cmdGridExport != null)
            {
                this.cmdGridExport.ServerClick += new EventHandler(cmdGridExport_ServerClick);
            }
            //if (this.gridWebGrid != null)
            //{
            //    this.gridWebGrid.ClickCellButton += new ClickCellButtonEventHandler(gridWebGrid_ClickCellButton);
            //}
            if (this.pagerToolBar != null)
            {
                this.pagerToolBar.OnPagerToolBarClick += new EventHandler(this.PagerToolBar_OnPagerToolBarClick);
            }
            if (this.pagerSizeSelector != null)
            {
                this.pagerSizeSelector.OnPagerSizeChanged += new BenQGuru.eMES.Web.Helper.PagerSizeSelector.PagerSizeChangedHandle(pagerSizeSelector_OnPagerSizeChanged);
            }
        }
        private void LoadServices()
        {
            SocialTFSEntities db = new SocialTFSEntities();

            foreach (var item in db.ServiceInstance.Where(s => s.Service.name != "SocialTFS"))
            {
                HtmlTableCell name = new HtmlTableCell();
                HtmlTableCell service = new HtmlTableCell();
                HtmlTableCell host = new HtmlTableCell();
                HtmlTableCell edit = new HtmlTableCell();
                HtmlTableCell delete = new HtmlTableCell();

                name.InnerText = item.name;
                service.InnerText = item.Service.name;
                host.InnerText = item.host;

                IService iService = ServiceFactory.getService(item.Service.name);

                if (iService.GetPrivateFeatures().Contains(FeaturesType.MoreInstance) || iService.GetPrivateFeatures().Contains(FeaturesType.Labels))
                {
                    HtmlInputButton editBT = new HtmlInputButton();
                    editBT.Attributes.Add("title", "Edit " + item.name);
                    editBT.Attributes.Add("class", "edit");
                    editBT.Value = item.pk_id.ToString();
                    edit.Attributes.Add("class", "center");
                    edit.Controls.Add(editBT);
                }

                HtmlInputButton deleteBT = new HtmlInputButton();
                deleteBT.Attributes.Add("title", "Delete " + item.name);
                deleteBT.Attributes.Add("class", "delete");
                deleteBT.Value = item.pk_id.ToString();
                delete.Attributes.Add("class", "center");
                delete.Controls.Add(deleteBT);

                HtmlTableRow tr = new HtmlTableRow();
                tr.ID = "Row" + item.pk_id;
                tr.Cells.Add(name);
                tr.Cells.Add(service);
                tr.Cells.Add(host);
                tr.Cells.Add(edit);
                tr.Cells.Add(delete);

                ServiceTable.Rows.Add(tr);
            }
        }
Exemplo n.º 28
0
    public void SetLanguage(string code)
    {
        for (int i = 0; i < pForm.Controls.Count; i++)
        {
            if ((pForm.Controls[i].GetType() == typeof(System.Web.UI.WebControls.Label)) && pForm.Controls[i].ID.StartsWith("lt\uFFFD"))
            {
                ((System.Web.UI.WebControls.Label)pForm.Controls[i]).Text = ((Language)Session["language"]).Words[System.Convert.ToInt32(pForm.Controls[i].ID.Replace("lt\uFFFD", "\uFFFD"))].ToString();
            }
        }
        lAttach.Text      = "<img src=\"icons/attach_off.gif\" style=\"width:16px;height:16px;\" align=\"absmiddle\" alt=\"\" name=\"attach\" />&nbsp;&nbsp;\uFFFD" + ((Language)Session["language"]).Words[27].ToString();
        lInsertImage.Text = "<img src=\"icons/pictures_off.gif\" style=\"width:16px;height:16px;\" align=\"absmiddle\" alt=\"\" name=\"pictures\" />&nbsp;&nbsp;\uFFFD" + ((Language)Session["language"]).Words[66].ToString();
        lCompose.Text     = ((Language)Session["language\uFFFD"]).Words[33].ToString();
        System.Web.UI.HtmlControls.HtmlInputButton bb = (System.Web.UI.HtmlControls.HtmlInputButton)pForm.FindControl("iSubmit");

        // TODO: Review it
        //((System.Web.UI.HtmlControls.HtmlInputButton)pForm.FindControl("iSubmit")).Value = ((Language)Session["language"]).Words[26].ToString();
        //((System.Web.UI.HtmlControls.HtmlInputButton)pForm.FindControl("iSave")).Value = ((Language)Session["language"]).Words[16].ToString();
    }
Exemplo n.º 29
0
        private void CreateButtons(Control container)
        {
            using (HtmlGenericControl buttons = new HtmlGenericControl("div"))
            {
                buttons.Attributes.Add("class", "ui buttons vpad8");

                this.showButton = new Button();
                this.showButton.CssClass = "ui red button";
                this.showButton.Text = Titles.Show;
                this.showButton.Click += this.ShowButton_Click;
                buttons.Controls.Add(this.showButton);

                using (HtmlInputButton checkAllButton = new HtmlInputButton())
                {
                    checkAllButton.ID = "CheckAllButton";
                    checkAllButton.Attributes.Add("class", "ui blue button");
                    checkAllButton.Value = Titles.CheckAll;

                    buttons.Controls.Add(checkAllButton);
                }

                using (HtmlInputButton uncheckAllButton = new HtmlInputButton())
                {
                    uncheckAllButton.ID = "UncheckAllButton";
                    uncheckAllButton.Attributes.Add("class", "ui pink button");
                    uncheckAllButton.Value = Titles.UncheckAll;

                    buttons.Controls.Add(uncheckAllButton);
                }

                this.saveButton = new Button();
                this.saveButton.CssClass = "ui green button";
                this.saveButton.Text = Titles.Save;
                this.saveButton.Click += this.SaveButton_Click;
                this.saveButton.OnClientClick = "return updateSelection();";
                buttons.Controls.Add(this.saveButton);

                container.Controls.Add(buttons);
            }
        }
Exemplo n.º 30
0
        public void CreateControls()
        {
            // Render Text inputs
            _ParameterProperties.ForEach(p =>
            {
                var tr = new HtmlTableRow();
                tr.Cells.Add(CreateTableCell(new LiteralControl(p.FriendlyName + ": ")));
                tr.Cells.Add(CreateTableCell(new LiteralControl("<input type=\"text\" style=\"width: 300px\" id=\"" + p.Name + "\" />")));

                tabForm.Controls.Add(tr);
            });

            // Render validation area
            var trValidation = new HtmlTableRow();
            trValidation.Cells.Add(CreateTableCell(new LiteralControl()));
            trValidation.Cells.Add(CreateTableCell(new LiteralControl("<span class=\"error-validation\" id=\"spnErrorMessage\"></span>")));
            tabForm.Controls.Add(trValidation);

            // Submit Button
            var trSubmit = new HtmlTableRow();
            var submitButton = new HtmlInputButton()
            {
                Value = "Subscribe"
            };

            submitButton.Attributes.Add("class", "button");
            submitButton.Attributes.Add("onclick", "validateInput();");
            submitButton.Attributes.Add("type", "button");

            trSubmit.Cells.Add(CreateTableCell(new LiteralControl()));

            var panel = new Panel();
            panel.Controls.Add(submitButton);

            var goBack = new LiteralControl("&nbsp;or <a href=\"javascript:history.go(-1);\">cancel</a>");
            panel.Controls.Add(goBack);

            trSubmit.Cells.Add(CreateTableCell(panel));
            tabForm.Controls.Add(trSubmit);
        }
Exemplo n.º 31
0
        protected void rptRefundList_ItemDataBound(object sender, System.Web.UI.WebControls.RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == System.Web.UI.WebControls.ListItemType.Item || e.Item.ItemType == System.Web.UI.WebControls.ListItemType.AlternatingItem)
            {
                System.Web.UI.HtmlControls.HtmlInputButton htmlInputButton  = (System.Web.UI.HtmlControls.HtmlInputButton)e.Item.FindControl("btnAgree");
                System.Web.UI.HtmlControls.HtmlInputButton htmlInputButton2 = (System.Web.UI.HtmlControls.HtmlInputButton)e.Item.FindControl("btnRefuce");
                System.Web.UI.WebControls.Label            label            = (System.Web.UI.WebControls.Label)e.Item.FindControl("lblIsAgree");
                RefundInfo.Handlestatus handlestatus             = (RefundInfo.Handlestatus)System.Web.UI.DataBinder.Eval(e.Item.DataItem, "HandleStatus");
                System.Web.UI.HtmlControls.HtmlAnchor htmlAnchor = (System.Web.UI.HtmlControls.HtmlAnchor)e.Item.FindControl("linkModify");
                switch (handlestatus)
                {
                case RefundInfo.Handlestatus.Applied:
                    htmlInputButton.Visible  = false;
                    htmlInputButton2.Visible = false;
                    label.Visible            = true;
                    label.Text         = "已申请";
                    htmlAnchor.Visible = false;
                    return;

                case RefundInfo.Handlestatus.Refunded:
                    htmlInputButton.Visible  = false;
                    htmlInputButton2.Visible = false;
                    label.Visible            = true;
                    label.Text         = "已退款";
                    htmlAnchor.Visible = false;
                    return;

                case RefundInfo.Handlestatus.Refused:
                    htmlInputButton.Visible  = false;
                    htmlInputButton2.Visible = false;
                    label.Visible            = true;
                    label.Text         = "拒绝申请";
                    htmlAnchor.Visible = false;
                    return;

                case RefundInfo.Handlestatus.NoneAudit:
                case RefundInfo.Handlestatus.HasTheAudit:
                case RefundInfo.Handlestatus.NoRefund:
                    break;

                case RefundInfo.Handlestatus.AuditNotThrough:
                    htmlInputButton.Visible  = false;
                    htmlInputButton2.Visible = false;
                    label.Visible            = true;
                    label.Text         = "审核不通过";
                    htmlAnchor.Visible = false;
                    break;

                case RefundInfo.Handlestatus.RefuseRefunded:
                    htmlInputButton.Visible  = false;
                    htmlInputButton2.Visible = false;
                    label.Visible            = true;
                    label.Text         = "拒绝退款";
                    htmlAnchor.Visible = false;
                    return;

                default:
                    return;
                }
            }
        }
Exemplo n.º 32
0
        private void AddInputButtonControlCell(TableRow row, string controlId, string cssClass, string value)
        {
            using (TableCell cell = new TableCell())
            {
                using (HtmlInputButton targetControl = new HtmlInputButton())
                {
                    targetControl.ID = controlId;
                    targetControl.Attributes.Add("class", cssClass);
                    targetControl.Value = value;

                    cell.Controls.Add(targetControl);
                }

                row.Controls.Add(cell);
            }

            #endregion
        }
Exemplo n.º 33
0
 public void AddButtonConfirm(System.Web.UI.HtmlControls.HtmlInputButton btn, string content)
 {
     this.AddButtonAttribute(btn, "onclick", "{" + string.Format(" return confirm('{0}'); ", content) + "}");
 }
Exemplo n.º 34
0
 private void CreateViewBackupButton(HtmlGenericControl container)
 {
     using (HtmlInputButton backupButton = new HtmlInputButton())
     {
         backupButton.Attributes.Add("class", "ui green button");
         backupButton.Attributes.Add("onclick", "$(\"#BackupModal\").modal(\"show\");");
         backupButton.Value = Titles.ViewBackups;
         container.Controls.Add(backupButton);
     }
 }
Exemplo n.º 35
0
        private void AddPrintButton(HtmlGenericControl container)
        {
            this.printButton = new HtmlInputButton();
            this.printButton.ID = "PrintButton";
            this.printButton.Attributes.Add("class", "ui orange button");
            this.printButton.Value = Titles.Print;

            container.Controls.Add(this.printButton);
        }
        private void TraducirControles(Control cnt, ResourceManager rm)
        {
            if (cnt == null || cnt.Controls == null)
            {
                return;
            }

            foreach (Control cn in cnt.Controls)
            {
                if (cn.GetType() == typeof(System.Web.UI.WebControls.Label))
                {
                    string sClaveRecurso = ((System.Web.UI.WebControls.Label)cn).Attributes["ClaveRecurso"];
                    if (sClaveRecurso != null && sClaveRecurso.Length > 0)
                    {
                        //Response.Write(rm.GetString(sClaveRecurso));
                        ((System.Web.UI.WebControls.Label)cn).Text = rm.GetString(sClaveRecurso);
                    }
                }
                else if (cn.GetType() == typeof(System.Web.UI.WebControls.Button))
                {
                    string sClaveRecurso = ((System.Web.UI.WebControls.Button)cn).Attributes["ClaveRecurso"];
                    if (sClaveRecurso != null && sClaveRecurso.Length > 0)
                    {
                        ((System.Web.UI.WebControls.Button)cn).Text = rm.GetString(sClaveRecurso);
                    }
                }
                else if (cn.GetType() == typeof(System.Web.UI.WebControls.TextBox))
                {
                    string sClaveRecurso = ((System.Web.UI.WebControls.TextBox)cn).Attributes["ClaveRecurso"];
                    if (sClaveRecurso != null && sClaveRecurso.Length > 0)
                    {
                        ((System.Web.UI.WebControls.TextBox)cn).Text = rm.GetString(sClaveRecurso);
                    }
                }
                else if (cn.GetType() == typeof(System.Web.UI.WebControls.HyperLink))
                {
                    string sClaveRecurso = ((System.Web.UI.WebControls.HyperLink)cn).Attributes["ClaveRecurso"];
                    if (sClaveRecurso != null && sClaveRecurso.Length > 0)
                    {
                        ((System.Web.UI.WebControls.HyperLink)cn).Text = rm.GetString(sClaveRecurso);
                    }
                }
                else if (cn.GetType() == typeof(System.Web.UI.WebControls.RadioButton))
                {
                    string sClaveRecurso = ((System.Web.UI.WebControls.RadioButton)cn).Attributes["ClaveRecurso"];
                    if (sClaveRecurso != null && sClaveRecurso.Length > 0)
                    {
                        ((System.Web.UI.WebControls.RadioButton)cn).Text = rm.GetString(sClaveRecurso);
                    }
                }
                else if (cn.GetType() == typeof(System.Web.UI.WebControls.CheckBox))
                {
                    string sClaveRecurso = ((System.Web.UI.WebControls.CheckBox)cn).Attributes["ClaveRecurso"];
                    if (sClaveRecurso != null && sClaveRecurso.Length > 0)
                    {
                        ((System.Web.UI.WebControls.CheckBox)cn).Text = rm.GetString(sClaveRecurso);
                    }
                }
                else if (cn.GetType() == typeof(System.Web.UI.WebControls.PlaceHolder))
                {
                    if (cn.ID.StartsWith("include"))
                    {
                        string sUrl = rm.GetString(cn.ID);
                        if (sUrl != null && sUrl.Length > 0)
                        {
                            Control control = Page.LoadControl(sUrl);
                            ((PlaceHolder)cn).Controls.Add(control);
                        }
                    }
                }
                else if (cn.GetType() == typeof(System.Web.UI.WebControls.Image))
                {
                    System.Web.UI.WebControls.Image imagen = (System.Web.UI.WebControls.Image)cn;
                    string sClaveRecurso = imagen.Attributes["ClaveRecurso"];
                    if (sClaveRecurso != null && sClaveRecurso.Length > 0)
                    {
                        string sUrlImagen = rm.GetString(sClaveRecurso);
                        sUrlImagen      = sUrlImagen.Replace("#COBRANDED", "Cobranded" + this.CobrandedID.ToString());
                        imagen.ImageUrl = sUrlImagen;
                    }
                }

                else if (cn.GetType() == typeof(System.Web.UI.HtmlControls.HtmlAnchor))
                {
                    System.Web.UI.HtmlControls.HtmlAnchor href = (System.Web.UI.HtmlControls.HtmlAnchor)cn;
                    string sClaveRecurso = href.Attributes["ClaveRecurso"];
                    if (sClaveRecurso != null && sClaveRecurso.Length > 0)
                    {
                        string sUrl = rm.GetString(sClaveRecurso);
                        sUrl      = sUrl.Replace("#COBRANDED", "Cobranded" + this.CobrandedID.ToString());
                        href.HRef = sUrl;
                    }

                    //Invoca recursivamente para traducir los labels que pueda haber dentro del href.
                    this.TraducirControles(href, rm);
                }

                else if (cn.GetType() == typeof(System.Web.UI.HtmlControls.HtmlInputButton))
                {
                    System.Web.UI.HtmlControls.HtmlInputButton boton = (System.Web.UI.HtmlControls.HtmlInputButton)cn;
                    string sClaveRecurso = boton.Attributes["ClaveRecurso"];
                    if (sClaveRecurso != null && sClaveRecurso.Length > 0)
                    {
                        ((System.Web.UI.HtmlControls.HtmlInputButton)cn).Value = rm.GetString(sClaveRecurso);
                    }
                }

                else if (cn.Controls.Count > 0)
                {
                    this.TraducirControles(cn, rm);
                }
            }
        }
Exemplo n.º 37
0
 public void AddButtonAttribute(System.Web.UI.HtmlControls.HtmlInputButton btn, string attributeKey, string content)
 {
     btn.Attributes[attributeKey] = content;
 }
Exemplo n.º 38
0
        protected override void AddContent()
        {
            Control content = AddDiv(Body, null);
            content.ID = "Content";
            
            if (ServiceClass.Description.Length > 0)
                AddGeneric(content, "span", "service-help", ServiceClass.Description);

            Control form = AddGeneric(content, "form");
            form.ID = "TestForm";
    
            Control selectionPara = AddPara(form, null, "Select method to test: ");
    
            HtmlSelect methodSelector = new HtmlSelect();
            methodSelector.ID = "Method";
            methodSelector.Attributes.Add("onchange", "return Method_onchange(this)");

            foreach (JsonRpcMethod method in SortedMethods)
                methodSelector.Items.Add(method.Name);
    
            selectionPara.Controls.Add(methodSelector);

            HtmlInputButton testButton = new HtmlInputButton();
            testButton.ID = "Test";
            testButton.Value = "Test";
            testButton.Attributes["onclick"] = "return Test_onclick(this)";
            testButton.Attributes["accesskey"] = "T";
            selectionPara.Controls.Add(new LiteralControl(" "));
            selectionPara.Controls.Add(testButton);

            selectionPara.Controls.Add(new LiteralControl(" "));

            HyperLink helpLink = new HyperLink();
            helpLink.Text = "Help";
            helpLink.NavigateUrl = Request.FilePath + "?help";
            selectionPara.Controls.Add(helpLink);

            Control requestPara = AddPara(form, null, "Request parameters: ");

            HtmlTextArea requestArea = new HtmlTextArea();
            requestArea.ID = "Request";
            requestArea.Rows = 10;
            requestArea.Attributes.Add("title", "Enter the array of parameters (in JSON) to send in the RPC request.");
            requestPara.Controls.Add(requestArea);
        
            Control responsePara = AddPara(form, null, "Response result/error: ");

            HtmlTextArea responseArea = new HtmlTextArea();
            responseArea.ID = "Response";
            responseArea.Rows = 10;
            responseArea.Attributes.Add("readonly", "readonly");
            responseArea.Attributes.Add("title", "The result or error object (in JSON) from the last RPC response.");
            responsePara.Controls.Add(responseArea);

            Control statsPara = AddPara(content, null, null);
            statsPara.ID = "Stats";

            Control headersPre = AddGeneric(content, "pre");
            headersPre.ID = "Headers";

            AddScriptInclude((Request.ApplicationPath.Equals("/") ? 
                string.Empty : Request.ApplicationPath) + "/json.js");

            AddScriptBlock(@"
                var callTemplates = " + BuildCallTemplatesObject() + @";
                var theForm = null;
                var nextRequestId = 0;

                Number.prototype.formatWhole = function()
                {
                    var s = this.toFixed(0).toString();
                    var groups = [];
                    while (s.length > 0)
                    {
                        groups.unshift(s.slice(-3));
                        s = s.slice(0, -3);
                    }
                    return groups.join();
                }

                window.onload = function() 
                { 
                    theForm = document.forms[0]; 
                    Method_onchange(theForm.Method); 
                }

                function Method_onchange(sender)
                {
                    theForm.Request.value = callTemplates[sender.options[sender.selectedIndex].value];
                }

                function Test_onclick(sender)
                {
                    var stats = document.getElementById('Stats');
                    setText(stats, null);

                    var headers = document.getElementById('Headers');
                    setText(headers, null);

                    var form = theForm;

                    try
                    {
                        var request = { 
                            id : ++nextRequestId, 
                            method : form.Method.value, 
                            params : JSON.parse(theForm.Request.value) };
                        
                        form.Response.value = '';
                        form.Response.className = '';
                        var response = callSync(request);
                        setText(stats, 'Time taken = ' + (response.timeTaken / 1000).toFixed(4) + ' milliseconds; Response size = ' + response.http.text.length.formatWhole() + ' char(s)');
                        setText(headers, response.http.headers);
                        if (response.error != null) throw response.error;
                        form.Response.value = JSON.stringify(response.result);
                    }
                    catch (e)
                    {
                        form.Response.className = 'error';
                        form.Response.value = JSON.stringify(e);
                        alert(e.message);
                    }
                }

                function callSync(request)
                {
                    var http = window.ActiveXObject ? 
                        new ActiveXObject('Microsoft.XMLHTTP') :
                        new XMLHttpRequest();
                    http.open('POST', '" + Request.FilePath + @"', false);
                    http.setRequestHeader('Content-Type', 'text/plain; charset=utf-8');
                    http.setRequestHeader('X-JSON-RPC', request.method);
                    http.send(JSON.stringify(request));
                    if (http.status != 200)
                        throw { message : http.status + ' ' + http.statusText, toString : function() { return this.message; } };
                    var clockStart = new Date();
                    var response = JSON.eval(http.responseText);
                    response.timeTaken = (new Date()) - clockStart;
                    response.http = { text : http.responseText, headers : http.getAllResponseHeaders() };
                    return response;
                }

                function setText(e, text)
                {
                    while (e.firstChild)
                        e.removeChild(e.firstChild);

                    if (text == null) 
                        return;

                    text = text.toString();

                    if (0 === text.length) 
                        return;

                    var textNode = document.createTextNode(text);
                    e.appendChild(textNode);
                }
                ");

            base.AddContent();
        }
Exemplo n.º 39
0
 /// <summary>
 /// 重载,初始化取消按钮
 /// </summary>
 /// <param name="cancelButton"></param>
 protected override void InitCancelButton(System.Web.UI.HtmlControls.HtmlInputButton cancelButton)
 {
     base.InitCancelButton(cancelButton);
 }
 protected override void InitCancelButton(System.Web.UI.HtmlControls.HtmlInputButton cancelButton)
 {
     cancelButton.Value = "关闭(C)";
 }
Exemplo n.º 41
0
			public void InstantiateIn(Control container)
			{
				HtmlInputButton l = new HtmlInputButton();
				l.Value = "Control template";
				container.Controls.Add(l);
			}
Exemplo n.º 42
0
 protected void rptList_ItemDataBound(object sender, System.Web.UI.WebControls.RepeaterItemEventArgs e)
 {
     if (e.Item.ItemType == System.Web.UI.WebControls.ListItemType.Item || e.Item.ItemType == System.Web.UI.WebControls.ListItemType.AlternatingItem)
     {
         System.Web.UI.WebControls.Repeater repeater = (System.Web.UI.WebControls.Repeater)e.Item.FindControl("rptSubList");
         OrderInfo orderInfo = OrderHelper.GetOrderInfo(System.Web.UI.DataBinder.Eval(e.Item.DataItem, "OrderID").ToString());
         if (orderInfo != null && orderInfo.LineItems.Count > 0)
         {
             repeater.DataSource = orderInfo.LineItems.Values;
             repeater.DataBind();
         }
         OrderStatus orderStatus = (OrderStatus)System.Web.UI.DataBinder.Eval(e.Item.DataItem, "OrderStatus");
         string      a           = "";
         if (!(System.Web.UI.DataBinder.Eval(e.Item.DataItem, "Gateway") is System.DBNull))
         {
             a = (string)System.Web.UI.DataBinder.Eval(e.Item.DataItem, "Gateway");
         }
         int num = (System.Web.UI.DataBinder.Eval(e.Item.DataItem, "GroupBuyId") != System.DBNull.Value) ? ((int)System.Web.UI.DataBinder.Eval(e.Item.DataItem, "GroupBuyId")) : 0;
         System.Web.UI.HtmlControls.HtmlInputButton htmlInputButton  = (System.Web.UI.HtmlControls.HtmlInputButton)e.Item.FindControl("btnModifyPrice");
         System.Web.UI.HtmlControls.HtmlInputButton htmlInputButton2 = (System.Web.UI.HtmlControls.HtmlInputButton)e.Item.FindControl("btnSendGoods");
         System.Web.UI.WebControls.Button           button           = (System.Web.UI.WebControls.Button)e.Item.FindControl("btnPayOrder");
         System.Web.UI.WebControls.Button           button2          = (System.Web.UI.WebControls.Button)e.Item.FindControl("btnConfirmOrder");
         System.Web.UI.HtmlControls.HtmlInputButton htmlInputButton3 = (System.Web.UI.HtmlControls.HtmlInputButton)e.Item.FindControl("btnCloseOrderClient");
         System.Web.UI.HtmlControls.HtmlAnchor      htmlAnchor       = (System.Web.UI.HtmlControls.HtmlAnchor)e.Item.FindControl("lkbtnCheckRefund");
         System.Web.UI.HtmlControls.HtmlAnchor      htmlAnchor2      = (System.Web.UI.HtmlControls.HtmlAnchor)e.Item.FindControl("lkbtnCheckReturn");
         System.Web.UI.HtmlControls.HtmlAnchor      htmlAnchor3      = (System.Web.UI.HtmlControls.HtmlAnchor)e.Item.FindControl("lkbtnCheckReplace");
         System.Web.UI.WebControls.Literal          literal          = (System.Web.UI.WebControls.Literal)e.Item.FindControl("WeiXinNickName");
         System.Web.UI.WebControls.Literal          literal2         = (System.Web.UI.WebControls.Literal)e.Item.FindControl("litOtherInfo");
         int        totalPointNumber = orderInfo.GetTotalPointNumber();
         MemberInfo member           = MemberProcessor.GetMember(orderInfo.UserId, true);
         if (member != null)
         {
             literal.Text = "买家:" + member.UserName;
         }
         System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();
         decimal total = orderInfo.GetTotal();
         if (total > 0m)
         {
             stringBuilder.Append("<strong>¥" + total.ToString("F2") + "</strong>");
             stringBuilder.Append("<small>(含运费¥" + orderInfo.AdjustedFreight.ToString("F2") + ")</small>");
         }
         if (totalPointNumber > 0)
         {
             stringBuilder.Append("<small>" + totalPointNumber.ToString() + "积分</small>");
         }
         if (orderInfo.PaymentType == "货到付款")
         {
             stringBuilder.Append("<span class=\"setColor bl\"><strong>货到付款</strong></span>");
         }
         if (string.IsNullOrEmpty(stringBuilder.ToString()))
         {
             stringBuilder.Append("<strong>¥" + total.ToString("F2") + "</strong>");
         }
         literal2.Text = stringBuilder.ToString();
         if (orderStatus == OrderStatus.WaitBuyerPay)
         {
             htmlInputButton.Visible = true;
             htmlInputButton.Attributes.Add("onclick", "DialogFrame('../trade/EditOrder.aspx?OrderId=" + System.Web.UI.DataBinder.Eval(e.Item.DataItem, "OrderID") + "&reurl='+ encodeURIComponent(goUrl),'修改订单价格',900,450)");
             htmlInputButton3.Attributes.Add("onclick", "CloseOrderFun('" + System.Web.UI.DataBinder.Eval(e.Item.DataItem, "OrderID") + "')");
             htmlInputButton3.Visible = true;
             if (a != "hishop.plugins.payment.podrequest")
             {
                 button.Visible = true;
             }
         }
         if (orderStatus == OrderStatus.ApplyForRefund)
         {
             htmlAnchor.Visible = true;
         }
         if (orderStatus == OrderStatus.ApplyForReturns)
         {
             htmlAnchor2.Visible = true;
         }
         if (orderStatus == OrderStatus.ApplyForReplacement)
         {
             htmlAnchor3.Visible = true;
         }
         if (num > 0)
         {
             GroupBuyStatus groupBuyStatus = (GroupBuyStatus)System.Web.UI.DataBinder.Eval(e.Item.DataItem, "GroupBuyStatus");
             htmlInputButton2.Visible = (orderStatus == OrderStatus.BuyerAlreadyPaid && groupBuyStatus == GroupBuyStatus.Success);
         }
         else
         {
             htmlInputButton2.Visible = (orderStatus == OrderStatus.BuyerAlreadyPaid || (orderStatus == OrderStatus.WaitBuyerPay && a == "hishop.plugins.payment.podrequest"));
         }
         htmlInputButton2.Attributes.Add("onclick", "DialogFrame('../trade/SendOrderGoods.aspx?OrderId=" + System.Web.UI.DataBinder.Eval(e.Item.DataItem, "OrderID") + "&reurl='+ encodeURIComponent(goUrl),'订单发货',750,220)");
         button2.Visible = (orderStatus == OrderStatus.SellerAlreadySent);
     }
 }