protected override IAsyncResult BeginExecute(AsyncCodeActivityContext context, AsyncCallback callback, object state)
        {
            LoadAuthentication(context);

            if (EnvelopeID.Get(context) != null)
            {
                mEnvelopeID = EnvelopeID.Get(context);
            }
            else
            {
                throw new System.ArgumentException("Envelope ID is required!");
            }

            if (DocumentID.Get(context) != null)
            {
                mDocumentID = DocumentID.Get(context);
            }
            else
            {
                throw new System.ArgumentException("Document ID is required!");
            }

            if (OutFile.Get(context) != null)
            {
                mOutFile = OutFile.Get(context);
            }
            else
            {
                throw new System.ArgumentException("Output filepath is required!");
            }

            GetDocumentDelegate = new Action(_DownloadDocument);
            return(GetDocumentDelegate.BeginInvoke(callback, state));
        }
        protected override DocumentRecordsAggregate CreateRecordsByDocument(DocumentID documentId)
        {
            var resultRecords = new DocumentRecordsAggregate();

            var taxTrans   = TaxTransByRefNbr[documentId.RefNbr].OrderBy(taxTran => taxTran.RecordID);
            var lineNumber = 1;

            foreach (var taxTran in taxTrans)
            {
                if ((documentId.DocType == TaxAdjustmentType.AdjustInput && Taxes[taxTran.TaxID].ReverseTax != true) ||
                    (documentId.DocType == TaxAdjustmentType.AdjustOutput && Taxes[taxTran.TaxID].ReverseTax == true) ||
                    Taxes[taxTran.TaxID].TaxType == CSTaxType.Withholding)
                {
                    var purchaseRecord = new PurchaseRecord();

                    _recordBuilderByTaxAdjustmentTaxTran.Build(purchaseRecord, _taxAdjustmentsByRefNbr[documentId.RefNbr], taxTran, lineNumber);

                    resultRecords.PurchaseRecords.Add(purchaseRecord);
                }
                else
                {
                    var supplyRecord = new SupplyRecord();

                    _recordBuilderByTaxAdjustmentTaxTran.Build(supplyRecord, _taxAdjustmentsByRefNbr[documentId.RefNbr], taxTran, lineNumber);

                    resultRecords.SupplyRecords.Add(supplyRecord);
                }

                lineNumber++;
            }

            return(resultRecords);
        }
Esempio n. 3
0
        private void BindToolBarAndButtons()
        {
            tbView.AddText(LocRM.GetString("QuickTracking"));

            // O.R. [2009-05-25]: DisableButtons function doesn't work with CausesValidation property

            /*
             * btnComplete.Attributes.Add("onclick","DisableButtons(this);");
             * btnSuspend.Attributes.Add("onclick","DisableButtons(this);");
             * btnUncomplete.Attributes.Add("onclick","DisableButtons(this);");
             * btnResume.Attributes.Add("onclick","DisableButtons(this);");
             * btnDecline.Attributes.Add("onclick","DisableButtons(this);");
             * btnAccept.Attributes.Add("onclick","DisableButtons(this);");
             * btnActivate.Attributes.Add("onclick","DisableButtons(this);");
             */

            string           ContainerKey  = "DocumentVers_" + DocumentID.ToString();
            string           ContainerName = "FileLibrary";
            BaseIbnContainer bic           = BaseIbnContainer.Create(ContainerName, ContainerKey);

            Mediachase.IBN.Business.ControlSystem.FileStorage fs = (Mediachase.IBN.Business.ControlSystem.FileStorage)bic.LoadControl("FileStorage");
            string commandLink = (Security.CurrentUser.IsExternal) ? "~/External/FileUpload.aspx" : "~/FileStorage/FileUpload.aspx";
            string link        = String.Format("javascript:ShowWizard('{0}?ParentFolderId={1}&ContainerKey={2}&ContainerName={3}{4}', 470, 270);return false;",
                                               ResolveUrl(commandLink), fs.Root.Id, ContainerKey, ContainerName,
                                               (Security.CurrentUser.IsExternal) ? ("&ExternalId=" + Security.CurrentUser.UserID) : "");

            btnNewVersion.Attributes.Add("onclick", link);
        }
