Esempio n. 1
0
        protected DataView GetData()
        {
            BPDocuments bp = new BPDocuments();

            if (ddlDocumentCategories.SelectedValue == "-1")
                DSDocuments = bp.SelectWithDocumentCategories();
            else
                DSDocuments = bp.SelectByDocumentCategoryID(Convert.ToInt32(ddlDocumentCategories.SelectedValue));


            DSDocuments.tbl_Documents.DefaultView.RowFilter = RowFilter("DocumentAlias", ((LinkButton)rptLetters.Items[0].FindControl("lnkLetter")).CommandName, "DocumentActive", lstActive.SelectedValue);
            return DSDocuments.tbl_Documents.DefaultView;
        }
Esempio n. 2
0
		protected void BindAvailableDocuments()
		{
			BPDocuments bpu = new BPDocuments();
			DSDocuments = new BEDocuments();

			if (FilterID != -1)
                DSDocuments.Merge(bpu.SelectActiveByDocumentCategoryID(FilterID));
			else
                DSDocuments.Merge(bpu.SelectActiveWithDocumentCategories());

			int DocumentCategoryID = -1;
			Boolean blnNew = true;

			StringBuilder returnDocuments = new StringBuilder(10000);
			 
			returnDocuments.Append("none,No Document|");

			foreach(DataRow dr in DSDocuments.tbl_Documents.Rows)
			{
				if ((int) dr["DocumentCategoryID"] != DocumentCategoryID)
				{
					DocumentCategoryID = (int) dr["DocumentCategoryID"];
					blnNew = true;
				}

				if (blnNew)
				{
					returnDocuments.Append(",-- " + dr["DocumentCategoryName"] + " --|");
					blnNew = false;
				}
				
				returnDocuments.Append(dr["DocumentID"] + "," + HttpUtility.HtmlDecode("    ") + dr["DocumentAlias"] + "|");
			}

            string returnDocumentsString = returnDocuments.Replace("'", @"\'").ToString();
			lblScript.Text = "<script Language=\"Javascript\">window.parent.handleResponse('" + returnDocuments + "', 'Document')</script>";
		}
Esempio n. 3
0
        private void BindDocuments()
        {
            if (DocumentID != 0)
            {
                BPDocuments bp = new BPDocuments();
                BEDocuments dsDocuments = bp.SelectByID(DocumentID);
                BEDocuments.tbl_DocumentsRow doc = null;

                if (dsDocuments.tbl_Documents.Count > 0)
                {
                    doc = dsDocuments.tbl_Documents[0];

                    txtDocumentAlias.Text = doc.DocumentAlias;
                    txtDocumentDescription.Text = (doc.IsDocumentDescriptionNull()) ? "" : doc.DocumentDescription;

                    if (ddlDocumentCategories.Items.FindByValue(doc.DocumentCategoryID.ToString()) != null)
                        ddlDocumentCategories.SelectedValue = doc.DocumentCategoryID.ToString();

                    txtFileName.Text = doc.DocumentName;
                    chkDocumentActive.Checked = doc.DocumentActive;

                    lblTitle.Text = "Edit Document - " + doc.DocumentAlias;
                }
            }
            else
            {
                btnDelete.Visible = false;
                lblTitle.Text = "Upload Document";

                if (ddlDocumentCategories.Items.FindByValue(FilterCatID) != null)
                    ddlDocumentCategories.SelectedValue = FilterCatID;
            }
        }
Esempio n. 4
0
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            BPDocuments bp = new BPDocuments();
            BEDocuments ds = bp.SelectByID(DocumentID);
            BEDocuments.tbl_DocumentsRow doc = ds.tbl_Documents.FindByDocumentID(DocumentID);

            if (doc != null)
            {
                DeleteLinksToDocument(doc.DocumentID);
                DeleteAttachmentsToDocument(doc.DocumentID);
                MWUtility.DeleteDocumentFiles(doc.DocumentName, this);
                doc.Delete();
                bp.Update(ds);
            }

            Response.Redirect("BrowseDocuments.aspx?CatID=" + FilterCatID);
        }
