/// <summary> /// Gens the source. /// </summary> /// <param name="text">The text.</param> /// <param name="totalCount">The total count.</param> /// <returns></returns> private DataTable genSource(string text, out int totalCount) { DataTable dt = new DataTable(); dt.Locale = CultureInfo.InvariantCulture; dt.Columns.Add(new DataColumn("PrimaryKeyId", typeof(int))); dt.Columns.Add(new DataColumn(TitleFieldName, typeof(string))); MetaClass mc = MetaDataWrapper.ResolveMetaClassByNameOrCardName(ClassName); FilterElementCollection fec = new FilterElementCollection(); fec.Add(new FilterElement(mc.TitleFieldName, FilterElementType.Contains, text)); if (!String.IsNullOrEmpty(CardFilter)) { string[] mas = CardFilter.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); if (mas.Length > 0) { OrBlockFilterElement fe = new OrBlockFilterElement(); foreach (string sCard in mas) { fe.ChildElements.Add(FilterElement.EqualElement("Card", sCard.Trim())); } fec.Add(fe); } } MetaObject[] list = MetaObject.List(mc, fec, new SortingElementCollection(SortingElement.Ascending(mc.TitleFieldName))); int count = 0; foreach (MetaObject bo in list) { DataRow row = dt.NewRow(); row["PrimaryKeyId"] = bo.PrimaryKeyId; row[TitleFieldName] = bo.Properties[mc.TitleFieldName].Value.ToString(); dt.Rows.Add(row); count++; if (count > 10) { break; } } totalCount = list.Length; return(dt); }
/// <summary> /// Customs the method. /// </summary> /// <param name="context">The context.</param> protected virtual void SetDefaultAddress(BusinessContext context) { // Load Address MetaObject newDefaultAddress = MetaObjectActivator.CreateInstance(AddressEntity.GetAssignedMetaClassName(), context.GetTargetPrimaryKeyId().Value); if (newDefaultAddress["ContactId"] != null) { // Find default addresses MetaObject[] defaultAddressList = MetaObject.List(DataContext.Current.GetMetaClass(AddressEntity.GetAssignedMetaClassName()), FilterElement.EqualElement("ContactId", newDefaultAddress["ContactId"]), FilterElement.EqualElement("IsDefaultContactElement", true)); // Reset default addresses foreach (MetaObject defaultAddress in defaultAddressList) { defaultAddress["IsDefaultContactElement"] = false; defaultAddress.Save(); } // Set default address newDefaultAddress["IsDefaultContactElement"] = true; newDefaultAddress.Save(); } else if (newDefaultAddress["OrganizationId"] != null) { // Find default addresses MetaObject[] defaultAddressList = MetaObject.List(DataContext.Current.GetMetaClass(AddressEntity.GetAssignedMetaClassName()), FilterElement.EqualElement("OrganizationId", newDefaultAddress["OrganizationId"]), FilterElement.EqualElement("IsDefaultOrganizationElement", true)); // Reset default addresses foreach (MetaObject defaultAddress in defaultAddressList) { defaultAddress["IsDefaultOrganizationElement"] = false; defaultAddress.Save(); } // Set default address newDefaultAddress["IsDefaultOrganizationElement"] = true; newDefaultAddress.Save(); } context.SetResponse(new Response()); }
public static Report[] List(Mediachase.Ibn.Data.FilterElementCollection filters, Mediachase.Ibn.Data.SortingElementCollection sorting) { return(MetaObject.List <Report>(Report.GetAssignedMetaClass(), filters, sorting)); }
public static ListInfo[] List(params Mediachase.Ibn.Data.SortingElement[] sorting) { return(MetaObject.List <ListInfo>(ListInfo.GetAssignedMetaClass(), sorting)); }
public static ListInfo[] List() { return(MetaObject.List <ListInfo>(ListInfo.GetAssignedMetaClass())); }
public static CalendarEvent[] List(params Mediachase.Ibn.Data.SortingElement[] sorting) { return(MetaObject.List <CalendarEvent>(CalendarEvent.GetAssignedMetaClass(), sorting)); }
public static CalendarEvent[] List() { return(MetaObject.List <CalendarEvent>(CalendarEvent.GetAssignedMetaClass())); }
public static CalendarFolder[] List() { return(MetaObject.List <CalendarFolder>(CalendarFolder.GetAssignedMetaClass())); }
public static Folder[] List() { return(MetaObject.List <Folder>(Folder.GetAssignedMetaClass())); }
public static TimeTrackingBlock[] List(Mediachase.Ibn.Data.FilterElementCollection filters, Mediachase.Ibn.Data.SortingElementCollection sorting) { return(MetaObject.List <TimeTrackingBlock>(TimeTrackingBlock.GetAssignedMetaClass(), filters, sorting)); }
public static CalendarEventRecurrence[] List() { return(MetaObject.List <CalendarEventRecurrence>(CalendarEventRecurrence.GetAssignedMetaClass())); }
public static Principal[] List(Mediachase.Ibn.Data.FilterElementCollection filters, Mediachase.Ibn.Data.SortingElementCollection sorting) { return(MetaObject.List <Principal>(Principal.GetAssignedMetaClass(), filters, sorting)); }
public static Principal[] List(params Mediachase.Ibn.Data.SortingElement[] sorting) { return(MetaObject.List <Principal>(Principal.GetAssignedMetaClass(), sorting)); }
public static Principal[] List(params Mediachase.Ibn.Data.FilterElement[] filters) { return(MetaObject.List <Principal>(Principal.GetAssignedMetaClass(), filters)); }
public static Principal[] List() { return(MetaObject.List <Principal>(Principal.GetAssignedMetaClass())); }
private void BindGrid() { DataTable dt = new DataTable(); dt.Columns.Add("Id", typeof(string)); dt.Columns.Add("Name", typeof(string)); string sSearch = tbSearchString.Text.Trim(); FilterElementCollection fec = new FilterElementCollection(); if (!String.IsNullOrEmpty(Request["filterName"]) && !String.IsNullOrEmpty(Request["filterValue"])) { FilterElement fe = FilterElement.EqualElement(Request["filterName"], Request["filterValue"]); FilterElement fe1 = FilterElement.IsNullElement(Request["filterName"]); FilterElement feOr = new OrBlockFilterElement(); feOr.ChildElements.Add(fe); feOr.ChildElements.Add(fe1); fec.Add(feOr); } else if (!String.IsNullOrEmpty(Request["filterName"]) && String.IsNullOrEmpty(Request["filterValue"])) { FilterElement fe = FilterElement.IsNullElement(Request["filterName"]); fec.Add(fe); } MetaObject[] list = MetaObject.List(mc, fec.ToArray()); foreach (MetaObject obj in list) { DataRow row = dt.NewRow(); row["Id"] = obj.PrimaryKeyId.ToString(); if (obj.Properties[mc.TitleFieldName].Value != null) { row["Name"] = CHelper.GetResFileString(obj.Properties[mc.TitleFieldName].Value.ToString()); } dt.Rows.Add(row); } if (ViewState["SelectItem_Sort"] == null) { ViewState["SelectItem_Sort"] = "Name"; } if (ViewState["SelectItem_CurrentPage"] == null) { ViewState["SelectItem_CurrentPage"] = 0; } if (dt.Rows != null && dt.Rows.Count < grdMain.PageSize) { grdMain.AllowPaging = false; } else { grdMain.AllowPaging = true; } DataView dv = dt.DefaultView; if (sSearch != String.Empty) { dv.RowFilter = String.Format(CultureInfo.InvariantCulture, "Name LIKE '%{0}%'", sSearch); } dv.Sort = ViewState["SelectItem_Sort"].ToString(); if (ViewState["SelectItem_CurrentPage"] != null && grdMain.AllowPaging) { grdMain.CurrentPageIndex = (int)ViewState["SelectItem_CurrentPage"]; } grdMain.DataSource = dv; grdMain.DataBind(); foreach (DataGridItem dgi in grdMain.Items) { ImageButton ib = (ImageButton)dgi.FindControl("ibRelate"); if (ib != null) { string sId = dgi.Cells[0].Text; string sAction = CHelper.GetCloseRefreshString(RefreshButton.Replace("xxx", sId)); ib.Attributes.Add("onclick", sAction); } } }
/// <summary> /// Binds the grid. /// </summary> private void BindGrid() { DataTable dt = new DataTable(); dt.Columns.Add("Id", typeof(int)); dt.Columns.Add("Name", typeof(string)); string sSearch = tbSearchString.Text.Trim(); MetaObject[] list; if (sSearch == String.Empty) { list = MetaObject.List(mc); } else { FilterElement filter = new FilterElement(mc.TitleFieldName, FilterElementType.Like, "%" + sSearch + "%"); list = MetaObject.List(mc, filter); } foreach (MetaObject obj in list) { DataRow row = dt.NewRow(); row["Id"] = obj.PrimaryKeyId; row["Name"] = obj.Properties[mc.TitleFieldName].Value.ToString(); dt.Rows.Add(row); } if (ViewState["SelectItem_Sort"] == null) { ViewState["SelectItem_Sort"] = "Name"; } if (ViewState["SelectItem_CurrentPage"] == null) { ViewState["SelectItem_CurrentPage"] = 0; } if (dt.Rows != null && dt.Rows.Count < grdMain.PageSize) { grdMain.AllowPaging = false; } else { grdMain.AllowPaging = true; } DataView dv = dt.DefaultView; dv.Sort = ViewState["SelectItem_Sort"].ToString(); if (ViewState["SelectItem_CurrentPage"] != null && grdMain.AllowPaging) { grdMain.CurrentPageIndex = (int)ViewState["SelectItem_CurrentPage"]; } grdMain.DataSource = dv; grdMain.DataBind(); foreach (DataGridItem dgi in grdMain.Items) { ImageButton ib = (ImageButton)dgi.FindControl("ibRelate"); if (ib != null) { string sId = dgi.Cells[0].Text; string sAction = CHelper.GetCloseRefreshString(RefreshButton.Replace("xxx", sId)); ib.Attributes.Add("onclick", sAction); } } }
public static Folder[] List(params Mediachase.Ibn.Data.FilterElement[] filters) { return(MetaObject.List <Folder>(Folder.GetAssignedMetaClass(), filters)); }
public static CalendarFolder[] List(Mediachase.Ibn.Data.FilterElementCollection filters, Mediachase.Ibn.Data.SortingElementCollection sorting) { return(MetaObject.List <CalendarFolder>(CalendarFolder.GetAssignedMetaClass(), filters, sorting)); }
public static Folder[] List(params Mediachase.Ibn.Data.SortingElement[] sorting) { return(MetaObject.List <Folder>(Folder.GetAssignedMetaClass(), sorting)); }
public static CalendarEvent[] List(params Mediachase.Ibn.Data.FilterElement[] filters) { return(MetaObject.List <CalendarEvent>(CalendarEvent.GetAssignedMetaClass(), filters)); }
public static TimeTrackingBlockType[] List() { return(MetaObject.List <TimeTrackingBlockType>(TimeTrackingBlockType.GetAssignedMetaClass())); }
public static CalendarEvent[] List(Mediachase.Ibn.Data.FilterElementCollection filters, Mediachase.Ibn.Data.SortingElementCollection sorting, int start, int count) { return(MetaObject.List <CalendarEvent>(CalendarEvent.GetAssignedMetaClass(), filters, sorting, start, count)); }
public static TimeTrackingBlockType[] List(params Mediachase.Ibn.Data.FilterElement[] filters) { return(MetaObject.List <TimeTrackingBlockType>(TimeTrackingBlockType.GetAssignedMetaClass(), filters)); }
public static ListInfo[] List(params Mediachase.Ibn.Data.FilterElement[] filters) { return(MetaObject.List <ListInfo>(ListInfo.GetAssignedMetaClass(), filters)); }
public static TimeTrackingBlockType[] List(params Mediachase.Ibn.Data.SortingElement[] sorting) { return(MetaObject.List <TimeTrackingBlockType>(TimeTrackingBlockType.GetAssignedMetaClass(), sorting)); }
public static ListInfo[] List(Mediachase.Ibn.Data.FilterElementCollection filters, Mediachase.Ibn.Data.SortingElementCollection sorting, int start, int count) { return(MetaObject.List <ListInfo>(ListInfo.GetAssignedMetaClass(), filters, sorting, start, count)); }
public static TimeTrackingBlockType[] List(Mediachase.Ibn.Data.FilterElementCollection filters, Mediachase.Ibn.Data.SortingElementCollection sorting, int start, int count) { return(MetaObject.List <TimeTrackingBlockType>(TimeTrackingBlockType.GetAssignedMetaClass(), filters, sorting, start, count)); }
private void BindGrid() { DataTable dt = new DataTable(); dt.Columns.Add("Id", typeof(PrimaryKeyId)); dt.Columns.Add("Name", typeof(string)); string sSearch = tbSearchString.Text.Trim(); MetaClass mc = MetaDataWrapper.GetMetaClassByName(ddClasses.SelectedValue); if (mc == null) { return; } MetaObject[] list = MetaObject.List(mc); foreach (MetaObject obj in list) { DataRow row = dt.NewRow(); row["Id"] = obj.PrimaryKeyId.Value; row["Name"] = CHelper.GetResFileString(obj.Properties[mc.TitleFieldName].Value.ToString()); dt.Rows.Add(row); } if (ViewState["SelectItem_Sort"] == null) { ViewState["SelectItem_Sort"] = "Name"; } if (ViewState["SelectItem_CurrentPage"] == null) { ViewState["SelectItem_CurrentPage"] = 0; } if (dt.Rows != null && dt.Rows.Count < grdMain.PageSize) { grdMain.AllowPaging = false; } else { grdMain.AllowPaging = true; } DataView dv = dt.DefaultView; if (sSearch != String.Empty) { dv.RowFilter = String.Format(CultureInfo.InvariantCulture, "Name LIKE '%{0}%'", sSearch); } dv.Sort = ViewState["SelectItem_Sort"].ToString(); if (ViewState["SelectItem_CurrentPage"] != null && grdMain.AllowPaging) { grdMain.CurrentPageIndex = (int)ViewState["SelectItem_CurrentPage"]; } grdMain.DataSource = dv; grdMain.DataBind(); foreach (DataGridItem dgi in grdMain.Items) { ImageButton ib = (ImageButton)dgi.FindControl("ibRelate"); if (ib != null) { string sId = ddClasses.SelectedValue + "_" + dgi.Cells[0].Text; string sAction = CHelper.GetCloseRefreshString(RefreshButton.Replace("xxx", sId)); ib.Attributes.Add("onclick", sAction); } } }
public static Report[] List(params Mediachase.Ibn.Data.SortingElement[] sorting) { return(MetaObject.List <Report>(Report.GetAssignedMetaClass(), sorting)); }