/// <summary> /// OnUpdate /// </summary> /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param> protected override void OnUpdate(EventArgs e) { base.OnUpdate(e); if (Page.IsValid) { //Get Solutions PortalsDB portals = new PortalsDB(); try { PathField.Text = PathField.Text.Replace("/", string.Empty); PathField.Text = PathField.Text.Replace("\\", string.Empty); PathField.Text = PathField.Text.Replace(".", string.Empty); if (!chkUseXMLTemplate.Checked) { // Create portal the "old" way int NewPortalID = portals.CreatePortal(this.PortalSettings.PortalID, AliasField.Text, TitleField.Text, PathField.Text); // Update custom settings in the database EditTable.ObjectID = NewPortalID; EditTable.UpdateControls(); } else { bool createdOk = true; int newPortalID = CreatePortal(out createdOk); if (!createdOk) { string aux = General.GetString("NEW_PORTAL_ERROR", "There was an error on creating the portal", this); ErrorMessage.Visible = true; ErrorMessage.Text = aux + "<br>"; return; } } // Redirect back to calling page RedirectBackToReferringPage(); } catch (Exception ex) { string aux = General.GetString("NEW_PORTAL_ERROR", "There was an error on creating the portal", this); ErrorHandler.Publish(LogLevel.Error, aux, ex); ErrorMessage.Visible = true; ErrorMessage.Text = aux + "<br>"; } } }
/// <summary> /// The Page_Load server event handler on this user control is used /// to populate the current site settings from the config system /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Page_Load(object sender, EventArgs e) { // If this is the first visit to the page, populate the site data if (Page.IsPostBack == false) { //We flush cache for enable correct localization of items PortalSettings.FlushBaseSettingsCache(portalSettings.PortalPath); siteName.Text = portalSettings.PortalName; sitePath.Text = portalSettings.PortalPath; } EditTable.DataSource = new SortedList(portalSettings.CustomSettings); EditTable.DataBind(); }
private void butEdit_Click(object sender, EventArgs e) { EditTable upcl = new EditTable(); upcl.id.Text = dataGridView1.CurrentRow.Cells[0].Value.ToString(); upcl.dayBox.Text = dataGridView1.CurrentRow.Cells[1].Value.ToString(); upcl.maskedStart.Text = dataGridView1.CurrentRow.Cells[2].Value.ToString(); upcl.maskedFinish.Text = dataGridView1.CurrentRow.Cells[3].Value.ToString(); this.Hide(); upcl.ShowDialog(); updateData(); this.Show(); }
private void PagePropertyPage_Load(object sender, EventArgs e) { //We reset cache before dispay page to ensure dropdown shows actual data //by Pekka Ylenius CurrentCache.Remove(Key.ModuleSettings(ModuleID)); // Using settings grouping tabs or not is set in config file. --Hongwei Shen EditTable.UseGroupingTabs = Rainbow.Framework.Settings.Config.UseSettingsGroupingTabs; // The width and height will take effect only when using grouping tabs. // When not using grouping tabs, width and height should be set in css // class -- Hongwei Shen EditTable.Width = Rainbow.Framework.Settings.Config.SettingsGroupingWidth; EditTable.Height = Rainbow.Framework.Settings.Config.SettingsGroupingHeight; EditTable.CssClass = "st_control"; EditTable.DataSource = new SortedList(moduleSettings); EditTable.DataBind(); }
/// <summary> /// Persists the changes to database /// </summary> protected override void OnUpdate(EventArgs e) { base.OnUpdate(e); // Only Update if Input Data is Valid if (Page.IsValid == true) { // Update settings in the database EditTable.UpdateControls(); } if (Request.QueryString.GetValues("ModalChangeMaster") != null) { Response.Write("<script type=\"text/javascript\">window.parent.location = window.parent.location.href;</script>"); } }
public void EditTest() { var entityitem = new T_PassWord() { CompanyCode = 2, EmployeeCode = "200026", OldID = "kimuraBBB" }; var edit = new EditTable <T_PassWord, MusuHR_TEntities>(); edit.Edit(entityitem); using (var entity2 = new MusuHR_TEntities()) { var founditem = entity2.T_PassWord.FirstOrDefault(find => find.EmployeeCode == entityitem.EmployeeCode); Assert.AreEqual(founditem.OldID, entityitem.OldID); } }
public void ViewTable() { if (!IsFileOpened) { return; } BdatTable table = BdatTables.Tables[SelectedTable]; var editTable = new EditTable(table); EditingTable = new DataTable(); CurrentTable = table; EditingTable.Columns.Add(new DataColumn("ID") { ReadOnly = true }); foreach (BdatMember col in editTable.Columns) { var column = new DataColumn(); if (col.Type != BdatMemberType.Scalar) { column.ReadOnly = true; } column.ColumnName = $"{col.Name}\n({col.ValType})"; EditingTable.Columns.Add(column); } foreach (object[] item in editTable.Items) { DataRow row = EditingTable.NewRow(); row.ItemArray = item; EditingTable.Rows.Add(item); } EditingTable.AcceptChanges(); IsTableOpened = true; DataTable temp = EditingTable; EditingTable = null; EditingTable = temp; }
public void StringExport() { var Files = OpenViaFileBrowser(".bdat", "BDAT Files (*.bdat)|*.bdat|All Files|*.*", true); if (Files == null) { return; } foreach (var File in Files) { List <string> Lines = new List <string>(); var Info = LoadBdat(File); foreach (var Table in Info.BDAT.Tables) { var CurrentTable = new EditTable(Table); foreach (var Row in CurrentTable.Items) { for (int Col = 1; Col < Row.Length; Col++) { var ColumnValue = Row[Col]; var ColumnInfo = CurrentTable.Columns[Col - 1]; if (ColumnInfo.ValType != BdatValueType.String) { continue; } Lines.Add(Escape((string)ColumnValue)); } } } string OutFile = File + ".txt"; using (StreamWriter Writer = System.IO.File.CreateText(OutFile)) { foreach (var Line in Lines) { Writer.WriteLine(Line); } } } MessageBox.Show("Exported!"); }
/// <summary> /// OnUpdate /// </summary> /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param> protected override void OnUpdate(EventArgs e) { base.OnUpdate(e); if (Page.IsValid) { //Update main settings and Tab info in the database new PortalsDB().UpdatePortalInfo(currentPortalID, TitleField.Text, PathField.Text, false); // Update custom settings in the database EditTable.ObjectID = currentPortalID; EditTable.UpdateControls(); // Remove cache for reload settings before redirect CurrentCache.Remove(Key.PortalSettings()); // Redirect back to calling page RedirectBackToReferringPage(); } }
/// <summary> /// Is used to update the Site Settings within the Portal Config System /// </summary> /// <param name="e"></param> protected override void OnUpdate(EventArgs e) { // Flush the cache for recovery the changes. [email protected] (30/07/2004) PortalSettings.FlushBaseSettingsCache(this.PortalSettings.PortalPath); //Call base base.OnUpdate(e); // Only Update if Input Data is Valid if (Page.IsValid == true) { //Update main settings and Tab info in the database new PortalsDB().UpdatePortalInfo(this.PortalSettings.PortalID, siteName.Text, String.IsNullOrEmpty(sitePath.Text) ? this.PortalSettings.PortalPath : sitePath.Text, false); // Update custom settings in the database EditTable.UpdateControls(); // Redirect to this site to refresh Response.Redirect(HttpUrlBuilder.BuildUrl(this.PortalSettings.ActivePage.PageID)); } }
/// <summary> /// Is used to update the Site Settings within the Portal Config System /// </summary> /// <param name="e"></param> protected override void OnUpdate(EventArgs e) { // Flush the cache for recovery the changes. [email protected] (30/07/2004) PortalSettings.FlushBaseSettingsCache(portalSettings.PortalPath); //Call base base.OnUpdate(e); // Only Update if Input Data is Valid if (Page.IsValid == true) { //Update main settings and Tab info in the database new PortalsDB().UpdatePortalInfo(portalSettings.PortalID, siteName.Text, sitePath.Text, false); // Update custom settings in the database EditTable.UpdateControls(); // Redirect to this site to refresh Response.Redirect(Request.RawUrl); } }
public void RefreshTable() { if (CurrentTable == null) { return; } var editTable = new EditTable(CurrentTable); EditingTable = new DataTable(); EditingTable.Columns.Add(new DataColumn("ID") { ReadOnly = true }); foreach (BdatMember col in editTable.Columns) { var column = new DataColumn(); /*if (col.Type != BdatMemberType.Scalar) * { * column.ReadOnly = true; * }*/ column.ColumnName = $"{col.Name}\n({col.ValType})"; EditingTable.Columns.Add(column); } foreach (object[] item in editTable.Items) { DataRow row = EditingTable.NewRow(); row.ItemArray = item; EditingTable.Rows.Add(item); } EditingTable.AcceptChanges(); IsTableOpened = true; DataTable temp = EditingTable; EditingTable = null; EditingTable = temp; }
/// <summary> /// The SavePageData helper method is used to persist the /// current tab settings to the database. /// </summary> private void SavePageData() { // Construct Authorized User Roles string string authorizedRoles = string.Empty; foreach (ListItem item in authRoles.Items) { if (item.Selected == true) { authorizedRoles = authorizedRoles + item.Text + ";"; } } // update Page info in the database new PagesDB().UpdatePage(portalSettings.PortalID, PageID, Int32.Parse(parentPage.SelectedItem.Value), tabName.Text, portalSettings.ActivePage.PageOrder, authorizedRoles, mobilePageName.Text, showMobile.Checked); // Update custom settings in the database EditTable.UpdateControls(); }
/// <summary> /// Persists the changes to database /// </summary> protected override void OnUpdate(EventArgs e) { base.OnUpdate(e); // Only Update if Input Data is Valid if (Page.IsValid == true) { // Update settings in the database EditTable.UpdateControls(); } if (Request.QueryString.GetValues("ModalChangeMaster") != null) { if (this.Module.GuidID == new Guid("{5AB6843E-5A24-4D36-BB3D-0AE815DDB3B1}")) { Response.Write("<script type=\"text/javascript\">window.parent.location = window.parent.location.href.split('?')[0];</script>"); } else { Response.Write("<script type=\"text/javascript\">window.parent.location = window.parent.location.href;</script>"); } } }
/// <summary> /// Handles the Load event of the Page control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param> private void Page_Load(object sender, EventArgs e) { // Verify that the current user has access to access this page // Removed by Mario Endara <*****@*****.**> (2004/11/04) // if (PortalSecurity.IsInRoles("Admins") == false) // PortalSecurity.AccessDeniedEdit(); // If this is the first visit to the page, populate the site data if (Page.IsPostBack == false) { // Bind the Portals to the SolutionsList SolutionsList.DataSource = GetPortals(); SolutionsList.DataBind(); //Preselect default Portal if (SolutionsList.Items.FindByValue("Default") != null) { SolutionsList.Items.FindByValue("Default").Selected = true; } } if (chkUseTemplate.Checked == false) { // Don't use a template portal, so show the EditTable // Remove the cache that can be setted by the new Portal, to get a "clean" PortalBaseSetting CurrentCache.Remove(Key.PortalBaseSettings()); EditTable.DataSource = new SortedList(PortalSettings.GetPortalBaseSettings(null)); EditTable.DataBind(); EditTable.Visible = true; SolutionsList.Enabled = false; } else { EditTable.Visible = false; SolutionsList.Enabled = true; } }
public void StringImport() { var Files = OpenViaFileBrowser(".bdat", "BDAT Files (*.bdat)|*.bdat|All Files|*.*", true); if (Files == null) { return; } bool IgnoreLimit = false; foreach (var File in Files) { string TxtFile = File + ".txt"; string OutFile = File + ".new"; if (!System.IO.File.Exists(TxtFile)) { continue; } string[] Lines = System.IO.File.ReadAllLines(TxtFile); int i = 0; var Info = LoadBdat(File); foreach (var Table in Info.BDAT.Tables) { var CurrentTable = new EditTable(Table); foreach (var Row in CurrentTable.Items) { for (int Col = 1; Col < Row.Length; Col++) { var ColumnValue = Row[Col]; var ColumnInfo = CurrentTable.Columns[Col - 1]; if (ColumnInfo.ValType != BdatValueType.String) { continue; } var OriLine = Table.ReadValue((int)Row.First(), ColumnInfo.Name); var NewLine = Unescape(Lines[i++]); if (!IgnoreLimit && NewLine.Length > OriLine.Length) { IgnoreLimit = MessageBoxResult.Yes == MessageBox.Show($"The line {i - 1} has more character than the original line. Ignore?", "Error at " + Path.GetFileName(File), MessageBoxButton.YesNo, MessageBoxImage.Error);; if (!IgnoreLimit) { return; } } if (NewLine.Length > OriLine.Length) { NewLine = NewLine.Substring(0, OriLine.Length); //Remove Possible Open Tags after the cut if (NewLine.LastIndexOf(']') < NewLine.LastIndexOf('[')) { NewLine = NewLine.Substring(0, NewLine.LastIndexOf('[')); } } Table.WriteValue((int)Row.First(), ColumnInfo.Name, NewLine); } } } System.IO.File.WriteAllBytes(OutFile, Info.BDAT.FileData); } MessageBox.Show("Imported!"); }
private void FormEditID_Load(object sender, EventArgs e) { lblGifName.Text = GifName; DgvEdit.AutoGenerateColumns = false; DgvEdit.DataSource = EditTable; DgvEdit.AllowUserToAddRows = false; DgvEdit.AllowUserToOrderColumns = false; DgvEdit.AllowUserToResizeRows = false; DgvEdit.AllowUserToDeleteRows = false; DgvEdit.AllowDrop = false; firstTB = EditTable.Copy(); // 番号列 DataGridViewTextBoxColumn numColumn = new DataGridViewTextBoxColumn { Name = "Number", DefaultCellStyle = HeaderStyle, MinimumWidth = 37, HeaderText = "項番", ReadOnly = true, SortMode = DataGridViewColumnSortMode.NotSortable, AutoSizeMode = DataGridViewAutoSizeColumnMode.ColumnHeader }; // ID列 DataGridViewTextBoxColumn idColumn = new DataGridViewTextBoxColumn { DataPropertyName = "ID", Name = "ID", HeaderText = "ID名", AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill, SortMode = DataGridViewColumnSortMode.NotSortable }; // 最小値 DataGridViewTextBoxColumn minColumn = new DataGridViewTextBoxColumn { DataPropertyName = "Min", Name = "Min", HeaderText = "最小値", DefaultCellStyle = NumStyle, AutoSizeMode = DataGridViewAutoSizeColumnMode.ColumnHeader, SortMode = DataGridViewColumnSortMode.NotSortable }; // 最大値 DataGridViewTextBoxColumn maxcolumn = new DataGridViewTextBoxColumn { DataPropertyName = "Max", Name = "Max", HeaderText = "最大値", DefaultCellStyle = NumStyle, AutoSizeMode = DataGridViewAutoSizeColumnMode.ColumnHeader, SortMode = DataGridViewColumnSortMode.NotSortable }; DataGridViewTextBoxColumn pertolcolumn = new DataGridViewTextBoxColumn { DataPropertyName = "Tolerance", Name = "Tol", HeaderText = "許容誤差(1.00=100%)", DefaultCellStyle = NumStyle, AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells, SortMode = DataGridViewColumnSortMode.NotSortable }; DgvEdit.Columns.Add(numColumn); DgvEdit.Columns.Add(idColumn); DgvEdit.Columns.Add(minColumn); DgvEdit.Columns.Add(maxcolumn); DgvEdit.Columns.Add(pertolcolumn); // 項番数を編集 for (int i = 0; i < DgvEdit.Rows.Count; i++) { DgvEdit[0, i].Value = i + 1; } DgvEdit.CurrentCellChanged += new EventHandler(DgvEdit_CurrentCellChanged); }
/// <summary> /// The Page_Load server event handler on this page is used /// to populate a tab's layout settings on the page /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param> protected override void OnLoad(EventArgs e) { base.OnLoad(e); //Confirm delete if (!(ClientScript.IsClientScriptBlockRegistered("confirmDelete"))) { string[] s = { "CONFIRM_DELETE" }; ClientScript.RegisterClientScriptBlock(this.GetType(), "confirmDelete", PortalSettings.GetStringResource( "CONFIRM_DELETE_SCRIPT", s)); } LeftDeleteBtn.Attributes.Add("OnClick", "return confirmDelete()"); RightDeleteBtn.Attributes.Add("OnClick", "return confirmDelete()"); ContentDeleteBtn.Attributes.Add("OnClick", "return confirmDelete()"); // If first visit to the page, update all entries if (!Page.IsPostBack) { msgError.Visible = false; // Set images for buttons from current theme LeftUpBtn.ImageUrl = CurrentTheme.GetImage("Buttons_Up", "Up.gif").ImageUrl; LeftRightBtn.ImageUrl = CurrentTheme.GetImage("Buttons_Right", "Right.gif").ImageUrl; LeftDownBtn.ImageUrl = CurrentTheme.GetImage("Buttons_Down", "Down.gif").ImageUrl; LeftEditBtn.ImageUrl = CurrentTheme.GetImage("Buttons_Edit", "Edit.gif").ImageUrl; LeftDeleteBtn.ImageUrl = CurrentTheme.GetImage("Buttons_Delete", "Delete.gif").ImageUrl; ContentUpBtn.ImageUrl = CurrentTheme.GetImage("Buttons_Up", "Up.gif").ImageUrl; ContentLeftBtn.ImageUrl = CurrentTheme.GetImage("Buttons_Left", "Left.gif").ImageUrl; ContentRightBtn.ImageUrl = CurrentTheme.GetImage("Buttons_Right", "Right.gif").ImageUrl; ContentDownBtn.ImageUrl = CurrentTheme.GetImage("Buttons_Down", "Down.gif").ImageUrl; ContentEditBtn.ImageUrl = CurrentTheme.GetImage("Buttons_Edit", "Edit.gif").ImageUrl; ContentDeleteBtn.ImageUrl = CurrentTheme.GetImage("Buttons_Delete", "Delete.gif").ImageUrl; RightUpBtn.ImageUrl = CurrentTheme.GetImage("Buttons_Up", "Up.gif").ImageUrl; RightLeftBtn.ImageUrl = CurrentTheme.GetImage("Buttons_Left", "Left.gif").ImageUrl; RightDownBtn.ImageUrl = CurrentTheme.GetImage("Buttons_Down", "Down.gif").ImageUrl; RightEditBtn.ImageUrl = CurrentTheme.GetImage("Buttons_Edit", "Edit.gif").ImageUrl; RightDeleteBtn.ImageUrl = CurrentTheme.GetImage("Buttons_Delete", "Delete.gif").ImageUrl; BindData(); SetSecurityAccess(); // 2/27/2003 Start - Ender Malkoc // After up or down button when the page is refreshed, select the previously selected // tab from the list. if (Request.Params["selectedmodid"] != null) { try { int modIndex = Int32.Parse(Request.Params["selectedmodid"]); SelectModule(leftPane, GetModules("LeftPane"), modIndex); SelectModule(contentPane, GetModules("ContentPane"), modIndex); SelectModule(rightPane, GetModules("RightPane"), modIndex); } catch (Exception ex) { ErrorHandler.Publish(LogLevel.Error, "After up or down button when the page is refreshed, select the previously selected tab from the list.", ex); } } // 2/27/2003 end - Ender Malkoc } // Binds custom settings to table EditTable.DataSource = new SortedList(pageSettings); EditTable.DataBind(); }