protected string GetResult(object resultObj)
        {
            string retval = string.Empty;

            if (resultObj != null && resultObj != DBNull.Value)
            {
                int result = (int)resultObj;

                retval = CHelper.GetResFileString(MetaEnum.GetFriendlyName(MetaDataWrapper.GetEnumByName("AssignmentExecutionResult"), result));
                if (result == (int)AssignmentExecutionResult.Accepted)
                {
                    retval = String.Concat("<span class=\"resultAccepted\">", retval, "</span>");
                }
                else if (result == (int)AssignmentExecutionResult.Declined)
                {
                    retval = String.Concat("<span class=\"resultDeclined\">", retval, "</span>");
                }
                else if (result == (int)AssignmentExecutionResult.Canceled)
                {
                    retval = String.Concat("<span class=\"resultCanceled\">", retval, "</span>");
                }
            }

            return(retval);
        }
Exemple #2
0
 /// <summary>
 /// Handles the RowCommand event of the grdMain control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="System.Web.UI.WebControls.GridViewCommandEventArgs"/> instance containing the event data.</param>
 protected void grdMain_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "Delete")
     {
         MetaFieldType type = MetaDataWrapper.GetEnumByName(e.CommandArgument.ToString());
         if (!MetaEnum.IsUsed(type))
         {
             MetaEnum.Remove(type);
         }
         BindData();
     }
     if (e.CommandName == "Edit")
     {
         MetaFieldType type = MetaDataWrapper.GetEnumByName(e.CommandArgument.ToString());
         Response.Redirect("~/Apps/MetaDataBase/Pages/Admin/EnumEdit.aspx?type=" + type.Name);
     }
 }
        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);
            }
        }
Exemple #4
0
        private void BindData()
        {
            lblFriendlyName.Text = CHelper.GetResFileString(mft.FriendlyName);
            MetaFieldType mft1 = MetaDataWrapper.GetEnumByName(TypeName);

            if (mft1 != null)
            {
                if (mft1.Attributes.ContainsKey(McDataTypeAttribute.EnumMultivalue))
                {
                    lbType.Text = GetGlobalResourceObject("IbnFramework.GlobalMetaInfo", "MultiValue").ToString();
                }
                else
                {
                    lbType.Text = GetGlobalResourceObject("IbnFramework.GlobalMetaInfo", "SingleValue").ToString();
                }
            }
            BindGrid(GetDataTable());
        }
Exemple #5
0
 private void BindData()
 {
     if (EnumName != string.Empty)
     {
         MetaFieldType mft = MetaDataWrapper.GetEnumByName(EnumName);
         if (mft != null)
         {
             txtEnumName.Text     = mft.Name;
             txtEnumName.ReadOnly = true;
             txtEnumName.CssClass = "text-readonly";
             txtFriendlyName.Text = mft.FriendlyName;
             if (mft.Attributes.ContainsKey(McDataTypeAttribute.EnumMultivalue) && mft.Attributes[McDataTypeAttribute.EnumMultivalue] != null)
             {
                 chkMultiValue.Checked = (bool)mft.Attributes[McDataTypeAttribute.EnumMultivalue];
             }
             chkMultiValue.Enabled = false;
         }
     }
 }
Exemple #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();
        }