Ejemplo n.º 1
0
 public void BindData(MetaClass mc, string FieldType)
 {
     using (SkipSecurityCheckScope scope = Mediachase.Ibn.Data.Services.Security.SkipSecurityCheck())
     {
         int count = (mc == null) ? 0 : MetaObject.GetTotalCount(mc);
         if (count > 1)
         {
             chkUnique.Checked = false;
             chkUnique.Visible = false;
         }
     }
 }
Ejemplo n.º 2
0
        protected void ddTemplates_SelectedIndexChanged(object sender, EventArgs e)
        {
            int value = int.Parse(ddTemplates.SelectedValue);

            if (value > -1)
            {
                ListInfo li = new ListInfo(value);
                trWithData.Visible = li.IsTemplate && MetaObject.GetTotalCount(ListManager.GetListMetaClass(li.PrimaryKeyId.Value)) > 0;
            }
            else
            {
                trWithData.Visible = false;
            }
        }
Ejemplo n.º 3
0
 public static int GetTotalCount(params FilterElement[] filters)
 {
     return(MetaObject.GetTotalCount(ListInfo.GetAssignedMetaClass(), filters));
 }
Ejemplo n.º 4
0
 public static int GetTotalCount(params FilterElement[] filters)
 {
     return(MetaObject.GetTotalCount(CalendarFolder.GetAssignedMetaClass(), filters));
 }
Ejemplo n.º 5
0
 public static int GetTotalCount(params FilterElement[] filters)
 {
     return(MetaObject.GetTotalCount(TimeTrackingBlockType.GetAssignedMetaClass(), filters));
 }
Ejemplo n.º 6
0
        /// <summary>
        /// Binds a data source to the invoked server control and all its child controls.
        /// </summary>
        public override void DataBind()
        {
            ListInfo li = ListManager.GetListInfoByMetaClass(mc);

            if (!li.IsTemplate)
            {
                ListDataLink.Text        = li.Title;
                ListDataLink.NavigateUrl = String.Format(CultureInfo.InvariantCulture, "~/Apps/MetaUIEntity/Pages/EntityList.aspx?ClassName={0}", mc.Name);
                ListTemplate.Visible     = false;
            }
            else
            {
                ListTemplate.Text    = li.Title;
                ListDataLink.Visible = false;
            }

            RecordCountLabel.Text = MetaObject.GetTotalCount(mc).ToString();
            CreatedByLabel.Text   = CommonHelper.GetUserStatus(li.CreatorId);
            CreatedLabel.Text     = li.Created.ToShortDateString();

            StatusLabel.Text = (li.Properties["Status"].Value != null) ? CHelper.GetResFileString(MetaEnum.GetFriendlyName(MetaDataWrapper.GetEnumByName(ListManager.ListStatusEnumName), (int)li.Properties["Status"].Value)) : "";
            TypeLabel.Text   = (li.Properties["ListType"].Value != null) ? CHelper.GetResFileString(MetaEnum.GetFriendlyName(MetaDataWrapper.GetEnumByName(ListManager.ListTypeEnumName), (int)li.Properties["ListType"].Value)) : "";

            string titleFieldName = mc.TitleFieldName;

            if (!String.IsNullOrEmpty(titleFieldName))
            {
                if (mc.Fields[titleFieldName] != null)
                {
                    DefaultFieldButton.Text = CHelper.GetResFileString(mc.Fields[titleFieldName].FriendlyName);
                    DefaultFieldLabel.Text  = DefaultFieldButton.Text;
                }
                else
                {
                    DefaultFieldButton.Text = titleFieldName;
                }
            }
            else
            {
                DefaultFieldButton.Text = GetGlobalResourceObject("IbnFramework.ListInfo", "DefaultFieldNotSet").ToString();
                DefaultFieldLabel.Text  = GetGlobalResourceObject("IbnFramework.ListInfo", "DefaultFieldNotSet").ToString();
            }

            foreach (MetaField mf in mc.Fields)
            {
                McDataType type = mf.GetOriginalMetaType().McDataType;
                if (mf.IsNullable || type != McDataType.String)
                {
                    continue;
                }
                string itemText = "";
                string name     = mf.Name;
                itemText = CHelper.GetResFileString(mf.FriendlyName);;
                FieldsList.Items.Add(new ListItem(itemText, name));
            }
            if (!String.IsNullOrEmpty(titleFieldName))
            {
                CHelper.SafeSelect(FieldsList, titleFieldName);
            }

            if (FieldsList.Items.Count > 0)
            {
                DefaultFieldButton.Visible = true;
                DefaultFieldLabel.Visible  = false;
            }
            else
            {
                DefaultFieldButton.Visible = false;
                DefaultFieldLabel.Visible  = true;
            }

            FieldsList.Visible   = false;
            SaveButton.Visible   = false;
            CancelButton.Visible = false;

            base.DataBind();
        }