Esempio n. 4
0
        public override int GetHashCode()
        {
            var digest = _imageDigest;
            var b      = DocumentID.GetHashCode() ^ Name.GetHashCode() ^ IsChecked.GetHashCode();

            return(digest == null ? b : (b ^ digest.GetHashCode()));
        }
Esempio n. 5
0
        public void Delete()
        {
            using (SqlConnection cn = new SqlConnection(ConfigurationManager.ConnectionStrings["ApplicationServices"].ConnectionString)) {
                SqlTransaction transaction;
                cn.Open();
                transaction = cn.BeginTransaction();
                try {
                    SqlCommand cmd = new SqlCommand("DELETE FROM cms_DocumentLink WHERE DocumentSerial = @DocumentSerial", cn, transaction);
                    cmd.Parameters.Add("@DocumentSerial", SqlDbType.Int).Value = _DocumentSerial;
                    cmd.ExecuteNonQuery();
                    cmd.CommandText = "DELETE FROM cms_Document WHERE DocumentSerial = @DocumentSerial";
                    cmd.ExecuteNonQuery();
                    transaction.Commit();
                } catch (SqlException sqlError) {
                    transaction.Rollback();
                    Elmah.ErrorLog.GetDefault(HttpContext.Current).Log(new Elmah.Error(sqlError));
                }
                cn.Close();
            }

            // Remove from Lucene search index
            Indexer.LuceneIndexer li = new Indexer.LuceneIndexer();
            li.CreateIndexWriter();
            li.Delete(DocumentID.ToString());
            li.Close();
        }
Esempio n. 6
0
        public override bool Equals(object obj)
        {
            var other = obj as TaskListCellModel;

            if (other == null)
            {
                return(false);
            }

            return(DocumentID.Equals(other.DocumentID) && Name.Equals(other.Name) && IncompleteCount == other.IncompleteCount);
        }
Esempio n. 7
0
        public override bool Equals(object obj)
        {
            var other = obj as TaskCellModel;

            if (other == null)
            {
                return(false);
            }

            return(DocumentID.Equals(other.DocumentID) && Name.Equals(other.Name) && IsChecked == other.IsChecked &&
                   String.Equals(_imageDigest, other._imageDigest));
        }
    /// <summary>
    /// Returns parameters according to the upload mode.
    /// </summary>
    private string GetModeParameters()
    {
        string[] args;

        if (MediaLibraryID > 0)
        {
            // MediaLibrary mode
            args = new[]
            {
                "MediaLibraryID", MediaLibraryID.ToString(),
                "MediaFolderPath", MediaFolderPath,
                "MediaFileID", MediaFileID.ToString(),
                "IsMediaThumbnail", IsMediaThumbnail.ToString(),
                "MediaFileName", MediaFileName
            };
            return("MediaLibraryArgs=" + GetArgumentsString(args, UploaderHelper.MEDIA_LIBRARY_ARGS_HASHING_PURPOSE));
        }

        if (ObjectID > 0)
        {
            // MetaFile mode
            args = new[]
            {
                "MetaFileID", MetaFileID.ToString(),
                "ObjectID", ObjectID.ToString(),
                "SiteID", SiteID.ToString(),
                "ObjectType", ObjectType,
                "Category", Category
            };
            return("MetaFileArgs=" + GetArgumentsString(args, UploaderHelper.META_FILE_ARGS_HASHING_PURPOSE));
        }

        if ((DocumentID > 0) || (FormGUID != Guid.Empty))
        {
            // Attachment mode
            args = new[]
            {
                "DocumentID", DocumentID.ToString(),
                "DocumentParentNodeID", DocumentParentNodeID.ToString(),
                "NodeClassName", NodeClassName,
                "AttachmentGUIDColumnName", AttachmentGUIDColumnName,
                "AttachmentGUID", AttachmentGUID.ToString(),
                "AttachmentGroupGUID", AttachmentGroupGUID.ToString(),
                "FormGUID", FormGUID.ToString(),
                "IsFieldAttachment", mIsFiledAttachment.ToString(),
                "FullRefresh", FullRefresh.ToString()
            };
            return("AttachmentArgs=" + GetArgumentsString(args, UploaderHelper.ATTACHEMENT_ARGS_HASHING_PURPOSE));
        }
        return(String.Empty);
    }
        protected override IList <PurchaseRecord> CreateGafRecordsForDocument(DocumentID documentId)
        {
            var records = base.CreateGafRecordsForDocument(documentId);

            var recordsByTaxDocuments = CreateDataByTaxDocumentTrans(documentId.RefNbr, records.Count + 1);

            var taxTran = TaxTransByRefNbrAndTaxID[documentId.RefNbr].Values.First();

            ApplySign(recordsByTaxDocuments, taxTran.Module, documentId.DocType);

            records.AddRange(recordsByTaxDocuments);

            return(records);
        }
        protected override IList <TGAFRecord> CreateGafRecordsForDocument(DocumentID documentId)
        {
            var gafRecords = CreateGAFRecordsByDocumentLineTrans(documentId.RefNbr);

            var gafRecordsByDocAmt = CreateGAFRecordsByTaxTransCalcedOnDocumentAmt(documentId.RefNbr, gafRecords.Count + 1);

            gafRecords.AddRange(gafRecordsByDocAmt);

            var taxTran = GetFirstTaxTranOfDocument(documentId.RefNbr);

            ApplySign(gafRecords, taxTran.Module, documentId.DocType);

            return(gafRecords);
        }
