Beispiel #1
0
        /// <summary>
        /// Handles the SelectedIndexChanged event of the ddClasses control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void ddClasses_SelectedIndexChanged(object sender, EventArgs e)
        {
            MetaClassName = ddClasses.SelectedValue;
            BindForms();

            lblTableName.Text = CHelper.GetResFileString(MetaDataWrapper.GetMetaClassByName(MetaClassName).FriendlyName);
        }
Beispiel #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string title = "";

            if (Request.QueryString["class"] != null)
            {
                string    className = Request.QueryString["class"];
                MetaClass mc        = MetaDataWrapper.GetMetaClassByName(className);

                if (mc.IsCard)
                {
                    title = "CardCustomization";
                }
                else if (mc.IsBridge)
                {
                    title = "BridgeCustomization";
                }
                else
                {
                    title = "InfoCustomization";
                }
            }
            pT.Title = GetGlobalResourceObject("IbnFramework.GlobalMetaInfo", title).ToString();

            Mediachase.IBN.Business.UserLightPropertyCollection pc = Mediachase.IBN.Business.Security.CurrentUser.Properties;
            if (pc["TimeTrackingMode"] != null && pc["TimeTrackingMode"] == "dev")
            {
                pT.SetControlProperties("ShowSystemInfo", true);
            }
            else
            {
                pT.SetControlProperties("ShowSystemInfo", false);
            }
        }
Beispiel #3
0
        private void BindData()
        {
            Role role = Mediachase.Ibn.Data.Services.RoleManager.GetObjectRole(mc, RoleName);

            if (role != null)
            {
                RoleNameLabel.Text = CHelper.GetResFileString(role.Properties["FriendlyName"].Value.ToString());
                if (role.Properties["ClassName"].Value != null)
                {
                    string className = (string)role.Properties["ClassName"].Value;
                    if (className.Contains("::"))
                    {
                        string[] s = new string[] { "::" };
                        className          = className.Split(s, StringSplitOptions.None)[0];
                        RoleNameLabel.Text = String.Format(CultureInfo.InvariantCulture,
                                                           "{0} ({1})",
                                                           RoleNameLabel.Text,
                                                           CHelper.GetResFileString(MetaDataWrapper.GetMetaClassByName(className).PluralName));
                    }
                }

                MetaObjectPropertyCollection properties = role.Properties;
                for (int i = 0; i < rights.Count; i++)
                {
                    string rightName = rights[i].ToString();
                    ((CheckControl)checkControls[i]).Value = (int)properties[rightName].Value;
                }
            }
        }
Beispiel #4
0
        /// <summary>
        /// Binds the DD.
        /// </summary>
        private void BindDD()
        {
            if (CanAddNewForm)
            {
                Dictionary <int, string> dic  = Mediachase.Ibn.Data.Meta.Management.SqlSerialization.MetaClassId.GetIds();
                List <string>            list = new List <string>(dic.Values);
                list.Sort();

                ddClasses.DataSource = list;
                ddClasses.DataBind();

                if (!String.IsNullOrEmpty(MetaClassName))
                {
                    CHelper.SafeSelect(ddClasses, MetaClassName);
                }

                MetaClassName = ddClasses.SelectedValue;
            }
            else
            {
                lblTempClassName.Text = CHelper.GetResFileString(MetaDataWrapper.GetMetaClassByName(MetaClassName).FriendlyName);
            }

            lblTableName.Text = CHelper.GetResFileString(MetaDataWrapper.GetMetaClassByName(MetaClassName).FriendlyName);

            ddClasses.Visible        = CanAddNewForm;
            lblTempClassName.Visible = !CanAddNewForm;

            BindForms();
        }
Beispiel #5
0
        private void RebindFieldInfoByPrimaryObject()
        {
            string selectedClassName = PrimaryObjectList.SelectedValue;

            NameTextBox.Text         = selectedClassName;
            FriendlyNameTextBox.Text = CHelper.GetResFileString(MetaDataWrapper.GetMetaClassByName(selectedClassName).FriendlyName);
        }