Esempio n. 5
0
        private bool SaveDocumentInfo()
        {
            bool isNew = false;
            bool updateExisting = false;
            string strFileName = null;
            BPDocuments bp = new BPDocuments();
            BEDocuments ds = new BEDocuments();

            if (DocumentID > 0)
            {
                if (inpUpload.PostedFile.FileName == "")
                    updateExisting = true;
            }
            else
                isNew = true;

            if (!updateExisting)
                strFileName = UploadFunctions.UploadFile(inpUpload.PostedFile, Server.MapPath(ConfigurationManager.AppSettings["UploadsPath"]), UploadTypes.Document);

            if (strFileName != null || updateExisting)
            {
                BEDocuments.tbl_DocumentsRow doc;

                if (isNew)
                    doc = ds.tbl_Documents.Newtbl_DocumentsRow();
                else
                {
                    ds = bp.SelectByID(DocumentID);
                    doc = ds.tbl_Documents.FindByDocumentID(DocumentID);
                }

                doc.DocumentCategoryID = Convert.ToInt32(ddlDocumentCategories.SelectedValue);

                if (!updateExisting)
                    doc.DocumentName = strFileName;

                doc.DocumentAlias = txtDocumentAlias.Text;

                if (txtDocumentDescription.Text.Trim() != "")
                    doc.DocumentDescription = txtDocumentDescription.Text;
                else
                    doc.SetDocumentDescriptionNull();


                string path = ConfigurationManager.AppSettings["UploadsPath"];
                if (File.Exists(Server.MapPath(path + doc.DocumentName)))
                {
                    FileInfo file = new FileInfo(Server.MapPath(path + doc.DocumentName));
                    doc.DocumentSize = file.Length;
                }
                else
                    doc.DocumentSize = 0;

                doc.DocumentActive = chkDocumentActive.Checked;
                doc.DateModified = DateTime.Now;
                doc.ModifiedByAdminID = PageUserID;

                if (isNew)
                {
                    doc.DateCreated = DateTime.Now;
                    ds.tbl_Documents.Addtbl_DocumentsRow(doc);
                }

                bp.Update(ds);
                return true;
            }
            else
                return false;
        }
Esempio n. 6
0
        protected void BindDocuments()
        {
            BPDocuments bpu = new BPDocuments();
            DSDocuments = new BEDocuments();

            if (ddlDocumentCategories.SelectedValue != "-1")
                DSDocuments.Merge(bpu.SelectActiveByDocumentCategoryID(Convert.ToInt32(ddlDocumentCategories.SelectedValue)));
            else
                DSDocuments.Merge(bpu.SelectActiveWithDocumentCategories());

            int DocumentCategoryID = -1;
            Boolean blnNew = true;

            ddlDocuments.Items.Clear();

            ddlDocuments.Items.Add(new ListItem("No Document", "0"));
            foreach (DataRow dr in DSDocuments.tbl_Documents.Rows)
            {
                if ((int)dr["DocumentCategoryID"] != DocumentCategoryID)
                {
                    DocumentCategoryID = (int)dr["DocumentCategoryID"];
                    blnNew = true;
                }

                if (blnNew)
                {
                    ddlDocuments.Items.Add(new ListItem("-- " + dr["DocumentCategoryName"] + " --", ""));
                    blnNew = false;
                }

                ddlDocuments.Items.Add(new ListItem(HttpUtility.HtmlDecode("&nbsp;&nbsp;&nbsp;&nbsp;") + dr["DocumentAlias"], dr["DocumentID"].ToString()));
            }

            if (SelectedDocument != 0)
                ddlDocuments.SelectedValue = SelectedDocument.ToString();

        }
Esempio n. 7
0
        private string GetDocumentAlias(int documentID)
        {
            string alias = "";
            BPDocuments bp = new BPDocuments();
            BEDocuments ds = bp.SelectByID(documentID);

            if (ds.tbl_Documents.Count > 0)
                alias = ds.tbl_Documents[0].DocumentAlias;

            return alias;
        }