Esempio n. 11
0
        protected override DocumentRecordsAggregate CreateRecordsByDocument(DocumentID documentId)
        {
            var resultRecords = new DocumentRecordsAggregate();

            var taxTranGroupsByLineRefNbr = TaxTransByRefNbr[documentId.RefNbr].OrderBy(taxTran => taxTran.RecordID)
                                            .GroupBy(taxTran => taxTran.LineRefNbr);

            foreach (var taxTranGroup in taxTranGroupsByLineRefNbr)
            {
                var lineNumber = 1;

                foreach (var taxTran in taxTranGroup)
                {
                    var glTranWithCuryInfo = GetGLTranWithCuryInfo(taxTran);

                    var glTran   = (GLTran)glTranWithCuryInfo;
                    var curyInfo = (CurrencyInfo)glTranWithCuryInfo;

                    if ((taxTran.TaxType == CSTaxType.Use && Taxes[taxTran.TaxID].ReverseTax != true) ||
                        (taxTran.TaxType == CSTaxType.Sales && Taxes[taxTran.TaxID].ReverseTax == true) ||
                        Taxes[taxTran.TaxID].TaxType == CSTaxType.Withholding)
                    {
                        var purchaseRecord = new PurchaseRecord();

                        _recordBuilderByGLTranAndTaxTran.Build(purchaseRecord, glTran, curyInfo.CuryID, taxTran,
                                                               lineNumber);

                        ApplySign(purchaseRecord, taxTran.Module, taxTran.TranType);

                        resultRecords.PurchaseRecords.Add(purchaseRecord);
                    }
                    else
                    {
                        var supplyRecord = new SupplyRecord();

                        _recordBuilderByGLTranAndTaxTran.Build(supplyRecord, glTran, curyInfo.CuryID, taxTran,
                                                               lineNumber);

                        ApplySign(supplyRecord, taxTran.Module, taxTran.TranType);

                        resultRecords.SupplyRecords.Add(supplyRecord);
                    }

                    lineNumber++;
                }
            }

            return(resultRecords);
        }