Beispiel #6
0
        /// <summary>
        /// Loads the request variables.
        /// </summary>
        private void LoadRequestVariables()
        {
            if (Request.QueryString["class"] != null)
            {
                ClassName = Request.QueryString["class"];
                mc        = MetaDataWrapper.GetMetaClassByName(ClassName);
            }

            if (mc != null && Request.QueryString["field"] != null)
            {
                FieldName = Request.QueryString["field"];
                mf        = mc.Fields[FieldName];
            }

            if (Request.QueryString["refclass"] != null)
            {
                RefClassName = Request.QueryString["refclass"];
                mcRef        = MetaDataWrapper.GetMetaClassByName(RefClassName);
            }

            if (mcRef != null && Request.QueryString["reffield"] != null)
            {
                RefFieldName = Request.QueryString["reffield"];
                mfRef        = mcRef.Fields[RefFieldName];
            }

            if (Request.QueryString["mode"] != null)
            {
                Mode = Request.QueryString["mode"].ToUpperInvariant();
            }
        }
Beispiel #7
0
        /// <summary>
        /// Binds from value.
        /// </summary>
        private void BindFromValue(string metaClassName)
        {
            CommandParameters cp = new CommandParameters("MC_MUI_EntityDDSmall");

            cp.CommandArguments = new System.Collections.Generic.Dictionary <string, string>();
            if (!String.IsNullOrEmpty(metaClassName))
            {
                cp.AddCommandArgument("Classes", metaClassName);
            }
            cp.AddCommandArgument("Refresh", String.Format("Refresh{0}", this.ID));
            //Mediachase.Ibn.Web.UI.WebControls.CommandHandler.RegisterCloseOpenedFrameScript(this.Page, cp.ToString());

            string scriptToExecute = CommandManager.GetCurrent(this.Page).AddCommand(metaClassName, string.Empty, string.Empty, cp);

            if (this.Value == null)
            {
                lblValue.Text = CHelper.GetResFileString("{IbnFramework.Common:tFilterSelectObject}");
            }
            else
            {
                PrimaryKeyId id  = PrimaryKeyId.Parse(this.Value.ToString());
                EntityObject obj = BusinessManager.Load(metaClassName, id);
                MetaClass    mc  = MetaDataWrapper.GetMetaClassByName(obj.MetaClassName);
                lblValue.Text = obj.Properties[mc.TitleFieldName].Value.ToString();
            }

            lblValue.Attributes.Add("onclick", scriptToExecute);
        }
Beispiel #8
0
        private void RebindDisplayInfo(
            string className,
            HtmlTableRow displayRow,
            BlockHeaderLight2 displayBlockHeader,
            string title,
            DropDownList displayRegion,
            HtmlTableRow displayTextRow,
            HtmlTableRow displayOrderRow)
        {
            if (ListManager.MetaClassIsList(className))
            {
                displayRow.Visible = false;
            }
            else
            {
                displayRow.Visible = true;

                displayBlockHeader.Title = String.Format(CultureInfo.InvariantCulture,
                                                         "{0} ({1})",
                                                         title,
                                                         CHelper.GetResFileString(MetaDataWrapper.GetMetaClassByName(className).FriendlyName));

                FillRegions(className, displayRegion, displayTextRow, displayOrderRow);
            }
        }
Beispiel #9
0
        /// <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="System.EventArgs"/> instance containing the event data.</param>
        protected void Page_Load(object sender, EventArgs e)
        {
            TitleFieldName                 = MetaDataWrapper.GetMetaClassByName(ClassName).TitleFieldName;
            hfClassName.ValueChanged      += new EventHandler(hfClassName_ValueChanged);
            tbMainExtender.XPath           = "tbody tr";
            tbMainExtender.XPathId         = "td input[type=image]";
            tbMainExtender.IdAttributeName = "onclick";
            tbMainExtender.ListContainer   = GridMain.ClientID;
            tbMainExtender.CssSelected     = "TextBoxListSelected";
            tbMain.TextChanged            += new EventHandler(tbMain_TextChanged);

/*			if (!IsPostBack)
 *                              BindGrid(string.Empty);
 */
            tbMain.Attributes.Add("autocomplete", "off");

            if (!Page.ClientScript.IsClientScriptBlockRegistered("MC_SelectPopup_js"))
            {
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "MC_SelectPopup_js",
                                                            String.Format("<script language=\"javascript\" type=\"text/javascript\" src=\"{0}\"></script>",
                                                                          CHelper.GetAbsolutePath("/Apps/Common/Scripts/SelectPopupScript.js")));
            }

            divClose.Attributes.Add("onclick", String.Format("javascript:MC_SELECT_POPUPS['{0}'].hideSelectPopup();", this.ClientID));
        }
