public void SetActiveView (View view) { int i = Controls.IndexOf (view); if (i == -1) throw new HttpException ("The provided view is not contained in the MultiView control."); ActiveViewIndex = i; }
/// <summary> /// Starts an operation with the provided name and window title. /// </summary> /// <param name="operation">The name of the operation.</param> /// <param name="view">The view to display.</param> public static void StartOperation(string operation, View view) { PreviousOperation = CurrentOperation; CurrentOperation = operation; if (view != null) ((MultiView)view.Parent).ActiveViewIndex = ((MultiView)view.Parent).Views.IndexOf(view); }
protected bool IsAppropriateView(View p_ctlView) { if (p_ctlView is UserView && Entity == EntityType.User) { return true; } if (p_ctlView is DefaultView) { return true; } return false; }
private string GetDesignTimeHtmlHelper(bool useRegions, DesignerRegionCollection regions) { System.Web.UI.WebControls.View component = (System.Web.UI.WebControls.View)base.Component; if (!(component.Parent is MultiView)) { return(base.CreateInvalidParentDesignTimeHtml(typeof(System.Web.UI.WebControls.View), typeof(MultiView))); } if (useRegions) { return(base.GetDesignTimeHtml(regions)); } return(base.GetDesignTimeHtml()); }
protected override void CreateChildControls() { Controls.Clear(); pairingMultiView = new MultiView() { ActiveViewIndex = 0 }; View notUsingLatchView = new View() { ID = "notUsingLatchView" }; notUsingLatchView.Controls.Add(new Literal() { Text = "You are not using the Latch Membership Provider." }); pairingMultiView.Views.Add(notUsingLatchView); View anonymousView = new View() { ID = "AnonymousView" }; anonymousView.Controls.Add(new Literal() { Text = "You are not logged in. Please login to manage your account pairing." }); pairingMultiView.Views.Add(anonymousView); View pairedView = new View() { ID = "PairedView" }; pairedView.Controls.Add(new Literal() { Text = "Account ID: " }); accountIdLabel = new Label() { ID = "AccountIdLabel" }; accountIdLabel.Font.Bold = true; pairedView.Controls.Add(accountIdLabel); Button unpairButton = new Button() { ID = "UnpairButton", Text = "Unpair" }; unpairButton.Click += new EventHandler(UnpairButton_Click); pairedView.Controls.Add(new Literal() { Text = " " }); pairedView.Controls.Add(unpairButton); pairingMultiView.Views.Add(pairedView); View unpairedView = new View() { ID = "UnpairedView" }; unpairedView.Controls.Add(new Literal() { Text = "Pairing token: " }); pairingTokenTextBox = new TextBox() { ID = "PairingTokenTextBox" }; unpairedView.Controls.Add(pairingTokenTextBox); Button pairButton = new Button() { ID = "PairButton", Text = "Pair" }; pairButton.Click += new EventHandler(PairButton_Click); unpairedView.Controls.Add(new Literal() { Text = " " }); unpairedView.Controls.Add(pairButton); pairingMultiView.Views.Add(unpairedView); //this.Controls.Add(new Literal() { Text = "<h3>Pairing with Latch</h3>" }); this.Controls.Add(pairingMultiView); }
protected void btnUpdate_Click(object sender, EventArgs e) { if (CurrentUserSession == null || (CurrentGroupMember == null && !CurrentUserSession.IsAdmin())) return; string name = Config.Misc.EnableBadWordsFilterGroups ? Parsers.ProcessBadWords(txtName.Text.Trim()) : txtName.Text.Trim(); string description = Config.Misc.EnableBadWordsFilterGroups ? Parsers.ProcessBadWords(txtDescription.Text.Trim()) : txtDescription.Text.Trim(); if (name.Length == 0) { lblError.Text = Lang.Trans("Please enter name"); CurrentView = viewEditGroupPhoto; return; } if (description.Length == 0) { lblError.Text = Lang.Trans("Please enter description"); CurrentView = viewEditGroupPhoto; return; } GroupPhoto groupPhoto = GroupPhoto.Fetch(GroupPhotoID); if (groupPhoto != null) { groupPhoto.Name = name; groupPhoto.Description = description; groupPhoto.Save(); } }
protected void btnSubmit_Click(object sender, EventArgs e) { if (CurrentUserSession == null || (CurrentGroupMember == null && !CurrentUserSession.IsAdmin()) || (CurrentGroupMember != null && CurrentGroupMember.Type != GroupMember.eType.Admin && CurrentGroupMember.Type != GroupMember.eType.Moderator)) return; bool kicked = false; GroupPhoto groupPhoto = GroupPhoto.Fetch(GroupPhotoID); if (groupPhoto != null) { if (cbBanMember.Checked) { if (ddBanPeriod.SelectedValue != "-1") { var groupBan = new GroupBan(GroupID, groupPhoto.Username); GroupMember.Delete(GroupID, groupPhoto.Username); // kick member kicked = true; groupBan.Expires = ddBanPeriod.SelectedValue == "0" ? DateTime.Now.AddYears(5) : DateTime.Now.AddDays(Double.Parse(ddBanPeriod.SelectedValue)); groupBan.Save(); } else { lblError.Text = Lang.Trans("Please select a period."); CurrentView = viewDeleteOptions; return; } } if (cbKickMember.Checked && !kicked) { GroupMember.Delete(GroupID, groupPhoto.Username); kicked = true; } if (kicked) { CurrentGroup.ActiveMembers--; CurrentGroup.Save(); } switch (rbList.SelectedValue) { case "deletePhoto": GroupPhoto.Delete(GroupPhotoID); break; case "deleteAll": GroupPhoto.Delete(GroupID, groupPhoto.Username); break; } Results = null; } }
protected void dlGroupPhotos_ItemCommand(object source, DataListCommandEventArgs e) { int groupPhotoID = Convert.ToInt32(e.CommandArgument); GroupPhotoID = groupPhotoID; GroupPhoto groupPhoto = GroupPhoto.Fetch(groupPhotoID); if (groupPhoto != null) { switch (e.CommandName) { case "Edit": txtName.Text = groupPhoto.Name; txtDescription.Text = groupPhoto.Description; CurrentView = viewEditGroupPhoto; break; case "Delete": bool isMember = false; bool isActive = false; GroupMember groupMember = GroupMember.Fetch(GroupID, groupPhoto.Username); if (groupMember != null) { isMember = true; isActive = groupMember.Active; } cbKickMember.Visible = isMember && isActive && groupPhoto.Username != CurrentUserSession.Username && groupPhoto.Username != Config.Users.SystemUsername && groupPhoto.Username != CurrentGroup.Owner; bool isBanned = isMember && isActive && !GroupMember.IsBanned(groupPhoto.Username, GroupID) && groupPhoto.Username != CurrentUserSession.Username && groupPhoto.Username != Config.Users.SystemUsername && groupPhoto.Username != CurrentGroup.Owner; cbBanMember.Visible = isBanned; ddBanPeriod.Visible = isBanned; cbKickMember.Checked = false; cbBanMember.Checked = false; if (CurrentUserSession.Username != groupPhoto.Username) { CurrentView = viewDeleteOptions; } else { GroupPhoto.Delete(groupPhotoID); Response.Redirect(UrlRewrite.CreateShowGroupPhotosUrl(GroupID.ToString())); } break; } } }
private Control CreateProgressView() { View view = new View(); //UpdateProgress updateProgess = new UpdateProgress(); //UpdatePanel updatePanel = (UpdatePanel)this.GetUpdatePanel(); //updateProgess.AssociatedUpdatePanelID = updatePanel.ID; //System.Web.UI.WebControls.Image image = new System.Web.UI.WebControls.Image(); //image.ImageUrl = Infolight.EasilyReportTools.Tools.ImageFilePath.ProgressBarUrl; //updateProgess.Controls.Add(image); //updatePanel.Parent.Controls.Add(updateProgess); //view.Controls.Add(updateProgess); return view; }
public static void EventsTest_4 (Page p) { MultiView MultiView1 = new MultiView (); MultiView1.ID = "MultiView1"; View view_1 = new View (); view_1.ID = "view_1"; View view_2 = new View (); view_2.ID = "view_2"; Button bt = new Button (); bt.ID = "bt"; bt.CommandName = "SwitchViewByIndex"; bt.CommandArgument = "1"; view_1.Controls.Add (bt); view_1.Controls.Add (new LiteralControl ("View_1_is_active")); view_2.Controls.Add (new LiteralControl ("View_2_is_active")); MultiView1.Views.Add (view_1); MultiView1.Views.Add (view_2); MultiView1.ActiveViewIndex = 0; MultiView1.ActiveViewChanged += new EventHandler (MultiView1_ActiveViewChanged); p.Controls.Add (MultiView1); }
public void MultiView_AddParsedSubObject () { PokerMultiView pmv = new PokerMultiView (); View v1 = new View (); pmv.DoAddParsedSubObject (v1); Assert.AreEqual (1, pmv.Controls.Count, "AddParsedSubObjectSuccssed"); }
public void MultiView_ActiveIndex () { PokerMultiView pmv = new PokerMultiView (); View myView = new View (); Assert.AreEqual (-1, pmv.ActiveViewIndex, "ActiveViewIndexDefault"); pmv.ActiveViewIndex = 0; Assert.AreEqual (0, pmv.ActiveViewIndex, "ActiveViewIndexChange"); pmv.Controls.Remove (myView); Assert.AreEqual (0, pmv.Controls.Count, "ControlsCount"); Assert.AreEqual (0, pmv.ActiveViewIndex, "ActiveViewIndexRemove"); }
private void MultiView1_Rechercher() { int nbAnnonces = 0; int nbPage = 1; int nbInPage = 5; foreach (DataRow dr in RechercherPage.DataTableRechercher.Rows) { nbAnnonces++; TableRow tRow = new TableRow(); tRow.Width = TableHeaderRow1.Width; tRow.Attributes.Add("style", "text-aligne:left"); TableCell dateCell = new TableCell(); dateCell.Text = dr[1].ToString(); dateCell.Width = TableHeaderCellDate.Width; tRow.Cells.Add(dateCell); TableCell posteCell = new TableCell(); posteCell.Text = dr[7].ToString(); posteCell.Width = TableHeaderCellPoste.Width; tRow.Cells.Add(posteCell); TableCell entrepriseCell = new TableCell(); entrepriseCell.Text = dr[13].ToString(); entrepriseCell.Width = TableHeaderCellEntreprise.Width; tRow.Cells.Add(entrepriseCell); TableCell locationCell = new TableCell(); locationCell.Text = dr[8].ToString(); //locationCell.Width = TableHeaderCellLocation.Width; tRow.Cells.Add(locationCell); if (nbAnnonces <= nbInPage) { Table1.Rows.Add(tRow); } else if (nbAnnonces == (nbInPage * nbPage + 1)) { nbPage++; Table tableTmp = new Table(); tableTmp.Width = TableHeader.Width; tableTmp.Rows.Add(tRow); View viewTmp = new View(); viewTmp.Controls.Add(tableTmp); MultiView1.Views.Add(viewTmp); } else { ((MultiView1.Views[MultiView1.Views.Count - 1]).Controls[0] as Table).Rows.Add(tRow); } } }
private Control CreateSendMailView() { View view = new View(); Table baseTable = CreateTable(1, 1, WebEasilyReportCSS.BaseTable, null); Table tableMailSetting = CreateTable(6, 2, WebEasilyReportCSS.PartTable + " " + WebEasilyReportCSS.MailSettingTable, new CellCssClass[]{ new CellCssClass(0, 0, WebEasilyReportCSS.MiddleLeft + " " + WebEasilyReportCSS.SettingTableLeft), new CellCssClass(1, 0, WebEasilyReportCSS.MiddleLeft + " " + WebEasilyReportCSS.SettingTableLeft), new CellCssClass(1, 1, WebEasilyReportCSS.MiddleLeft + " " + WebEasilyReportCSS.SettingTableRight), new CellCssClass(2, 0, WebEasilyReportCSS.MiddleLeft + " " + WebEasilyReportCSS.SettingTableLeft), new CellCssClass(2, 1, WebEasilyReportCSS.MiddleLeft + " " + WebEasilyReportCSS.SettingTableRight), new CellCssClass(3, 0, WebEasilyReportCSS.MiddleLeft + " " + WebEasilyReportCSS.SettingTableLeft), new CellCssClass(3, 1, WebEasilyReportCSS.MiddleLeft + " " + WebEasilyReportCSS.SettingTableRight), new CellCssClass(4, 0, WebEasilyReportCSS.MiddleLeft + " " + WebEasilyReportCSS.SettingTableLeft), new CellCssClass(4, 1, WebEasilyReportCSS.MiddleLeft + " " + WebEasilyReportCSS.SettingTableRight), new CellCssClass(5, 0, WebEasilyReportCSS.MiddleRight), new CellCssClass(5, 1, WebEasilyReportCSS.MiddleLeft) }); Panel panelMailSend = new Panel(); panelMailSend.CssClass = WebEasilyReportCSS.Panel_MailSend; panelMailSend.GroupingText = ERptMultiLanguage.GetLanValue("gbMailSend"); panelMailSend.Controls.Add(tableMailSetting); baseTable.Rows[0].Cells[0].Controls.Add(panelMailSend); view.Controls.Add(baseTable); #region tableMailSetting Label labelMailTitle = new Label(); labelMailTitle.Text = ERptMultiLanguage.GetLanValue("lbMailTitle"); labelMailTitle.CssClass = WebEasilyReportCSS.Label; tableMailSetting.Rows[0].Cells[0].Controls.Add(labelMailTitle); TextBox textboxMailTitle = new TextBox(); textboxMailTitle.ID = TEXTBOX_SENDMAIL_TITLE; textboxMailTitle.Width = new Unit(100); tableMailSetting.Rows[0].Cells[1].Controls.Add(textboxMailTitle); Label labelMailTo = new Label(); labelMailTo.CssClass = WebEasilyReportCSS.Label; labelMailTo.Text = ERptMultiLanguage.GetLanValue("lbMailTo"); tableMailSetting.Rows[1].Cells[0].Controls.Add(labelMailTo); TextBox textboxMailTo = new TextBox(); textboxMailTo.Width = new Unit(100); textboxMailTo.ID = TEXTBOX_SENDMAIL_TO; tableMailSetting.Rows[1].Cells[1].Controls.Add(textboxMailTo); Label labelMailFrom = new Label(); labelMailFrom.CssClass = WebEasilyReportCSS.Label; labelMailFrom.Text = ERptMultiLanguage.GetLanValue("lbMailFrom"); tableMailSetting.Rows[2].Cells[0].Controls.Add(labelMailFrom); TextBox textboxMailFrom = new TextBox(); textboxMailFrom.Width = new Unit(100); textboxMailFrom.ID = TEXTBOX_SENDMAIL_FROM; tableMailSetting.Rows[2].Cells[1].Controls.Add(textboxMailFrom); Label labelMailPassword = new Label(); labelMailPassword.CssClass = WebEasilyReportCSS.Label; labelMailPassword.Text = ERptMultiLanguage.GetLanValue("lbPassword"); tableMailSetting.Rows[3].Cells[0].Controls.Add(labelMailPassword); TextBox textboxMailPassword = new TextBox(); textboxMailPassword.Width = new Unit(100); textboxMailPassword.ID = TEXTBOX_SENDMAIL_PASSWORD; tableMailSetting.Rows[3].Cells[1].Controls.Add(textboxMailPassword); Label labelMailServer = new Label(); labelMailServer.CssClass = WebEasilyReportCSS.Label; labelMailServer.Text = ERptMultiLanguage.GetLanValue("lbSmtpServer"); tableMailSetting.Rows[4].Cells[0].Controls.Add(labelMailServer); TextBox textboxMailServer = new TextBox(); textboxMailServer.Width = new Unit(100); textboxMailServer.ID = TEXTBOX_SENDMAIL_SERVER; tableMailSetting.Rows[4].Cells[1].Controls.Add(textboxMailServer); Button buttonSendMail = new Button(); buttonSendMail.ID = BUTTON_SENDMAIL; buttonSendMail.CssClass = WebEasilyReportCSS.Button; buttonSendMail.Text = ERptMultiLanguage.GetLanValue("btWebSendMail"); buttonSendMail.Click += new EventHandler(buttonSendMail_Click); tableMailSetting.Rows[5].Cells[0].Controls.Add(buttonSendMail); Button buttonClose = new Button(); buttonClose.CssClass = WebEasilyReportCSS.Button; buttonClose.Text = ERptMultiLanguage.GetLanValue("btClose"); buttonClose.Click += new EventHandler(buttonSendMailClose_Click); tableMailSetting.Rows[5].Cells[1].Controls.Add(buttonClose); #endregion return view; }
private void MultiView1_Original() { if (MultiView1.Views.Count > 1) { return; } //get top 100 annonces by date DESC DataTableAnnonces = SQL.GetTopAnnonces(); //later, should select the annonces by username and the profile of the user //like the depts and the end date of the contrat /* System.Text.StringBuilder output = new System.Text.StringBuilder(); HttpCookie aCookie; if (Request.Cookies["userinfo"] == null) { Response.Cookies["userInfo"]["userName"] = Session["UserName"].ToString(); Response.Cookies["userInfo"]["lastVisit"] = DateTime.Now.ToString(); Response.Cookies["userInfo"].Expires = DateTime.Now.AddDays(1); } for (int i = 0; i < Request.Cookies.Count; i++) { aCookie = Request.Cookies[i]; output.Append("Cookie name = " + Server.HtmlEncode(aCookie.Name) + "<br />"); output.Append("Cookie value = " + Server.HtmlEncode(aCookie.Value) + "<br /><br />"); } */ dataTableDisplay = DataTableAnnonces.Clone(); DataTable dtSupprime = SQL.GetTable(@"select id_annonce from annonces_m where id_user='******' and supprimer = '1'"); bool supprime = false; foreach (DataRow dr in DataTableAnnonces.Select(strFliter)) { supprime = false; foreach (DataRow drSupprime in dtSupprime.Rows) { if (drSupprime["id_annonce"].ToString() == dr["id"].ToString()) { supprime = true; } } if (!supprime) { dataTableDisplay.ImportRow(dr); } } int nbAnnonces = 0; int nbPage = 1; int nbInPage = 50; //Table1.Width = TableHeader.Width; bool lu = false; int nbline = 0; foreach (DataRow dr in dataTableDisplay.Rows) { nbline++; nbAnnonces++; TableRow tRow = new TableRow(); tRow.Width = TableHeaderRow1.Width; tRow.Attributes.Add("style", "text-aligne:left"); ((WebControl)tRow).CssClass += "trAnn"; tRow.Attributes.Add("id","annonce"+dr["id"].ToString()); //tRow.Attributes.Add("onclick", "ShowAnnonce('"+dr["id"].ToString()+"');"); //tRow.Attributes.Add("onclick", "TRow_Click;"); //tRow.Attributes.Add("tooltip","tooltip!!!!!!!!!!!!!"); TableCell dateCell = new TableCell(); dateCell.Text = ((DateTime)dr["date"]).Date.ToShortDateString(); dateCell.Width = TableHeaderCellDate.Width; tRow.Cells.Add(dateCell); TableCell posteCell = new TableCell(); posteCell.Text = dr["poste"].ToString(); posteCell.Width = TableHeaderCellPoste.Width; posteCell.Attributes.Add("class", "over"); posteCell.Attributes.Add("class", " foo"); //posteCell.Attributes.Add("onmouseover", "Show1('" + dr["id"].ToString() + "');"); //posteCell.Attributes.Add("onmouseout", "Hide1();"); posteCell.Attributes.Add("onclick", "ShowAnnonce('" + dr["id"].ToString() + "', this.parentNode.id);"); tRow.Cells.Add(posteCell); TableCell entrepriseCell = new TableCell(); entrepriseCell.Text = dr["entreprise"].ToString(); entrepriseCell.Width = TableHeaderCellEntreprise.Width; tRow.Cells.Add(entrepriseCell); TableCell locationCell = new TableCell(); locationCell.Text = dr["localisation"].ToString(); locationCell.Width = TableHeaderCellLocation.Width; tRow.Cells.Add(locationCell); TableCell InfCell = new TableCell(); Image imgNote = new Image(); Image imgConserver = new Image(); Image imgSupprimer = new Image(); Image imgRappeler = new Image(); imgNote.ImageUrl = "../IMG/Used/Note1.png"; imgConserver.ImageUrl = "../IMG/Used/ico_do_save.png"; imgSupprimer.ImageUrl = "../IMG/Used/ico_do_delete.png"; imgRappeler.ImageUrl = "../IMG/Used/sts_ar.png"; imgNote.Attributes.Add("onclick", "ShowNote('" + dr["id"].ToString() + "');"); imgConserver.Attributes.Add("onclick", "SaveConserver('" + dr["id"].ToString() + "');"); imgSupprimer.Attributes.Add("onclick", "SupprimerAnnonce('" + dr["id"].ToString() + "');"); imgRappeler.Attributes.Add("onclick", "multiPopup('"+ dr["id"].ToString() +"');"); imgNote.Attributes.Add("class", "action"); imgConserver.Attributes.Add("class", "action"); imgSupprimer.Attributes.Add("class", "action"); imgRappeler.Attributes.Add("class", "action"); //Button btnSupprime = new Button(); //btnSupprime.Controls.Add(imgSupprimer); //btnSupprime.Click += new EventHandler(this.btnSupprimeClick); InfCell.Controls.Add(imgNote); InfCell.Controls.Add(imgConserver); InfCell.Controls.Add(imgSupprimer); InfCell.Controls.Add(imgRappeler); //locationInf.Text = dr["location"].ToString(); InfCell.Width = TableHeaderCellInf.Width; tRow.Cells.Add(InfCell); DataTable dtLu = SQL.GetTable(@"select id_annonce from annonces_m where id_user='******' and lu = '1'"); foreach (DataRow drLu in dtLu.Rows) { if (drLu["id_annonce"].ToString() == dr["id"].ToString()) { lu = true; ((WebControl)tRow).CssClass += " lu"; } } if(nbline%2==0) { ((WebControl)tRow).CssClass += " linedouble"; } if (nbAnnonces <= nbInPage) { Table1.Rows.Add(tRow); } else if (nbAnnonces == (nbInPage * nbPage + 1)) { nbPage++; Table tableTmp = new Table(); tableTmp.Width = TableHeader.Width; tableTmp.Rows.Add(tRow); View viewTmp = new View(); viewTmp.Controls.Add(tableTmp); MultiView1.Views.Add(viewTmp); } else { ((MultiView1.Views[MultiView1.Views.Count - 1]).Controls[0] as Table).Rows.Add(tRow); } //MultiView1.ActiveViewIndex = 0; } }
private View CreateSettingView() { View view = new View(); Table tableSettingMain = CreateTable(2, 2, WebEasilyReportCSS.BaseTable, new CellCssClass[] { new CellCssClass(0, 0, WebEasilyReportCSS.TopCenter), new CellCssClass(0, 1, WebEasilyReportCSS.TopCenter), new CellCssClass(1, 0, WebEasilyReportCSS.TopCenter), new CellCssClass(1, 1, WebEasilyReportCSS.TopCenter) }); Table tablePageSize = CreateTable(2, 1, WebEasilyReportCSS.PartTableNoBackColor + " " + WebEasilyReportCSS.SettingTable, new CellCssClass[]{ new CellCssClass(0, 0, WebEasilyReportCSS.TopLeft), new CellCssClass(1, 0, WebEasilyReportCSS.TopLeft) }); Table tablePrintOrientation = CreateTable(4, 1, WebEasilyReportCSS.PartTableNoBackColor, new CellCssClass[]{ new CellCssClass(0, 0, WebEasilyReportCSS.TopLeft), new CellCssClass(1, 0, WebEasilyReportCSS.TopLeft), new CellCssClass(2, 0, WebEasilyReportCSS.TopLeft), new CellCssClass(3, 0, WebEasilyReportCSS.TopLeft) }); Table tableMailSetting = CreateTable(5, 2, WebEasilyReportCSS.PartTableNoBackColor + " " + WebEasilyReportCSS.MailSettingTable, new CellCssClass[]{ new CellCssClass(0, 0, WebEasilyReportCSS.MiddleLeft + " " + WebEasilyReportCSS.SettingTableLeft), new CellCssClass(1, 0, WebEasilyReportCSS.MiddleLeft + " " + WebEasilyReportCSS.SettingTableLeft), new CellCssClass(1, 1, WebEasilyReportCSS.MiddleLeft + " " + WebEasilyReportCSS.SettingTableRight), new CellCssClass(2, 0, WebEasilyReportCSS.MiddleLeft + " " + WebEasilyReportCSS.SettingTableLeft), new CellCssClass(2, 1, WebEasilyReportCSS.MiddleLeft + " " + WebEasilyReportCSS.SettingTableRight), new CellCssClass(3, 0, WebEasilyReportCSS.MiddleLeft + " " + WebEasilyReportCSS.SettingTableLeft), new CellCssClass(3, 1, WebEasilyReportCSS.MiddleLeft + " " + WebEasilyReportCSS.SettingTableRight), new CellCssClass(4, 0, WebEasilyReportCSS.MiddleLeft + " " + WebEasilyReportCSS.SettingTableLeft), new CellCssClass(4, 1, WebEasilyReportCSS.MiddleLeft + " " + WebEasilyReportCSS.SettingTableRight) }); Table tablePageSetting = CreateTable(4, 2, WebEasilyReportCSS.ContainerTable, new CellCssClass[]{ new CellCssClass(0, 0, WebEasilyReportCSS.TopLeft), new CellCssClass(0, 1, WebEasilyReportCSS.TopLeft), new CellCssClass(1, 0, WebEasilyReportCSS.TopLeft), new CellCssClass(1, 1, WebEasilyReportCSS.TopLeft), new CellCssClass(2, 0, WebEasilyReportCSS.TopLeft), new CellCssClass(2, 1, WebEasilyReportCSS.TopLeft), new CellCssClass(3, 0, WebEasilyReportCSS.TopLeft), new CellCssClass(3, 1, WebEasilyReportCSS.TopLeft) }); Table tableOutputSetting = CreateTable(3, 2, "eReportFullWidth_table", new CellCssClass[]{ new CellCssClass(0, 0, WebEasilyReportCSS.TopLeft), new CellCssClass(0, 1, WebEasilyReportCSS.TopLeft), new CellCssClass(1, 0, WebEasilyReportCSS.TopLeft), new CellCssClass(1, 1, WebEasilyReportCSS.TopLeft), new CellCssClass(2, 0, WebEasilyReportCSS.TopLeft), new CellCssClass(2, 1, WebEasilyReportCSS.TopLeft) }); Table tablePageMargin = CreateTable(2, 4, "eReportContainer_table", new CellCssClass[]{ new CellCssClass(0, 0, WebEasilyReportCSS.TopLeft), new CellCssClass(0, 1, WebEasilyReportCSS.TopLeft), new CellCssClass(0, 2, WebEasilyReportCSS.TopLeft), new CellCssClass(0, 3, WebEasilyReportCSS.TopLeft), new CellCssClass(1, 0, WebEasilyReportCSS.TopLeft), new CellCssClass(1, 1, WebEasilyReportCSS.TopLeft), new CellCssClass(1, 2, WebEasilyReportCSS.TopLeft), new CellCssClass(1, 3, WebEasilyReportCSS.TopLeft) }); #region tableSettingMain view.Controls.Add(tableSettingMain); Panel panelPageSetting = new Panel(); panelPageSetting.CssClass = WebEasilyReportCSS.Panel_PageSetting; panelPageSetting.GroupingText = ERptMultiLanguage.GetLanValue("gbPageSetting"); panelPageSetting.Controls.Add(tablePageSetting); Panel panelPageSize = new Panel(); panelPageSize.CssClass = WebEasilyReportCSS.Panel_PageSize; panelPageSize.GroupingText = ERptMultiLanguage.GetLanValue("gbPageSize"); panelPageSize.Controls.Add(tablePageSize); Panel panelPrintOrientation = new Panel(); panelPrintOrientation.CssClass = WebEasilyReportCSS.Panel_PrintOrientation; panelPrintOrientation.GroupingText = ERptMultiLanguage.GetLanValue("gbPrintOrientation"); panelPrintOrientation.Controls.Add(tablePrintOrientation); Panel panelOutputSetting = new Panel(); panelOutputSetting.CssClass = WebEasilyReportCSS.Panel_OutputSetting; panelOutputSetting.GroupingText = ERptMultiLanguage.GetLanValue("gbOutputSetting"); panelOutputSetting.Controls.Add(tableOutputSetting); Panel panelMailSetting = new Panel(); panelMailSetting.CssClass = WebEasilyReportCSS.Panel_MailSetting; panelMailSetting.GroupingText = ERptMultiLanguage.GetLanValue("gbMailConfig"); panelMailSetting.Controls.Add(tableMailSetting); Panel panelPageMargin = new Panel(); panelPageMargin.CssClass = WebEasilyReportCSS.Panel_PageMargin; panelPageMargin.ID = PANEL_PAGE_MARGIN; panelPageMargin.GroupingText = ERptMultiLanguage.GetLanValue("gbPageMargin"); panelPageMargin.Controls.Add(tablePageMargin); tableSettingMain.Rows[0].Cells[0].Controls.Add(panelPageSetting); tableSettingMain.Rows[0].Cells[1].Controls.Add(panelMailSetting); tableSettingMain.Rows[1].Cells[0].ColumnSpan = 2; tableSettingMain.Rows[1].Cells[0].Controls.Add(panelOutputSetting); #endregion #region tablePageSetting tablePageSetting.Rows[0].Cells[0].RowSpan = 3; tablePageSetting.Rows[0].Cells[0].Controls.Add(panelPageSize); CheckBox checkboxHeaderRepeat = new CheckBox(); checkboxHeaderRepeat.ID = CHECKBOX_HEADER_REPEAT; checkboxHeaderRepeat.Text = ERptMultiLanguage.GetLanValue("cbHeaderRepeat"); tablePageSetting.Rows[3].Cells[0].Controls.Add(checkboxHeaderRepeat); tablePageSetting.Rows[1].Cells[1].Controls.Add(panelPrintOrientation); tablePageSetting.Rows[2].Cells[1].Controls.Add(panelPageMargin); #endregion #region tablePageSize RadioButtonList radiobuttonlistPageSize = new RadioButtonList(); radiobuttonlistPageSize.ID = RADIOBUTTONLIST_PAGE_SIZE; foreach (object item in Enum.GetValues(typeof(ReportFormat.PageType))) { radiobuttonlistPageSize.Items.Add(item.ToString()); } tablePageSize.Rows[1].Cells[0].Controls.Add(radiobuttonlistPageSize); #endregion #region tablePrintOrientation RadioButtonList radiobuttonlistPrintOrientation = new RadioButtonList(); radiobuttonlistPrintOrientation.ID = RADIOBUTTONLIST_PRINT_ORIENTATION; foreach (object item in Enum.GetValues(typeof(Orientation))) { radiobuttonlistPrintOrientation.Items.Add(item.ToString()); } tablePrintOrientation.Rows[1].Cells[0].Controls.Add(radiobuttonlistPrintOrientation); #endregion #region tablePageMargin Label lbLeft = new Label(); lbLeft.CssClass = "eReport_label"; lbLeft.Text = ERptMultiLanguage.GetLanValue("lbLeft"); tablePageMargin.Rows[0].Cells[0].Controls.Add(lbLeft); TextBox tbLeft = new TextBox(); tbLeft.ID = TEXTBOX_LEFTMARGIN; tbLeft.Attributes.Add("onkeydown", "CheckDecimal(this, event);"); tbLeft.Width = new Unit(25); tablePageMargin.Rows[0].Cells[1].Controls.Add(tbLeft); Label lbTop = new Label(); lbTop.CssClass = "eReport_label"; lbTop.Text = ERptMultiLanguage.GetLanValue("lbTop"); tablePageMargin.Rows[0].Cells[2].Controls.Add(lbTop); TextBox tbTop = new TextBox(); tbTop.ID = TEXTBOX_TOPMARGIN; tbTop.Attributes.Add("onkeydown", "CheckDecimal(this, event);"); tbTop.Width = new Unit(25); tablePageMargin.Rows[0].Cells[3].Controls.Add(tbTop); Label lbRight = new Label(); lbRight.CssClass = "eReport_label"; lbRight.Text = ERptMultiLanguage.GetLanValue("lbRight"); tablePageMargin.Rows[1].Cells[0].Controls.Add(lbRight); TextBox tbRight = new TextBox(); tbRight.ID = TEXTBOX_RIGHTMARGIN; tbRight.Attributes.Add("onkeydown", "CheckDecimal(this, event);"); tbRight.Width = new Unit(25); tablePageMargin.Rows[1].Cells[1].Controls.Add(tbRight); Label lbBottom = new Label(); lbBottom.CssClass = "eReport_label"; lbBottom.Text = ERptMultiLanguage.GetLanValue("lbBottom"); tablePageMargin.Rows[1].Cells[2].Controls.Add(lbBottom); TextBox tbBottom = new TextBox(); tbBottom.ID = TEXTBOX_BOTTOMMARGIN; tbBottom.Attributes.Add("onkeydown", "CheckDecimal(this, event);"); tbBottom.Width = new Unit(25); tablePageMargin.Rows[1].Cells[3].Controls.Add(tbBottom); #endregion #region tableMailSetting Label labelMailTitle = new Label(); labelMailTitle.Text = ERptMultiLanguage.GetLanValue("lbMailTitle"); labelMailTitle.CssClass = WebEasilyReportCSS.Label; tableMailSetting.Rows[0].Cells[0].Controls.Add(labelMailTitle); TextBox textboxMailTitle = new TextBox(); textboxMailTitle.ID = TEXTBOX_MAIL_TITLE; textboxMailTitle.Width = new Unit(100); tableMailSetting.Rows[0].Cells[1].Controls.Add(textboxMailTitle); Label labelMailTo = new Label(); labelMailTo.CssClass = WebEasilyReportCSS.Label; labelMailTo.Text = ERptMultiLanguage.GetLanValue("lbMailTo"); tableMailSetting.Rows[1].Cells[0].Controls.Add(labelMailTo); TextBox textboxMailTo = new TextBox(); textboxMailTo.Width = new Unit(100); textboxMailTo.ID = TEXTBOX_MAIL_TO; tableMailSetting.Rows[1].Cells[1].Controls.Add(textboxMailTo); Label labelMailFrom = new Label(); labelMailFrom.CssClass = WebEasilyReportCSS.Label; labelMailFrom.Text = ERptMultiLanguage.GetLanValue("lbMailFrom"); tableMailSetting.Rows[2].Cells[0].Controls.Add(labelMailFrom); TextBox textboxMailFrom = new TextBox(); textboxMailFrom.Width = new Unit(100); textboxMailFrom.ID = TEXTBOX_MAIL_FROM; tableMailSetting.Rows[2].Cells[1].Controls.Add(textboxMailFrom); Label labelMailPassword = new Label(); labelMailPassword.CssClass = WebEasilyReportCSS.Label; labelMailPassword.Text = ERptMultiLanguage.GetLanValue("lbPassword"); tableMailSetting.Rows[3].Cells[0].Controls.Add(labelMailPassword); TextBox textboxMailPassword = new TextBox(); textboxMailPassword.Width = new Unit(100); textboxMailPassword.ID = TEXTBOX_MAIL_PASSWORD; tableMailSetting.Rows[3].Cells[1].Controls.Add(textboxMailPassword); Label labelMailServer = new Label(); labelMailServer.CssClass = WebEasilyReportCSS.Label; labelMailServer.Text = ERptMultiLanguage.GetLanValue("lbSmtpServer"); tableMailSetting.Rows[4].Cells[0].Controls.Add(labelMailServer); TextBox textboxMailServer = new TextBox(); textboxMailServer.Width = new Unit(100); textboxMailServer.ID = TEXTBOX_MAIL_SERVER; tableMailSetting.Rows[4].Cells[1].Controls.Add(textboxMailServer); #endregion #region tableOutputSetting Label labelExportFormat = new Label(); //set text labelExportFormat.CssClass = "eReport_label"; labelExportFormat.Text = ERptMultiLanguage.GetLanValue("lbExportFormat"); tableOutputSetting.Rows[0].Cells[0].Controls.Add(labelExportFormat); DropDownList dropdownlistExportFormat = new DropDownList(); dropdownlistExportFormat.ID = DROPDOWNLIST_EXPORT_FORMAT; dropdownlistExportFormat.AutoPostBack = true; dropdownlistExportFormat.SelectedIndexChanged += new EventHandler(dropdownlistExportFormat_SelectedIndexChanged); foreach (object item in Enum.GetValues(typeof(ReportFormat.ExportType))) { dropdownlistExportFormat.Items.Add(item.ToString()); } tableOutputSetting.Rows[0].Cells[0].Controls.Add(dropdownlistExportFormat); Label labelPageRecords = new Label(); labelPageRecords.CssClass = WebEasilyReportCSS.Label; labelPageRecords.Text = ERptMultiLanguage.GetLanValue("lbPageRecords"); tableOutputSetting.Rows[1].Cells[0].Controls.Add(labelPageRecords); TextBox textboxPageRecords = new TextBox(); textboxPageRecords.Width = new Unit(80); textboxPageRecords.ID = TEXTBOX_PAGE_RECORDS; textboxPageRecords.Attributes.Add("onkeypress", "CheckNum();"); tableOutputSetting.Rows[1].Cells[0].Controls.Add(textboxPageRecords); //Label labelOutputMode = new Label(); //labelOutputMode.CssClass = WebEasilyReportCSS.Label; //labelOutputMode.Text = ERptMultiLanguage.GetLanValue("lbOutputMode"); //tableOutputSetting.Rows[2].Cells[0].Controls.Add(labelOutputMode); CheckBox checkboxSendMail = new CheckBox(); checkboxSendMail.Text = ERptMultiLanguage.GetLanValue("cbxSendMail"); checkboxSendMail.ID = CHECKBOX_SEND_MAIL; tableOutputSetting.Rows[2].Cells[0].Controls.Add(checkboxSendMail); #endregion return view; }
public void SetActiveView(View view) { }
protected void btnCancelUpdate_Click(object sender, EventArgs e) { CurrentView = viewGroupPhotosView; }
public void MultiView_ControlState () { PokerMultiView pmv = new PokerMultiView (); View v1 = new View (); View v2 = new View (); View v3 = new View (); pmv.AddViewCtrl (v1); pmv.AddViewCtrl (v2); pmv.AddViewCtrl (v3); pmv.SetActiveView (v1); Assert.AreEqual (v1, pmv.GetActiveView (), "BeforeLoadState"); object state = pmv.SaveState (); pmv.SetActiveView (v2); Assert.AreEqual (1, pmv.ActiveViewIndex, "AftreSetActiveViewChanged"); pmv.LoadState (state); Assert.AreEqual (0, pmv.ActiveViewIndex, "AftreLoadState"); }
public void MultiView_AddViews () { PokerMultiView pmv = new PokerMultiView (); View v1 = new View (); pmv.Controls.Add (v1); Assert.AreEqual (1, pmv.Views.Count, "ViewsCount"); Assert.AreEqual (-1, pmv.ActiveViewIndex, "ActiveViewIndex"); }
public void MultiView_IndexOutRange () { PokerMultiView pmw = new PokerMultiView (); View pv1 = new View (); pmw.Controls.Add (pv1); pmw.SetActiveView (pv1); pmw.ActiveViewIndex = 7; }
public void MultiView_RemoveViewControlEvent () { PokerMultiView pmv = new PokerMultiView (); View pv1 = new View (); View pv2 = new View (); View pv3 = new View (); pmv.Controls.Add (pv1); pmv.Controls.Add (pv2); pmv.Controls.Add (pv3); pmv.SetActiveView (pv1); Assert.AreEqual (0, pmv.ActiveViewIndex, "MultiViewActiveView"); Assert.AreEqual (3, pmv.Controls.Count, "MultiViewControlsCount1"); pmv.Controls.Remove (pv1); Assert.AreEqual (2, pmv.Controls.Count, "MultiViewControlsCount2"); // Protected method MultiView RemovedControl has changed active view to next Assert.AreSame (pv2, pmv.GetActiveView (), "EventRemovedControl"); }
private void CreateFieldsInTabs(Control container) { Fields = new System.Collections.Hashtable(); // create a tabstrip with the categories _TabStrip = new SCSWeb.TabStrip(); #if VERSION4 _TabStrip.ViewStateMode = ViewStateMode.Enabled; #endif _TabStrip.TabItemClicked += new SCSWeb.TabStrip.ItemClickedHandler(TabStrip_TabItemClicked); container.Controls.Add(_TabStrip); // create a multiview to store the tab contents _TabMultiView = new MultiView(); container.Controls.Add(_TabMultiView); // collect list of categories from the columns ListOfTabs = "Main"; foreach (DataColumn dc in _dccol) if (ListOfTabs.IndexOf(dc.Namespace) < 0) ListOfTabs = string.Format("{0},{1}", ListOfTabs, dc.Namespace); // create menu items as tabs string[] strTabs = ListOfTabs.Split(','); //_Tabs = new List<View>(strTabs.Length); foreach (string strCategory in strTabs) { // add tab to tabstrip SCSWeb.TabItem objTab = new SCSWeb.TabItem(); objTab.Text = strCategory; objTab.Tag = strCategory; _TabStrip.Items.Add(objTab); // add corresponding view View objTabView = new View(); objTabView.ID = strCategory; //_Tabs.Add(objTabView); _TabMultiView.Controls.Add(objTabView); // create a table within the view Table tbl = new Table(); tbl.CssClass = CssClassTable; TableRow tr = null; TableCell td = null; objTabView.Controls.Add(tbl); int iColNbr = 0; foreach (DataColumn dc in _dccol) { if (dc.ColumnName != null && dc.Namespace == strCategory ) { iColNbr++; // if there are more than the given nbr of rows, start adding columns instead of rows // making the formview grow sideways instead of downward if (iColNbr > NbrRows) // add columns starting from first row on tr = tbl.Rows[ ( iColNbr - 1 ) % NbrRows ]; else { tr = new TableRow(); tr.BorderWidth = Unit.Pixel(0); tr.VerticalAlign = VerticalAlign.Top; tbl.Rows.Add(tr); } // for each DataColum create a TableRow with 2 cells td = new TableCell(); td.Wrap = false; tr.Cells.Add(td); td.Text = FormatColumnName(dc.ColumnName) + ":"; td.CssClass = CssClassTableCell; td = new TableCell(); td.Wrap = false; tr.Cells.Add(td); CreateColumnControl(td, dc); } } } // make the first tab selected _TabStrip.Items[0].Selected = true; _TabMultiView.SetActiveView(_TabMultiView.Views[0]); if (_type == ListItemType.Item) { LinkButton lnkEdit = new LinkButton(); lnkEdit.Text = "Edit"; lnkEdit.ToolTip = "Click here to turn on the EditItemTemplate of the FormView"; lnkEdit.CommandName = "Edit"; container.Controls.Add(lnkEdit); } else { // create a table to hold the link buttons Table tbl = new Table(); tbl.CssClass = CssClassTable; TableRow tr = new TableRow(); TableCell td = new TableCell(); LinkButton lnkButton = new LinkButton(); lnkButton.Text = "Cancel"; lnkButton.ToolTip = "Click here to cancel the Edit process"; lnkButton.CommandName = "Cancel"; lnkButton.CausesValidation = false; td.Controls.Add(lnkButton); tr.Controls.Add(td); td = new TableCell(); lnkButton = new LinkButton(); lnkButton.Text = "Update"; lnkButton.ToolTip = "Click here to update the record"; lnkButton.CommandName = "Update"; lnkButton.CausesValidation = false; td.Controls.Add(lnkButton); tr.Controls.Add(td); tbl.Controls.Add(tr); container.Controls.Add(tbl); } }
public void MultiView_SomeViewsButtonRender () { PokerMultiView m = new PokerMultiView (); View v = new View (); View v1 = new View (); Button b = new Button (); Button b1 = new Button (); b1.ID = "test1"; b.ID = "test"; v.Controls.Add (b); v1.Controls.Add (b1); m.Controls.Add (v); m.Controls.Add (v1); m.SetActiveView (v); Assert.AreEqual (m.Render (), "<input type=\"submit\" name=\"test\" value=\"\" id=\"test\" />", "ViewWithButtonRender"); m.SetActiveView (v1); Assert.AreEqual (m.Render (), "<input type=\"submit\" name=\"test1\" value=\"\" id=\"test1\" />", "ChangeViewButtonRender"); }
public static void StartOperation(ICommandInfo command, View view) { StartOperation(command.Action + command.TypeName, view); }
public void MultiView_OnBubbleEvent () { Page myPage = new Page (); PokerMultiView pmv = new PokerMultiView (); View v1 = new View (); View v2 = new View (); pmv.Controls.Add (v1); pmv.Controls.Add (v2); pmv.ActiveViewIndex = 0; // Command NextView CommandEventArgs ceaNext = new CommandEventArgs ("NextView", null); pmv.DoBubbleEvent (this, ceaNext); Assert.AreEqual (1, pmv.ActiveViewIndex, "BubbleEventNext "); // Command PrevView CommandEventArgs ceaPrev = new CommandEventArgs ("PrevView", null); pmv.DoBubbleEvent (this, ceaPrev); Assert.AreEqual (0, pmv.ActiveViewIndex, "BubbleEventPrev"); // Command SwitchViewByIndex CommandEventArgs ceaSwitch = new CommandEventArgs ("SwitchViewByIndex", "1"); pmv.DoBubbleEvent (this, ceaSwitch); Assert.AreEqual (1, pmv.ActiveViewIndex, "BubbleSwitchViewByIndex"); // Command SwitchViewByID v1.ID = "v1"; myPage.Controls.Add (pmv); // FindControl inherited from control & Page must exist CommandEventArgs ceaSwitchViewByID = new CommandEventArgs ("SwitchViewByID", "v1"); pmv.DoBubbleEvent (this, ceaSwitchViewByID); Assert.AreEqual (0, pmv.ActiveViewIndex, "SwitchViewByID"); }
public static void EventsTest (Page p) { MultiView MultiView1 = new MultiView (); MultiView1.ID = "MultiView1"; View view_1 = new View (); view_1.ID = "view_1"; View view_2 = new View (); view_2.ID = "view_2"; Button bt = new Button (); bt.ID = "bt"; bt.CommandName = "NextView"; view_1.Controls.Add (bt); view_1.Controls.Add (new LiteralControl ("View_1_is_active")); view_2.Controls.Add (new LiteralControl ("View_2_is_active")); view_1.Activate += new EventHandler (view_1_Activate); view_1.Deactivate += new EventHandler (view_1_Deactivate); MultiView1.Views.Add (view_1); MultiView1.Views.Add (view_2); p.Controls.Add (MultiView1); MultiView1.ActiveViewIndex = 0; }
public static void EventsTest (Page p) { MultiView MultiView1 = new MultiView (); MultiView1.ID = "MultiView1"; View view_1 = new View (); view_1.ID = "view_1"; View view_2 = new View (); view_2.ID = "view_2"; Button bt = new Button (); bt.ID = "bt"; view_1.Controls.Add (bt); view_1.Controls.Add (new LiteralControl ("View_1_is_active")); view_2.Controls.Add (new LiteralControl ("View_2_is_active")); MultiView1.Views.Add (view_1); MultiView1.Views.Add (view_2); MultiView1.ActiveViewIndex = 0; MultiView1.ActiveViewChanged += new EventHandler (MultiView1_ActiveViewChanged); p.Controls.Add (MultiView1); if (p.IsPostBack) { MultiView1.ActiveViewIndex = 1; } }
/// <devdoc> /// <para>[To be supplied.]</para> /// </devdoc> public void SetActiveView(View view) { int index = Views.IndexOf (view); if (index < 0) { throw new HttpException(SR.GetString(SR.MultiView_view_not_found, (view == null ? "null" : view.ID), this.ID)); } ActiveViewIndex = index; }
public void AddViewCtrl (View v) { this.Controls.Add (v); }
protected void Page_Load(object sender, EventArgs e) { CurrentView = viewGroupPhotosView; if (!IsPostBack) { loadStrings(); mvGroupPhotos.SetActiveView(viewGroupPhotosView); } }