Beispiel #1
0
        public override void DataBind()
        {
            DataTable dt = new DataTable();
            dt.Locale = CultureInfo.InvariantCulture;
            dt.Columns.Add("AssignmentId", typeof(string));
            dt.Columns.Add("Subject", typeof(string));
            dt.Columns.Add("User", typeof(string));
            dt.Columns.Add("State", typeof(string));
            dt.Columns.Add("Result", typeof(int));
            dt.Columns.Add("FinishDate", typeof(string));
            dt.Columns.Add("Comment", typeof(string));
            dt.Columns.Add("Indent", typeof(int));
            dt.Columns.Add("ClosedBy", typeof(string));

            WorkflowInstanceEntity wfEntity = (WorkflowInstanceEntity)DataItem;

            // Filter:
            //	1: WorkflowInstanceId = wfEntity.PrimaryKeyId,
            //	2: ParentAssignmentId IS NULL (other elements we'll get via the recursion)
            FilterElementCollection fec = new FilterElementCollection();
            fec.Add(FilterElement.EqualElement(AssignmentEntity.FieldWorkflowInstanceId, wfEntity.PrimaryKeyId.Value));
            fec.Add(FilterElement.IsNullElement(AssignmentEntity.FieldParentAssignmentId));

            // Sorting
            SortingElementCollection sec = new SortingElementCollection();
            sec.Add(new SortingElement(AssignmentEntity.FieldCreated, SortingElementType.Asc));

            EntityObject[] assignments = BusinessManager.List(AssignmentEntity.ClassName, fec.ToArray(), sec.ToArray());

            ProcessCollection(dt, assignments, wfEntity, 0);

            AssignmentList.DataSource = dt;
            AssignmentList.DataBind();

            if (dt.Rows.Count > 0)
            {
                AssignmentList.Visible = true;
                NoAssignmentsLabel.Visible = false;
            }
            else
            {
                AssignmentList.Visible = false;
                NoAssignmentsLabel.Visible = true;
                NoAssignmentsLabel.Text = GetGlobalResourceObject("IbnFramework.BusinessProcess", "NoAssignments").ToString();
            }
        }
        public static SynchronizationReplicaRow[] List(SortingElementCollection sorting, int start, int count)
        {
            ArrayList list = new ArrayList();

            using (IDataReader reader = DataHelper.List("SYNCHRONIZATION_REPLICA", sorting.ToArray()))
            {
                while (reader.Read() && count > 0)
                {
                    if (start == 0)
                    {
                        list.Add(new SynchronizationReplicaRow(reader));

                        count--;
                    }
                    else
                    {
                        start--;
                    }
                }
            }
            return((SynchronizationReplicaRow[])list.ToArray(typeof(SynchronizationReplicaRow)));
        }
        public static WorkflowParticipantRow[] List(SortingElementCollection sorting, int start, int count)
        {
            ArrayList list = new ArrayList();

            using (IDataReader reader = DataHelper.List("WorkflowParticipant", sorting.ToArray()))
            {
                while (reader.Read() && count > 0)
                {
                    if (start == 0)
                    {
                        list.Add(new WorkflowParticipantRow(reader));

                        count--;
                    }
                    else
                    {
                        start--;
                    }
                }
            }
            return((WorkflowParticipantRow[])list.ToArray(typeof(WorkflowParticipantRow)));
        }
Beispiel #4
0
        public static mcweb_ReportAceRow[] List(SortingElementCollection sorting, int start, int count)
        {
            ArrayList list = new ArrayList();

            using (IDataReader reader = DataHelper.List("mcweb_ReportAce", sorting.ToArray()))
            {
                while (reader.Read() && count > 0)
                {
                    if (start == 0)
                    {
                        list.Add(new mcweb_ReportAceRow(reader));

                        count--;
                    }
                    else
                    {
                        start--;
                    }
                }
            }
            return((mcweb_ReportAceRow[])list.ToArray(typeof(mcweb_ReportAceRow)));
        }
        public static SynchronizationMetadataRow[] List(SortingElementCollection sorting, int start, int count)
        {
            ArrayList list = new ArrayList();

               using (IDataReader reader = DataHelper.List("SYNCHRONIZATION_METADATA", sorting.ToArray()))
               {
              while (reader.Read() && count > 0)
              {
                  if (start == 0)
                  {
                      list.Add(new SynchronizationMetadataRow(reader));

                      count--;
                  }
                  else start--;
              }
               }
               return (SynchronizationMetadataRow[])list.ToArray(typeof(SynchronizationMetadataRow));
        }
        public static OutgoingEmailServiceConfigRow[] List(SortingElementCollection sorting, int start, int count)
        {
            ArrayList list = new ArrayList();

               using (IDataReader reader = DataHelper.List("OutgoingEmailServiceConfig", sorting.ToArray()))
               {
              while (reader.Read() && count > 0)
              {
                  if (start == 0)
                  {
                      list.Add(new OutgoingEmailServiceConfigRow(reader));

                      count--;
                  }
                  else start--;
              }
               }
               return (OutgoingEmailServiceConfigRow[])list.ToArray(typeof(OutgoingEmailServiceConfigRow));
        }