Beispiel #10
0
 private void RebindFieldInfo(string selectedClassName)
 {
     NameTextBox.Text         = String.Concat(ClassName, "_", selectedClassName);
     FriendlyNameTextBox.Text = String.Concat(
         CHelper.GetResFileString(mc.PluralName),
         CHelper.GetResFileString(MetaDataWrapper.GetMetaClassByName(selectedClassName).PluralName));
 }
Beispiel #11
0
        private void BindDataGrid(bool dataBind)
        {
            grdMain.SearchKeyword = tbSearchString.Text.Trim();

            DataTable dt = ((DataTable)ViewState["Resources"]).Copy();
            FilterElementCollection fec = new FilterElementCollection();

            foreach (DataRow dr in dt.Rows)
            {
                string[] elem = dr["Id"].ToString().Split(new string[] { "::" }, StringSplitOptions.RemoveEmptyEntries);
                if (elem[1] != "0")
                {
                    MetaClass mcEl = MetaDataWrapper.GetMetaClassByName(elem[1]);
                    if (mcEl.IsCard)
                    {
                        elem[1] = mcEl.CardOwner.Name;
                    }
                }
                if (elem[1] == ddFilter.SelectedValue)
                {
                    MetaClass     mc = MetaDataWrapper.GetMetaClassByName(ddFilter.SelectedValue);
                    FilterElement fe = FilterElement.NotEqualElement(
                        SqlContext.Current.Database.Tables[mc.DataSource.PrimaryTable].PrimaryKey.Name,
                        PrimaryKeyId.Parse(elem[0]));
                    fec.Add(fe);
                }
            }
            grdMain.AddFilters = fec;

            if (dataBind)
            {
                grdMain.DataBind();
            }
        }
Beispiel #12
0
        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();
            }
        }
Beispiel #13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(ClassName))
            {
                throw new ArgumentException("ClassName");
            }

            if (!IsPostBack)
            {
                MetaClass mc = MetaDataWrapper.GetMetaClassByName(ClassName);

                // Tree
                BindTree();

                // Default Values
                ItemText.Text = CHelper.GetResFileString(mc.PluralName);

                // Style
                Page.ClientScript.RegisterClientScriptBlock(this.Page.GetType(), Guid.NewGuid().ToString(),
                                                            String.Format("<link type='text/css' rel='stylesheet' href='{0}' />", ResolveClientUrl("~/Styles/Shell/mainLeftTemplate.css")));

                // Header
                MainHeader.AddLink(
                    CHelper.GetIconText(CHelper.GetResFileString("{IbnFramework.ListInfo:tClose}"), ResolveClientUrl("~/layouts/images/cancel.gif")),
                    "javascript:window.close();");

                // Buttons
                PublishButton.Attributes.Add("onclick", "DisableButtons(this);");
                PublishButton.Style.Add(HtmlTextWriterStyle.Width, "150px;");
                CloseButton.Attributes.Add("onclick", "window.close();");
                CloseButton.Style.Add(HtmlTextWriterStyle.Width, "150px;");
            }
        }
