protected override void CreateChildControls() { Controls.Clear(); EmailAddressLabel = new Label(); EmailAddressLabel.ID = "EmailAddressLabel"; EmailAddressLabel.AssociatedControlID = "EmailAddressTextBox"; EmailAddressLabel.Text = "Your email address (optional):"; Controls.Add(EmailAddressLabel); EmailAddressTextBox = new TextBox(); EmailAddressTextBox.ID = "EmailAddressTextBox"; EmailAddressTextBox.Columns = 50; Controls.Add(EmailAddressTextBox); DetailLabel = new Label(); DetailLabel.ID = "DetailLabel"; DetailLabel.AssociatedControlID = "DetailTextBox"; DetailLabel.Text = "Describe what you were doing when the error occurred (optional):"; Controls.Add(DetailLabel); DetailTextBox = new TextBox(); DetailTextBox.ID = "DetailTextBox"; DetailTextBox.TextMode = TextBoxMode.MultiLine; DetailTextBox.Columns = 50; DetailTextBox.Rows = 10; Controls.Add(DetailTextBox); SendButton = new Button(); SendButton.ID = "SendButton"; SendButton.Text = "Send"; SendButton.Click += OnSendButtonClick; Controls.Add(SendButton); }
protected override void CreateChildControls() { // base.CreateChildControls(); // Add Literal Controls this.Controls.Add(new LiteralControl("<h3>Value: ")); // Add Textbox TextBox box = new TextBox(); box.Text = "0"; box.TextChanged +=new EventHandler(this.TextBox_Changed); this.Controls.Add(box); // Add Literal Controls this.Controls.Add(new LiteralControl("</h3>")); // Add "Add" Button Button addButton = new Button(); addButton.Text = "Add"; addButton.Click += new EventHandler(this.AddBtn_Click); this.Controls.Add(addButton); // Add Literal Controls this.Controls.Add(new LiteralControl(" | ")); // Add "Subtract" Button Button subtractButton = new Button(); subtractButton.Text = "Subtract"; subtractButton.Click += new EventHandler(this.SubtractBtn_Click); this.Controls.Add(subtractButton); }
public void create_request_table(string stg1, string stg2) { TableRow row = new TableRow(); TableCell cell1 = new TableCell(); cell1.Text = "<h4 class = 'font-thai font-1d8'>" + stg1 + "</h4>"; row.Cells.Add(cell1); cell1 = new TableCell(); cell1.Text = "<h4 class = 'font-thai font-1d8'>" + stg2 + "</h4>"; row.Cells.Add(cell1); cell1 = new TableCell(); Button bt = new Button(); bt.CssClass = "mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--accent"; bt.Text = "ยืนยัน"; bt.Click += delegate { teacher_delete(stg1); }; cell1.Controls.Add(bt); bt = new Button(); bt.CssClass = "mdl-button mdl-js-button mdl-button--raised mdl-button--colored"; bt.Text = "ดู"; cell1.Controls.Add(bt); bt = new Button(); bt.CssClass = "mdl-button mdl-js-button mdl-button--accent"; bt.Text = "ไม่ยืนยัน"; bt.Click += delegate { teacher_delete(stg1); }; cell1.Controls.Add(bt); row.Cells.Add(cell1); request_view_table.Rows.Add(row); }
protected void Page_Load(object sender, EventArgs e) { p = (Person)Session["Person"]; if (p != null) { itemTable.Visible = false; Label2.Visible = false; personTable.Visible = false; Label3.Visible = false; foreach (ShoppingList sl in p.shoppingLists) { Button b = new Button(); TableRow row = new TableRow(); TableCell liste = new TableCell(); b.ID = sl.ShoppingListNumber.ToString(); b.Text = sl.Title; b.Click += ItemButton_Click; liste.Controls.Add(b); row.Cells.Add(liste); listTable.Rows.Add(row); } } else { Label1.Text = "Log venligst ind"; } }
public static Button GetButton(string text,string css) { Button button = new Button(); button.Text = text; if(css.Length > 0) button.CssClass = css; return button; }
protected override void OnInit(EventArgs e) { base.OnInit(e); LiteralControl lastExport = CreateLastExport(); tbFrom = new TextBox(); tbFrom.ID = "tbFrom"; tbFrom.Text = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1).ToString("yyyy.MM.dd"); tbTo = new TextBox(); tbTo.ID = "tbTo"; tbTo.Text = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1).AddMonths(1).ToString("yyyy.MM.dd"); Button btnExport = new Button(); btnExport.ID = "btnExport"; btnExport.Text = HttpContext.GetGlobalResourceObject("FormPortlet", "ExportToCsv") as string;//"Export to .csv"; btnExport.Click += new EventHandler(btnExport_Click); Controls.Add(new LiteralControl(HttpContext.GetGlobalResourceObject("FormPortlet", "DateFrom") as string)); Controls.Add(tbFrom); Controls.Add(new LiteralControl(HttpContext.GetGlobalResourceObject("FormPortlet", "DateTo") as string)); Controls.Add(tbTo); Controls.Add(btnExport); if (lastExport != null) Controls.Add(lastExport); }
private static void ComputerMove() { Random rand = new Random(); int positionIndex = rand.Next(0, freePositions.Count); Position position = freePositions[positionIndex]; int row = position.X; int col = position.Y; if (game[row, col] == '*') { game[row, col] = computerCharacter; freePositions.Remove(position); Button btn = new Button(); Page page = new Page(); if (HttpContext.Current != null) { page = (Page)HttpContext.Current.Handler; btn = (Button)page.FindControl("Btn" + row + col); btn.Text = computerCharacter.ToString(); } if (Win(computerCharacter)) { Label lbWinner = (Label)page.FindControl("Winner"); lbWinner.Text = "You win!"; lbWinner.Visible = true; computerScores++; UpdateScores(page); return; } } else { ComputerMove(); } }
/// <summary> /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering. /// </summary> protected override void CreateChildControls() { base.CreateChildControls(); base.Controls.Clear(); _dfltShowButton = new Button(); base.Controls.Add(_dfltShowButton); _dfltShowButton.ID = "default"; _dfltShowButton.Attributes.Add("style","display:none"); _dialogPanel = new Panel(); base.Controls.Add( _dialogPanel ); _dialogPanel.ID = "panel"; _dialogPanel.CssClass = "rock-modal-frame"; _dialogPanel.Attributes.Add("style","display:none"); _contentPanel = new Panel(); _dialogPanel.Controls.Add( _contentPanel ); _contentPanel.ID = "contentPanel"; _contentPanel.CssClass = "iframe"; _iFrame = new HtmlGenericControl( "iframe" ); _iFrame.ID = "iframe"; _iFrame.Attributes.Add( "scrolling", "no" ); _contentPanel.Controls.Add( _iFrame ); this.PopupControlID = _dialogPanel.ID; }
protected override void CreateChildControls() { base.CreateChildControls(); var tbl = new Table(); var row = new TableRow(); var cell = new TableCell { ColumnSpan = 2, VerticalAlign = VerticalAlign.Middle, HorizontalAlign = HorizontalAlign.Center }; var lblTitle = new Label {Text = "This WebPart will send a parameter to a consumer:"}; cell.Controls.Add(lblTitle); row.Controls.Add(cell); tbl.Controls.Add(row); row = new TableRow(); cell = new TableCell {VerticalAlign = VerticalAlign.Middle, HorizontalAlign = HorizontalAlign.Center}; _textBox = new TextBox {Text = "", Width = Unit.Pixel(120)}; cell.Controls.Add(_textBox); row.Controls.Add(cell); cell = new TableCell {VerticalAlign = VerticalAlign.Middle, HorizontalAlign = HorizontalAlign.Center}; _button = new Button {Text = "Send..."}; _button.Click += btn_Click; cell.Controls.Add(_button); row.Controls.Add(cell); tbl.Controls.Add(row); Controls.Add(tbl); }
protected override void CreateChildControls() { base.CreateChildControls(); Label lbl = new Label(); TextBox txt = new TextBox(); Button btn = new Button(); DateTime dt = DateTime.Now; btn.Text = "Show All Lists"; btn.Click += delegate { do { SPWebCollection Webs; SPListCollection lists; Webs = SPContext.Current.Site.AllWebs; foreach (SPWeb web in Webs) { lists = web.Lists; foreach (SPList list in lists) lbl.Text = lbl.Text + "<br>" + list.Title; } } while (dt.AddSeconds(int.Parse(txt.Text)).CompareTo(DateTime.Now) > 0); }; Controls.Add(txt); Controls.Add(btn); Controls.Add(lbl); }
/// <summary> /// Initializes a new instance of the <see cref="View" /> class. /// </summary> protected View() : base(HtmlTextWriterTag.Div) { Presenter = new Presenter(this); _answerCountLabel = new Label() { Text = ResourceHelper.GetString("AnswerCountDropDownLabel") }; _answerCountDropDown = new DropDownList() { AutoPostBack = true }; QuestionComposerControl = new QuestionComposer() { QuestionLabelText = ResourceHelper.GetString("QuestionLabelText"), AnswerLabelText = ResourceHelper.GetString("AnswerLabelText"), FractionLabelText = ResourceHelper.GetString("FractionLabelText"), ValidatorErrorMessage = ResourceHelper.GetString("FractionValidatorErrorMessage"), IsVisibleLabelText = ResourceHelper.GetString("IsVisibleLabelText") }; _generateXmlButton = new Button() { Text = ResourceHelper.GetString("GenerateXMLButtonText") }; _generateXmlButton.Click += GenerateXmlButton_Click; }
protected override void InitializeSkin(System.Web.UI.Control Skin) { LogTitle = (TextBox)Skin.FindControl("LogTitle"); Search = (Button)Skin.FindControl("Search"); Search.Click += new EventHandler(Search_Click); //throw new NotImplementedException(); }
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { // Create cancel order button Button cancelBtn = new Button(); cancelBtn.Style.Add("width", "105px"); cancelBtn.Style.Add("padding", "5px"); cancelBtn.Style.Add("margin", "5px"); cancelBtn.Enabled = false; cancelBtn.Text = "Cancel order"; if (e.Row.RowIndex > -1) { // Change tracking ID to link String track = e.Row.Cells[4].Text; if (track != " " && track.Length > 0) { Literal trackLink = new Literal(); trackLink.Text = "<a style='color: blue;' href='" + track + "'/>Track</a>"; e.Row.Cells[4].Controls.Add(trackLink); } // Add buttons to column String oid = e.Row.Cells[0].Text; Literal invoiceLink = new Literal(); invoiceLink.Text = "<a style='color: blue;' href='Invoice.aspx?oid=" + oid + "'/>" + oid + "</a>"; e.Row.Cells[0].Controls.Add(invoiceLink); e.Row.Cells[e.Row.Cells.Count - 1].Controls.Add(cancelBtn); // Pass order id & row to on-click event //cancelBtn.Click += new EventHandler(this.cancelBtn_Click); cancelBtn.CommandArgument = e.Row.RowIndex + "-" + oid; } }
protected override void CreateChildControls() { Random random = new Random(); _firstInt = random.Next(0, 20); _secondInt = random.Next(0, 20); ResourceManager rm = new ResourceManager("SystemWebExtensionsAUT.LocalizingClientResourcesWalkthrough.VerificationResources", this.GetType().Assembly); Controls.Clear(); _firstLabel = new Label(); _firstLabel.ID = "firstNumber"; _firstLabel.Text = _firstInt.ToString(); _secondLabel = new Label(); _secondLabel.ID = "secondNumber"; _secondLabel.Text = _secondInt.ToString(); _answer = new TextBox(); _answer.ID = "userAnswer"; _button = new Button(); _button.ID = "Button"; _button.Text = rm.GetString("Verify"); _button.OnClientClick = "return CheckAnswer();"; Controls.Add(_firstLabel); Controls.Add(new LiteralControl(" + ")); Controls.Add(_secondLabel); Controls.Add(new LiteralControl(" = ")); Controls.Add(_answer); Controls.Add(_button); }
public void InstantiateIn(Control objContainer) { Button btn = new Button(); btn.CommandName = strCommandName; btn.DataBinding += new EventHandler(btn_DataBinding); objContainer.Controls.Add(btn); }
public override void InitializeCell(TableCell cell, int columnIndex, ListItemType itemType) { base.InitializeCell(cell, columnIndex, itemType); if (Enum.IsDefined(typeof(ListItemType), itemType) && itemType != ListItemType.Footer && itemType != ListItemType.Header) { WebControl toDisplay = null; if(ButtonType == ButtonColumnType.PushButton) { Button b = new Button(); b.Text = Text; b.CommandName = CommandName; b.CausesValidation = false; toDisplay = b; } else { LinkButton lb = new DataGridLinkButton(); lb.Text = Text; lb.CommandName = CommandName; lb.CausesValidation = false; toDisplay = lb; } if(DataTextField.Length > 0) { toDisplay.DataBinding += new EventHandler(OnDataBindButtonColumn); } cell.Controls.Add(toDisplay); } }
/// <summary> /// 根据参数,控制按钮的显示或隐藏 /// </summary> /// <param name="InCheck">是否是在审核状态下</param> /// <param name="DateStatus">数据状态</param> /// <param name="btnEdit">修改保存按钮</param> /// <param name="btnSubmit">提交按钮</param> /// <param name="btnReturn">返回按钮</param> public void SetBtnStatus(bool InCheck, string DateStatus, Button btnEdit, Button btnSubmit, Button btnReturn, Button btnAtt) { //根据明细判断:审核用(按钮全隐藏) //数据状态:0保存未提交(可修改);1提交待审批;2审批通过(不可修改);3退回(可修改);4审批暂停(可修改) if (InCheck) //如果是审核状态,则隐藏按钮 { if (btnEdit != null) btnEdit.Visible = false; if (btnSubmit != null) btnSubmit.Visible = false; if (btnReturn != null) btnReturn.Visible = false; if (btnAtt != null) btnAtt.Visible = false; } else if (DateStatus == "0" || DateStatus == "3" || DateStatus == "4") //可修改和提交 { if (btnEdit != null) btnEdit.Enabled = true; if (btnSubmit != null) btnSubmit.Enabled = true; if (btnAtt != null) btnAtt.Enabled = true; } else if (DateStatus == "1" || DateStatus == "2") //不可修改和提交 { if (btnEdit != null) btnEdit.Enabled = false; if (btnSubmit != null) btnSubmit.Enabled = false; if (btnAtt != null) btnAtt.Enabled = false; } }
/// <summary> /// Must create and return the control /// that will show the logon interface. /// If none is available returns null /// </summary> public Control GetLoginInterface(Style controlStyle) { this._uIdTable = new Table(); TableCell cell = new TableCell(); TableRow row = new TableRow(); Button child = new Button(); child.Click += new EventHandler(this.OnUIdSubmit); this._uIdTextBox = new TextBox(); this._uIdTextBox.CssClass = "lddl"; //this._uIdTable.ControlStyle.Font.CopyFrom(controlStyle.Font); this._uIdTable.ControlStyle.CssClass = "tablelddl "; this._uIdTable.Width = Unit.Percentage(100.0); child.Text = ResourceManager.GetString("SubmitUId"); child.CssClass = "btn btn-primary btn-xs bw"; cell.Controls.Add(new LiteralControl(ResourceManager.GetString("EnterUIdMessage", this.LanguageCode))); row.Cells.Add(cell); this._uIdTable.Rows.Add(row); cell = new TableCell(); row = new TableRow(); cell.Controls.Add(this._uIdTextBox); cell.Controls.Add(child); row.Cells.Add(cell); this._uIdTable.Rows.Add(row); return this._uIdTable; }
public override void Ini() { CssClass = "_devices"; burnerList = new Dictionary<string, Devices>(); burnerList = ((Bake)deviceList[name]).GetBurnerList(); bakeOvenList = ((Bake)deviceList[name]).GetBakeOvenList(); panelName = new Panel(); panelName.CssClass = "_bakePanelName"; labelName = new Label(); labelName.Text = name; panelName.Controls.Add(labelName); buttonDelete = new Button(); buttonDelete.Text = "X"; buttonDelete.CssClass = "_buttonDelete"; buttonDelete.Click += Delete_Click; Controls.Add(panelName); Controls.Add(buttonDelete); foreach (var burner in burnerList) { Controls.Add(((IDraw)burner.Value).Draw(burner.Key, burnerList)); } foreach (var oven in bakeOvenList) { Controls.Add(((IDraw)oven.Value).Draw(oven.Key, bakeOvenList)); } }
public void displayJoiners() { //display all the joiners of this event IEnumerable<withid> joiners =( from i in db.calendar_joinevent join j in db.aspnet_Users on i.UserId equals j.UserId where i.eventid == eventid select new withid { Friend = j.UserName, id = j.UserId }); joinlist.Controls.Clear(); foreach (withid i in joiners) { withid inner = i; Button newb = new Button(); newb.BackColor = Color.White; newb.ForeColor = Color.Green; newb.BorderStyle = BorderStyle.None; newb.Text = i.Friend; newb.ID = i.Friend; newb.Click+=new EventHandler(delegate(object sender,EventArgs e){ Utilities.Utilities.redirectToFriendHome( Session, Response, i.id, i.Friend); }); this.joinlist.Controls.Add(newb); } // ret += "<a href=\"\">" + i + "</a> "; // this.joinlist.Text = ret; }
protected void Page_Init(object sender, EventArgs e) { FineUI.Button btn = new Button(); btn.Text = "工具栏中的按钮数(动态添加的按钮)"; btn.Click += new EventHandler(btn_Click); Toolbar1.Items.Add(btn); }
/// <summary> /// Method <c>setToEditionMode</c> is used when the gadgetContainer is shown /// in cockpit edition page. /// </summary> public void setToEditionMode() { gadgetTitle.Text = ""; gadgetPanel.Style.Add("height", gadget.getHeight().ToString()+"px"); gadgetPanel.Style.Add("width", this.gadgetContainerPanel.Width.ToString()+"px"); gadgetPanel.BackColor = System.Drawing.ColorTranslator.FromHtml("#83a1bd"); Label lblGadgetName = new Label(); lblGadgetName.Text = gadget.getUniqueID() + " - " + gadget.getName(); lblGadgetName.Style.Add("font-size", "20px"); gadgetPanel.Controls.Add(lblGadgetName); Button btnRemoveGadget = new Button(); btnRemoveGadget.ID = "btnRemoveGadget" + gadget.getUniqueID(); btnRemoveGadget.Style.Add("background-image", "url(Images/stop-12x12.png)"); btnRemoveGadget.Style.Add("background-repeat", "no-repeat"); btnRemoveGadget.Style.Add("width", "13px"); btnRemoveGadget.Style.Add("height", "16px"); btnRemoveGadget.CommandArgument = gadget.getUniqueID().ToString(); //handler used when user remove the gadget EventHandler btnHandler = new EventHandler(removeGadget); btnRemoveGadget.Click += btnHandler; header.Controls.Add(btnRemoveGadget); }
/// <summary> /// Called by the ASP.NET page framework to notify server controls /// that use composition-based implementation to create any child controls /// they contain in preparation for posting back or rendering. /// </summary> protected override void CreateChildControls() { base.CreateChildControls(); m_MainPanel = new UpdatePanel(); m_MainPanel.RenderMode = UpdatePanelRenderMode.Inline; // The next two lines ensure that nothing is sent to the client, // as there's no information to send anyway. This reduces overhead. m_MainPanel.UpdateMode = UpdatePanelUpdateMode.Conditional; m_MainPanel.ChildrenAsTriggers = false; Controls.Add(m_MainPanel); m_TypeBox = new TextBox(); m_TypeBox.ID = "Type"; m_TypeBox.EnableViewState = false; m_TypeBox.ValidationGroup = "Communicator"; m_MainPanel.ContentTemplateContainer.Controls.Add(m_TypeBox); m_MessageBox = new TextBox(); m_MessageBox.ID = "Message"; m_MessageBox.EnableViewState = false; m_MessageBox.ValidationGroup = "Communicator"; m_MainPanel.ContentTemplateContainer.Controls.Add(m_MessageBox); m_SubmitButton = new Button(); m_SubmitButton.ID = "Submit"; m_MessageBox.EnableViewState = false; m_SubmitButton.ValidationGroup = "Communicator"; m_SubmitButton.Click += new EventHandler(SubmitButton_Click); m_MainPanel.ContentTemplateContainer.Controls.Add(m_SubmitButton); }
public static void _TestStyle (Page p) { Button b = new Button (); b.BackColor = Color.Red; b.ID = "Yoni"; p.Controls.Add (b); }
protected void AddAdress(string id) { // 用以显示地址编号的Label. Label lb = new Label(); lb.Text = "地址" + id + ": "; // 用以输入地址的TextBox. TextBox tb = new TextBox(); tb.ID = "TextBox" + id; if (id != "1") { // 可以尝试不带判定条件下的这句代码. // 单击Save按钮后会有很奇怪的行为. tb.Text = Request.Form[tb.ID]; } // 用以检查地址的Button. // 同时演示如何绑定事件到一个动态控件上. Button btn = new Button(); btn.Text = "检查"; btn.ID = "Button" + id; // 使用+=运算符绑定事件. btn.Click += new EventHandler(ClickEvent); Literal lt = new Literal() { Text = "<br />" }; // 作为一个组件添加这些控件到pnlAddressContainer. pnlAddressContainer.Controls.Add(lb); pnlAddressContainer.Controls.Add(tb); pnlAddressContainer.Controls.Add(btn); pnlAddressContainer.Controls.Add(lt); }
protected override void CreateChildControls() { base.CreateChildControls(); TitleLabel = new Label(); TitleLabel.Text = "Titel"; this.Controls.Add(TitleLabel); TitleTextBox = new TextBox(); this.Controls.Add(TitleTextBox); BodyLabel = new Label(); BodyLabel.Text = "Text"; this.Controls.Add(BodyLabel); BodyTextArea = new TextBox(); BodyTextArea.TextMode = TextBoxMode.MultiLine; this.Controls.Add(BodyTextArea); ExpireLabel = new Label(); ExpireLabel.Text = "Ablaufdatum"; this.Controls.Add(ExpireLabel); ExpireTextBox = new TextBox(); this.Controls.Add(ExpireTextBox); AddButton = new Button(); AddButton.Text = "Hinzufügen"; AddButton.ID = "AddButton"; AddButton.Click += AddButtonClick; this.Controls.Add(AddButton); }
private void displayShow(PlaceHolder placeholder, int shid) { placeholder.Controls.Clear(); Show show = new Show(); show.id = Convert.ToInt32(Request["shid"]); show.get(); TextBox tickets = new TextBox(); tickets.ID = "numOfTickets"; Button order = new Button(); order.Text = "Order!"; order.Click += new System.EventHandler(this.orderClick); HiddenField hiddenShid = new HiddenField(); hiddenShid.Value = shid.ToString(); hiddenShid.ID = "hiddenShid"; placeholder.Controls.Add(new LiteralControl("<h1>"+show.read("moid", true)+" @ "+show.read("show_start")+"</h1>")); placeholder.Controls.Add(new LiteralControl("<p>### tickets left</p>")); placeholder.Controls.Add(new LiteralControl("<p>Please input # of tickets you want to order</p>")); placeholder.Controls.Add(tickets); placeholder.Controls.Add(order); placeholder.Controls.Add(new LiteralControl("<br /><br /><a href=\"order_ticket.aspx\">Back to show list</a>")); placeholder.Controls.Add(hiddenShid); }
private TableCell CreateLinks(SoftwareDto software) { var tc = new TableCell(); var btnDetail = new Button { Text = "Details", CssClass = "btn btn-info", ID = "btnDetail_" + software.Id, PostBackUrl = "SoftwareDetails.aspx?id=" + software.Id }; var btnEdit = new Button { ID = "btnEdit_" + software.Id, Text = "Edit", CssClass = "btn btn-warning", PostBackUrl = "SoftwareEdit.aspx?id=" + software.Id }; var btnDelete = new Button { Text = "Delete", CssClass="btn btn-danger" }; tc.Controls.Add(btnDetail); tc.Controls.Add(new Label() { Text = " " }); tc.Controls.Add(btnEdit); tc.Controls.Add(new Label() { Text = " " }); tc.Controls.Add(btnDelete); return tc; }
protected override void InitializeSkin(System.Web.UI.Control Skin) { KeyWords=(TextBox)Skin.FindControl("KeyWords"); AllowPsd = (CheckBox)Skin.FindControl("AllowPsd"); IsEnReply = (CheckBox)Skin.FindControl("IsEnReply"); IsIndexShow = (CheckBox)Skin.FindControl("IsIndexShow"); AllowPsd.Attributes.Add("onclick", "AllowPsd()"); TextBox1 = (TextBox)Skin.FindControl("TextBox1"); TextBox2 = (TextBox)Skin.FindControl("TextBox2"); //js把logId写入 CreateTime = (TextBox)Skin.FindControl("CreateTime"); if (!Page.IsPostBack) { CreateTime.Text = DateTime.Now.ToString(); } LogIdTex = (TextBox)Skin.FindControl("LogId");//没有用到啊··· Title = (TextBox)Skin.FindControl("title"); Add = (Button)Skin.FindControl("Add"); AddDraft = (Button)Skin.FindControl("AddDraft"); Cansel = (Button)Skin.FindControl("Cansel"); Editor = (TextBox)Skin.FindControl("txtContent"); LogCategory = (DropDownList)Skin.FindControl("LogCategory"); this.DataBind(); }
private void LoadToolbar() { XmlDocument doc = LoadXml(); // 根节点的子节点们 XmlNodeList nodes = doc.DocumentElement.ChildNodes; foreach (XmlNode node in nodes) { FineUI.Button btn = new Button(); btn.Text = node.Attributes["text"].Value; btn.EnablePostBack = false; Toolbar1.Items.Add(btn); // 如果此节点没有子节点 if (node.ChildNodes.Count == 0) { XmlAttribute attrURL = node.Attributes["navigateurl"]; if (attrURL != null) { btn.OnClientClick = String.Format("window.open('{0}','_blank')", attrURL.Value); } } else { ResolveMenu(btn, node.ChildNodes); } } }
/// <summary> /// 让服务器按钮点击后变灰 /// </summary> /// <param name="button"></param> /// <param name="newText">点后的显示文本</param> public static void ClickDisabled(this System.Web.UI.WebControls.Button button, string newText = "") { if (button == null) { return; } StringBuilder js = new StringBuilder(); System.Web.UI.Page page = (System.Web.UI.Page)HttpContext.Current.Handler; page.ClientScript.GetPostBackEventReference(button, string.Empty); if (!button.ValidationGroup.IsNullOrEmpty()) { js.AppendFormat("if({0})", button.ValidationGroup); js.Append("{"); if (!button.OnClientClick.IsNullOrEmpty()) { js.Append(button.OnClientClick); } js.Append("this.disabled=true;"); if (!newText.IsNullOrEmpty()) { js.AppendFormat("this.value=\"{0}\";", newText); } js.AppendFormat("__doPostBack(\"{0}\",\"\");", button.ID); js.Append("}else{return false;}"); } else { if (!button.OnClientClick.IsNullOrEmpty()) { js.Append(button.OnClientClick); } js.Append("this.disabled=true;"); if (!newText.IsNullOrEmpty()) { js.AppendFormat("this.value=\"{0}\";", newText); } js.AppendFormat("__doPostBack(\"{0}\",\"\");", button.ID); } button.OnClientClick = js.ToString(); }
protected void Page_Load(object sender, EventArgs e) { for (int i = 0; i < gvViewQuotes.Rows.Count; i++) { bool submitted = false; string referenceNum = gvViewQuotes.Rows[i].Cells[0].Text; //check to see if the quote is submitted. if it is, the hyperlink will be disabled and the text will be: "submitted" SqlConnection connSubmitted = Website.getSQLConnection(); SqlCommand cmdSubmitted = Website.getSQLCommand(connSubmitted); cmdSubmitted.CommandText = "SELECT * FROM quote where Reference# = " + Convert.ToInt32(referenceNum) + "AND Submitted = 1"; cmdSubmitted.CommandType = System.Data.CommandType.Text; SqlDataReader readerSubmitted; connSubmitted.Open(); readerSubmitted = cmdSubmitted.ExecuteReader(); int counterSubmitted = 0; while (readerSubmitted.Read()) { counterSubmitted++; } if (counterSubmitted > 0) { submitted = true; } connSubmitted.Close(); HyperLink hyperlink = new HyperLink(); hyperlink.Text = "Edit"; hyperlink.NavigateUrl = "~/Wepages/Applicant.aspx/?ReferenceNum=" + referenceNum; if (submitted) { hyperlink.Text = "Submitted"; hyperlink.Enabled = false; gvViewQuotes.Rows[i].Cells[4].Controls.Add(hyperlink); } else { gvViewQuotes.Rows[i].Cells[4].Controls.Add(hyperlink); } /*System.Web.UI.WebControls.Button btnView = new System.Web.UI.WebControls.Button(); * btnView.ID = "btnView"; * btnView.Text = "View PDF"; * btnView.Click += new System.EventHandler((s, ea) => viewPDF(s, ea, referenceNum)); * gvViewQuotes.Rows[i].Cells[5].Controls.Add(btnView);*/ SqlConnection conn = Website.getSQLConnection(); SqlCommand cmd = Website.getSQLCommand(conn); cmd.CommandText = "select * from QuotePDFs where pdfID = (select quoteID from quote where reference# = " + referenceNum + ")"; cmd.CommandType = System.Data.CommandType.Text; SqlDataReader readerPDF; conn.Open(); readerPDF = cmd.ExecuteReader(); int count = 0; while (readerPDF.Read()) { count++; } try { if (count == 1) { System.Web.UI.WebControls.Button btnView = new System.Web.UI.WebControls.Button(); btnView.ID = "btnView"; btnView.Text = "View PDF"; btnView.Click += new System.EventHandler((s, ea) => viewPDF(s, ea, referenceNum)); gvViewQuotes.Rows[i].Cells[5].Controls.Add(btnView); } } catch { } conn.Close(); // add view pdf btn System.Web.UI.WebControls.Button btnFinalize = new System.Web.UI.WebControls.Button(); btnFinalize.ID = "btnFinalize"; btnFinalize.Text = "Finalize"; btnFinalize.OnClientClick = "return confirm('You are Finalizing this quote. Click Ok to confirm.');"; btnFinalize.Click += new System.EventHandler((s, ea) => btnFinalize_Click(s, ea, referenceNum)); if (!submitted) { gvViewQuotes.Rows[i].Cells[6].Controls.Add(btnFinalize); } } if (gvViewQuotes.Rows.Count < 1) { SqlConnection conn = Website.getSQLConnection(); SqlCommand cmd = Website.getSQLCommand(conn); try { lblSearchInput.Text = "No results found. Please fill out your Agency Information if you have not done so."; } catch { } } }
protected void GV_RowCommand(object sender, GridViewCommandEventArgs e) { lbid = hlbid.Value; System.Web.UI.WebControls.Button btn = e.CommandSource as System.Web.UI.WebControls.Button; if (btn == null) { return; } int index = ((System.Web.UI.WebControls.GridViewRow)btn.Parent.Parent).RowIndex; DataKey key = this.GV.DataKeys[index]; string NewsID = key.Value.ToString(); GridViewRow gvr = GV.Rows[index]; if (e.CommandName == "upFile") { //寻找上传控件 FileUpload fu_small = (FileUpload)gvr.FindControl("FileUpload2"); //缩略图 FileUpload fu = (FileUpload)gvr.FindControl("FileUpload1"); //原图 string pic = "", picSmall = ""; //上传图片 pic = UpFile(fu); //上传图片 //picSmall = UpFile(fu_small); if (pic != "") { picSmall = pic.ToLower().Replace(".jpg", "_s.jpg"); SQLHelper db = new SQLHelper(); //删除原图 db.sql = "SELECT pic FROM " + com.tablePrefix + "News WHERE NewsID=" + NewsID; string pic0 = db.Get_DataTable().Rows[0][0].ToString(); if (pic0.Length > 0) { FileSys.delFile(pic0); } //更新数据库 db.sql = "UPDATE News SET pic='" + pic + "' WHERE NewsID=" + NewsID; db.ExecSql(); bindGv(); alert.Show(Page, "图片更新成功"); } if (picSmall != "") { SQLHelper db = new SQLHelper(); //删除原图 db.sql = "SELECT picSmall FROM " + com.tablePrefix + "News WHERE NewsID=" + NewsID; string pic0 = db.Get_DataTable().Rows[0][0].ToString(); if (pic0.Length > 0) { FileSys.delFile(pic0); } //更新数据库 db.sql = "UPDATE News SET picSmall='" + picSmall + "' WHERE NewsID=" + NewsID; db.ExecSql(); bindGv(); alert.Show(Page, "图片更新成功"); } } if (e.CommandName == "Save") { //查找 title控件 TextBox txtTitle = null; try { txtTitle = this.GV.Rows[index].Cells[1].Controls[0] as TextBox; } catch { alert.Show(Page, "未找到标题控件"); return; } TextBox txtEditTime = null; try { txtEditTime = this.GV.Rows[index].Cells[2].Controls[0] as TextBox; } catch { alert.Show(Page, "未找到标题控件"); return; } //FileUpload fu_small = gvr.Cells[4].FindControl("FileUpload2") as FileUpload;//缩略图 FileUpload fu = gvr.Cells[4].FindControl("FileUpload1") as FileUpload; string title = pg.GetSafeString(txtTitle.Text.Trim()); string EditTime = pg.GetSafeString(txtEditTime.Text.Trim()); if (title == "") { alert.Show(Page, "请填写标题"); return; } if (EditTime == "") { EditTime = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"); } string pic = UpFile(fu), picSmall = ""; if (pic != "") { picSmall = pic.ToLower().Replace(".jpg", "_s.jpg"); } SQLHelper db = new SQLHelper(); if (NewsID.Length > 0) { //取出旧图 string oldPic = "", oldPicSmall = ""; db.sql = "SELECT pic,picSmall FROM " + com.tablePrefix + "News WHERE NewsID=" + NewsID; DataTable dt = db.Get_DataTable(); if (dt.Rows.Count > 0) { oldPic = dt.Rows[0]["pic"].ToString(); oldPicSmall = dt.Rows[0]["picSmall"].ToString(); } //更新 string sql = "UPDATE News SET title='" + title + "',editTime='" + EditTime + "'"; if (pic.Length > 0) { sql += " ,pic='" + pic + "'"; FileSys.delFile(oldPic); } if (picSmall.Length > 0) { sql += " ,picSmall='" + picSmall + "'"; FileSys.delFile(oldPicSmall); } sql += " WHERE NewsID=" + NewsID; db.sql = sql; if (db.ExecSql() != "1") { alert.Show(Page, "保存失败"); } else { GV.EditIndex = -1; bindGv(); } } else { //添加 NewsID = clsNews.MaxNewsid(); db.sql = "INSERT INTO News(ParentNewsID,NewsID,title,pic,picSmall,EditTime,AddTime) VALUES(" + lbid + "," + NewsID + ",'" + title + "','" + pic + "','" + picSmall + "','" + EditTime + "',getdate())"; if (db.ExecSql() != "1") { alert.Show(Page, "添加失败"); } else { GV.EditIndex = -1; bindGv(); } } } }
protected void GV_RowCommand(object sender, GridViewCommandEventArgs e) { productid = hlbid.Value; System.Web.UI.WebControls.Button btn = e.CommandSource as System.Web.UI.WebControls.Button; if (btn == null) { return; } int index = ((System.Web.UI.WebControls.GridViewRow)btn.Parent.Parent).RowIndex; DataKey key = this.GV.DataKeys[index]; string NewsID = key.Value.ToString(); GridViewRow gvr = GV.Rows[index]; #region 单击上传图片按钮 if (e.CommandName == "upFile") { //寻找上传控件 FileUpload fu = (FileUpload)gvr.FindControl("FileUpload1");//原图 string pic = ""; //上传图片 pic = UpFile(fu); string picSmall = ""; if (pic != "") { picSmall = pic.ToLower().Replace(".jpg", "_s.jpg"); //ThumNail.MakeThumNail(pic, picSmall, 127, 127, "HW"); SQLHelper_ db = new SQLHelper_(); //删除原图 db.sql = "SELECT pic,picSmall FROM " + com.tablePrefix + "News WHERE NewsID=" + NewsID; DataTable dtp = db.Get_DataTable(); if (dtp.Rows.Count > 0) { string pic0 = dtp.Rows[0][0].ToString(); string pic1 = dtp.Rows[0][1].ToString(); if (pic0.Length > 0) { FileSys.delFile(pic0); } if (pic1.Length > 0) { FileSys.delFile(pic1); } } //更新数据库 db.sql = "UPDATE News SET pic='" + pic + "',picSmall='" + picSmall + "' WHERE NewsID=" + NewsID; db.ExecSql(); bindGv(); alert.Show(Page, "图片更新成功"); } } #endregion #region 保存 if (e.CommandName == "Save") { //查找 title控件 TextBox txtTitle = null; try { txtTitle = this.GV.Rows[index].Cells[1].Controls[0] as TextBox; } catch { alert.ShowAndBack(Page, "未找到标题控件"); return; } string colorid = "-1"; try { DropDownList ddlColor = (DropDownList)GV.Rows[index].FindControl("ddlColor"); colorid = ddlColor.SelectedValue; } catch (Exception) { alert.ShowAndBack(Page, "未找到颜色控件"); return; } string imgTypeid = ""; try { DropDownList ddImglType = (DropDownList)GV.Rows[index].FindControl("ddlpro_imgTypeid"); imgTypeid = ddImglType.SelectedValue; } catch (Exception) { alert.ShowAndBack(Page, "未找到图片类型控件"); return; } FileUpload fu = gvr.Cells[5].FindControl("FileUpload1") as FileUpload; string title = pg.GetSafeString(txtTitle.Text.Trim()); if (title == "") { alert.ShowAndBack(Page, "请填写标题"); return; } TextBox tbxOrder = null; try { tbxOrder = this.GV.Rows[index].Cells[6].Controls[0] as TextBox; } catch { alert.ShowAndBack(Page, "未找到排序文本框控件"); return; } string orderid = pg.GetSafeString(tbxOrder.Text.Trim()); if (orderid == "") { orderid = "0"; } string pic = UpFile(fu); string picSmall = ""; if (pic != "") { picSmall = pic.ToLower().Replace(".jpg", "_s.jpg"); } SQLHelper_ db = new SQLHelper_(); if (NewsID.Length > 0) { //取出旧图 string oldPic = "", oldPicSmall = ""; db.sql = "SELECT pic,picSmall FROM " + com.tablePrefix + "News WHERE NewsID=" + NewsID; DataTable dt = db.Get_DataTable(); if (dt.Rows.Count > 0) { oldPic = dt.Rows[0]["pic"].ToString(); oldPicSmall = dt.Rows[0]["picSmall"].ToString(); } //更新 string sql = "UPDATE News SET title='" + title + "',ColorId=" + colorid + ",pro_imgTypeid=" + imgTypeid + ",editTime=getdate(),OrderId=" + orderid; if (pic.Length > 0) { sql += " ,pic='" + pic + "'"; FileSys.delFile(oldPic); } if (picSmall.Length > 0) { sql += " ,picSmall='" + picSmall + "'"; FileSys.delFile(oldPicSmall); } sql += " WHERE NewsID=" + NewsID; db.sql = sql; if (db.ExecSql() != "1") { alert.Show(Page, "保存失败"); } else { GV.EditIndex = -1; bindGv(); } } else { //添加 NewsID = clsNews.MaxNewsid(); db.sql = "INSERT INTO News(ParentNewsID,NewsID,title,ColorId,pro_imgTypeid,pic,picSmall,EditTime,AddTime,OrderId) VALUES(" + productid + "," + NewsID + ",'" + title + "'," + colorid + "," + imgTypeid + ",'" + pic + "','" + picSmall + "',getdate(),getdate()," + orderid + ")"; if (db.ExecSql() != "1") { Response.Write("添加失败,sql=" + db.sql); //alert.Show(Page, "添加失败"); Response.End(); } else { GV.EditIndex = -1; bindGv(); } } } #endregion }
protected void GV_RowCommand(object sender, GridViewCommandEventArgs e) { System.Web.UI.WebControls.Button btn = e.CommandSource as System.Web.UI.WebControls.Button; if (btn == null) { return; } int index = ((System.Web.UI.WebControls.GridViewRow)btn.Parent.Parent).RowIndex; DataKey key = this.GV.DataKeys[index]; string lbid = key.Value.ToString(); GridViewRow gvr = GV.Rows[index]; if (e.CommandName == "Save") { //查找 title控件 TextBox txtTitle = null; try { txtTitle = this.GV.Rows[index].Cells[2].Controls[0] as TextBox; } catch { alert.Show(Page, "未找到类别名称文本框控件"); return; } string title = pg.GetSafeString(txtTitle.Text.Trim()); if (title == "") { alert.ShowAndBack(Page, "请填写类别名称"); return; } SQLHelper db = new SQLHelper(); if (lbid.Length > 0) { //更新 string sql = "UPDATE lb SET lbname='" + title + "'"; sql += " WHERE lbid=" + lbid; db.sql = sql; if (db.ExecSql() != "1") { alert.Show(Page, "保存失败"); } else { GV.EditIndex = -1; bindGv(); } } else { //添加 db.sql = "INSERT INTO lb(lbid,lbname,parentid) VALUES(" + clsLB.MaxLbid() + ",'" + title + "'," + ddlLbid.SelectedValue + ")"; if (db.ExecSql() != "1") { alert.Show(Page, "添加失败"); } else { GV.EditIndex = -1; bindGv(); } } } }
private void CreateHierarchy(short AxisOrdinal, HtmlTable hostTable, Hierarchy hier, byte TreeDepth) { //string hierIdentifier=_contr.IdentifierFromHierarchy(hier); bool hierIsAggregated = false; bool hierIsMeasures = (hier.UniqueName == "[Measures]"); MembersAggregate aggr = hier.FilterMember as MembersAggregate; if (aggr != null) { hierIsAggregated = true; } HtmlTableRow tr = new HtmlTableRow(); HtmlTableCell td; System.Web.UI.WebControls.Button btn; // --- node contr col-- tr = new HtmlTableRow(); td = new HtmlTableCell(); if (AxisOrdinal != 2) { btn = new System.Web.UI.WebControls.Button(); btn.ToolTip = "Move To Filter"; btn.ID = "sel_del:" + hier.UniqueName; //hierIdentifier; btn.CssClass = "sel_del"; td.Controls.Add(btn); btn = new System.Web.UI.WebControls.Button(); btn.ToolTip = "Move Up"; btn.ID = "sel_up:" + hier.UniqueName; //hierIdentifier; btn.CssClass = "sel_up"; td.Controls.Add(btn); btn = new System.Web.UI.WebControls.Button(); btn.ToolTip = "Move Down"; btn.ID = "sel_down:" + hier.UniqueName; //hierIdentifier; btn.CssClass = "sel_down"; td.Controls.Add(btn); } else { btn = new System.Web.UI.WebControls.Button(); btn.ToolTip = "Move To Row"; btn.ID = "sel_torow:" + hier.UniqueName; //hierIdentifier; btn.CssClass = "sel_torow"; td.Controls.Add(btn); btn = new System.Web.UI.WebControls.Button(); btn.ToolTip = "Move To Column"; btn.ID = "sel_tocol:" + hier.UniqueName; //hierIdentifier; btn.CssClass = "sel_tocol"; td.Controls.Add(btn); } td.Attributes.Add("class", "sel_C1"); td.NoWrap = true; tr.Cells.Add(td); // --- node name col-- td = new HtmlTableCell(); Literal lit = new Literal(); for (int i = 0; i < TreeDepth; i++) { lit.Text = lit.Text + " "; } td.Controls.Add(lit); btn = new System.Web.UI.WebControls.Button(); if (hier.IsOpen) { btn.ToolTip = "Close"; btn.ID = "sel_hclose:" + hier.UniqueName; //hierIdentifier; btn.CssClass = "sel_close"; } else { btn.ToolTip = "Open"; btn.ID = "sel_hopen:" + hier.UniqueName; //hierIdentifier; btn.CssClass = "sel_open"; } td.Controls.Add(btn); lit = new Literal(); lit.Text = hier.Caption; td.Controls.Add(lit); td.Attributes.Add("class", "sel_C"); td.NoWrap = true; tr.Cells.Add(td); // --- node select col-- td = new HtmlTableCell(); if (AxisOrdinal != 2 && hier.IsOpen && !hierIsMeasures) { btn = new System.Web.UI.WebControls.Button(); btn.ToolTip = "Select Children"; btn.ID = "sel_hselall:" + hier.UniqueName; //hierIdentifier; btn.CssClass = "sel_selall"; td.Controls.Add(btn); btn = new System.Web.UI.WebControls.Button(); btn.ToolTip = "Deselect All Children"; btn.ID = "sel_hdeselall:" + hier.UniqueName; //hierIdentifier; btn.CssClass = "sel_deselall"; td.Controls.Add(btn); } else if (AxisOrdinal == 2 && !hierIsMeasures) { btn = new System.Web.UI.WebControls.Button(); if (hierIsAggregated) { btn.ToolTip = "Set Aggregate Off"; btn.ID = "sel_aggr_off:" + hier.UniqueName; //hierIdentifier; btn.CssClass = "sel_aggr_on"; } else { btn.ToolTip = "Set Aggregate On"; btn.ID = "sel_aggr_on:" + hier.UniqueName; //hierIdentifier; btn.CssClass = "sel_aggr_off"; } td.Controls.Add(btn); } td.Attributes.Add("class", "sel_C2"); td.NoWrap = true; tr.Cells.Add(td); hostTable.Rows.Add(tr); if (hier.IsOpen == false) { return; } TreeDepth++; // data members level depth=0 for (int j = 0; j < hier.SchemaMembers.Count; j++) { CreateMemHierarchy(AxisOrdinal, hostTable, hier.SchemaMembers[j], hierIsAggregated, TreeDepth, false); } // calc members for (int j = 0; j < hier.CalculatedMembers.Count; j++) { CreateMemHierarchy(AxisOrdinal, hostTable, hier.CalculatedMembers[j], hierIsAggregated, 0, false); } }
protected void GV_RowCommand(object sender, GridViewCommandEventArgs e) { System.Web.UI.WebControls.Button btn = e.CommandSource as System.Web.UI.WebControls.Button; if (btn == null) { return; } int index = ((System.Web.UI.WebControls.GridViewRow)btn.Parent.Parent).RowIndex; DataKey key = this.GV.DataKeys[index]; string NewsID = key.Value.ToString(); GridViewRow gvr = GV.Rows[index]; if (e.CommandName == "Save") { TextBox txtemail = null; try { txtemail = this.GV.Rows[index].Cells[1].Controls[0] as TextBox; } catch { alert.Show(Page, "未找到邮箱控件"); return; } TextBox txtusername = null; try { txtusername = this.GV.Rows[index].Cells[2].Controls[0] as TextBox; } catch { alert.Show(Page, "未找到昵称控件"); return; } string username = pg.GetSafeString(txtusername.Text.Trim()); string email = pg.GetSafeString(txtemail.Text.Trim()); if (email == "") { //alert.ShowAndBack(Page, "请填写标题"); alert.Show(Page, "请填写邮箱"); return; } if (username == "") { alert.Show(Page, "请填写昵称"); return; } SQLHelper db = new SQLHelper(); if (NewsID.Length > 0) { //更新 db.sql = "UPDATE Members SET email='" + email + "',username='******' WHERE userid=" + NewsID; string result = db.ExecSql(); if (result != "1") { Response.Write(result + db.sql); Response.End(); //alert.Show(Page, "保存失败"); } else { GV.EditIndex = -1; bindGv(); alert.Show(Page, "保存成功"); } } else { //添加 NewsID = clsNews.MaxNewsid(); db.sql = "INSERT INTO Members(email,username,pwd,regtime) VALUES('" + email + "','" + username + "','" + com.MD5(hpwd.Value, 1) + "',getdate())"; if (db.ExecSql() != "1") { alert.Show(Page, "添加失败"); } else { GV.EditIndex = -1; bindGv(); alert.Show(Page, "添加成功"); } } } }
protected override void CreateChildControls() { Controls.Add(new LiteralControl("<p>")); ErrorMessage = new Label(); ErrorMessage.ForeColor = Color.Red; Controls.Add(ErrorMessage); Controls.Add(new LiteralControl("</p>")); DataGrid1 = new DataGrid(); DataGrid1.EditItemStyle.BackColor = Color.WhiteSmoke; DataGrid1.HeaderStyle.BackColor = Color.FromArgb(148, 175, 192); DataGrid1.HeaderStyle.Font.Bold = true; DataGrid1.CellPadding = 5; DataGrid1.BorderWidth = 1; DataGrid1.BorderColor = Color.LightGray; DataGrid1.Width = 600; DataGrid1.AutoGenerateColumns = false; DataGrid1.ItemCommand += new DataGridCommandEventHandler(DataGrid1_Command); TemplateColumn c1 = new TemplateColumn(); c1.HeaderTemplate = new CheckColumnTemplate(ListItemType.Header); c1.HeaderStyle.Width = 21; c1.ItemTemplate = new CheckColumnTemplate(ListItemType.Item); c1.ItemStyle.VerticalAlign = VerticalAlign.Top; c1.Visible = false; DataGrid1.Columns.Add(c1); TemplateColumn c2 = new TemplateColumn(); DataGrid1.Columns.Add(c2); DataGrid1.ItemCreated += new DataGridItemEventHandler(DataGrid1_ItemCreated); DataGrid1.EditCommand += new DataGridCommandEventHandler(DataGrid1_EditCommand); DataGrid1.CancelCommand += new DataGridCommandEventHandler(DataGrid1_CancelCommand); DataGrid1.UpdateCommand += new DataGridCommandEventHandler(DataGrid1_UpdateCommand); ButtonColumn c3 = new ButtonColumn(); c3.ButtonType = ButtonColumnType.PushButton; c3.HeaderStyle.Width = 5; c3.ItemStyle.Width = 5; c3.HeaderText = "Shift Up"; c3.CommandName = "UpClick"; c3.Text = "\u2191"; c3.Visible = false; DataGrid1.Columns.Add(c3); ButtonColumn c4 = new ButtonColumn(); c4.ButtonType = ButtonColumnType.PushButton; c4.ItemStyle.Width = 5; c4.HeaderStyle.Width = 5; c4.HeaderText = "Shift Down"; c4.CommandName = "DownClick"; c4.ItemStyle.HorizontalAlign = HorizontalAlign.Right; c4.Text = "\u2193"; c4.Visible = false; DataGrid1.Columns.Add(c4); ButtonColumn c5 = new ButtonColumn(); c5.ButtonType = ButtonColumnType.PushButton; c5.ItemStyle.Width = 25; c5.CommandName = "Delete"; c5.HeaderText = "Delete"; c5.Text = "Delete"; c5.Visible = false; DataGrid1.Columns.Add(c5); Controls.Add(DataGrid1); Controls.Add(new LiteralControl("<p>")); NewButton = new Button(); NewButton.ID = "NewButton"; NewButton.CssClass = "defaultButton"; NewButton.Text = "New"; NewButton.CausesValidation = false; NewButton.Click += new EventHandler(NewButton_Click); Controls.Add(NewButton); Controls.Add(new LiteralControl(" ")); DeleteButton = new Button(); DeleteButton.ID = "DeleteButton"; DeleteButton.CssClass = "defaultButton"; DeleteButton.Text = "Delete"; DeleteButton.Enabled = false; DeleteButton.CausesValidation = false; DeleteButton.Click += new EventHandler(DeleteButton_Click); //Controls.Add( DeleteButton ); Controls.Add(new LiteralControl(" ")); UpButton = new Button(); UpButton.ID = "UpButton"; UpButton.CssClass = "defaultButton"; UpButton.Text = "Up"; UpButton.Enabled = false; UpButton.CausesValidation = false; UpButton.CommandName = "MoveUp"; UpButton.Command += new CommandEventHandler(OnMoveCommand); //Controls.Add( UpButton ); Controls.Add(new LiteralControl(" ")); DownButton = new Button(); DownButton.ID = "DownButton"; DownButton.CssClass = "defaultButton"; DownButton.Text = "Down"; DownButton.Enabled = false; DownButton.CausesValidation = false; DownButton.CommandName = "MoveDown"; DownButton.Command += new CommandEventHandler(OnMoveCommand); //Controls.Add( DownButton ); Controls.Add(new LiteralControl("</p>")); }
private void CreateMemHierarchy(short AxisOrdinal, HtmlTable hostTable, Member mem, bool HierIsAggregated, byte TreeDepth, bool autoSelect) { //do not display aggregate, display undlying calc members instead if (HierIsAggregated == true && mem.UniqueName == mem.Hierarchy.FilterMember.UniqueName) { MembersAggregate maggr = mem.Hierarchy.FilterMember as MembersAggregate; if (maggr != null) { for (int i = 0; i < maggr.Members.Count; i++) { CalculatedMember cmem = maggr.Members[i] as CalculatedMember; if (cmem != null) { this.CreateMemHierarchy(AxisOrdinal, hostTable, cmem, HierIsAggregated, TreeDepth, false); // recursion } } } return; } string memIdentifier = _contr.IdentifierFromSchemaMember(mem); string hierIdentifier = mem.Hierarchy.Axis.Ordinal.ToString() + ":" + mem.Hierarchy.Ordinal.ToString(); bool memIsSelected = false; bool memIsOpen = false; bool memIsPlaceholder = false; bool memAutoSelectChildren = (mem.Hierarchy.CalculatedMembers.GetMemberChildrenSet(mem.UniqueName) != null); SchemaMember smem = mem as SchemaMember; if (smem != null) { memIsOpen = smem.IsOpen; memIsPlaceholder = smem.IsPlaceholder; } if (HierIsAggregated) { memIsSelected = (((MembersAggregate)mem.Hierarchy.FilterMember).Members[mem.UniqueName] != null?true:false); } else { memIsSelected = (mem.Hierarchy.GetMember(mem.UniqueName) != null); } HtmlTableRow tr = new HtmlTableRow(); HtmlTableCell td; System.Web.UI.WebControls.Button btn; Literal lit; // --- node contr col-- td = new HtmlTableCell(); td.Attributes.Add("class", "sel_C1"); td.NoWrap = true; tr.Cells.Add(td); // --- node name col-- td = new HtmlTableCell(); lit = new Literal(); for (int i = 0; i < TreeDepth; i++) { lit.Text = lit.Text + " "; } td.Controls.Add(lit); if (memIsOpen) { btn = new System.Web.UI.WebControls.Button(); btn.ToolTip = "Close"; btn.ID = "sel_close:" + memIdentifier; btn.CssClass = "sel_close"; td.Controls.Add(btn); } else { if (mem.CanDrillDown) { btn = new System.Web.UI.WebControls.Button(); btn.ToolTip = "Open"; btn.ID = "sel_open:" + memIdentifier; btn.CssClass = "sel_open"; td.Controls.Add(btn); } else { // no image lit.Text = lit.Text + " "; } } if (memIsPlaceholder == false) { if (AxisOrdinal == 2 && HierIsAggregated == false) { HtmlInputRadioButton radio = new HtmlInputRadioButton(); radio.Name = "m:" + hierIdentifier; radio.ID = "m:" + memIdentifier; radio.EnableViewState = false; radio.Checked = (memIsSelected || autoSelect); radio.Disabled = autoSelect; radio.Attributes.Add("class", "sel_chk"); td.Controls.Add(radio); } else { HtmlInputCheckBox chk = new HtmlInputCheckBox(); chk.ID = "m:" + mem.UniqueName; //note, UniqueName ! chk.EnableViewState = false; chk.Checked = (memIsSelected || autoSelect); chk.Disabled = autoSelect; chk.Attributes.Add("class", "sel_chk"); td.Controls.Add(chk); } } lit = new Literal(); lit.Text = mem.Name; td.Controls.Add(lit); td.Attributes.Add("class", "sel_C"); td.NoWrap = true; tr.Cells.Add(td); // --- node select col-- td = new HtmlTableCell(); if (AxisOrdinal != 2 && memIsOpen) { if (!memAutoSelectChildren) { btn = new System.Web.UI.WebControls.Button(); btn.ToolTip = "Auto-Select Children"; btn.ID = "sel_selauto:" + memIdentifier; btn.CssClass = "sel_selauto"; td.Controls.Add(btn); btn = new System.Web.UI.WebControls.Button(); btn.ToolTip = "Select Children"; btn.ID = "sel_selall:" + memIdentifier; btn.CssClass = "sel_selall"; td.Controls.Add(btn); } btn = new System.Web.UI.WebControls.Button(); btn.ToolTip = "Deselect All Children"; btn.ID = "sel_deselall:" + memIdentifier; btn.CssClass = "sel_deselall"; td.Controls.Add(btn); } td.Attributes.Add("class", "sel_C2"); td.NoWrap = true; tr.Cells.Add(td); hostTable.Rows.Add(tr); if (memIsOpen == false) { return; } // next level members if it's schema member TreeDepth++; if (smem != null) { for (int j = 0; j < smem.Children.Count; j++) { CreateMemHierarchy(AxisOrdinal, hostTable, smem.Children[j], HierIsAggregated, TreeDepth, memAutoSelectChildren); } } }
protected void GV_RowCommand(object sender, GridViewCommandEventArgs e) { System.Web.UI.WebControls.Button btn = e.CommandSource as System.Web.UI.WebControls.Button; if (btn == null) { return; } int index = ((System.Web.UI.WebControls.GridViewRow)btn.Parent.Parent).RowIndex; DataKey key = this.GV.DataKeys[index]; string lbid = key.Value.ToString(); GridViewRow gvr = GV.Rows[index]; if (e.CommandName == "Save") { //查找 title控件 TextBox txtTitle = null; try { txtTitle = this.GV.Rows[index].Cells[1].Controls[0] as TextBox; } catch { alert.Show(Page, "未找到省份名称文本框控件"); return; } TextBox tbxJianCheng = null;//JianCheng try { tbxJianCheng = this.GV.Rows[index].Cells[2].Controls[0] as TextBox; } catch { alert.Show(Page, "未找到排序文本框控件"); return; } TextBox tbxOrderId = null; try { tbxOrderId = this.GV.Rows[index].Cells[3].Controls[0] as TextBox; } catch { alert.Show(Page, "未找到排序文本框控件"); return; } string title = pg.GetSafeString(txtTitle.Text.Trim()); string orderid = pg.GetSafeString(tbxOrderId.Text.Trim()); string jianCheng = tbxJianCheng.Text.Trim(); if (title == "") { alert.ShowAndBack(Page, "请填写省份名称"); return; } if (jianCheng == "") { alert.ShowAndBack(Page, "请填写简称"); return; } try { int o = Int32.Parse(orderid); } catch (Exception) { orderid = "0"; } SQLHelper_ db = new SQLHelper_(); if (lbid.Length > 0) { //更新 string sql = "UPDATE Province SET name='" + title + "',jianCheng='" + jianCheng + "',OrderId=" + orderid; sql += " WHERE id=" + lbid; db.sql = sql; if (db.ExecSql() != "1") { alert.Show(Page, "保存失败"); } else { GV.EditIndex = -1; bindGv(); } } else { //添加 db.sql = "INSERT INTO Province(name,jianCheng,OrderId) VALUES('" + title + "','" + jianCheng + "'," + orderid + ")"; if (db.ExecSql() != "1") { alert.Show(Page, "添加失败"); } else { GV.EditIndex = -1; bindGv(); } } } }
public void SetDefaultButton(System.Web.UI.WebControls.Button button) { PageManager.SetDefaultButton(button, this.Controls); }
protected void GV_RowCommand(object sender, GridViewCommandEventArgs e) { System.Web.UI.WebControls.Button btn = e.CommandSource as System.Web.UI.WebControls.Button; if (btn == null) { return; } int index = ((System.Web.UI.WebControls.GridViewRow)btn.Parent.Parent).RowIndex; DataKey key = this.GV.DataKeys[index]; string id = key.Value.ToString(); GridViewRow gvr = GV.Rows[index]; if (e.CommandName == "Save") { //查找 title控件 TextBox txtTitle = null; try { txtTitle = this.GV.Rows[index].Cells[1].Controls[0] as TextBox; } catch { alert.Show(Page, "未找到颜色名称文本框"); return; } TextBox txtColorValue = null; try { txtColorValue = this.GV.Rows[index].Cells[2].Controls[0] as TextBox; } catch { alert.Show(Page, "未找到色值文本框"); return; } //排序 TextBox txtOrderId = null; try { txtOrderId = this.GV.Rows[index].Cells[3].Controls[0] as TextBox; } catch { alert.Show(Page, "未找到排序文本框"); return; } string ColorName = pg.GetSafeString(txtTitle.Text.Trim()); string colorValue = pg.GetSafeString(txtColorValue.Text.Trim()); string orderid = pg.GetSafeString(txtOrderId.Text.Trim()); if (ColorName == "") { alert.ShowAndBack(Page, "请填写类别名称"); return; } SQLHelper db = new SQLHelper(); if (id.Length > 0) { //更新 string sql = "UPDATE Color SET ColorName='" + ColorName + "',ColorValue='" + colorValue + "',OrderId=" + orderid; sql += " WHERE id=" + id; db.sql = sql; if (db.ExecSql() != "1") { alert.Show(Page, "保存失败"); } else { GV.EditIndex = -1; bindGv(); } } else { //添加 db.sql = "INSERT INTO Color(ColorName,ColorValue,OrderId) VALUES('" + ColorName + "','" + colorValue + "'," + orderid + ")"; if (db.ExecSql() != "1") { alert.Show(Page, "添加失败"); } else { GV.EditIndex = -1; bindGv(); } } } }
protected void BtnClicked(object sender, EventArgs e) { System.Web.UI.WebControls.Button myBtn = (System.Web.UI.WebControls.Button)sender; display.Text = myBtn.Text.ToString(); StoreDisplaySimp(myBtn.Text.ToString()); }
private void CreateDimension(short AxisOrdinal, HtmlTable hostTable, Dimension dim) { HtmlTableRow tr = new HtmlTableRow(); HtmlTableCell td; System.Web.UI.WebControls.Button btn; // --- node contr col-- tr = new HtmlTableRow(); td = new HtmlTableCell(); td.Attributes.Add("class", "sel_C1"); td.NoWrap = true; tr.Cells.Add(td); // --- node name col-- td = new HtmlTableCell(); btn = new System.Web.UI.WebControls.Button(); if (dim.IsOpen) { btn.ToolTip = "Close"; btn.ID = "sel_dclose:" + dim.UniqueName; btn.CssClass = "sel_close"; } else { btn.ToolTip = "Open"; btn.ID = "sel_dopen:" + dim.UniqueName; btn.CssClass = "sel_open"; } td.Controls.Add(btn); Literal lit = new Literal(); lit.Text = dim.Name; td.Controls.Add(lit); td.Attributes.Add("class", "sel_C"); td.NoWrap = true; tr.Cells.Add(td); // --- node select col-- td = new HtmlTableCell(); td.Attributes.Add("class", "sel_C"); td.NoWrap = true; tr.Cells.Add(td); hostTable.Rows.Add(tr); if (dim.IsOpen == false) { return; } // members level depth=0 for (int j = 0; j < dim.Hierarchies.Count; j++) { if (dim.Hierarchies[j].Axis.Ordinal == AxisOrdinal) // only if axis matches { CreateHierarchy(AxisOrdinal, hostTable, dim.Hierarchies[j], 1); //treedepth is 1 because 0 is dim } } }
private void InitializeComponent() { settings = new SettingsManager(); ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainWindow)); ComponentResourceManager componentResourceManager = new ComponentResourceManager(typeof(MainWindow)); login_panel = new System.Web.UI.WebControls.Panel(); submit_login = new System.Web.UI.WebControls.Button(); label2 = new System.Web.UI.WebControls.Label(); //Email Label label1 = new System.Web.UI.WebControls.Label(); //Passwirt label password_input = new System.Web.UI.WebControls.TextBox(); email_input = new System.Web.UI.WebControls.TextBox(); version_text = new System.Web.UI.WebControls.Label(); // progressBardownload = new System.Windows.Controls.ProgressBar(); //this.login_panel.Controls.Add((Control)this.logo); login_panel.Controls.Add(submit_login); login_panel.Controls.Add(label2); login_panel.Controls.Add(label1); login_panel.Controls.Add(password_input); login_panel.Controls.Add(email_input); login_panel.Width = 375; login_panel.Height = 377; //new Size(375, 377); login_panel.TabIndex = 6; //this.logo.BackgroundImage = (Image)Resources.logo; //this.logo.BackgroundImageLayout = ImageLayout.Zoom; //this.logo.Location = new Point(60, 75); // this.logo.Name = "logo"; //this.logo.Size = new Size(250, 66); //this.logo.TabIndex = 6; //this.logo.TabStop = false; //submit_login.FlatAppearance.BorderColor = Color.FromArgb(204, 204, 204); //submit_login.FlatAppearance.MouseDownBackColor = Color.FromArgb(150, 150, 150); //submit_login.FlatAppearance.MouseOverBackColor = Color.FromArgb(204, 204, 204); //submit_login.FlatStyle = FlatStyle.Flat; //submit_login.Location = new Point(60, 274); //submit_login.Name = "submit_login"; //submit_login.Size = new Size(250, 25); submit_login.TabIndex = 4; submit_login.Text = translation.login; //submit_login.UseVisualStyleBackColor = true; submit_login.Click += new EventHandler(submit_login_Click); //label2.AutoSize = true; //label2.Location = new Point(57, 151); //label2.Name = "label2"; //label2.Size = new Size(53, 13); label2.TabIndex = 3; label2.Text = translation.password; //label1.AutoSize = true; //label1.Location = new Point(57, 100); //label1.Name = "label1"; //label1.Size = new Size(131, 13); label1.TabIndex = 2; label1.Text = translation.login_username; //password_input.Location = new Point(60, 167); //password_input.Name = "password_input"; // password_input.Size = new Size(250, 22); password_input.TabIndex = 1; //password_input.UseSystemPasswordChar = true; //password_input.KeyUp += new KeyEventHandler(password_input_KeyPress); // email_input.Location = new Point(60, 116); //email_input.Name = "email_input"; // email_input.Size = new Size(250, 22); email_input.TabIndex = 0; /* * version_text.AutoSize = true; * version_text.Location = new Point(280, 3); * version_text.Name = "version_text"; * version_text.Size = new Size(101, 13); * version_text.TabIndex = 7; * version_text.Text = "Version: 1.1.1 Alpha"; * version_text.TextAlign = ContentAlignment.MiddleRight; * AutoScaleDimensions = new SizeF(6f, 13f); * AutoScaleMode = AutoScaleMode.Font; * BackColor = Color.White; * ClientSize = new Size(384, 411); * Controls.Add(login_panel); * Font = new Font("Segoe UI", 8.25f, FontStyle.Regular, GraphicsUnit.Point, 0); * FormBorderStyle = FormBorderStyle.FixedSingle; * //this.Icon = (Icon)componentResourceManager.GetObject("$this.Icon"); * MaximizeBox = false; * Name = nameof(Main); * StartPosition = FormStartPosition.CenterScreen; * Text = "VTCManager"; * Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); * Load += new EventHandler(Main_Load); * Resize += new EventHandler(Main_Resize); * login_panel.ResumeLayout(false); * login_panel.PerformLayout(); * ResumeLayout(false); * PerformLayout(); */ }
public static void CreateConfirmBox(ref System.Web.UI.WebControls.Button btn, string strMessage) { btn.Attributes.Add("onclick", "return confirm('" + strMessage + "');"); }
protected override void CreateChildControls() { HomeNews webPart = (HomeNews)this.WebPartToEdit; if (webPart == null) { return; } if (ViewState["FirstLoad"] == null || !bool.Parse(ViewState["FirstLoad"].ToString())) { ViewState["CommingUp"] = webPart.CommingUpLink; } ViewState["FirstLoad"] = true; lblTitle = new System.Web.UI.WebControls.Label(); lblTitle.Text = "Comming up link : "; Controls.Add(lblTitle); literalSpace = new Literal(); literalSpace.Text = "<br />Title: "; Controls.Add(literalSpace); txtCommingUpTitle = new TextBox(); txtCommingUpTitle.ID = "txtTitle"; Controls.Add(txtCommingUpTitle); literalSpace = new Literal(); literalSpace.Text = "<br />Link: "; Controls.Add(literalSpace); txtCommingUpLink = new TextBox(); txtCommingUpLink.ID = "txtLink"; Controls.Add(txtCommingUpLink); literalSpace = new Literal(); literalSpace.Text = "<br />"; Controls.Add(literalSpace); btnAdd = new Button(); btnAdd.ID = "btnAdd"; btnAdd.Text = "Add"; btnAdd.Click += new EventHandler(btnAdd_Click); Controls.Add(btnAdd); literalSpace = new Literal(); literalSpace.Text = "<br /><br />"; Controls.Add(literalSpace); gridCommingUpLink = new GridView(); gridCommingUpLink.Style.Add("width", "100%"); gridCommingUpLink.RowDeleting += new GridViewDeleteEventHandler(gridCommingUpLink_RowDeleting); gridCommingUpLink.AutoGenerateDeleteButton = true; gridCommingUpLink.DataSource = ViewState["CommingUp"] as List <CommingUpLink>; gridCommingUpLink.DataBind(); Controls.Add(gridCommingUpLink); base.CreateChildControls(); }
protected void Page_Load(object sender, EventArgs e) { Guid userID = new Guid(Membership.GetUser(HttpContext.Current.User.Identity.Name).ProviderUserKey.ToString()); Session["UserID"] = userID; /* try * { * SqlConnection conn = Website.getSQLConnection(); * SqlCommand cmd = Website.getSQLCommand(conn); * * SqlDataSource sdsViewQuotes = new SqlDataSource(); * //sdsViewQuotes.SelectCommandType = SqlDataSourceCommandType.Text; * sdsViewQuotes.SelectCommand = "SELECT reference#, InsuranceType, LastName + ', ' + FirstName as Name, DateCreated, " + "case(active) When 0 THEN 'Inactive' When 1 THEN 'Active'END as Status " + "from Quote " + "WHERE Reactivation IS NULL " + "AND ACTIVE = 1 " + "AND AgentID = '"+userID+"' ORDER BY Reference# ASC"; + //cmd.CommandText = "SELECT * FROM AGENT WHERE AGENTID = '{a013e5db-9105-4912-ba8b-4fc8ba743cd7}'"; + //sdsViewQuotes.SelectParameters.Add("@UserID", Session["UserID"].ToString()); + sdsViewQuotes.ConnectionString = WebConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; + sdsViewQuotes.ID = "sdsViewQuotes"; + Page.Controls.Add(sdsViewQuotes); + sdsViewQuotes.Select(DataSourceSelectArguments.Empty); + //sdsViewQuotes.DataBind(); + + gvViewQuotes.DataSourceID = "sdsViewQuotes"; + gvViewQuotes.DataBind(); + } + catch + { + throw; + }*/ for (int i = 0; i < gvViewQuotes.Rows.Count; i++) { bool submitted = false; string referenceNum = gvViewQuotes.Rows[i].Cells[0].Text; //check to see if the quote is submitted. if it is, the hyperlink will be disabled and the text will be: "submitted" SqlConnection connSubmitted = Website.getSQLConnection(); SqlCommand cmdSubmitted = Website.getSQLCommand(connSubmitted); cmdSubmitted.CommandText = "SELECT * FROM quote where Reference# = " + Convert.ToInt32(referenceNum) + "AND Submitted = 1"; cmdSubmitted.CommandType = System.Data.CommandType.Text; SqlDataReader readerSubmitted; connSubmitted.Open(); readerSubmitted = cmdSubmitted.ExecuteReader(); int counterSubmitted = 0; while (readerSubmitted.Read()) { counterSubmitted++; } if (counterSubmitted > 0) { submitted = true; } connSubmitted.Close(); HyperLink hyperlink = new HyperLink(); hyperlink.Text = "Edit"; hyperlink.NavigateUrl = "~/Wepages/Applicant.aspx/?ReferenceNum=" + referenceNum; if (submitted) { hyperlink.Text = "Submitted"; hyperlink.Enabled = false; gvViewQuotes.Rows[i].Cells[4].Controls.Add(hyperlink); } else { gvViewQuotes.Rows[i].Cells[4].Controls.Add(hyperlink); } // add view pdf btn /*System.Web.UI.WebControls.Button btnView = new System.Web.UI.WebControls.Button(); * btnView.ID = "btnView"; * btnView.Text = "View PDF"; * btnView.Click += new System.EventHandler((s, ea) => viewPDF(s, ea, referenceNum)); * gvViewQuotes.Rows[i].Cells[5].Controls.Add(btnView);*/ SqlConnection conn = Website.getSQLConnection(); SqlCommand cmd = Website.getSQLCommand(conn); cmd.CommandText = "select * from QuotePDFs where pdfID = (select quoteID from quote where reference# = " + referenceNum + ")"; cmd.CommandType = System.Data.CommandType.Text; SqlDataReader readerPDF; conn.Open(); readerPDF = cmd.ExecuteReader(); int count = 0; while (readerPDF.Read()) { count++; } try { if (count == 1) { System.Web.UI.WebControls.Button btnView = new System.Web.UI.WebControls.Button(); btnView.ID = "btnView"; btnView.Text = "View PDF"; btnView.Click += new System.EventHandler((s, ea) => viewPDF(s, ea, referenceNum)); gvViewQuotes.Rows[i].Cells[5].Controls.Add(btnView); } } catch { } conn.Close(); // add view pdf btn System.Web.UI.WebControls.Button btnFinalize = new System.Web.UI.WebControls.Button(); btnFinalize.ID = "btnFinalize"; btnFinalize.Text = "Finalize"; btnFinalize.OnClientClick = "return confirm('You are Finalizing this quote. Click Ok to confirm.');"; btnFinalize.Click += new System.EventHandler((s, ea) => btnFinalize_Click(s, ea, referenceNum)); if (!submitted) { gvViewQuotes.Rows[i].Cells[6].Controls.Add(btnFinalize); } } if (gvViewQuotes.Rows.Count < 1) { try { lblSearchInput.Text = "No results found. Please fill out your Agency Information if you have not done so."; } catch { } } }
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); } }
private void closingFirstGridViewRow() { VisitClosing = new DataTable("VisitClosing"); DataRow drClosing = null; VisitClosing.Columns.Add("PostCallAnalysisName", Type.GetType("System.String")); VisitClosing.Columns.Add("RequestName", Type.GetType("System.String")); VisitClosing.Columns.Add("NextCallObjName", Type.GetType("System.String")); VisitClosing.Columns.Add("SampleName", Type.GetType("System.String")); drClosing = VisitClosing.NewRow(); drClosing["PostCallAnalysisName"] = string.Empty; //drClosing = VisitClosing.NewRow(); drClosing["RequestName"] = string.Empty; //drClosing = VisitClosing.NewRow(); drClosing["NextCallObjName"] = string.Empty; //drClosing = VisitClosing.NewRow(); drClosing["SampleName"] = string.Empty; VisitClosing.Rows.Add(drClosing); if (int.Parse(Session["IsEditCall"].ToString()) == 0) { ViewState["CurrentTableClosing"] = VisitClosing; gvClosing.DataSource = VisitClosing; gvClosing.DataBind(); DropDownList ddlPostCallAnalysis = (DropDownList)gvClosing.Rows[0].Cells[0].FindControl("ddlPostCallAnalysis"); ddlPostCallAnalysis.Focus(); DropDownList ddlPhysicianRequest = (DropDownList)gvClosing.Rows[0].Cells[1].FindControl("ddlPhysicianRequest"); ddlPhysicianRequest.Focus(); DropDownList ddlNextCallObjective = (DropDownList)gvClosing.Rows[0].Cells[2].FindControl("ddlNextCallObjective"); ddlNextCallObjective.Focus(); DropDownList ddlSample = (DropDownList)gvClosing.Rows[0].Cells[3].FindControl("ddlSample"); ddlSample.Focus(); } else { ViewState["CurrentTableClosing"] = VisitClosing; VisitClosing.Rows.Clear(); for (int iii = 0; iii < VisitClosing2.Rows.Count; iii++) { DataRow drVisitClosing = VisitClosing.NewRow(); drVisitClosing["PostCallAnalysisName"] = string.Empty; drVisitClosing["RequestName"] = string.Empty; drVisitClosing["NextCallObjName"] = string.Empty; drVisitClosing["SampleName"] = string.Empty; VisitClosing.Rows.Add(drVisitClosing); } gvClosing.DataSource = VisitClosing; gvClosing.DataBind(); for (int iii = 0; iii < VisitClosing2.Rows.Count; iii++) { DropDownList ddlPostCallAnalysis = (DropDownList)gvClosing.Rows[iii].Cells[0].FindControl("ddlPostCallAnalysis"); ddlPostCallAnalysis.SelectedIndex = ddlPostCallAnalysis.Items.IndexOf(ddlPostCallAnalysis.Items.FindByValue(VisitClosing2.Rows[iii][0].ToString())); DropDownList ddlPhysicianRequest = (DropDownList)gvClosing.Rows[iii].Cells[1].FindControl("ddlPhysicianRequest"); ddlPhysicianRequest.SelectedIndex = ddlPhysicianRequest.Items.IndexOf(ddlPhysicianRequest.Items.FindByValue(VisitClosing2.Rows[iii][2].ToString())); DropDownList ddlNextCallObjective = (DropDownList)gvClosing.Rows[iii].Cells[2].FindControl("ddlNextCallObjective"); ddlNextCallObjective.SelectedIndex = ddlNextCallObjective.Items.IndexOf(ddlNextCallObjective.Items.FindByValue(VisitClosing2.Rows[iii][4].ToString())); DropDownList ddlSample = (DropDownList)gvClosing.Rows[iii].Cells[3].FindControl("ddlSample"); ddlSample.SelectedIndex = ddlSample.Items.IndexOf(ddlSample.Items.FindByValue(VisitClosing2.Rows[iii][6].ToString())); } } System.Web.UI.WebControls.Button btnAddMessage = (System.Web.UI.WebControls.Button)gvClosing.FooterRow.Cells[0].FindControl("btnAddClosing"); //Page.Form.DefaultFocus = btnAddMessage.ClientID; for testing purpose }
protected void print_offerletter(object sender, EventArgs e) { { try { if (TXTNOKP.Text != "") { System.Web.UI.WebControls.Button button = (System.Web.UI.WebControls.Button)sender; string buttonId = button.ID; DataTable app_rujno = new DataTable(); app_rujno = DBCon.Ora_Execute_table("select cmn_applcn_no from cmn_ref_no where cmn_applcn_no= '" + TXTNOKP.Text + "' and cmn_ref_no='" + no_rujukan.Text + "'"); DataTable app_icno = new DataTable(); app_icno = DBCon.Ora_Execute_table("select app_new_icno from jpa_application where app_applcn_no= '" + TXTNOKP.Text + "'"); string sqno = string.Empty; if (buttonId == "Button5") { sqno = "1"; } else if (buttonId == "Button6") { sqno = "2"; } else { sqno = "3"; } if (app_rujno.Rows.Count != 0) { //Path DataSet ds = new DataSet(); DataTable dt = new DataTable(); //if (buttonId == "Button5" || buttonId == "Button6" || buttonId == "Button7") //{ // dt = DBCon.Ora_Execute_table("select * from (select * from jpa_guarantor where gua_applcn_no='" + TXTNOKP.Text + "' and gua_seq_no='" + sqno + "') as a full outer join(select * from cmn_ref_no where cmn_applcn_no='" + TXTNOKP.Text + "' and cmn_crt_dt IN (SELECT max(cmn_crt_dt) FROM cmn_ref_no)) as b on b.cmn_applcn_no=a.gua_applcn_no full outer join(select * from jpa_application where app_applcn_no='" + TXTNOKP.Text + "') as c on c.app_applcn_no=b.cmn_applcn_no"); //} //else //{ dt = DBCon.Ora_Execute_table("select *,mm.mem_member_no,app_new_icno,FORMAT (GETDATE(), 'dd/MM/yyyy', 'en-US') as cdt,FORMAT (jkk.jkk_meeting_dt, 'dd/MM/yyyy', 'en-US') as jkk_mdt,ISNULL(db.pha_pay_amt,'0.00') as jb_amt,ISNULL(app_loan_amt,'')+ISNULL(app_cumm_profit_amt,'') as lon_prfit_tot from (select * from cmn_ref_no where cmn_crt_dt IN (SELECT max(cmn_crt_dt) FROM cmn_ref_no) and cmn_applcn_no='" + TXTNOKP.Text + "') as a full outer join (select * from jpa_application where app_applcn_no='" + TXTNOKP.Text + "') as b on b.app_applcn_no=a.cmn_applcn_no full outer join (select cal_applcn_no,isnull(cal_approve_amt,0)cal_approve_amt,isnull(cal_installment_amt,0)cal_installment_amt,isnull(cal_profit_amt,0)cal_profit_amt,isnull(cal_stamp_duty_amt,0)cal_stamp_duty_amt,isnull(cal_process_fee,0)cal_process_fee,isnull(cal_deposit_amt,0)cal_deposit_amt,isnull(cal_tkh_amt,0)cal_tkh_amt,(isnull(cal_approve_amt,0) + isnull(cal_profit_amt,0)) as ap_amt,isnull(cal_profit_rate,0)cal_profit_rate from jpa_calculate_fee where cal_applcn_no='" + TXTNOKP.Text + "') as c on c.cal_applcn_no=b.app_applcn_no left join jpa_jkkpa_approval jkk on jkk.jkk_applcn_no=b.app_applcn_no left join jpa_disburse db on db.pha_applcn_no=b.app_applcn_no left join mem_member mm on mm.mem_new_icno=b.app_new_icno"); //} Rptviwer_cetak.Reset(); ds.Tables.Add(dt); Rptviwer_cetak.LocalReport.DataSources.Clear(); ReportDataSource rds; DataTable mem_status = new DataTable(); mem_status = DBCon.Ora_Execute_table("select app_loan_type_cd from jpa_application where app_applcn_no='" + TXTNOKP.Text + "'"); if (mem_status.Rows.Count != 0) { if (mem_status.Rows[0]["app_loan_type_cd"].ToString() == "P") { if (buttonId == "Button3") { Rptviwer_cetak.LocalReport.ReportPath = "Pelaburan_Anggota/cetak_offer_sahabat.rdlc"; rds = new ReportDataSource("coffer", dt); } //else if (buttonId == "Button4") //{ // Rptviwer_cetak.LocalReport.ReportPath = "Pelaburan_Anggota/Kemudahan_staff.rdlc"; // rds = new ReportDataSource("kemudahan", dt); //} //else if (buttonId == "Button8") //{ // Rptviwer_cetak.LocalReport.ReportPath = "Pelaburan_Anggota/Tambahan.rdlc"; // rds = new ReportDataSource("tambahan", dt); //} else if (buttonId == "Button4") { Rptviwer_cetak.LocalReport.ReportPath = "Pelaburan_Anggota/Penjamin.rdlc"; rds = new ReportDataSource("penjamin", dt); } else { Rptviwer_cetak.LocalReport.ReportPath = ""; rds = new ReportDataSource("coffer", dt); } } else { if (buttonId == "Button3") { Rptviwer_cetak.LocalReport.ReportPath = "Pelaburan_Anggota/cetak_offer_sahabat.rdlc"; rds = new ReportDataSource("coffer", dt); } //else if (buttonId == "Button4") //{ // Rptviwer_cetak.LocalReport.ReportPath = "Pelaburan_Anggota/Kemudahan_sahabat.rdlc"; // rds = new ReportDataSource("kemudahan", dt); //} //else if (buttonId == "Button8") //{ // Rptviwer_cetak.LocalReport.ReportPath = "Pelaburan_Anggota/Tambahan.rdlc"; // rds = new ReportDataSource("tambahan", dt); //} else if (buttonId == "Button4") { Rptviwer_cetak.LocalReport.ReportPath = "Pelaburan_Anggota/Penjamin.rdlc"; rds = new ReportDataSource("penjamin", dt); } else { Rptviwer_cetak.LocalReport.ReportPath = ""; rds = new ReportDataSource("coffer", dt); } } } else { Rptviwer_cetak.LocalReport.ReportPath = ""; rds = new ReportDataSource("coffer", dt); } //Parameters // if (buttonId == "Button4") // { // decimal a10 = decimal.Parse(dt.Rows[0][40].ToString()); // string ldu = DecimalToWords(a10); // decimal a4 = (decimal)dt.Rows[0]["cal_approve_amt"]; // string cpa = DecimalToWords(a4); // decimal a5 = (decimal)dt.Rows[0]["cal_installment_amt"]; // string cima = DecimalToWords(a5); // decimal a6 = (decimal)dt.Rows[0]["cal_profit_amt"]; // string cpat = DecimalToWords(a6); // decimal a7 = (decimal)dt.Rows[0]["ap_amt"]; // string apa = DecimalToWords(a7); // decimal a8 = (decimal)dt.Rows[0]["cal_profit_rate"]; // string cpr = DecimalToWords(a8); // decimal a9 = (decimal)dt.Rows[0]["lon_prfit_tot"]; // string lpt = DecimalToWords(a9); // ReportParameter[] rptParams = new ReportParameter[]{ //new ReportParameter("amt", cpa ), //new ReportParameter("amt1", cima ), //new ReportParameter("amt2", cpat ), //new ReportParameter("amt3", apa ), //new ReportParameter("amt4", cpr ), // new ReportParameter("amt5", lpt ), //new ReportParameter("amt6", ldu ) //}; // Rptviwer_cetak.LocalReport.SetParameters(rptParams); // } Rptviwer_cetak.LocalReport.DataSources.Add(rds); //Refresh Rptviwer_cetak.LocalReport.Refresh(); Warning[] warnings; string[] streamids; string mimeType; string encoding; string extension; string fname = DateTime.Now.ToString("dd_MM_yyyy"); string devinfo = "<DeviceInfo><ColorDepth>32</ColorDepth><DpiX>350</DpiX><DpiY>350</DpiY><OutputFormat>PDF</OutputFormat>" + " <PageWidth>12.20in</PageWidth>" + " <PageHeight>8.27in</PageHeight>" + " <MarginTop>0.1in</MarginTop>" + " <MarginLeft>0.5in</MarginLeft>" + " <MarginRight>0in</MarginRight>" + " <MarginBottom>0in</MarginBottom>" + "</DeviceInfo>"; byte[] bytes = Rptviwer_cetak.LocalReport.Render("PDF", null, out mimeType, out encoding, out extension, out streamids, out warnings); Response.Buffer = true; Response.Clear(); Response.ClearHeaders(); Response.ClearContent(); Response.ContentType = "application/pdf"; if (buttonId == "Button3") { Response.AddHeader("content-disposition", "attachment; filename=Surat_Tawaran_" + TXTNOKP.Text + "." + extension); } //else if (buttonId == "Button8") //{ // Response.AddHeader("content-disposition", "attachment; filename=Perjanjian_Tambahan_" + TXTNOKP.Text + "." + extension); //} else if (buttonId == "Button4") { Response.AddHeader("content-disposition", "attachment; filename=Kemudahan_Perjanjian_" + TXTNOKP.Text + "." + extension); } else { Response.AddHeader("content-disposition", "attachment; filename=Kemudahan_Perjanjian_" + TXTNOKP.Text + "." + extension); } Response.BinaryWrite(bytes); //Response.Write("<script>"); //Response.Write("window.open('', '_newtab');"); //Response.Write("</script>"); Response.Flush(); Response.End(); } else { tab1(); ScriptManager.RegisterStartupScript(this, GetType(), "alertMessage", "$.Zebra_Dialog('Sila Masukkan No Rujukan',{'type': 'warning','title': 'Warning','auto_close': 2000});", true); } } else { tab1(); ScriptManager.RegisterStartupScript(this, GetType(), "alertMessage", "$.Zebra_Dialog('Medan Input Adalah Mandatori',{'type': 'warning','title': 'Warning','auto_close': 2000});", true); } } catch (Exception ex) { throw ex; } } }
protected override void CreateChildControls() { ctrl = new System.Web.UI.WebControls.Button(); ctrl.ID = "ctrl"; Controls.Add(ctrl); }
private void RunDesignTimeTests() { try { this.DataGrid1.DataSource = WebControl_Attributes.m_dataSource; this.DataGrid2.DataSource = WebControl_Attributes.m_dataSource; this.DataList1.DataSource = WebControl_Attributes.m_dataSource; this.DataList2.DataSource = WebControl_Attributes.m_dataSource; this.DataGrid1.DataBind(); this.DataGrid2.DataBind(); this.DataList1.DataBind(); this.DataList2.DataBind(); GHTSubTest test1 = this.GHTSubTest25; WebControl control1 = this.Button1; this.AddAttributes(ref test1, ref control1); this.Button1 = (Button)control1; this.GHTSubTest25 = test1; test1 = this.GHTSubTest26; control1 = this.CheckBox1; this.AddAttributes(ref test1, ref control1); this.CheckBox1 = (CheckBox)control1; this.GHTSubTest26 = test1; test1 = this.GHTSubTest28; control1 = this.HyperLink1; this.AddAttributes(ref test1, ref control1); this.HyperLink1 = (HyperLink)control1; this.GHTSubTest28 = test1; test1 = this.GHTSubTest30; control1 = this.Image1; this.AddAttributes(ref test1, ref control1); this.Image1 = (Image)control1; this.GHTSubTest30 = test1; test1 = this.GHTSubTest32; control1 = this.ImageButton1; this.AddAttributes(ref test1, ref control1); this.ImageButton1 = (ImageButton)control1; this.GHTSubTest32 = test1; test1 = this.GHTSubTest34; control1 = this.Label1; this.AddAttributes(ref test1, ref control1); this.Label1 = (Label)control1; this.GHTSubTest34 = test1; test1 = this.GHTSubTest36; control1 = this.LinkButton1; this.AddAttributes(ref test1, ref control1); this.LinkButton1 = (LinkButton)control1; this.GHTSubTest36 = test1; test1 = this.GHTSubTest37; control1 = this.Panel1; this.AddAttributes(ref test1, ref control1); this.Panel1 = (Panel)control1; this.GHTSubTest37 = test1; test1 = this.GHTSubTest38; control1 = this.RadioButton1; this.AddAttributes(ref test1, ref control1); this.RadioButton1 = (RadioButton)control1; this.GHTSubTest38 = test1; test1 = this.GHTSubTest39; control1 = this.TextBox1; this.AddAttributes(ref test1, ref control1); this.TextBox1 = (TextBox)control1; this.GHTSubTest39 = test1; test1 = this.GHTSubTest40; control1 = this.DropDownList1; this.AddAttributes(ref test1, ref control1); this.DropDownList1 = (DropDownList)control1; this.GHTSubTest40 = test1; test1 = this.GHTSubTest41; control1 = this.ListBox1; this.AddAttributes(ref test1, ref control1); this.ListBox1 = (ListBox)control1; this.GHTSubTest41 = test1; test1 = this.GHTSubTest42; control1 = this.RadioButtonList1; this.AddAttributes(ref test1, ref control1); this.RadioButtonList1 = (RadioButtonList)control1; this.GHTSubTest42 = test1; test1 = this.GHTSubTest43; control1 = this.CheckBoxList1; this.AddAttributes(ref test1, ref control1); this.CheckBoxList1 = (CheckBoxList)control1; this.GHTSubTest43 = test1; test1 = this.GHTSubTest50; control1 = this.DataGrid1; this.AddAttributes(ref test1, ref control1); this.DataGrid1 = (DataGrid)control1; this.GHTSubTest50 = test1; test1 = this.GHTSubTest51; control1 = this.DataGrid2.Items[0]; this.AddAttributes(ref test1, ref control1); this.GHTSubTest51 = test1; test1 = this.GHTSubTest52; control1 = this.DataList1; this.AddAttributes(ref test1, ref control1); this.DataList1 = (DataList)control1; this.GHTSubTest52 = test1; test1 = this.GHTSubTest53; control1 = this.DataList2.Items[0]; this.AddAttributes(ref test1, ref control1); this.GHTSubTest53 = test1; test1 = this.GHTSubTest54; control1 = this.Table1; this.AddAttributes(ref test1, ref control1); this.Table1 = (Table)control1; this.GHTSubTest54 = test1; test1 = this.GHTSubTest55; control1 = this.Table5; this.AddAttributes(ref test1, ref control1); this.Table5 = (Table)control1; this.GHTSubTest55 = test1; test1 = this.GHTSubTest56; control1 = this.Table2; this.AddAttributes(ref test1, ref control1); this.Table2 = (Table)control1; this.GHTSubTest56 = test1; test1 = this.GHTSubTest57; control1 = this.Table3; this.AddAttributes(ref test1, ref control1); this.Table3 = (Table)control1; this.GHTSubTest57 = test1; } catch (Exception exception2) { // ProjectData.SetProjectError(exception2); Exception exception1 = exception2; this.GHTSubTestBegin(); string text1 = string.Empty + exception1.GetType().ToString(); text1 = text1 + " caught during preperations for design time tests."; text1 = text1 + "<br>Message: "; text1 = text1 + exception1.Message; text1 = text1 + "<br>Trace: "; text1 = text1 + exception1.StackTrace; this.GHTSubTestAddResult(text1); this.GHTSubTestEnd(); // ProjectData.ClearProjectError(); } }
private void fillTable(string rack, string zona) { HtmlTableRow r = new HtmlTableRow(); HtmlTableCell c = new HtmlTableCell(); string scom = "", text = "", vent = "", id = "", values = ""; List <int> niveles = new List <int>(), ventanas = new List <int>(); int n = 0, v = 0, pos = 0; try { con = new SqlConnection(ds); con2 = new SqlConnection(ds); con.Open(); con2.Open(); scom = "SELECT N.Clave, count(V.idVentana) AS VENTANAS FROM VENTANAS V " + "inner JOIN NIVELES N ON N.idNivel = V.IDnivel " + "INNER JOIN RACKS R ON R.idRack = N.IDrack " + "INNER JOIN Zonas z ON z.IdZona = R.IDZona " + "WHERE R.Clave = '" + rack + "' and r.IDZona = '" + zona + "'" + "GROUP by N.Clave ORDER by N.Clave DESC"; com = new SqlCommand(scom, con); SqlDataReader dr = com.ExecuteReader(); while (dr.Read()) { n = (int.Parse(dr[0].ToString())); v = (int.Parse(dr[1].ToString())); r = new HtmlTableRow(); // new row for (int i = 0; i < 1; i++) { scom = "SELECT R.idRack as idRack,R.clave AS rackClave, N.idNivel AS idNivel, V.idVentana AS idVentana,V.clave AS claveVentana, V.tipo, P.IDPosicion AS idPosicion " + ",P.imo, P.peso, P.altura, P.IdTipoPos " + "FROM RACKS R " + "INNER JOIN NIVELES N ON N.IDrack = R.idRack " + "INNER JOIN VENTANAS V ON V.IDnivel = N.idNivel " + "INNER JOIN POSICIONES P on P.IDventana = V.idVentana " + "INNER JOIN Zonas z on z.IdZona = R.IDZona " + //"WHERE N.idNivel = " + n + " AND P.clave = 1 ORDER BY v.idVentana"; "WHERE N.idNivel = " + n + " AND R.IDZona = " + ddlZona.SelectedValue.ToString() + " AND R.IDRack = '" + ddlRack.SelectedItem.ToString() + "' AND P.clave = 1 ORDER BY v.idVentana"; com2 = new SqlCommand(scom, con2); SqlDataReader dr2 = com2.ExecuteReader(); while (dr2.Read()) { vent = String.Format("{0:00}", dr2[4]); pos = int.Parse(dr2[5].ToString()); id = ddlZona.SelectedItem.ToString() + dr2[1].ToString() + n + vent + pos; // values = imo,peso, altura, idTipoPos values = "," + dr2[7].ToString() + "," + dr2[8].ToString() + "," + dr2[9].ToString() + "," + dr2[10]; c = new HtmlTableCell(); // cells System.Web.UI.WebControls.Button b = new System.Web.UI.WebControls.Button(); text = "Nivel " + n + " - Ventana " + vent; if (int.Parse(dr2[10].ToString()) == 3) { b.Attributes.Add("class", "btn btn-small btn-danger btn-block"); } else if (pos == 1) { b.Attributes.Add("class", "btn btn-small btn-block"); } else if (pos == 2) { b.Attributes.Add("class", "btn btn-small btn-success btn-block"); } else if (pos == 3) { b.Attributes.Add("class", "btn btn-small btn-warning btn-block"); } else if (pos == 4) { b.Attributes.Add("class", "btn btn-small btn-info btn-block"); } b.ID = id + values; b.Text = "N" + n + " V" + vent; // -- tooltip b.Attributes.Add("data-toggle", "tooltip"); b.Attributes.Add("title", ""); b.Attributes.Add("data-original-title", text); b.Attributes.Add("UseSubmitBehavior", "false"); // le das en la madre al submit b.Attributes.Add("onclick", "return JSFunction(this);"); c.Controls.Add(b); r.Cells.Add(c); } dr2.Close(); } // ventanas por nivel t1.Rows.Add(r); } // fin while dr.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { if (con.State == ConnectionState.Open) { con.Close(); } if (con2.State == ConnectionState.Open) { con2.Close(); } } //Page.ClientScript.RegisterStartupScript(this.GetType(), "Myscript", "getMessage();"); //ScriptManager.RegisterClientScriptBlock(Page, this.GetType(), "Myscript", "config_click();", true); }
protected void Page_Load(object sender, EventArgs e) { if (Session["uid"] == null) { ordersTable.Visible = true; uOrdertable.Visible = false; if (Request.Cookies["COMP"] != null) { comp.InnerText = Server.HtmlEncode(Request.Cookies["COMP"]["item"]); tp.InnerText = Server.HtmlEncode(Request.Cookies["COMP"]["price"]); } if (Request.Cookies["RAM"] != null) { r.InnerText = Server.HtmlEncode(Request.Cookies["RAM"]["item"]); rp.InnerText = Server.HtmlEncode(Request.Cookies["RAM"]["price"]); } if (Request.Cookies["HD"] != null) { h.InnerText = Server.HtmlEncode(Request.Cookies["HD"]["item"]); hp.InnerText = Server.HtmlEncode(Request.Cookies["HD"]["price"]); } if (Request.Cookies["CPU"] != null) { c.InnerText = Server.HtmlEncode(Request.Cookies["CPU"]["item"]); cp.InnerText = Server.HtmlEncode(Request.Cookies["CPU"]["price"]); } if (Request.Cookies["D"] != null) { d.InnerText = Server.HtmlEncode(Request.Cookies["D"]["item"]); dp.InnerText = Server.HtmlEncode(Request.Cookies["D"]["price"]); } if (Request.Cookies["OS"] != null) { o.InnerText = Server.HtmlEncode(Request.Cookies["OS"]["item"]); op.InnerText = Server.HtmlEncode(Request.Cookies["OS"]["price"]); } if (Request.Cookies["SC"] != null) { s.InnerText = Server.HtmlEncode(Request.Cookies["SC"]["item"]); sp.InnerText = Server.HtmlEncode(Request.Cookies["SC"]["price"]); } } else { ordersTable.Visible = false; uOrdertable.Visible = true; DBManager myDBManager = new DBManager(); List <string> orders = myDBManager.getOrders(Session["uid"].ToString()); for (int i = 0; i < orders.Count; i += 3) { HtmlTableRow row = new HtmlTableRow(); HtmlTableRow totalRow = new HtmlTableRow(); HtmlTableRow buttonRow = new HtmlTableRow(); HtmlTableCell cell = new HtmlTableCell(); HtmlTableCell priceCell = new HtmlTableCell(); HtmlTableCell itemCell = new HtmlTableCell(); HtmlTableCell totalCell = new HtmlTableCell(); HtmlTableCell totalPriceCell = new HtmlTableCell(); HtmlTableCell editCell = new HtmlTableCell(); HtmlTableCell removeCell = new HtmlTableCell(); cell.InnerHtml = "computer:<br>RAM:<br>Hard Drive:<br>CPU:<br>Display:<br>OS:<br>Soundcard:"; itemCell.InnerHtml = orders[i]; priceCell.InnerHtml = orders[i + 1]; totalCell.InnerHtml = "Total:"; string[] prices = Regex.Split(orders[i + 1], "<br>"); List <string> pricesList = prices.ToList <string>(); pricesList.RemoveAll(s => string.IsNullOrWhiteSpace(s)); List <int> pricesInt = pricesList.Select(int.Parse).ToList(); int totalPrice = pricesInt.Sum(); totalPriceCell.InnerHtml = totalPrice.ToString(); System.Web.UI.WebControls.Button edit = new System.Web.UI.WebControls.Button(); edit.ID = "edit" + orders[i + 2]; edit.Text = "Edit"; edit.Click += new EventHandler(editB); edit.CommandArgument = orders[i + 2]; editCell.Controls.Add(edit); System.Web.UI.WebControls.Button remove = new System.Web.UI.WebControls.Button(); remove.ID = "remove" + orders[i + 2]; remove.Text = "Remove"; remove.Click += new EventHandler(removeB); remove.CommandArgument = orders[i + 2]; removeCell.Controls.Add(remove); row.Cells.Add(cell); row.Cells.Add(itemCell); row.Cells.Add(priceCell); totalRow.Cells.Add(new HtmlTableCell()); totalRow.Cells.Add(totalCell); totalRow.Cells.Add(totalPriceCell); buttonRow.Cells.Add(editCell); buttonRow.Cells.Add(removeCell); uOrdertable.Rows.Add(row); uOrdertable.Rows.Add(totalRow); uOrdertable.Rows.Add(buttonRow); uOrdertable.Rows.Add(new HtmlTableRow()); } } }
protected void Populate_GridView(string panel_name, string gv_name, string mycmd, SqlConnection con) { LogToPage("here in Populate_GridView: " + panel_name + ", " + gv_name); if (debugprint) { tblmyinfo.Rows[0].Cells[0].InnerHtml += "<br/>---> Populate:" + gv_name + " <br/>"; } try { if (debugprint) { tblmyinfo.Rows[0].Cells[0].InnerHtml += "--> mycmd: " + mycmd + "<br/>"; } SqlCommand sqlCmd = new System.Data.SqlClient.SqlCommand(mycmd, con); SqlDataReader sqlReader = sqlCmd.ExecuteReader(); DataTable dt = new DataTable(); LogToPage("here in Populate_GridView 1"); dt.Load(sqlReader); LogToPage("here in Populate_GridView 2"); if (gv_name == "GridView_01a") { gv_Tables_Views.DataSource = dt; gv_Tables_Views.DataBind(); } else { GridView gv = new GridView(); LogToPage("here in Populate_GridView 3"); gv.ID = gv_name; gv.DataSource = dt; LogToPage("here in Populate_GridView 4"); gv.RowCommand += new GridViewCommandEventHandler(gv_RowCommand); gv.DataBind(); LogToPage("here in Populate_GridView 5"); if (gv_name == "GridView_01") { foreach (System.Web.UI.WebControls.GridViewRow row in gv.Rows) { string val = row.Cells[11].Text; // row["NDARview"]; row.Cells[0].Text = ""; System.Web.UI.WebControls.Button btn = new System.Web.UI.WebControls.Button(); btn.Text = "Export file"; btn.CommandName = "cmdExport"; btn.CommandArgument = val; row.Cells[0].Controls.Add(btn); } } Control ctl = this.FindControlRecursive(this.Page, panel_name); LogToPage("here in Populate_GridView 6"); Panel panel = (Panel)ctl; panel.Controls.Add(gv); LogToPage("here in Populate_GridView 7"); panel.Visible = true; } } catch (SqlException oException) { LogToPage("here in error. "); foreach (SqlError oErr in oException.Errors) { tblmyinfo.Rows[0].Cells[0].InnerHtml += oErr.Message; } } }
protected void Page_Load(object sender, EventArgs e) { for (int i = 0; i < gvViewQuotes.Rows.Count; i++) { bool submitted = false; string referenceNum = gvViewQuotes.Rows[i].Cells[0].Text; //check to see if the quote is submitted. if it is, the hyperlink will be disabled and the text will be: "submitted" SqlConnection connSubmitted = Website.getSQLConnection(); SqlCommand cmdSubmitted = Website.getSQLCommand(connSubmitted); cmdSubmitted.CommandText = "SELECT * FROM quote where Reference# = " + Convert.ToInt32(referenceNum) + "AND Submitted = 1"; cmdSubmitted.CommandType = System.Data.CommandType.Text; SqlDataReader readerSubmitted; connSubmitted.Open(); readerSubmitted = cmdSubmitted.ExecuteReader(); int counterSubmitted = 0; while (readerSubmitted.Read()) { counterSubmitted++; } if (counterSubmitted > 0) { submitted = true; } connSubmitted.Close(); HyperLink hyperlink = new HyperLink(); hyperlink.Text = "Edit"; hyperlink.NavigateUrl = "~/Wepages/Applicant.aspx/?ReferenceNum=" + referenceNum; if (submitted) { hyperlink.Text = "Submitted"; hyperlink.Enabled = false; gvViewQuotes.Rows[i].Cells[5].Controls.Add(hyperlink); } else if (gvViewQuotes.Rows[i].Cells[4].Text == "Active") { gvViewQuotes.Rows[i].Cells[5].Controls.Add(hyperlink); } else { hyperlink.Enabled = false; gvViewQuotes.Rows[i].Cells[5].Controls.Add(hyperlink); } System.Web.UI.WebControls.Button deactivate = new System.Web.UI.WebControls.Button(); deactivate.ID = "btnDeac"; deactivate.Text = "Deactivate"; deactivate.OnClientClick = "return confirm('You are Deactivating this quote. Click Ok to confirm.');"; deactivate.Click += new System.EventHandler((s, ea) => deactivateClicked(s, ea, referenceNum)); System.Web.UI.WebControls.Button reqReactivate = new System.Web.UI.WebControls.Button(); reqReactivate.ID = "btnReac"; reqReactivate.OnClientClick = "return confirm('You are requesting to reactivate this quote. Click Ok to confirm.');"; reqReactivate.Text = "Request Reactivation"; reqReactivate.Click += new System.EventHandler((s, ea) => reqReactivateClicked(s, ea, referenceNum)); if (submitted) { } else if (gvViewQuotes.Rows[i].Cells[4].Text == "Active") { gvViewQuotes.Rows[i].Cells[6].Controls.Add(deactivate); } else { gvViewQuotes.Rows[i].Cells[6].Controls.Add(reqReactivate); } //go through each quote and look to see if reactivation was requested. //test to see if there is another manager. If the this manager is THE ONLY manager, the system will assign his agentID to their manager columns SqlConnection conn = Website.getSQLConnection(); SqlCommand cmd = Website.getSQLCommand(conn); cmd.CommandText = "SELECT * FROM quote where Reference# = " + Convert.ToInt32(referenceNum) + " and reactivation = 1"; cmd.CommandType = System.Data.CommandType.Text; SqlDataReader reader; conn.Open(); reader = cmd.ExecuteReader(); int counter = 0; while (reader.Read()) { counter++; } conn.Close(); if (counter == 1)//if the quote is requested to be reactivated, disable the button and change its text. { reqReactivate.Text = "Reactivation Requested"; reqReactivate.Enabled = false; } cmd.CommandText = "select * from QuotePDFs where pdfID = (select quoteID from quote where reference# = " + referenceNum + ")"; cmd.CommandType = System.Data.CommandType.Text; SqlDataReader readerPDF; conn.Open(); readerPDF = cmd.ExecuteReader(); int count = 0; while (readerPDF.Read()) { count++; } try { if (count == 1) { System.Web.UI.WebControls.Button btnView = new System.Web.UI.WebControls.Button(); btnView.ID = "btnView"; btnView.Text = "View PDF"; btnView.Click += new System.EventHandler((s, ea) => viewPDF(s, ea, referenceNum)); gvViewQuotes.Rows[i].Cells[7].Controls.Add(btnView); } } catch { } conn.Close(); } if (gvViewQuotes.Rows.Count < 1) { lblSearchInput.Text = "No results found."; } }
private void UpdateViewButton() { TransportationOrder order = TheTransportationOrderMgr.LoadTransportationOrder(this.OrderNo); User currentUser = this.Page.Session["Current_User"] as User; Button btnSave = ((Button)(this.FV_Order.FindControl("btnSave"))); Button btnStart = ((Button)(this.FV_Order.FindControl("btnStart"))); Button btnCancel = ((Button)(this.FV_Order.FindControl("btnCancel"))); Button btnPrint = ((Button)(this.FV_Order.FindControl("btnPrint"))); Button btnComplete = ((Button)(this.FV_Order.FindControl("btnComplete"))); Button btnValuate = ((Button)(this.FV_Order.FindControl("btnValuate"))); Button btnCheck = ((Button)(this.FV_Order.FindControl("btnCheck"))); Button btnRestore = ((Button)(this.FV_Order.FindControl("btnRestore"))); btnSave.Visible = false; btnStart.Visible = false; btnCancel.Visible = false; btnPrint.Visible = false; btnComplete.Visible = false; btnCheck.Visible = false; btnRestore.Visible = false; btnValuate.Visible = !order.IsValuated && (order.Status != BusinessConstants.CODE_MASTER_STATUS_VALUE_CREATE && order.Status != BusinessConstants.CODE_MASTER_STATUS_VALUE_CANCEL); if (order.Status == BusinessConstants.CODE_MASTER_STATUS_VALUE_CREATE) { btnSave.Visible = true; //btnStart.Visible = true; // if (currentUser.HasPermission("btnIPCreate")) btnCancel.Visible = true; btnCheck.Visible = true; } else if (order.Status == BusinessConstants.CODE_MASTER_STATUS_VALUE_SUBMIT) { btnCancel.Visible = true; btnPrint.Visible = true; } else if (order.Status == BusinessConstants.CODE_MASTER_STATUS_VALUE_INPROCESS) { btnCancel.Visible = true; btnPrint.Visible = true; btnRestore.Visible = true; if (currentUser.HasPermission("btnIPStart")) { btnComplete.Visible = true; } } else if (order.Status == BusinessConstants.CODE_MASTER_STATUS_VALUE_COMPLETE) { btnPrint.Visible = true; btnValuate.Visible = false; btnCancel.Visible = false; btnRestore.Visible = true; } else if (order.Status == "Checked")//已审核 { btnStart.Visible = true; btnValuate.Visible = false; btnCancel.Visible = true; btnRestore.Visible = true; } else if (order.Status == "Close") { btnComplete.Visible = true; btnPrint.Visible = true; btnRestore.Visible = true; } }
protected void Page_Load(object sender, EventArgs e) { if (Session["cid"] == null) { Page.ClientScript.RegisterStartupScript(this.GetType(), "msgbox", "<script> message('Please Login First')</script>"); Session["link"] = "BuyerProfile.aspx"; Response.AddHeader("REFRESH", "3;URL=loginform.aspx?val=login"); } else { int cat_count; c.cmd.CommandText = "select cat_name from cat"; adp.SelectCommand = c.cmd; dt2.Clear(); adp.Fill(dt2); cat_count = dt2.Rows.Count; if (!Page.IsPostBack) { ddcatlist.Items.Clear(); ddcatlist.Items.Add("All"); for (int ii = 1; ii < dt2.Rows.Count; ii++) { ddcatlist.Items.Add(dt2.Rows[ii - 1].ItemArray[0].ToString()); } } //HtmlAnchor[] a = new HtmlAnchor[cat_count]; //HtmlGenericControl[] li = new HtmlGenericControl[cat_count]; //for (int ii = 0; ii < cat_count; i++) //{ // li[i] = new HtmlGenericControl("li"); // a[i] = new HtmlAnchor(); // li[i].InnerHtml = dt2.Rows[i].ItemArray[0].ToString(); // a[i].ServerClick += new EventHandler(view_cats); // a[i].HRef = "ProductList.aspx"; // a[i].Attributes.Add("cat_name", dt2.Rows[i].ItemArray[0].ToString()); // //catul.Controls.Add(a[i]); // a[i].Controls.Add(li[i]); //} if (Convert.ToString(Session["cid"]) == "") { userlogin.Visible = false; user1.Visible = true; user2.Visible = true; lblitemcount.Text = "0"; //lblamt.Text = "RS:00"; } else { Label3.Text = "Hi ," + Session["cfname"].ToString() + "!"; long tot = 0; user1.Visible = false; user2.Visible = false; userlogin.Visible = true; c.cmd.CommandText = "SELECT * FROM cart WHERE (cid = '" + Session["cid"].ToString() + "')"; adp.SelectCommand = c.cmd; dt3.Clear(); adp.Fill(dt3); if (dt3.Rows.Count > 0) { lblitemcount.Text = dt3.Rows.Count.ToString(); for (int k = 0; k < dt3.Rows.Count; k++) { tot += Convert.ToInt64(dt3.Rows[k].ItemArray[4]); } // lblamt.Text = "RS:" + tot; } else { lblitemcount.Text = "0"; //lblamt.Text = "RS:00"; } } c.cmd.CommandText = "select img3 from cust where cid='" + Session["cid"].ToString() + "'"; adp.SelectCommand = c.cmd; dt5.Clear(); adp.Fill(dt5); if (dt5.Rows.Count > 0) { i1.ImageUrl = Convert.ToString(dt5.Rows[0].ItemArray[0]); } // try // { int loop = 0, i = 0; DateTime date = new DateTime(); date = DateTime.Now; TableCell[] tc = new TableCell[16]; TableRow[] tr = new TableRow[8]; c.cmd.CommandText = "select cfname,email,contact,address,city,state,pin,country from cust where cid='" + Session["cid"].ToString() + "'"; adp.SelectCommand = c.cmd; dt.Clear(); adp.Fill(dt); if (dt.Rows.Count > 0) { foreach (DataColumn dc in dt.Columns) { tr[loop] = new TableRow(); tc[i] = new TableCell(); tc[i].Text = dc.ColumnName.ToString(); tc[i].Text = tc[i].Text.ToUpper() + ":"; tc[i].CssClass = "tblhead"; tr[loop].Controls.Add(tc[i]); i++; tc[i] = new TableCell(); tc[i].Text = dt.Rows[0].ItemArray[loop].ToString(); tc[i].Text = tc[i].Text.ToUpper(); tr[loop].Controls.Add(tc[i]); tr[loop].CssClass = "tblcontent"; i++; addresstbl.Controls.Add(tr[loop]); loop++; } TableCell tc2 = new TableCell(); TableRow tr2 = new TableRow(); tr2.CssClass = "updateaddr"; LinkButton lnkaddress = new LinkButton(); lnkaddress.Click += new EventHandler(lnkaddress_Click); lnkaddress.CssClass = " lnkaddress"; addresstbl.Controls.Add(tr2); tr2.Controls.Add(tc2); tc2.Controls.Add(lnkaddress); lnkaddress.Text = "Update Address>>"; tc2.ColumnSpan = 2; c.cmd.CommandText = "select date,name,order_detail.total,status,payment,order_detail.order_id,product_id,qty,delivery_date from orders,order_detail where orders.order_id=order_detail.order_id and cid='" + Session["cid"] + "' order by date desc"; adp.SelectCommand = c.cmd; dt1.Clear(); adp.Fill(dt1); if (dt1.Rows.Count > 0) { //ordertbl.Visible = true; j = 0; num = 1; TableRow[] tr1 = new TableRow[dt1.Rows.Count]; TableCell[] tc1 = new TableCell[dt1.Rows.Count * 9]; System.Web.UI.WebControls.Button[] b = new System.Web.UI.WebControls.Button[dt1.Rows.Count * 3]; for (i = 0; i < dt1.Rows.Count; i++) { loop = 0; tr1[i] = new TableRow(); tr1[i].CssClass = "row"; total += Convert.ToInt64(dt1.Rows[i].ItemArray[2]); qty += Convert.ToInt16(dt1.Rows[i].ItemArray[7]); for (; j < (i + 1) * 9; j++) { HtmlAnchor a = new HtmlAnchor(); tc1[j] = new TableCell(); tc1[j].CssClass = "ordercontent"; if (j % 9 == 0) { tc1[j].Text = num.ToString().ToUpper(); num++; } else if (j == ((i + 1) * 9) - 1) { if (dt1.Rows[i].ItemArray[3].ToString() == "delivered") { tc1[j].Text = "Delivered"; } else if (dt1.Rows[i].ItemArray[3].ToString() == "cancelled") { tc1[j].Text = "Cancelled"; } else { b[i] = new System.Web.UI.WebControls.Button(); b[i].CssClass = "invoicebtn"; b[i].Attributes.Add("order_id", dt1.Rows[i].ItemArray[5].ToString()); b[i].Attributes.Add("product_id", dt1.Rows[i].ItemArray[6].ToString()); b[i].Click += new EventHandler(track_Click); b[i].Text = "Track"; tc1[j].Controls.Add(b[i]); } } else if (j == ((i + 1) * 9) - 3) { b[i] = new System.Web.UI.WebControls.Button(); b[i].CssClass = "invoicebtn"; b[i].Attributes.Add("order_id", dt1.Rows[i].ItemArray[5].ToString()); b[i].Attributes.Add("product_id", dt1.Rows[i].ItemArray[6].ToString()); b[i].Click += new EventHandler(btninvoice_Click); b[i].Text = "Invoice"; tc1[j].Controls.Add(b[i]); } else if (j == ((i + 1) * 9) - 2) { b[i] = new System.Web.UI.WebControls.Button(); b[i].CssClass = "returnbtn"; b[i].Attributes.Add("order_id", dt1.Rows[i].ItemArray[5].ToString()); b[i].Attributes.Add("product_id", dt1.Rows[i].ItemArray[6].ToString()); TimeSpan ts = date.Date - date.Date; if (dt1.Rows[i].ItemArray[8].ToString() != "") { ts = date.Date - Convert.ToDateTime(dt1.Rows[i].ItemArray[8]).Date; } if (ts.TotalDays > 7 && dt1.Rows[i].ItemArray[3].ToString() == "delivered") { c.cmd.CommandText = "select * from reviews where cid='" + Session["cid"].ToString() + "' and product_id='" + b[i].Attributes["product_id"].ToString() + "'and order_id=" + Convert.ToInt64(b[i].Attributes["order_id"]) + ""; adp.SelectCommand = c.cmd; dt4.Clear(); adp.Fill(dt4); if (dt4.Rows.Count <= 0) { b[i].Text = "Rate"; } else { b[i].Text = "Edit Rate"; } b[i].Click += new EventHandler(rate_Click); } else if (dt1.Rows[i].ItemArray[3].ToString() == "delivered") { b[i].Text = "Return"; b[i].Click += new EventHandler(btnreturn_Click); } else { b[i].Text = "Cancel"; b[i].Attributes.Add("qty", dt1.Rows[i].ItemArray[7].ToString()); b[i].OnClientClick = "return Confirm()"; b[i].Click += new EventHandler(btncancel_Click); } if (dt1.Rows[i].ItemArray[3].ToString() == "cancelled") { b[i].Enabled = false; b[i].Text = "Cancelled"; } if (dt1.Rows[i].ItemArray[3].ToString().Substring(0, 6) == "return") { b[i].Enabled = false; b[i].Text = "Retun Request Received"; } tc1[j].Controls.Add(b[i]); } else { tc1[j].Text = dt1.Rows[i].ItemArray[loop].ToString().ToUpper(); loop++; } tr1[i].Controls.Add(tc1[j]); } //ordertbl.Controls.Add(tr1[i]); } } else { //ordertbl.Visible = false; } } c.cmd.CommandText = "SELECT * FROM cart WHERE (cid = '" + Session["cid"].ToString() + "')"; adp.SelectCommand = c.cmd; dt3.Clear(); adp.Fill(dt3); if (dt3.Rows.Count > 0) { tot = 0; //lblitemcount.Text = dt3.Rows.Count.ToString(); for (int k = 0; k < dt3.Rows.Count; k++) { tot += Convert.ToInt64(dt3.Rows[k].ItemArray[4]); } //lblamt.Text = "RS:" + tot; } else { //lblitemcount.Text = "0"; //lblamt.Text = "0"; } //lblpurchaseitemcount.Text = qty.ToString(); //lblpurchaseamt.Text = total.ToString(); // } //catch (NullReferenceException) // { // Page.ClientScript.RegisterStartupScript(this.GetType(), "msgbox", "<script> message('Please Login First')</script>"); // Session["link"] = "BuyerProfile.aspx"; // Response.AddHeader("REFRESH", "3;URL=loginform.aspx?val=login"); // } // catch (Exception) // { // throw; // } } }
private void RunDesignTimeTests() { try { this.Datagrid3.DataSource = WebControl_Style.m_dataSource; this.Datagrid4.DataSource = WebControl_Style.m_dataSource; this.Datalist3.DataSource = WebControl_Style.m_dataSource; this.Datalist4.DataSource = WebControl_Style.m_dataSource; this.Datagrid3.DataBind(); this.Datagrid4.DataBind(); this.Datalist3.DataBind(); this.Datalist4.DataBind(); GHTSubTest test1 = this.GHTSubTest24; WebControl control1 = this.Button2; this.AddAttributes(ref test1, ref control1); this.Button2 = (Button)control1; this.GHTSubTest24 = test1; test1 = this.GHTSubTest25; control1 = this.Checkbox2; this.AddAttributes(ref test1, ref control1); this.Checkbox2 = (CheckBox)control1; this.GHTSubTest25 = test1; test1 = this.GHTSubTest26; control1 = this.Hyperlink2; this.AddAttributes(ref test1, ref control1); this.Hyperlink2 = (HyperLink)control1; this.GHTSubTest26 = test1; test1 = this.GHTSubTest27; control1 = this.Image2; this.AddAttributes(ref test1, ref control1); this.Image2 = (Image)control1; this.GHTSubTest27 = test1; test1 = this.GHTSubTest28; control1 = this.Imagebutton2; this.AddAttributes(ref test1, ref control1); this.Imagebutton2 = (ImageButton)control1; this.GHTSubTest28 = test1; test1 = this.GHTSubTest29; control1 = this.Label2; this.AddAttributes(ref test1, ref control1); this.Label2 = (Label)control1; this.GHTSubTest29 = test1; test1 = this.GHTSubTest30; control1 = this.Linkbutton2; this.AddAttributes(ref test1, ref control1); this.Linkbutton2 = (LinkButton)control1; this.GHTSubTest30 = test1; test1 = this.GHTSubTest31; control1 = this.Panel2; this.AddAttributes(ref test1, ref control1); this.Panel2 = (Panel)control1; this.GHTSubTest31 = test1; test1 = this.GHTSubTest32; control1 = this.Radiobutton2; this.AddAttributes(ref test1, ref control1); this.Radiobutton2 = (RadioButton)control1; this.GHTSubTest32 = test1; test1 = this.GHTSubTest33; control1 = this.Textbox2; this.AddAttributes(ref test1, ref control1); this.Textbox2 = (TextBox)control1; this.GHTSubTest33 = test1; test1 = this.GHTSubTest34; control1 = this.Dropdownlist2; this.AddAttributes(ref test1, ref control1); this.Dropdownlist2 = (DropDownList)control1; this.GHTSubTest34 = test1; test1 = this.GHTSubTest35; control1 = this.Listbox2; this.AddAttributes(ref test1, ref control1); this.Listbox2 = (ListBox)control1; this.GHTSubTest35 = test1; test1 = this.GHTSubTest36; control1 = this.Radiobuttonlist2; this.AddAttributes(ref test1, ref control1); this.Radiobuttonlist2 = (RadioButtonList)control1; this.GHTSubTest36 = test1; test1 = this.GHTSubTest37; control1 = this.Checkboxlist2; this.AddAttributes(ref test1, ref control1); this.Checkboxlist2 = (CheckBoxList)control1; this.GHTSubTest37 = test1; test1 = this.GHTSubTest44; control1 = this.Datagrid3; this.AddAttributes(ref test1, ref control1); this.Datagrid3 = (DataGrid)control1; this.GHTSubTest44 = test1; test1 = this.GHTSubTest45; control1 = this.Datagrid4.Items[0]; this.AddAttributes(ref test1, ref control1); this.GHTSubTest45 = test1; test1 = this.GHTSubTest46; control1 = this.Datalist3; this.AddAttributes(ref test1, ref control1); this.Datalist3 = (DataList)control1; this.GHTSubTest46 = test1; test1 = this.GHTSubTest47; control1 = this.Datalist4.Items[0]; this.AddAttributes(ref test1, ref control1); this.GHTSubTest47 = test1; test1 = this.GHTSubTest48; control1 = this.Table4; this.AddAttributes(ref test1, ref control1); this.Table4 = (Table)control1; this.GHTSubTest48 = test1; test1 = this.GHTSubTest49; control1 = this.Table6; this.AddAttributes(ref test1, ref control1); this.Table6 = (Table)control1; this.GHTSubTest49 = test1; test1 = this.GHTSubTest50; control1 = this.Table7; this.AddAttributes(ref test1, ref control1); this.Table7 = (Table)control1; this.GHTSubTest50 = test1; test1 = this.GHTSubTest51; control1 = this.Table8; this.AddAttributes(ref test1, ref control1); this.Table8 = (Table)control1; this.GHTSubTest51 = test1; } catch (Exception exception2) { // ProjectData.SetProjectError(exception2); Exception exception1 = exception2; this.GHTSubTestBegin(); this.GHTSubTestUnexpectedExceptionCaught(exception1); this.GHTSubTestEnd(); // ProjectData.ClearProjectError(); } }