示例#1
0
        public override void DataBind()
        {
            object bindObject = DataBinder.GetDataItem(this.Parent);
            string retVal     = "";

            if (bindObject != null && bindObject is MetaObject)
            {
                string argumentType = ((MetaObject)bindObject).Properties["ArgumentType"].Value.ToString();
                string argumentData = ((MetaObject)bindObject).Properties["ArgumentData"].Value.ToString();

                Type   objType = Mediachase.Ibn.Data.AssemblyUtil.LoadType(argumentType);
                object obj     = McXmlSerializer.GetObject(objType, argumentData);
                if (obj != null)
                {
                    PropertyInfo pinfo = objType.GetProperty("CurrentState");
                    if (pinfo != null)
                    {
                        object curState = pinfo.GetValue(obj, null);
                        if (curState is State)
                        {
                            retVal = String.Format("<b>{0}:</b>&nbsp;{1}",
                                                   CHelper.GetResFileString("{IbnFramework.TimeTracking:_mc_State}"),
                                                   CHelper.GetResFileString(StateMachineManager.GetState("TimeTrackingBlock", ((State)curState).Name).Properties["FriendlyName"].Value.ToString()));
                        }
                    }
                }
                if (String.IsNullOrEmpty(retVal))
                {
                    retVal = CHelper.GetEventResourceString((MetaObject)bindObject);
                }

                lblStateValue.Text = retVal;
            }
            base.DataBind();
        }
示例#2
0
        void div_DataBinding(object sender, EventArgs e)
        {
            HtmlGenericControl div = (HtmlGenericControl)sender;

            if (div.NamingContainer is IDataItemContainer)
            {
                IDataItemContainer container = (IDataItemContainer)div.NamingContainer;
                div.InnerHtml = CHelper.GetEventResourceString((MetaObject)container.DataItem);
            }
        }
        public override void DataBind()
        {
            object bindObject = DataBinder.GetDataItem(this.Parent);
            string retVal     = "";

            if (bindObject != null && bindObject is MetaObject)
            {
                if (((MetaObject)bindObject).Properties["Description"] != null &&
                    ((MetaObject)bindObject).Properties["Description"].Value != null)
                {
                    retVal = ((MetaObject)bindObject).Properties["Description"].Value.ToString();
                }

                if (String.IsNullOrEmpty(retVal))
                {
                    retVal = CHelper.GetEventResourceString((MetaObject)bindObject);
                }

                lblCommentValue.Text = retVal;
            }
            base.DataBind();
        }