Beispiel #14
0
        /// <summary>
        /// Binds the data.
        /// </summary>
        private void BindData()
        {
            if (mc == null)
            {
                if (OwnerClassName != String.Empty)
                {
                    MetaClass ownerClass = MetaDataWrapper.GetMetaClassByName(OwnerClassName);
                    ddlClass.Items.Add(new ListItem(CHelper.GetResFileString(ownerClass.FriendlyName), ownerClass.Name));
                    ddlClass.Enabled = false;
                }
                else
                {
                    foreach (MetaClass cls in MetaDataWrapper.GetMetaClassesSupportedCards())
                    {
                        ddlClass.Items.Add(new ListItem(cls.Name, cls.Name));
                    }
                }

                txtClassName.Attributes.Add("onblur", "SetName('" + txtClassName.ClientID + "','" + txtClassFriendlyName.ClientID + "','" + vldClassFriendlyName_Required.ClientID + "')" + "; SetName('" + txtClassName.ClientID + "','" + txtClassPluralName.ClientID + "','" + vldClassPluralName_Required.ClientID + "')");
            }
            else
            {
                MetaClass ownerClass = MetaDataWrapper.GetOwnerClass(mc);
                ddlClass.Items.Add(new ListItem(ownerClass.Name, ownerClass.Name));
                ddlClass.Enabled = false;

                txtClassName.Text    = mc.Name;
                txtClassName.Enabled = false;

                txtClassFriendlyName.Text = mc.FriendlyName;
                txtClassPluralName.Text   = mc.PluralName;
            }
        }
Beispiel #15
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!String.IsNullOrEmpty(Request["ClassName"]))
     {
         pT.Title = CHelper.GetResFileString(MetaDataWrapper.GetMetaClassByName(Request["ClassName"]).FriendlyName);
     }
 }
Beispiel #16
0
 private void LoadRequestVariables()
 {
     if (Request.QueryString["class"] != null)
     {
         ClassName = Request.QueryString["class"];
         mc        = MetaDataWrapper.GetMetaClassByName(ClassName);
     }
 }
Beispiel #17
0
        protected void btnSave_ServerClick(object sender, EventArgs e)
        {
            DataTable dt = ((DataTable)ViewState["Resources"]).Copy();

            List <CalendarEventResourceEntity> list = new List <CalendarEventResourceEntity>();

            foreach (DataRow dr in dt.Rows)
            {
                CalendarEventResourceEntity cero = BusinessManager.InitializeEntity <CalendarEventResourceEntity>(CalendarEventResourceEntity.ClassName);
                string[] elem = dr["Id"].ToString().Split(new string[] { "::" }, StringSplitOptions.RemoveEmptyEntries);
                if (elem[1] != "0")
                {
                    MetaClass mcEl = MetaDataWrapper.GetMetaClassByName(elem[1]);
                    if (mcEl.IsCard)
                    {
                        elem[1] = mcEl.CardOwner.Name;
                    }
                }

                if (elem[1] == "0")
                {
                    cero.Email = elem[0];
                }
                else if (elem[1] == Principal.GetAssignedMetaClass().Name)
                {
                    cero.PrincipalId = PrimaryKeyId.Parse(elem[0]);
                }
                else if (elem[1] == ContactEntity.GetAssignedMetaClassName())
                {
                    cero.ContactId = PrimaryKeyId.Parse(elem[0]);
                }
                else if (elem[1] == OrganizationEntity.GetAssignedMetaClassName())
                {
                    cero.OrganizationId = PrimaryKeyId.Parse(elem[0]);
                }

                cero.Name   = dr["Name"].ToString();
                cero.Status = (int)eResourceStatus.NotResponded;
                list.Add(cero);
            }

            CalendarEventEntity ceo = (CalendarEventEntity)BusinessManager.Load(CalendarEventEntity.ClassName, _workObjectId);
            CalendarEventUpdateResourcesRequest req = new CalendarEventUpdateResourcesRequest(ceo, list.ToArray());

            BusinessManager.Execute(req);

            if (Request["CommandName"] != null)
            {
                CommandParameters cp = new CommandParameters(Request["CommandName"]);
                Mediachase.Ibn.Web.UI.WebControls.CommandHandler.RegisterCloseOpenedFrameScript(this.Page, cp.ToString());
            }
            else
            {
                Mediachase.Ibn.Web.UI.WebControls.CommandHandler.RegisterCloseOpenedFrameScript(this.Page, String.Empty);
            }
        }
Beispiel #18
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Request["ClassName"] != null)
     {
         MetaClass mc = MetaDataWrapper.GetMetaClassByName(Request["ClassName"]);
         if (mc != null)
         {
             pT.Title = CHelper.GetResFileString(mc.PluralName);
         }
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            mc = Mediachase.Ibn.Data.Services.RoleManager.GetObjectRoleMetaClass(ClassName);
            sm = new Mediachase.Ibn.Data.Services.StateMachine(MetaDataWrapper.GetMetaClassByName(ClassName), StateMachineId);

            GenerateStructure();
            if (!IsPostBack)
            {
                BindData();
            }
        }
