Пример #1
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                if (Request["btnCancel"] != null)
                {
                    DocumentTransaction.End();
                    Response.Redirect("~/CloseWindow.html");
                    return;
                }

                if (!DocumentTransaction.IsActive())
                {
                    throw new BipFatalException();
                }
                doc = DocumentTransaction.Current.Document;
                if (doc.Id < 1)
                {
                    btnUpdate.Visible = false;
                }
                else
                {
                    btnCreate.Visible = false;
                }
                CtrlDocInfoView.Document = doc;
                DataBind();
            }
            catch (Exception ex)
            {
                ProcessException(ex);
            }
        }
Пример #2
0
 protected void btnCreate_Click(object sender, System.EventArgs e)
 {
     try
     {
         int id = doc.Create();
         DocumentTransaction.End();
         Response.Redirect("~/CloseWindow.html");
     }
     catch (Exception ex)
     {
         this.ProcessException(ex);
     }
 }
Пример #3
0
 private void btnConfDelete_Click(object sender, System.EventArgs e)
 {
     try
     {
         doc.Delete();
         DocumentTransaction.End();
         Response.Redirect("~/CloseWindow.html");
     }
     catch (Exception ex)
     {
         this.ProcessException(ex);
     }
 }
        private void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                if (Request["btnCancel"] != null)
                {
                    DocumentTransaction.End();
                    Response.Redirect("~/CloseWindow.html");
                    return;
                }
                PanPreview.Visible = false;

                if (!DocumentTransaction.IsActive())
                {
                    throw new BipFatalException();
                }

                doc = DocumentTransaction.Current.Document;
                lblFileName.Text = doc.FileName;
                if (Page.IsPostBack == false)
                {
                    ddlFileType.DataSource     = DocFileType.FindAll();
                    ddlFileType.DataTextField  = "Name";
                    ddlFileType.DataValueField = "Id";
                    ddlFileType.DataBind();
                    //ddlFileType.Items.Insert(0, new ListItem("", "0"));
                    ListUtils.SelectSingleListItem(ddlFileType.Items, doc.FileTypeId.ToString());
                }
                else
                {
                    int fileType = Convert.ToInt32(ddlFileType.SelectedItem.Value);
                    if (fileType == 0)
                    {
                        throw new BipGenericException(Bip.Components.BipResources.GetString("StMustSelectFileType"));
                    }
                    doc.ConfigureFileType(Convert.ToInt32(ddlFileType.SelectedItem.Value));
                }

                if (doc.Id > 0)
                {
                    btnBack.Visible = false;
                }
            }
            catch (Exception ex)
            {
                ProcessException(ex);
            }
        }
Пример #5
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                if (Page.IsPostBack)
                {
                    if (Request["btnCancel"] != null)
                    {
                        DocumentTransaction.End();
                        Response.Redirect("~/CloseWindow.html");
                        return;
                    }

                    if (UploadedFile.PostedFile == null ||
                        UploadedFile.PostedFile.ContentLength == 0 ||
                        UploadedFile.PostedFile.FileName == null)
                    {
                        throw new BipGenericException(Bip.Components.BipResources.GetString("StrFileUploadError"));
                    }

                    DocumentEnt doc = null;
                    if (!DocumentTransaction.IsActive())
                    {
                        doc = new DocumentEnt();
                        doc.New();
                        DocumentTransaction.Begin(doc);
                    }
                    else
                    {
                        doc = DocumentTransaction.Current.Document;
                    }

                    doc.UploadFile(UploadedFile.PostedFile.InputStream, System.IO.Path.GetFileName(UploadedFile.PostedFile.FileName));
                    //doc.FileName = ;
                    Response.Redirect("DocFileTypeEdit.aspx");
                }
            }
            catch (Exception ex)
            {
                ProcessException(ex);
            }

            // Put user code to initialize the page here
        }
 private void btnCancel_Click(object sender, System.EventArgs e)
 {
     DocumentTransaction.End();
     Response.Redirect("~/CloseWindow.html");
 }
        protected void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                if (!DocumentTransaction.IsActive())
                {
                    throw new BipFatalException();
                }

                doc = DocumentTransaction.Current.Document;

                if (Request["btnCancel"] != null)
                {
                    DocumentTransaction.End();
                    Response.Redirect("~/CloseWindow.html");
                    return;
                }


                if (Page.IsPostBack == false)
                {
                    if (doc.Id < 1)
                    {
                        PanExistingDocAttrs.Visible = false;
                        btnBack.Text  = "< " + BipResources.GetString("StrBtnBackCaption");
                        btnBack.Width = new Unit("100px");
                    }

                    LoadDropDownList(ddlDocCategory, DocCategoryEnt.FindAll());
                    LoadDropDownList(ddlDocType, DocTypeEnt.FindAll());
                    LoadDropDownList(ddlDocSource, DocSourceEnt.FindAll());

                    dlGroups.DataSource = Bip.Components.GroupEnt.FindAll();
                    dlGroups.DataBind();


                    LoadAttributes();
                }

                // ParentDocID ---------------------------------
                if (Page.IsPostBack == false ||
                    Request["_BIP_ACTION"] == "SelectParentDoc")
                {
                    if (Request["_BIP_ACTION"] == "SelectParentDoc")
                    {
                        doc.ParentId = Convert.ToInt32(Request["_BIP_ACTION_ARGS"]);
                    }
                    ShowParentDocLink(doc);
                }

                // PreviousVersionDocID ---------------------------------
                if (Page.IsPostBack == false ||
                    Request["_BIP_ACTION"] == "SelectPreviousVersionDoc")
                {
                    if (Request["_BIP_ACTION"] == "SelectPreviousVersionDoc")
                    {
                        doc.PreviousVersionId = Convert.ToInt32(Request["_BIP_ACTION_ARGS"]);
                    }
                    ShowPreviousVersionDocLink(doc);
                }

                // RelatedDocs ---------------------------------
                if (Page.IsPostBack == false ||
                    Request["_BIP_ACTION"] == "AddRelatedDoc" ||
                    Request["_BIP_ACTION"] == "RemoveRelatedDoc")
                {
                    if (Request["_BIP_ACTION"] == "AddRelatedDoc" ||
                        Request["_BIP_ACTION"] == "RemoveRelatedDoc")
                    {
                        ArrayList docEnum = new ArrayList();
                        if (doc.RefDocuments != null)
                        {
                            foreach (int ids in doc.RefDocuments)
                            {
                                docEnum.Add(ids);
                            }
                        }

                        int id = Convert.ToInt32(Request["_BIP_ACTION_ARGS"]);
                        if (Request["_BIP_ACTION"] == "AddRelatedDoc")
                        {
                            if (docEnum.IndexOf(id) == -1)
                            {
                                docEnum.Add(id);
                            }
                        }
                        else
                        {
                            docEnum.Remove(id);
                        }

                        doc.RefDocuments = docEnum;
                    }

                    grdDocRefRelated.DataSource = DocumentEnt.FindEnum(doc.RefDocuments);
                    grdDocRefRelated.DataBind();
                }

                string s1, s2;
                bool   showInBrowser = false;
                DocFileType.GetTypeInfo(doc.FileTypeId, out s1, out s2, out showInBrowser);
                btnShowHidePreview.Visible = showInBrowser;
            }
            catch (Exception ex)
            {
                ProcessException(ex);
            }
        }