private long insertPalletPhotoDocument(Overtech.DataModels.Warehouse.GatheringPalletPhoto palletPhoto, IDAL dal)
        {
            try
            {
                var documentOp       = new DocumentOperations(dal, _resolver);
                var tmpOrganizastion = palletPhoto.Organization;
                var tmpEvent         = palletPhoto.Event;
                var documentTypeId   = documentOp.ReadDocumentTypeByName("Gathering Pallet Photo").DocumentTypeId;
                var tmpFilename      = "palletPhoto_" + palletPhoto.GatheringPalletPhotoId.ToString() + "_" + DateTime.Now.ToShortDateString();
                var tmpExtension     = "png";
                var tmpPhoto         = System.Text.Encoding.ASCII.GetBytes(palletPhoto.PhotoContent);

                var tmpDocumentId = documentOp.CreateDocument(tmpOrganizastion, tmpEvent, null, null, documentTypeId, tmpFilename, tmpExtension, tmpPhoto);
                return(tmpDocumentId);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 2
0
        public long insertZetImageDocument(Overtech.DataModels.Reconciliation.ZetImage zetImage)
        {
            using (IDAL dal = this.DAL)
            {
                dal.BeginTransaction();
                try
                {
                    var documentOp       = new DocumentOperations(dal, _resolver);
                    var tmpOrganizastion = zetImage.Organization;
                    var tmpEvent         = zetImage.Event;
                    var documentTypeId   = 18;
                    var tmpFilename      = "";
                    if (zetImage.CashRegister != 0 && zetImage.CashRegister != null)
                    {
                        tmpFilename = "zetImage_" + zetImage.CashRegister.ToString() + "_" + DateTime.Now.ToShortDateString();
                    }
                    else
                    {
                        tmpFilename = "zetImage_undefinedCR" + "_" + DateTime.Now.ToShortDateString();
                    }
                    var tmpExtension = "png";
                    var tmpPhoto     = System.Text.Encoding.ASCII.GetBytes(zetImage.Photo);

                    var tmpDocumentId = documentOp.CreateDocument(tmpOrganizastion, tmpEvent, null, null, documentTypeId, tmpFilename, tmpExtension, tmpPhoto);

                    dal.CommitTransaction();

                    return(tmpDocumentId);
                }
                catch
                {
                    dal.RollbackTransaction();
                    throw;
                }
            }
        }