Beispiel #7
0
        public static WorkflowParticipantRow[] List(SortingElementCollection sorting, int start, int count)
        {
            ArrayList list = new ArrayList();

               using (IDataReader reader = DataHelper.List("WorkflowParticipant", sorting.ToArray()))
               {
              while (reader.Read() && count > 0)
              {
                  if (start == 0)
                  {
                      list.Add(new WorkflowParticipantRow(reader));

                      count--;
                  }
                  else start--;
              }
               }
               return (WorkflowParticipantRow[])list.ToArray(typeof(WorkflowParticipantRow));
        }
Beispiel #8
0
        /// <summary>
        /// Internals the bind.
        /// </summary>
        private void internalBind()
        {
            MetaClass mc = Mediachase.Ibn.Core.MetaDataWrapper.GetMetaClassByName(ClassName);

            MainGrid.Columns.Clear();

            MainGrid.AllowPaging = true;

            if (!ShowPaging)
            {
                MainGridExt.BottomHeight = 1;
                SetPageSize(-1);
            }
            else
            {
                MainGridExt.BottomHeight = 30;
                MainGrid.PageSize = GetPageSize();
            }

            int width = 0;

            if (this.ShowCheckboxes)
                width += 22 + 7;

            foreach (EntityGridCustomColumnInfo customColumn in this.CustomColumns)
            {
                MainGrid.Columns.Add(customColumn.Column);
                width += customColumn.Width + 7;
            }

            int counter = 0;
            foreach (EntityFieldInfo field in this.VisibleMetaFields)
            {
                if (PlaceName == String.Empty)
                    MainGrid.Columns.Add((new ListColumnFactory(this.ViewName)).GetColumn(this.Page, field.Field));
                else
                    MainGrid.Columns.Add((new ListColumnFactory(this.ViewName)).GetColumn(this.Page, field.Field, PlaceName));

                int cellWidth = GetMetaFieldWidth(counter, field.Width);

                width += cellWidth;

                counter++;
            }

            width += this.VisibleMetaFields.Length * 7;

            MainGrid.Width = width;

            //Adding CssColumn
            MainGrid.Columns.Add((new ListColumnFactory(this.ViewName)).GetCssColumn(this.Page, ClassName));

            internalBindHeader();

            FilterElementCollection fec = new FilterElementCollection();
            fec.AddRange(CurrentProfile.Filters.ToArray());
            if (!String.IsNullOrEmpty(this.SearchKeyword))
            {
                FilterElement fe = CHelper.GetSearchFilterElementByKeyword(this.SearchKeyword, ClassName);
                fec.Add(fe);
            }
            fec.AddRange(AddFilters.ToArray());

            //Sorting
            SortingElementCollection sec = new SortingElementCollection();
            string key = GetPropertyKey(SortingPropertyKey);
            if (_pc[key] != null)
            {
                string sort = _pc[key];
                SortingElementType set = SortingElementType.Asc;
                if (sort.IndexOf(" DESC") >= 0)
                {
                    sort = sort.Substring(0, sort.IndexOf(" DESC"));
                    set = SortingElementType.Desc;
                }

                // O.R. [2009-11-02] check that sorting field exists
                if (mc.Fields.Contains(sort))
                {
                    sec.Add(new SortingElement(sort, set));
                }
                else
                {
                    _pc[key] = null;
                }
            }
            else if (CurrentProfile.Sorting != null)
            {
                // O.R. [2009-11-02] check that sorting fields exist
                foreach (SortingElement sortElement in CurrentProfile.Sorting)
                {
                    if (!mc.Fields.Contains(sortElement.Source))
                    {
                        CurrentProfile.Sorting = null;
                        break;
                    }
                }

                if (CurrentProfile.Sorting != null)
                    sec = CurrentProfile.Sorting;
            }

            if (this.GridFilters.Count > 0)
            {
                fec.AddRange(this.GridFilters);
            }

            if (this.GridSorting.Count > 0)
            {
                sec.AddRange(this.GridSorting);
            }

            if (this.CustomDataSource == null)
            {
                EntityObject[] list;
                try
                {
                    list = BusinessManager.List(ClassName, fec.ToArray(), sec.ToArray());
                }
                catch
                {
                    string sKey = GetPropertyKey(SortingPropertyKey);
                    _pc[sKey] = null;
                    if (this.Parent != null && this.Parent.Parent != null && this.Parent.Parent.Parent != null && this.Parent.Parent.Parent is Mediachase.Ibn.Web.UI.MetaUIEntity.Modules.EntityList)
                        Mediachase.Ibn.Web.UI.MetaUIEntity.Modules.EntityList.SetProfileName(_pc, ClassName, null);
                    throw;
                }

                MainGridExt.IsEmpty = (list.Length == 0);

                if (list.Length == 0)
                {
                    list = new EntityObject[] { new EntityObject(ClassName) };
                    this.Count = 0;
                }
                else
                {
                    this.Count = list.Length;
                }

                MainGrid.DataSource = list;
            }
            else
            {
                MainGrid.DataSource = this.CustomDataSource;
                this.Count = this.CustomDataSource.Length;
            }

            MainGrid.DataBind();

            internalBindPaging();

            #region Appply paging for dashboard
            if (this.DashboardMode)
            {
                MainGridExt.BottomHeight = 16;
                //HtmlControl c = (HtmlControl)MainGrid.BottomPagerRow.FindControl("pagingContainer");
                //c.Style.Add(HtmlTextWriterStyle.Position, "static");
                //c.Style.Add("float", "right");

                //MainGridExt.ServicePath = "debug";
            }
            #endregion

            //if (MainGridExt.IsEmpty)
            //    MainGrid.CssClass = "serverGridBodyEmpty";
        }
        public static OutgoingEmailServiceConfigRow[] List(SortingElementCollection sorting, int start, int count)
        {
            ArrayList list = new ArrayList();

            using (IDataReader reader = DataHelper.List("OutgoingEmailServiceConfig", sorting.ToArray()))
            {
                while (reader.Read() && count > 0)
                {
                    if (start == 0)
                    {
                        list.Add(new OutgoingEmailServiceConfigRow(reader));

                        count--;
                    }
                    else
                    {
                        start--;
                    }
                }
            }
            return((OutgoingEmailServiceConfigRow[])list.ToArray(typeof(OutgoingEmailServiceConfigRow)));
        }
