Пример #1
0
        public void Invoke(object Sender, object Element)
        {
            NameValueCollection qs = ((Control)Sender).Page.Request.QueryString;

            if (!String.IsNullOrEmpty(qs["ObjectId"]))
            {
                WorkflowInstanceEntity entity = (WorkflowInstanceEntity)BusinessManager.Load(WorkflowInstanceEntity.ClassName, PrimaryKeyId.Parse(qs["ObjectId"]));
                if (entity != null)
                {
                    if (entity.OwnerDocumentId.HasValue)
                    {
                        ((Control)Sender).Page.Response.Redirect(CHelper.GetLinkObjectViewByOwnerName("ownerdocumentid", entity.OwnerDocumentId.ToString()));
                    }
                }
            }

            if (!String.IsNullOrEmpty(qs["Id"]))
            {
                WorkflowInstanceEntity entity = (WorkflowInstanceEntity)BusinessManager.Load(WorkflowInstanceEntity.ClassName, PrimaryKeyId.Parse(qs["Id"]));
                if (entity != null)
                {
                    if (entity.OwnerDocumentId.HasValue)
                    {
                        ((Control)Sender).Page.Response.Redirect(CHelper.GetLinkObjectViewByOwnerName("ownerdocumentid", entity.OwnerDocumentId.ToString()));
                    }
                }
            }
        }
Пример #2
0
        private string GetOwnerLink()
        {
            string retval = String.Empty;

            if (instance == null)             // new
            {
                if (!String.IsNullOrEmpty(OwnerName) && OwnerId > 0)
                {
                    retval = CHelper.GetLinkObjectViewByOwnerName(OwnerName, OwnerId.ToString());
                }
            }
            else
            {
                string ownerName = string.Empty;
                if (instance.OwnerDocumentId != null)
                {
                    ownerName = WorkflowInstanceEntity.FieldOwnerDocumentId;
                }

                if (!String.IsNullOrEmpty(ownerName))
                {
                    retval = CHelper.GetLinkObjectViewByOwnerName(ownerName, instance.OwnerDocumentId.ToString());
                }
            }

            return(retval);
        }
Пример #3
0
        private void BindData()
        {
            string containerKey = string.Empty;

            // WF Name
            WorkFlowLabel.Text = info.Name;

            // WF State
            if (info.State == BusinessProcessState.Active)
            {
                StateLabel.Text = GetGlobalResourceObject("IbnFramework.BusinessProcess", "WFStateActive").ToString();
            }
            else if (info.State == BusinessProcessState.Pending)
            {
                StateLabel.Text = GetGlobalResourceObject("IbnFramework.BusinessProcess", "WFStatePending").ToString();
            }
            else if (info.State == BusinessProcessState.Suspended)
            {
                StateLabel.Text = GetGlobalResourceObject("IbnFramework.BusinessProcess", "WFStateSuspended").ToString();
            }
            else
            {
                StateLabel.Text = GetGlobalResourceObject("IbnFramework.BusinessProcess", "WFStateCompleted").ToString();
            }

            // Owner Type
            if (String.Compare(OwnerName, WorkflowInstanceEntity.FieldOwnerDocumentId, true) == 0)
            {
                OwnerLiteral.Text = GetGlobalResourceObject("IbnFramework.Admin", "ObjectType_Document").ToString();
                OwnerLink.Text    = CommonHelper.GetObjectTitle((int)Mediachase.IBN.Business.ObjectTypes.Document, OwnerId);

                containerKey = String.Concat("DocumentId_", OwnerId.ToString());
            }
            OwnerLink.NavigateUrl = CHelper.GetLinkObjectViewByOwnerName(OwnerName, OwnerId.ToString());

            // Current Date
            CurrentDateLiteral.Text = GetGlobalResourceObject("IbnFramework.BusinessProcess", "CurrentDate").ToString();
            DateTime userDate = Mediachase.IBN.Business.User.GetLocalDate(DateTime.UtcNow);

            CurrentDateLabel.Text = String.Concat(userDate.ToLongDateString(), " ", userDate.ToShortTimeString());

            // Files
            string      containerName = "FileLibrary";
            string      filesText     = string.Empty;
            FileStorage fs            = FileStorage.Create(containerName, containerKey);

            FileInfo[] files = fs.GetFiles();
            if (files != null && files.Length > 0)
            {
                foreach (FileInfo file in files)
                {
                    if (!String.IsNullOrEmpty(filesText))
                    {
                        filesText += ", ";
                    }
                    filesText += file.Name;
                }
            }
            FilesLabel.Text = filesText;
        }
Пример #4
0
        private void BindToolbar()
        {
            MainHeader.Title = GetGlobalResourceObject("IbnFramework.BusinessProcess", "WorkflowInfo").ToString();

            string link = CHelper.GetLinkObjectViewByOwnerName(OwnerName, OwnerId.ToString());
            string text = CHelper.GetIconText(GetGlobalResourceObject("IbnFramework.Common", "Back").ToString(), ResolveClientUrl("~/Images/IbnFramework/cancel.GIF"));

            if (!String.IsNullOrEmpty(link))
            {
                MainHeader.AddLink(text, link);
            }
        }