Esempio n. 12
0
 private void UpdateIndex()
 {
     // Update Lucene search index
     Indexer.LuceneIndexer li = new Indexer.LuceneIndexer();
     li.CreateIndexWriter();
     if (!string.IsNullOrEmpty(DocumentTitle))
     {
         li.UpdateWebPage(DocumentID.ToString(), URL, DocumentTitle, Description, "Document");
     }
     else
     {
         li.UpdateWebPage(DocumentID.ToString(), URL, LinkText, Description, "Document");
     }
     li.Close();
     li.IndexWords();
 }
    /// <summary>
    /// Builds breadcrumb URL.
    /// </summary>
    private string GenerateBreadCrumbUrl()
    {
        string returnUrl;

        if (QueryHelper.Contains("productid"))
        {
            returnUrl = ResolveUrl("~/CMSModules/Ecommerce/Pages/Tools/Products/Product_Edit_Options.aspx");
            returnUrl = URLHelper.AddParameterToUrl(returnUrl, "nodeid", NodeID.ToString());
            returnUrl = URLHelper.AddParameterToUrl(returnUrl, "documentid", DocumentID.ToString());
            returnUrl = URLHelper.AddParameterToUrl(returnUrl, "productid", HTMLHelper.HTMLEncode(QueryHelper.GetString("productid", string.Empty)));
            returnUrl = URLHelper.AddParameterToUrl(returnUrl, "dialog", QueryHelper.GetString("dialog", "0"));
        }
        else
        {
            returnUrl = "~/CMSModules/Ecommerce/Pages/Tools/ProductOptions/OptionCategory_List.aspx";
        }

        return(returnUrl);
    }
        protected override IList <PurchaseRecord> CreateGafRecordsForDocument(DocumentID documentId)
        {
            //we can not match old check to bill -- skip it.
            if (!_taxTransWithAdjdDocumentByRefNbrAndTaxID.ContainsKey(documentId.RefNbr))
            {
                return(new List <PurchaseRecord>());
            }

            var taxTransWithAdjdDocument = _taxTransWithAdjdDocumentByRefNbrAndTaxID[documentId.RefNbr].OrderBy(taxTranWithAdjdDocument => ((TaxTran)taxTranWithAdjdDocument).AdjdDocType)
                                           .ThenBy(taxTranWithAdjdDocument => ((TaxTran)taxTranWithAdjdDocument).AdjdRefNbr)
                                           .ThenBy(taxTranWithAdjdDocument => ((TaxTran)taxTranWithAdjdDocument).AdjNbr)
                                           .ThenBy(taxTranWithAdjdDocument => ((TaxTran)taxTranWithAdjdDocument).TaxID);

            var paymentRegister = DocumentsByRefNbr[documentId.RefNbr];

            var     lineNumberForGaf = 1;
            TaxTran prevTaxTran      = taxTransWithAdjdDocument.First();

            var purchaseRecords = new List <PurchaseRecord>();

            foreach (var taxTranWithAdjdDocument in taxTransWithAdjdDocument)
            {
                var taxTran = (TaxTran)taxTranWithAdjdDocument;
                var adjdDocumentRegister = (APRegister)taxTranWithAdjdDocument;

                if (taxTran.AdjdDocType != prevTaxTran.AdjdDocType ||
                    taxTran.AdjdRefNbr != prevTaxTran.AdjdRefNbr ||
                    taxTran.AdjNbr != prevTaxTran.AdjNbr)
                {
                    prevTaxTran = taxTran;
                    lineNumberForGaf++;
                }

                var gafRecord = _recordBuilderByTaxTranOfApPayment.Build(paymentRegister, taxTran,
                                                                         Contragents[paymentRegister.VendorID], lineNumberForGaf, adjdDocumentRegister.DocDesc);

                purchaseRecords.Add(gafRecord);
            }

            return(purchaseRecords);
        }
Esempio n. 15
0
        public DocumentRecordsAggregate CreateGAFRecordsForDocumentGroup(DocumentIDGroup documentIDGroup, int?branchID, string taxPeriodID)
        {
            LoadData(documentIDGroup, branchID, taxPeriodID);

            var resultRecordsAggregate = new DocumentRecordsAggregate();

            foreach (var refNbr in documentIDGroup.RefNbrs)
            {
                var documentId = new DocumentID()
                {
                    Module = documentIDGroup.Module,
                    RefNbr = refNbr
                };

                var documentRecordsAggregate = CreateRecordsByDocument(documentId);

                resultRecordsAggregate.PurchaseRecords.AddRange(documentRecordsAggregate.PurchaseRecords);
                resultRecordsAggregate.SupplyRecords.AddRange(documentRecordsAggregate.SupplyRecords);
            }

            return(resultRecordsAggregate);
        }