Beispiel #10
0
        private void ProcessCollection(DataTable dt, EntityObject[] assignments, WorkflowInstanceEntity wfEntity, int level)
        {
            level++;

            foreach (AssignmentEntity assignment in assignments)
            {
                DataRow row = dt.NewRow();
                row["AssignmentId"] = assignment.PrimaryKeyId.ToString();
                row["Subject"]      = assignment.Subject;
                if (assignment.UserId.HasValue)
                {
                    row["User"] = CommonHelper.GetUserStatus(assignment.UserId.Value);
                }
                row["State"] = CHelper.GetResFileString(MetaEnum.GetFriendlyName(MetaDataWrapper.GetEnumByName("AssignmentState"), assignment.State));
                if (assignment.ExecutionResult.HasValue)
                {
                    row["Result"] = assignment.ExecutionResult.Value;
                }
                if (assignment.ActualFinishDate.HasValue)
                {
                    row["FinishDate"] = String.Concat(assignment.ActualFinishDate.Value.ToShortDateString(), " ", assignment.ActualFinishDate.Value.ToShortTimeString());
                }
                row["Comment"] = CHelper.ParseText(assignment.Comment, true, true, false);
                row["Indent"]  = (level - 1) * indentSize;
                if (assignment.ClosedBy.HasValue)
                {
                    row["ClosedBy"] = CommonHelper.GetUserStatus(assignment.ClosedBy.Value);
                }
                dt.Rows.Add(row);

                // Filter:
                //	1: WorkflowInstanceId = wfEntity.PrimaryKeyId,
                //	2: ParentAssignmentId = assignment.PrimaryKeyId
                FilterElementCollection fec = new FilterElementCollection();
                fec.Add(FilterElement.EqualElement(AssignmentEntity.FieldWorkflowInstanceId, wfEntity.PrimaryKeyId.Value));
                fec.Add(FilterElement.EqualElement(AssignmentEntity.FieldParentAssignmentId, assignment.PrimaryKeyId.Value));

                // Sorting
                SortingElementCollection sec = new SortingElementCollection();
                sec.Add(new SortingElement(AssignmentEntity.FieldCreated, SortingElementType.Asc));

                EntityObject[] children = BusinessManager.List(AssignmentEntity.ClassName, fec.ToArray(), sec.ToArray());

                ProcessCollection(dt, children, wfEntity, level);
            }
        }
