예제 #1
0
        private string BuilderFiles(int sealRequestId, bool showDeleted)
        {
            string tmpFiles            = string.Empty;
            List <SealFileEntity> list = app.GetSealFilesList(sealRequestId);
            bool One = true;

            foreach (SealFileEntity entity in list.FindAll(r => r.Type == 1))
            {
                if (One)
                {
                    One = false;
                }
                else
                {
                    tmpFiles += "&nbsp;&nbsp;&nbsp;&nbsp;";
                }

                tmpFiles += string.Format("<div id='div{0}' style='margin-bottom:-5px;'><a href='/do/DownloadSealFile.ashx?id={0}' target='iframeDownloadFile'>{1}</a>", entity.ID, entity.Name);
                if (showDeleted)
                {
                    tmpFiles += string.Format("&nbsp;&nbsp;<a href='#' onclick='deleteFile(\"{0}\");'><img src='/Images/ico_delete.gif' align='absmiddle'/></a>", entity.ID);
                }
                tmpFiles += "</div>";
            }
            rptFiles.DataSource = list.FindAll(r => r.Type == 2);
            rptFiles.DataBind();
            return(tmpFiles);
        }
예제 #2
0
        public string GetFielsJson(int SealRequestsID)
        {
            SealsApplication            app = new SealsApplication();
            SealRequestsEntity          sealRequestsEntity = app.GetSealRequests(SealRequestsID);
            string                      tmpFiles           = string.Empty;
            List <SealFileEntity>       list   = app.GetSealFilesList(SealRequestsID);
            Dictionary <string, object> result = new Dictionary <string, object>();

            result.Add("files", list.FindAll(r => r.Type == 2));
            result.Add("currentUserID", UserID);
            result.Add("NotShowDelete", sealRequestsEntity.Status >= RequestStatus.Approved);
            return(Newtonsoft.Json.JsonConvert.SerializeObject(result));
        }
예제 #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();
        }