Esempio n. 16
0
        public virtual IList <TGAFRecord> CreateGAFRecordsForDocumentGroup(DocumentGroup <TDocument> documentGroup, int?taxAgencyID, string taxPeriodID)
        {
            DocumentsByRefNbr = documentGroup.DocumentsByRefNbr;

            LoadData(documentGroup, taxAgencyID, taxPeriodID);

            var gafRecords = new List <TGAFRecord>();

            foreach (var refNbr in documentGroup.DocumentsByRefNbr.Keys)
            {
                var documentId = new DocumentID()
                {
                    Module  = documentGroup.Module,
                    DocType = documentGroup.DocumentType,
                    RefNbr  = refNbr
                };

                var documentRecords = CreateGafRecordsForDocument(documentId);

                gafRecords.AddRange(documentRecords);
            }

            return(gafRecords);
        }
Esempio n. 17
0
    /// <summary>
    /// Returns parameters according to the upload mode.
    /// </summary>
    private string GetModeParameters()
    {
        string[] args = null;

        if (MediaLibraryID > 0)
        {
            // MediaLibrary mode
            args = new string[] {
                "MediaLibraryID", MediaLibraryID.ToString(),
                "MediaFolderPath", HttpUtility.UrlEncode(MediaFolderPath),
                "MediaFileID", MediaFileID.ToString(),
                "IsMediaThumbnail", IsMediaThumbnail.ToString(),
                "MediaFileName", HttpUtility.UrlEncode(MediaFileName)
            };

            return("MediaLibraryArgs=" + GetArgumentsString(args));
        }
        else
        {
            if ((NodeID > 0) && (SourceType == MediaSourceEnum.Content))
            {
                // CMS.File mode
                args = new string[] {
                    "NodeID", NodeID.ToString(),
                    "DocumentCulture", DocumentCulture,
                    "IncludeExtension", IncludeExtension.ToString(),
                    "NodeGroupID", NodeGroupID.ToString()
                };

                return("FileArgs=" + GetArgumentsString(args));
            }
            else
            {
                if (ObjectID > 0)
                {
                    // MetaFile mode
                    args = new string[] {
                        "MetaFileID", MetaFileID.ToString(),
                        "ObjectID", ObjectID.ToString(),
                        "SiteID", SiteID.ToString(),
                        "ObjectType", ObjectType,
                        "Category", Category
                    };

                    return("MetaFileArgs=" + GetArgumentsString(args));
                }
                else
                {
                    if (PostForumID > 0)
                    {
                        // Forum attachment
                        args = new string[] {
                            "PostForumID", PostForumID.ToString(),
                            "PostID", PostID.ToString()
                        };

                        return("ForumArgs=" + GetArgumentsString(args));
                    }
                    else
                    {
                        if ((DocumentID > 0) || (FormGUID != Guid.Empty))
                        {
                            // Attachment mode
                            args = new string[] {
                                "DocumentID", DocumentID.ToString(),
                                "DocumentParentNodeID", DocumentParentNodeID.ToString(),
                                "NodeClassName", NodeClassName,
                                "AttachmentGUIDColumnName", AttachmentGUIDColumnName,
                                "AttachmentGUID", AttachmentGUID.ToString(),
                                "AttachmentGroupGUID", AttachmentGroupGUID.ToString(),
                                "FormGUID", FormGUID.ToString(),
                                "IsFieldAttachment", mIsFiledAttachment.ToString()
                            };

                            return("AttachmentArgs=" + GetArgumentsString(args));
                        }
                    }
                }
            }
        }
        return(String.Empty);
    }
 protected abstract DocumentRecordsAggregate CreateRecordsByDocument(DocumentID documentID);
Esempio n. 19
0
 public override int GetHashCode()
 {
     return(DocumentID.GetHashCode() ^ (Name ?? "").GetHashCode() ^ IncompleteCount.GetHashCode());
 }
Esempio n. 20
0
 protected abstract IList <TGAFRecord> CreateGafRecordsForDocument(DocumentID documentId);