Beispiel #11
0
        public override void DataBind()
        {
            DataTable dt = new DataTable();

            dt.Locale = CultureInfo.InvariantCulture;
            dt.Columns.Add("AssignmentId", typeof(string));
            dt.Columns.Add("Subject", typeof(string));
            dt.Columns.Add("User", typeof(string));
            dt.Columns.Add("State", typeof(string));
            dt.Columns.Add("Result", typeof(int));
            dt.Columns.Add("FinishDate", typeof(string));
            dt.Columns.Add("Comment", typeof(string));
            dt.Columns.Add("Indent", typeof(int));
            dt.Columns.Add("ClosedBy", typeof(string));

            WorkflowInstanceEntity wfEntity = (WorkflowInstanceEntity)DataItem;

            // Filter:
            //	1: WorkflowInstanceId = wfEntity.PrimaryKeyId,
            //	2: ParentAssignmentId IS NULL (other elements we'll get via the recursion)
            FilterElementCollection fec = new FilterElementCollection();

            fec.Add(FilterElement.EqualElement(AssignmentEntity.FieldWorkflowInstanceId, wfEntity.PrimaryKeyId.Value));
            fec.Add(FilterElement.IsNullElement(AssignmentEntity.FieldParentAssignmentId));

            // Sorting
            SortingElementCollection sec = new SortingElementCollection();

            sec.Add(new SortingElement(AssignmentEntity.FieldCreated, SortingElementType.Asc));

            EntityObject[] assignments = BusinessManager.List(AssignmentEntity.ClassName, fec.ToArray(), sec.ToArray());

            ProcessCollection(dt, assignments, wfEntity, 0);

            AssignmentList.DataSource = dt;
            AssignmentList.DataBind();

            if (dt.Rows.Count > 0)
            {
                AssignmentList.Visible     = true;
                NoAssignmentsLabel.Visible = false;
            }
            else
            {
                AssignmentList.Visible     = false;
                NoAssignmentsLabel.Visible = true;
                NoAssignmentsLabel.Text    = GetGlobalResourceObject("IbnFramework.BusinessProcess", "NoAssignments").ToString();
            }
        }
Beispiel #12
0
        public static mcweb_ReportAceRow[] List(SortingElementCollection sorting, int start, int count)
        {
            ArrayList list = new ArrayList();

               using (IDataReader reader = DataHelper.List("mcweb_ReportAce", sorting.ToArray()))
               {
              while (reader.Read() && count > 0)
              {
                  if (start == 0)
                  {
                      list.Add(new mcweb_ReportAceRow(reader));

                      count--;
                  }
                  else start--;
              }
               }
               return (mcweb_ReportAceRow[])list.ToArray(typeof(mcweb_ReportAceRow));
        }
Beispiel #13
0
        private void ProcessCollection(DataTable dt, EntityObject[] assignments, WorkflowInstanceEntity wfEntity, int level)
        {
            level++;

            foreach (AssignmentEntity assignment in assignments)
            {
                DataRow row = dt.NewRow();
                row["AssignmentId"] = assignment.PrimaryKeyId.ToString();
                row["Subject"] = assignment.Subject;
                if (assignment.UserId.HasValue)
                    row["User"] = CommonHelper.GetUserStatus(assignment.UserId.Value);
                row["State"] = CHelper.GetResFileString(MetaEnum.GetFriendlyName(MetaDataWrapper.GetEnumByName("AssignmentState"), assignment.State));
                if (assignment.ExecutionResult.HasValue)
                    row["Result"] = assignment.ExecutionResult.Value;
                if (assignment.ActualFinishDate.HasValue)
                    row["FinishDate"] = String.Concat(assignment.ActualFinishDate.Value.ToShortDateString(), " ", assignment.ActualFinishDate.Value.ToShortTimeString());
                row["Comment"] = CHelper.ParseText(assignment.Comment, true, true, false);
                row["Indent"] = (level - 1) * indentSize;
                if (assignment.ClosedBy.HasValue)
                {
                    row["ClosedBy"] = CommonHelper.GetUserStatus(assignment.ClosedBy.Value);
                }
                dt.Rows.Add(row);

                // Filter:
                //	1: WorkflowInstanceId = wfEntity.PrimaryKeyId,
                //	2: ParentAssignmentId = assignment.PrimaryKeyId
                FilterElementCollection fec = new FilterElementCollection();
                fec.Add(FilterElement.EqualElement(AssignmentEntity.FieldWorkflowInstanceId, wfEntity.PrimaryKeyId.Value));
                fec.Add(FilterElement.EqualElement(AssignmentEntity.FieldParentAssignmentId, assignment.PrimaryKeyId.Value));

                // Sorting
                SortingElementCollection sec = new SortingElementCollection();
                sec.Add(new SortingElement(AssignmentEntity.FieldCreated, SortingElementType.Asc));

                EntityObject[] children = BusinessManager.List(AssignmentEntity.ClassName, fec.ToArray(), sec.ToArray());

                ProcessCollection(dt, children, wfEntity, level);
            }
        }