Beispiel #20
0
        private void BindCards()
        {
            ddType.Items.Clear();
            EntityObject[] mas = BusinessManager.List(DocumentTypeEntity.GetAssignedMetaClassName(), new FilterElementCollection().ToArray());
            foreach (EntityObject eo in mas)
            {
                MetaClass mc = MetaDataWrapper.GetMetaClassByName(eo.Properties["Name"].Value.ToString());
                ddType.Items.Add(new ListItem(CHelper.GetResFileString(mc.FriendlyName), eo.Properties["Name"].Value.ToString()));
            }

            BindTemplates();
        }
Beispiel #21
0
        private static string GetResourceTitle(int principalId)
        {
            string       retVal       = String.Empty;
            EntityObject entityObject = BusinessManager.Load(Principal.GetAssignedMetaClass().Name, principalId);
            MetaClass    mc           = MetaDataWrapper.GetMetaClassByName(Principal.GetAssignedMetaClass().Name);

            if (entityObject != null && entityObject.Properties[mc.TitleFieldName] != null &&
                entityObject[mc.TitleFieldName] != null)
            {
                retVal = entityObject[mc.TitleFieldName].ToString();
            }
            return(retVal);
        }
Beispiel #22
0
        /// <summary>
        /// Loads the request variables.
        /// </summary>
        private void LoadRequestVariables()
        {
            if (Request.QueryString["class"] != null)
            {
                ClassName = Request.QueryString["class"];
                _mc       = MetaDataWrapper.GetMetaClassByName(ClassName);
            }

            if (Request.QueryString["back"] != null)
            {
                Back = Request.QueryString["back"].ToLower();
            }
        }
Beispiel #23
0
        private void BindDropDowns()
        {
            ddFilter.Items.Clear();
            ddFilter.Items.Add(new ListItem(CHelper.GetResFileString(MetaDataWrapper.GetMetaClassByName("Principal").FriendlyName), Principal.GetAssignedMetaClass().Name));
            ddFilter.Items.Add(new ListItem(CHelper.GetResFileString(MetaDataWrapper.GetMetaClassByName("Organization").FriendlyName), OrganizationEntity.GetAssignedMetaClassName()));
            ddFilter.Items.Add(new ListItem(CHelper.GetResFileString(MetaDataWrapper.GetMetaClassByName("Contact").FriendlyName), ContactEntity.GetAssignedMetaClassName()));

            if (_pc[_key] == null)
            {
                _pc[_key] = "Principal";
            }
            CHelper.SafeSelect(ddFilter, _pc[_key]);
        }
Beispiel #24
0
        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));
            }
        }
Beispiel #25
0
        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();
            }
        }
Beispiel #26
0
        /// <summary>
        /// Loads the request variables.
        /// </summary>
        private void LoadRequestVariables()
        {
            if (Request.QueryString["class"] != null)
            {
                ClassName = Request.QueryString["class"];
                mc        = MetaDataWrapper.GetMetaClassByName(ClassName);
            }

            if (mc != null && Request.QueryString["field"] != null)
            {
                FieldName = Request.QueryString["field"];
                mf        = mc.Fields[FieldName];
            }
        }
