protected void SaveButton_Click(object sender, EventArgs e) { if (!String.IsNullOrEmpty(ClassName)) { MetaClass mc = MetaDataWrapper.GetMetaClassByName(ClassName); HistoryMetaClassInfo historyInfo = HistoryManager.GetInfo(mc); historyInfo.SelectedFields.Add(FieldList.SelectedValue); HistoryManager.SetInfo(mc, historyInfo); ListViewProfile[] mas = ListViewProfile.GetSystemProfiles(HistoryManager.GetHistoryMetaClassName(ClassName), "ItemHistoryList"); if (mas.Length == 0) { CHelper.GetHistorySystemListViewProfile(HistoryManager.GetHistoryMetaClassName(ClassName), "ItemHistoryList"); mas = ListViewProfile.GetSystemProfiles(HistoryManager.GetHistoryMetaClassName(ClassName), "ItemHistoryList"); } if (!mas[0].FieldSet.Contains(FieldList.SelectedValue)) { mas[0].FieldSet.Add(FieldList.SelectedValue); mas[0].ColumnsUI.Add(new ColumnProperties(FieldList.SelectedValue, "150px", String.Empty)); ListViewProfile.SaveSystemProfile(HistoryManager.GetHistoryMetaClassName(ClassName), "ItemHistoryList", Mediachase.IBN.Business.Security.CurrentUser.UserID, mas[0]); } CommandParameters cp = new CommandParameters(CommandName); Mediachase.Ibn.Web.UI.WebControls.CommandHandler.RegisterCloseOpenedFrameScript(this.Page, cp.ToString()); //CHelper.UpdateModalPopupContainer(this, ContainerId); //CHelper.RequireDataBind(); } }
private void BindBlockHeader() { // Check, that there are fields left MetaClass mc = MetaDataWrapper.GetMetaClassByName(ClassName); HistoryMetaClassInfo historyInfo = HistoryManager.GetInfo(mc); Collection <string> selectedFields = historyInfo.SelectedFields; bool fieldsExist = false; foreach (MetaField mf in mc.Fields) { if (HistoryManager.IsSupportedField(mf) && !selectedFields.Contains(mf.Name)) { fieldsExist = true; break; } } CommandManager cm = CommandManager.GetCurrent(this.Page); CommandParameters cp; if (fieldsExist) { string id = String.Empty; ListViewProfile[] mas = ListViewProfile.GetSystemProfiles(HistoryManager.GetHistoryMetaClassName(ClassName), "ItemHistoryList"); if (mas.Length == 0) { id = CHelper.GetHistorySystemListViewProfile(HistoryManager.GetHistoryMetaClassName(ClassName), "ItemHistoryList"); } else { id = mas[0].Id; } cp = new CommandParameters("MC_ListApp_HistoryProfileEdit"); cp.CommandArguments = new Dictionary <string, string>(); cp.AddCommandArgument("ClassName", HistoryManager.GetHistoryMetaClassName(ClassName)); cp.AddCommandArgument("uid", id); string cmd = cm.AddCommand("", "", "ListInfoView", cp); MainBlockHeader.AddRightLink( GetGlobalResourceObject("IbnFramework.ListInfo", "HistoryView").ToString(), String.Format("javascript:{{{0}}};", cmd)); cp = new CommandParameters("MC_ListApp_AddHistoryFieldFrame", new Dictionary <string, string>()); cp.AddCommandArgument("ClassName", ClassName); string command = cm.AddCommand("", "", "ListInfoView", cp); MainBlockHeader.AddRightLink( GetGlobalResourceObject("IbnFramework.ListInfo", "AddField").ToString(), String.Format("javascript:{{{0}}};", command)); } }
protected void MainGrid_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == deleteCommand && !String.IsNullOrEmpty(ClassName)) { string fieldName = e.CommandArgument.ToString(); MetaClass mc = MetaDataWrapper.GetMetaClassByName(ClassName); HistoryMetaClassInfo historyInfo = HistoryManager.GetInfo(mc); historyInfo.SelectedFields.Remove(fieldName); HistoryManager.SetInfo(mc, historyInfo); CHelper.RequireDataBind(); } }
private void BindList() { FieldList.Items.Clear(); if (!String.IsNullOrEmpty(ClassName)) { MetaClass mc = MetaDataWrapper.GetMetaClassByName(ClassName); HistoryMetaClassInfo historyInfo = HistoryManager.GetInfo(mc); Collection <string> selectedFields = historyInfo.SelectedFields; foreach (MetaField mf in mc.Fields) { if (HistoryManager.IsSupportedField(mf) && !selectedFields.Contains(mf.Name)) { FieldList.Items.Add(new ListItem(CHelper.GetMetaFieldName(mf), mf.Name)); } } } }
private void BindGrid() { MetaClass mc = MetaDataWrapper.GetMetaClassByName(ClassName); DataTable dt = new DataTable(); dt.Locale = CultureInfo.InvariantCulture; dt.Columns.Add("Id", typeof(string)); dt.Columns.Add("Name", typeof(string)); dt.Columns.Add("Type", typeof(string)); HistoryMetaClassInfo historyInfo = HistoryManager.GetInfo(mc); Collection <string> selectedFields = historyInfo.SelectedFields; foreach (string fieldName in selectedFields) { MetaField mf = mc.Fields[fieldName]; if (mf == null) { continue; } DataRow row = dt.NewRow(); row["Id"] = fieldName; row["Name"] = CHelper.GetMetaFieldName(mf); row["Type"] = CHelper.GetMcDataTypeName(mf.GetOriginalMetaType().McDataType); dt.Rows.Add(row); } MainGrid.DataSource = dt; MainGrid.DataBind(); foreach (GridViewRow row in MainGrid.Rows) { ImageButton ib = (ImageButton)row.FindControl("DeleteButton"); if (ib != null) { ib.Attributes.Add("onclick", "return confirm('" + GetGlobalResourceObject("IbnFramework.GlobalMetaInfo", "Delete").ToString() + "?')"); } } }