Beispiel #14
0
        private EntityObject[] GetEntityObjectListForExport()
        {
            string variant = "0";

            if (Request["variant"] != null)
            {
                variant = Request["variant"];
            }

            SortingElementCollection sec = new SortingElementCollection();

            if (_pc[grdMain.GetPropertyKey(EntityGrid.SortingPropertyKey)] != null)
            {
                string             sort = _pc[grdMain.GetPropertyKey(EntityGrid.SortingPropertyKey)];
                SortingElementType set  = SortingElementType.Asc;
                if (sort.IndexOf(" DESC") >= 0)
                {
                    sort = sort.Substring(0, sort.IndexOf(" DESC"));
                    set  = SortingElementType.Desc;
                }

                sec.Add(new SortingElement(sort, set));
            }

            int pageSize = 10;

            if (_pc[grdMain.GetPropertyKey(EntityGrid.PageSizePropertyKey)] != null)
            {
                pageSize = Convert.ToInt32(_pc[grdMain.GetPropertyKey(EntityGrid.PageSizePropertyKey)].ToString());
                if (pageSize == -1)
                {
                    pageSize = 10000;
                }
            }
            int pageIndex = 0;

            if (_pc["EntityList_" + ClassName + "_" + _profileName + "_PageIndex"] != null)
            {
                pageIndex = int.Parse(_pc["EntityList_" + ClassName + "_" + _profileName + "_PageIndex"]);
            }

            ListViewProfile lvp = null;

            switch (variant)
            {
            case "1":                           //OnlyView
                lvp = ListViewProfile.Load(ClassName, _profileName, _placeName);
                if (sec.Count == 0)
                {
                    sec = lvp.Sorting;
                }
                return(BusinessManager.List(ClassName, lvp.Filters.ToArray(), sec.ToArray()));

            case "2":                           //Only Visible
                lvp = ListViewProfile.Load(ClassName, _profileName, _placeName);

                FilterElementCollection fec = new FilterElementCollection(lvp.Filters.ToArray());

                if (!String.IsNullOrEmpty(txtSearch.Text))
                {
                    FilterElement fe = CHelper.GetSearchFilterElementByKeyword(txtSearch.Text, ClassName);
                    fec.Add(fe);
                }

                EntityObject[]      list    = BusinessManager.List(ClassName, fec.ToArray(), sec.ToArray());
                List <EntityObject> newList = new List <EntityObject>();
                int start  = pageIndex * pageSize;
                int finish = start + pageSize;
                for (int i = start; i <= finish && i < list.Length; i++)
                {
                    newList.Add(list[i]);
                }
                return(newList.ToArray());

            case "3":                           //Only Selected
                string              values           = Request["ids"];
                string[]            selectedElements = values.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
                List <PrimaryKeyId> listPkey         = new List <PrimaryKeyId>();
                foreach (string elem in selectedElements)
                {
                    string       id  = elem.Split(new string[] { "::" }, StringSplitOptions.RemoveEmptyEntries)[0];
                    PrimaryKeyId key = PrimaryKeyId.Parse(id);
                    if (key != PrimaryKeyId.Empty)
                    {
                        listPkey.Add(key);
                    }
                }
                FilterElementCollection fecPkey = new FilterElementCollection();
                foreach (PrimaryKeyId id in listPkey)
                {
                    FilterElement fe = FilterElement.EqualElement(FilterElement.PrimaryKeyFieldName, id);
                    fecPkey.Add(fe);
                }
                FilterElement orFilter = new OrBlockFilterElement(fecPkey.ToArray());
                fecPkey.Clear();
                fecPkey.Add(orFilter);

                return(BusinessManager.List(ClassName, fecPkey.ToArray(), sec.ToArray()));

            default:                            //All
                return(BusinessManager.List(ClassName, (new FilterElementCollection()).ToArray(), sec.ToArray()));
            }
        }