Ejemplo n.º 1
0
        public string GetNotesJson(int SealRequestsID)
        {
            SealsApplication            app    = new SealsApplication();
            List <SealNotesEntity>      list   = app.GetSealNotesList(SealRequestsID);
            Dictionary <string, object> result = new Dictionary <string, object>();

            result.Add("notes", list);
            return(Newtonsoft.Json.JsonConvert.SerializeObject(result));
        }
Ejemplo n.º 2
0
        private void BindSealRequestData(SealRequestsEntity entity)
        {
            hdID.Value          = entity.ID.ToString();
            txtTitle.Text       = entity.Title;
            txtStatus.Text      = entity.Status.ToString();
            txtDescription.Text = entity.Description.Replace("<br>", "\r\n");

            List <SealUnionRequestsEntity> list = app.GetSealUnionRequestsList(entity.ID);

            if ((int)entity.Status < (int)RequestStatus.Approved)
            {
                BindDropDownData();
                foreach (SealUnionRequestsEntity tmpEntity in list)
                {
                    ListItem li = chklistSeal.Items.FindByValue(tmpEntity.SealID.ToString());
                    if (li != null)
                    {
                        li.Selected = true;
                    }
                }
            }
            else
            {
                ltSelas.Text = BuilderSeals(entity.ID);
            }

            if (entity.RequestedBy == UserInfo.UserID && entity.Status < RequestStatus.Approved) //修改为在Approve前都可以删除
            {
                lblFiles.InnerHtml = BuilderFiles(entity.ID, true);
            }
            else
            {
                lblFiles.InnerHtml = BuilderFiles(entity.ID, false);
            }

            if (entity.Status == RequestStatus.Open && UserInfo.UserID == entity.RequestedBy)
            {
                DisableControl(true, string.Empty);
            }
            else
            {
                DisableControl(false, entity.Description);
            }

            switch (entity.Status)
            {
            case RequestStatus.Open:
                if (entity.RequestedBy == UserInfo.UserID)
                {
                    trUploadFiles.Visible = true;
                    btnCancel.Visible     = true;
                    btnSave.Visible       = true;
                    btnSubmit.Visible     = true;
                }
                break;

            case RequestStatus.Submit:
                foreach (SealUnionRequestsEntity unionEntity in list)
                {
                    if (entity.RequestedBy == UserInfo.UserID)
                    {
                        btnSave.Visible       = true;
                        trUploadFiles.Visible = true;
                    }
                    if (unionEntity.ApprovedBy == UserInfo.UserID)
                    {
                        btnDenied.Visible   = true;
                        btnApproved.Visible = true;
                        break;
                    }
                }
                break;

            case RequestStatus.Approved:
                foreach (SealUnionRequestsEntity unionEntity in list)
                {
                    if (unionEntity.SealedBy == UserInfo.UserID)
                    {
                        btnSeal.Visible = true;
                        if (unionEntity.IsSealed)
                        {
                            btnSeal.Visible = false;
                        }
                        break;
                    }
                }
                break;

            case RequestStatus.Sealed:
                if (entity.RequestedBy == UserInfo.UserID)
                {
                    btnCompleted.Visible = true;
                }
                break;

            case RequestStatus.Complete:
            case RequestStatus.Denied:
            case RequestStatus.Cancel:
                break;
            }
            rptNotes.DataSource = app.GetSealNotesList(entity.ID);
            rptNotes.DataBind();
        }
Ejemplo n.º 3
0
        private void BindRequestData(SealRequestsEntity entity)
        {
            hdID.Value          = entity.ID.ToString();
            txtTitle.Text       = entity.Title;
            lblStatus.Text      = entity.Status.RequestStatusToText();
            lblCreator.Text     = new App.UserApplication().GetUser(entity.RequestedBy).FirstAndLastName;
            txtDescription.Text = entity.Description.Replace("<br>", "\r\n");

            List <SealUnionRequestsEntity> list = app.GetSealUnionRequestsList(entity.ID);

            if (entity.Type == 0)
            {
                if ((int)entity.Status < (int)RequestStatus.Processed)
                {
                    List <SealsEntity> seallist = app.GetList().FindAll(r => r.Status == Status.Active);
                    foreach (SealUnionRequestsEntity tmpEntity in list)
                    {
                        SealsEntity tmpSealEntity = seallist.Find(r => r.ID == tmpEntity.SealID);
                        if (tmpSealEntity != null)
                        {
                            tmpSealEntity.Checked = true;
                        }
                    }
                    rptSeals.DataSource = seallist;
                    rptSeals.DataBind();
                }
                else
                {
                    ltSelas.Text = BuilderSeals(entity.ID);
                }
            }

            if (entity.RequestedBy == UserInfo.UserID && entity.Status < RequestStatus.Approved) //修改为在Approve前都可以删除
            {
                lblFiles.InnerHtml = BuilderFiles(entity.ID, true);
            }
            else
            {
                lblFiles.InnerHtml = BuilderFiles(entity.ID, false);
            }

            if (entity.Status == RequestStatus.Draft && UserInfo.UserID == entity.RequestedBy)
            {
                DisableControl(false, string.Empty);
                divUploadFiles1.Visible = true;
            }
            else
            {
                DisableControl(true, entity.Description);
                divUploadFiles1.Visible = false;
            }

            if (sealRequestEntity.Status == RequestStatus.Canceled || sealRequestEntity.Status == RequestStatus.Completed || sealRequestEntity.Status == RequestStatus.Draft)
            {
                divUploadFiles2.Visible = false;
                divComments.Visible     = false;
            }
            else
            {
                divUploadFiles2.Visible = true;
                divComments.Visible     = true;
            }

            rptFiles.DataSource = app.GetSealFilesList(entity.ID, -1);
            rptFiles.DataBind();

            rptNotes.DataSource = app.GetSealNotesList(entity.ID);
            rptNotes.DataBind();

            // Bind Workflow history Repeater
            List <WorkflowHistoryEntity> wfhisLst = app.GetWorkflowHistoryList(entity.ID);

            rptWorkflowHistory.DataSource = wfhisLst;
            rptWorkflowHistory.DataBind();
        }