示例#1
0
        protected void btnAddDoc_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                GetSessionValues();

                try
                {
                    if (tbUploadDocument.HasFile && tbUploadDocument.PostedFile != null)
                    {
                        string fileName = SaveDocToTemp(tbUploadDocument);

                        dto.IssueDocument issueDoc = GetDocValues();

                        issueDoc.FullFileName = fileName;

                        IssueBF.IssueDto.Documents.Add(issueDoc);

                        SetSessionValues();

                        LoadDocGrid();

                        ResetDocumentFormValues();
                    }
                    else
                    {
                        DisplayPopup("The document cannot be empty.  Please choose a document with content.");
                    }
                }
                catch (IOException ioEx)
                {
                    throw;
                }
            }
        }
示例#2
0
        protected void gvDocuments_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            GetSessionValues();

            //Get the document
            dto.IssueDocument issueDoc = IssueBF.IssueDto.Documents[e.RowIndex];

            try
            {
                File.Delete(issueDoc.FullFileName);
            }
            catch (IOException ioEx)
            {
                DisplayPopup("An error occured deleting the document.");
            }

            //Remove from documents list
            IssueBF.IssueDto.Documents.RemoveAt(e.RowIndex);

            //Update session
            SetSessionValues();

            //Reload the grid
            LoadDocGrid();
        }
示例#3
0
        private dto.IssueDocument GetDocValues()
        {
            dto.IssueDocument issueDoc = new dto.IssueDocument();

            issueDoc.IssueDocTypeId = Convert.ToInt32(ddlIssueDocTypes.SelectedValue);

            issueDoc.Comments = tbComments.Text.Trim();

            issueDoc.CreationUserId = UserInfo.UserDto.UserId;

            issueDoc.IsActive = Convert.ToBoolean(Convert.ToInt32(ddlDocStatus.SelectedValue));

            return(issueDoc);
        }
示例#4
0
        protected void gvDocuments_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            //If the item bound is a row item
            if (e.Row.RowType.Equals(DataControlRowType.DataRow))
            {
                Label lblDocType = (Label)e.Row.FindControl("lblDocType");

                dto.IssueDocument issueDoc = (dto.IssueDocument)e.Row.DataItem;

                if (!(lblDocType == null || issueDoc == null))
                {
                    ListItem liItem = ddlIssueDocTypes.Items.FindByValue(issueDoc.IssueDocTypeId.ToString());

                    if (liItem != null)
                    {
                        lblDocType.Text = liItem.Text;
                    }
                }
            }
        }