Beispiel #27
0
        private void BindToolbar()
        {
            MainBlockHeader.Title = CHelper.GetResFileString(MetaDataWrapper.GetMetaClassByName(ClassName).FriendlyName);

            MainBlockHeader.ClearLinks();

            //if (!String.IsNullOrEmpty(this.Page.Request["ViewName"]))
            //    MainBlockHeader.AddLink("Back To List", CHelper.GetLinkMetaViewShow(Request["ViewName"]));

            //SecurityService ss = ((BusinessObject)_bindObject).GetService<SecurityService>();
            //if (!(ss != null && !ss.CheckUserRight("Write")))
            //{
            MainBlockHeader.AddLink(
                "~/Images/IbnFramework/saveitem.gif",
                CHelper.GetResFileString("{IbnFramework.Global:_mc_Save}"),
                Page.ClientScript.GetPostBackClientHyperlink(btnSave, String.Empty, true)
                );

            string backLink;

            if (Back == "view" && ObjectId != PrimaryKeyId.Empty)
            {
                backLink = CHelper.GetLinkEntityView(ClassName, ObjectId.ToString());
            }
            else
            {
                if (ClassName == Mediachase.Ibn.Events.CalendarEventEntity.ClassName)
                {
                    backLink = "~/Apps/Calendar/Pages/Calendar.aspx";
                }
                else
                {
                    backLink = CHelper.GetLinkEntityList(ClassName);
                }
            }
            MainBlockHeader.AddLink(
                "~/Images/IbnFramework/cancel.gif",
                CHelper.GetResFileString("{IbnFramework.Global:_mc_Cancel}"),
                backLink);

//			if (Back
            //}

            //if (Mode.ToLower() == "popup")
            //    MainBlockHeader.AddLink("~/Images/IbnFramework/close.gif", GetGlobalResourceObject("IbnFramework.GlobalMetaInfo", "Close").ToString(), "javascript:window.close();");
        }
Beispiel #28
0
        /// <summary>
        /// Loads the request variables.
        /// </summary>
        private void LoadRequestVariables()
        {
            // Class
            if (Request.QueryString["class"] != null)
            {
                ClassName = Request.QueryString["class"];
                mc        = MetaDataWrapper.GetMetaClassByName(ClassName);
            }

            // Bridge
            if (Request.QueryString["bridge"] != null)
            {
                BridgeName = Request.QueryString["bridge"];
                mcBridge   = MetaDataWrapper.GetMetaClassByName(BridgeName);
            }

            // Current Field
            if (mcBridge != null && Request.QueryString["field"] != null)
            {
                FieldName = Request.QueryString["field"];
                mf        = mcBridge.Fields[FieldName];
            }

            // Another field
            if (mf != null)
            {
                if (mf.Name == mcBridge.Attributes.GetValue <string>(MetaClassAttribute.BridgeRef1Name, string.Empty))
                {
                    mfRef = mcBridge.Fields[mcBridge.Attributes[MetaClassAttribute.BridgeRef2Name].ToString()];
                }
                else
                {
                    mfRef = mcBridge.Fields[mcBridge.Attributes[MetaClassAttribute.BridgeRef1Name].ToString()];
                }
            }

            // Another Class
            if (mfRef != null)
            {
                RefClassName = mfRef.Attributes.GetValue <string>(McDataTypeAttribute.ReferenceMetaClassName, string.Empty);
                if (!String.IsNullOrEmpty(RefClassName))
                {
                    mcRef = MetaDataWrapper.GetMetaClassByName(RefClassName);
                }
            }
        }
Beispiel #29
0
        private void BindFields()
        {
            ddlField.Items.Clear();

            string[]  class_field = ddlClass.SelectedValue.Split(',');
            MetaClass mc          = MetaDataWrapper.GetMetaClassByName(class_field[0]);

            foreach (MetaField field in mc.Fields)
            {
                McDataType type         = field.GetMetaType().McDataType;
                McDataType originalType = field.GetOriginalMetaType().McDataType;
                // forbid reference and referenced fields
                if (type != McDataType.Reference && type != McDataType.ReferencedField && originalType != McDataType.ReferencedField)
                {
                    ddlField.Items.Add(new ListItem(CHelper.GetResFileString(field.FriendlyName), field.Name));
                }
            }
        }
Beispiel #30
0
        /// <summary>
        /// Gets the name of the user.
        /// </summary>
        /// <param name="UserID">The user ID.</param>
        /// <returns></returns>
        public static string GetUserName(int UserID)
        {
            if (UserID <= 0)
            {
                return("Unknown User");
            }

            try
            {
                MetaObject pc = MetaObjectActivator.CreateInstance("Principal", UserID);
                return(pc.Properties[MetaDataWrapper.GetMetaClassByName("Principal").TitleFieldName].Value.ToString());
                //Principal pc = new Principal(UserID);
                //return pc.Name;
            }
            catch { }

            return("Unknown User");
        }