コード例 #1
0
 public JsonResult _SavePartyLicenceID(string scaleId, string licenseImageRefId)
 {
     try {
         bool result = false;
         if (!string.IsNullOrEmpty(licenseImageRefId))
         {
             ScaleAttachmentsLibrary scaleAttOps     = new ScaleAttachmentsLibrary(ConfigurationHelper.GetsmARTDBContextConnectionString());
             ScaleAttachments        scaleAttachment = scaleAttOps.GetScaleAttachmentByRefId(new Guid(licenseImageRefId));
             if (scaleAttachment != null)
             {
                 FilelHelper fileHelper = new FilelHelper();
                 string      imagePath  = fileHelper.GetFilePathByFileRefId(licenseImageRefId);
                 byte[]      imageBytes = fileHelper.GetBytesFromFile(imagePath);
                 SaveScaleIDCardAttachment(Convert.ToInt32(scaleId), imageBytes);
                 result = true;
             }
         }
         var data = new { Success = result };
         return(Json(data, JsonRequestBehavior.AllowGet));
     }
     catch (Exception ex) {
         string message = ex.Message;
         Common.MessageLogger.Instance.LogMessage(ex, ex.Message, Common.Priority.High, 0, System.Diagnostics.TraceEventType.Critical, "Scanner Error", "Scanner");
         throw ex;
     }
 }
コード例 #2
0
        public Guid SaveScaleIDCardAttachment(int Id, byte[] data)
        {
            Guid guid = SaveFile(data);

            ScaleAttachments attachments = new ScaleAttachments();

            attachments.Document_Name  = "LicenceID-Image.jpeg";
            attachments.Document_RefId = guid;
            attachments.Document_Size  = data.LongLength;
            attachments.Document_Title = "LicenceID-Image";
            attachments.Document_Type  = "jpeg";

            attachments.Updated_By        = User.Identity.Name;
            attachments.Created_By        = User.Identity.Name;
            attachments.Created_Date      = DateTime.Now;
            attachments.Last_Updated_Date = DateTime.Now;

            attachments.Parent = new Scale {
                ID = Id
            };

            string destinationPath;
            string sourcePath;

            FilelHelper fileHelper = new FilelHelper();

            destinationPath = fileHelper.GetSourceDirByFileRefId(attachments.Document_RefId.ToString());     // Path.Combine(Configuration.GetsmARTDocPath(), Scale.Document_RefId.ToString());
            sourcePath      = fileHelper.GetTempSourceDirByFileRefId(attachments.Document_RefId.ToString()); // Path.Combine(Configuration.GetsmARTTempDocPath(), Scale.Document_RefId.ToString());

            attachments.Document_Path = fileHelper.GetFilePath(sourcePath);

            if (Id > 0)
            {
                fileHelper.MoveFile(attachments.Document_Name, sourcePath, destinationPath);
                ScaleAttachmentsLibrary ScaleLibrary = new ScaleAttachmentsLibrary(ConfigurationHelper.GetsmARTDBContextConnectionString());
                ScaleLibrary.Add(attachments);
            }
            else
            {
                if (Session["ScaleAttachments"] == null)
                {
                    Session["ScaleAttachments"] = new List <ScaleAttachments>();
                }
                IList <ScaleAttachments> iList = (IList <ScaleAttachments>)Session["ScaleAttachments"];
                iList.Add(attachments);
            }
            return(guid);
        }
コード例 #3
0
        private void SaveAttachment(int Id, byte[] data, string fileName, EnumAttachmentRefType refType, FileFormat fileFormat)
        {
            Guid guid = SaveFile(data, fileName);

            ScaleAttachments attachments = new ScaleAttachments();

            attachments.Document_Name  = fileName;// "Thumb-Image.jpeg";
            attachments.Document_RefId = guid;
            attachments.Document_Size  = data.LongLength;
            attachments.Document_Title = fileName;
            attachments.Document_Type  = fileFormat.ToString();
            attachments.Ref_Type       = (int)refType;

            attachments.Updated_By        = User.Identity.Name;
            attachments.Created_By        = User.Identity.Name;
            attachments.Created_Date      = DateTime.Now;
            attachments.Last_Updated_Date = DateTime.Now;
            attachments.Parent            = new Scale {
                ID = Id
            };

            string destinationPath;
            string sourcePath;

            FilelHelper fileHelper = new FilelHelper();

            destinationPath = fileHelper.GetSourceDirByFileRefId(attachments.Document_RefId.ToString());     // Path.Combine(Configuration.GetsmARTDocPath(), Scale.Document_RefId.ToString());
            sourcePath      = fileHelper.GetTempSourceDirByFileRefId(attachments.Document_RefId.ToString()); // Path.Combine(Configuration.GetsmARTTempDocPath(), Scale.Document_RefId.ToString());

            attachments.Document_Path = fileHelper.GetFilePath(sourcePath);

            if (Id > 0)
            {
                fileHelper.MoveFile(attachments.Document_Name, sourcePath, destinationPath);
                ScaleAttachmentsLibrary ScaleLibrary = new ScaleAttachmentsLibrary(ConfigurationHelper.GetsmARTDBContextConnectionString());
                attachments.Document_Name = fileName;
                ScaleAttachments scaleAttachment = ScaleLibrary.Add(attachments);
            }
            else
            {
                if (Session["ScaleAttachments"] == null)
                {
                    Session["ScaleAttachments"] = new List <ScaleAttachments>();
                }
                IList <ScaleAttachments> iList = (IList <ScaleAttachments>)Session["ScaleAttachments"];
                iList.Add(attachments);
            }
        }
コード例 #4
0
        //private void AddNewMakeAndModel(Scale entity)
        //{
        //    LOVLibrary lib = new LOVLibrary(ConfigurationHelper.GetsmARTDBContextConnectionString());
        //    if (!string.IsNullOrEmpty(entity.Make))
        //    {
        //        // Make does not exists in database.
        //        LOV makeLOV = lib.GetByValue(entity.Make);
        //        if (makeLOV == null)
        //        {
        //            LOVTypeLibrary libType = new LOVTypeLibrary(ConfigurationHelper.GetsmARTDBContextConnectionString());
        //            LOVType modelLOVType = libType.GetByLOVType("Make");
        //            makeLOV = new LOV()
        //            {
        //                Active_Ind = true,
        //                LOV_Active = true,
        //                Parent_Type_ID = modelLOVType.ID,
        //                LOV_Value = entity.Make,
        //                LOV_Display_Value = entity.Make,
        //                LOVType = modelLOVType,
        //                Parent = new LOV()
        //            };
        //            lib.Add(makeLOV);
        //        }
        //    }

        //    if (!string.IsNullOrEmpty(entity.Model) && !string.IsNullOrEmpty(entity.Make))
        //    {
        //        // Model does not exists in database.
        //        LOV modelLOV = lib.GetByValueAndParent(entity.Model, entity.Make);
        //        if (modelLOV == null)
        //        {
        //            LOVTypeLibrary libType = new LOVTypeLibrary(ConfigurationHelper.GetsmARTDBContextConnectionString());
        //            LOVType modelLOVType = libType.GetByLOVType("Model");
        //            LOV parentModelLOV = lib.GetByValue(entity.Make);
        //            modelLOV = new LOV()
        //            {
        //                Active_Ind = true,
        //                LOV_Active = true,
        //                Parent_Type_ID = modelLOVType.ID,
        //                LOV_Value = entity.Model,
        //                LOV_Display_Value = entity.Model,
        //                LOVType = modelLOVType,
        //                Parent = parentModelLOV
        //            };
        //            lib.Add(modelLOV);
        //        }
        //    }
        //}

        public bool GetCustomerImageRefIds(int scaleId, out string thumbImage1, out string thumbImage2, out string photo, out string signatureImage, out string licenseImage, out string vehicleImageRefId, out string cashCardImageRefId)
        {
            thumbImage1 = thumbImage2 = photo = signatureImage = licenseImage = vehicleImageRefId = cashCardImageRefId = string.Empty;
            ScaleAttachments thumb1Attach        = null;
            ScaleAttachments thumb2Attach        = null;
            ScaleAttachments photoAttach         = null;
            ScaleAttachments signatureAttach     = null;
            ScaleAttachments dlLicenseAttach     = null;
            ScaleAttachments vehicleImageAttach  = null;
            ScaleAttachments cashCardImageAttach = null;

            if (scaleId > 0)
            {
                ScaleAttachmentsLibrary lib = new ScaleAttachmentsLibrary(ConfigurationHelper.GetsmARTDBContextConnectionString());
                thumb1Attach        = lib.GetAttachmentsByRefTypeAndParentId(EnumAttachmentRefType.Thumbprint1, scaleId).FirstOrDefault();
                thumb2Attach        = lib.GetAttachmentsByRefTypeAndParentId(EnumAttachmentRefType.Thumbprint2, scaleId).FirstOrDefault();
                photoAttach         = lib.GetAttachmentsByRefTypeAndParentId(EnumAttachmentRefType.Customer, scaleId).FirstOrDefault();
                signatureAttach     = lib.GetAttachmentsByRefTypeAndParentId(EnumAttachmentRefType.Signature, scaleId).FirstOrDefault();
                dlLicenseAttach     = lib.GetAttachmentsByRefTypeAndParentId(EnumAttachmentRefType.DriverLicense, scaleId).FirstOrDefault();
                vehicleImageAttach  = lib.GetAttachmentsByRefTypeAndParentId(EnumAttachmentRefType.Vehicle, scaleId).FirstOrDefault();
                cashCardImageAttach = lib.GetAttachmentsByRefTypeAndParentId(EnumAttachmentRefType.CashCard, scaleId).FirstOrDefault();
            }
            else
            {
                if (Session["ScaleAttachments"] != null)
                {
                    IEnumerable <ScaleAttachments> resultList = (IList <ScaleAttachments>)Session["ScaleAttachments"];
                    thumb1Attach        = resultList.FirstOrDefault(a => a.Ref_Type == (int)EnumAttachmentRefType.Thumbprint1);
                    thumb2Attach        = resultList.FirstOrDefault(a => a.Ref_Type == (int)EnumAttachmentRefType.Thumbprint2);
                    photoAttach         = resultList.FirstOrDefault(a => a.Ref_Type == (int)EnumAttachmentRefType.Customer);
                    signatureAttach     = resultList.FirstOrDefault(a => a.Ref_Type == (int)EnumAttachmentRefType.Signature);
                    dlLicenseAttach     = resultList.FirstOrDefault(a => a.Ref_Type == (int)EnumAttachmentRefType.DriverLicense);
                    vehicleImageAttach  = resultList.FirstOrDefault(a => a.Ref_Type == (int)EnumAttachmentRefType.Vehicle);
                    cashCardImageAttach = resultList.FirstOrDefault(a => a.Ref_Type == (int)EnumAttachmentRefType.CashCard);
                }
            }

            if (thumb1Attach != null)
            {
                thumbImage1 = thumb1Attach.Document_RefId.ToString();
            }

            if (thumb2Attach != null)
            {
                thumbImage2 = thumb2Attach.Document_RefId.ToString();
            }

            if (photoAttach != null)
            {
                photo = photoAttach.Document_RefId.ToString();
            }

            if (signatureAttach != null)
            {
                signatureImage = signatureAttach.Document_RefId.ToString();
            }

            if (dlLicenseAttach != null)
            {
                licenseImage = dlLicenseAttach.Document_RefId.ToString();
            }

            if (vehicleImageAttach != null)
            {
                vehicleImageRefId = vehicleImageAttach.Document_RefId.ToString();
            }

            if (cashCardImageAttach != null)
            {
                cashCardImageRefId = cashCardImageAttach.Document_RefId.ToString();
            }

            return(true);
        }
コード例 #5
0
        private void SaveThumbScannerAttachment(int Id, byte[] data, string fileName, EnumAttachmentRefType refType, FileFormat fileFormat, bool updateParty = true)
        {
            Guid guid = SaveFile(data, string.Format("{0}.{1}", fileName, fileFormat.ToString()));

            ScaleAttachments attachments = new ScaleAttachments();

            attachments.Document_Name  = string.Format("{0}.{1}", fileName, fileFormat.ToString());// "Thumb-Image.jpeg";
            attachments.Document_RefId = guid;
            attachments.Document_Size  = data.LongLength;
            attachments.Document_Title = "Thumb-Image";
            attachments.Document_Type  = "jpeg";
            attachments.Ref_Type       = (int)refType;

            attachments.Updated_By        = User.Identity.Name;
            attachments.Created_By        = User.Identity.Name;
            attachments.Created_Date      = DateTime.Now;
            attachments.Last_Updated_Date = DateTime.Now;
            attachments.Parent            = new Scale {
                ID = Id
            };

            string destinationPath;
            string sourcePath;

            FilelHelper fileHelper = new FilelHelper();

            destinationPath = fileHelper.GetSourceDirByFileRefId(attachments.Document_RefId.ToString());     // Path.Combine(Configuration.GetsmARTDocPath(), Scale.Document_RefId.ToString());
            sourcePath      = fileHelper.GetTempSourceDirByFileRefId(attachments.Document_RefId.ToString()); // Path.Combine(Configuration.GetsmARTTempDocPath(), Scale.Document_RefId.ToString());

            attachments.Document_Path = fileHelper.GetFilePath(sourcePath);

            if (Id > 0)
            {
                fileHelper.MoveFile(attachments.Document_Name, sourcePath, destinationPath);
                ScaleAttachmentsLibrary ScaleLibrary = new ScaleAttachmentsLibrary(ConfigurationHelper.GetsmARTDBContextConnectionString());
                attachments.Document_Name = string.Format("{0}.{1}", fileName, "jpg");
                ScaleAttachments scaleAttachment = ScaleLibrary.Add(attachments);

                if (updateParty)
                {
                    Scale        scale    = new ScaleLibrary(ConfigurationHelper.GetsmARTDBContextConnectionString()).GetByID(Id.ToString(), new string[] { "Party_ID" });
                    PartyLibrary partyLib = new PartyLibrary(ConfigurationHelper.GetsmARTDBContextConnectionString());
                    Party        party    = partyLib.GetByID(scale.Party_ID.ID.ToString());
                    if (party != null)
                    {
                        party.PhotoRefId = scaleAttachment.Document_RefId.ToString();
                        partyLib.Modify(party);
                    }
                }
            }
            else
            {
                if (Session["ScaleAttachments"] == null)
                {
                    Session["ScaleAttachments"] = new List <ScaleAttachments>();
                }

                IList <ScaleAttachments> iList = (IList <ScaleAttachments>)Session["ScaleAttachments"];
                iList.Add(attachments);
            }
        }
コード例 #6
0
        public Ticket MapTicketFromRsmartTicket(Scale rsmartScale, IEnumerable <ScaleDetails> rsmartScaleDetails, IEnumerable <ScaleAttachments> rsmartScaleAttachments, AddressBook rsmartAddress, Ticket t)
        {
            FilelHelper fileHelper = new FilelHelper();

            // Ticket Details
            t.key = new TicketKey();
            t.key.ticketnumber   = rsmartScale.Scale_Ticket_No;
            t.key.ticketDateTime = rsmartScale.Created_Date.ToString();

            if (rsmartScale.Party_ID != null)
            {
                // Customer Details
                t.customer          = new Customer();
                t.customer.name     = rsmartScale.Party_ID.Party_Name;
                t.customer.idNumber = rsmartScale.Party_ID.License_No;
                string dobString = rsmartScale.Party_ID.Party_DOB;
                t.customer.phone = rsmartScale.Party_ID.Party_Phone1;


                DateTime dobDt;
                if (!string.IsNullOrEmpty(dobString) && smART.Common.DateTimeHelper.IsValidDate(dobString, out dobDt))
                {
                    t.customer.dob = dobDt.ToString();
                }
                //t.customer.dob = Convert .ToString(rsmartScale.Party_ID.Party_DOB);

                // Address details
                if (rsmartAddress != null)
                {
                    t.customer.address1   = rsmartAddress.Address1;
                    t.customer.city       = rsmartAddress.City;
                    t.customer.state      = rsmartAddress.State;
                    t.customer.postalCode = rsmartAddress.Zip_Code;
                }

                // Vehicle details
                t.customer.vehicle         = new Vehicle();
                t.customer.vehicle.color   = rsmartScale.Color;
                t.customer.vehicle.make    = rsmartScale.Make;
                t.customer.vehicle.model   = rsmartScale.Model;
                t.customer.vehicle.state   = rsmartScale.Plate_State;
                t.customer.vehicle.license = rsmartScale.Vehicle_Plate_No;
                t.customer.vehicle.year    = rsmartScale.Vehicle_Year;


                if (rsmartScaleAttachments != null && rsmartScaleAttachments.Count() > 0)
                {
                    List <Image> customerImageList = new List <Image>();

                    // Signature
                    ScaleAttachments signatureAttachment = rsmartScaleAttachments.FirstOrDefault(a => a.Ref_Type == (int)EnumAttachmentRefType.Signature);
                    if (signatureAttachment != null)
                    {
                        Image img = new Image();
                        img.imageData     = fileHelper.GetBytesFromFile(fileHelper.GetFilePathByFileRefId(signatureAttachment.Document_RefId.ToString()));
                        img.imageType     = ImageType.Jpeg;
                        img.imageCategory = ImageCategory.Signature;
                        customerImageList.Add(img);
                    }

                    // Thumb Print
                    ScaleAttachments thumbAttachment = rsmartScaleAttachments.FirstOrDefault(a => a.Ref_Type == (int)EnumAttachmentRefType.Thumbprint1);
                    if (thumbAttachment != null)
                    {
                        Image img = new Image();
                        img.imageData     = fileHelper.GetBytesFromFile(fileHelper.GetFilePathByFileRefId(thumbAttachment.Document_RefId.ToString()));
                        img.imageType     = ImageType.Jpeg;
                        img.imageCategory = ImageCategory.Thumbprint;
                        customerImageList.Add(img);
                    }

                    // Customer
                    ScaleAttachments customerAttachment = rsmartScaleAttachments.FirstOrDefault(a => a.Ref_Type == (int)EnumAttachmentRefType.Customer);
                    if (customerAttachment != null)
                    {
                        Image img = new Image();
                        img.imageData     = fileHelper.GetBytesFromFile(fileHelper.GetFilePathByFileRefId(customerAttachment.Document_RefId.ToString()));
                        img.imageType     = ImageType.Jpeg;
                        img.imageCategory = ImageCategory.Customer;
                        customerImageList.Add(img);
                    }

                    // Customer License Id
                    ScaleAttachments licenseAttachment = rsmartScaleAttachments.FirstOrDefault(a => a.Ref_Type == (int)EnumAttachmentRefType.DriverLicense);
                    if (licenseAttachment != null)
                    {
                        Image img = new Image();
                        img.imageData     = fileHelper.GetBytesFromFile(fileHelper.GetFilePathByFileRefId(licenseAttachment.Document_RefId.ToString()));
                        img.imageType     = ImageType.Jpeg;
                        img.imageCategory = ImageCategory.CustomerID;
                        customerImageList.Add(img);
                    }

                    // Vehicle
                    ScaleAttachments vehicleLicenseAttachment = rsmartScaleAttachments.FirstOrDefault(a => a.Ref_Type == (int)EnumAttachmentRefType.Vehicle);
                    if (vehicleLicenseAttachment != null)
                    {
                        Image img = new Image();
                        img.imageData     = fileHelper.GetBytesFromFile(fileHelper.GetFilePathByFileRefId(vehicleLicenseAttachment.Document_RefId.ToString()));
                        img.imageType     = ImageType.Jpeg;
                        img.imageCategory = ImageCategory.Vehicle;
                        customerImageList.Add(img);
                    }

                    // Cash Card
                    ScaleAttachments cashCardAttachment = rsmartScaleAttachments.FirstOrDefault(a => a.Ref_Type == (int)EnumAttachmentRefType.CashCard);
                    if (cashCardAttachment != null)
                    {
                        Image img = new Image();
                        img.imageData     = fileHelper.GetBytesFromFile(fileHelper.GetFilePathByFileRefId(cashCardAttachment.Document_RefId.ToString()));
                        img.imageType     = ImageType.Jpeg;
                        img.imageCategory = ImageCategory.Customer;
                        customerImageList.Add(img);
                    }
                    t.customer.images = new Image[] { };
                    t.customer.images = customerImageList.ToArray <Image>();
                }
            }

            if (rsmartScaleDetails != null && rsmartScaleDetails.Count() > 0)
            {
                // Item Details
                List <smART.Integration.LeadsOnline.LeadsOnlineWCF.Item> itemList = new List <smART.Integration.LeadsOnline.LeadsOnlineWCF.Item>();
                string clerk = ConfigurationHelper.GetClerk();
                foreach (var item in rsmartScaleDetails)
                {
                    smART.Integration.LeadsOnline.LeadsOnlineWCF.Item item1 = new smART.Integration.LeadsOnline.LeadsOnlineWCF.Item();
                    item1.description = item.Apply_To_Item.Long_Name;
                    item1.amount      = Convert.ToDouble(item.Amount);
                    item1.weight      = Convert.ToDouble(item.NetWeight);
                    item1.employee    = clerk;

                    // Item image
                    List <ScaleAttachments> itemAttachments = rsmartScaleAttachments.Where <ScaleAttachments>(s => s.Ref_ID == item.ID && s.Ref_Type == (int)EnumAttachmentRefType.Item).ToList(); //|| s.Document_Title == item.Apply_To_Item.Short_Name
                    if (itemAttachments != null && itemAttachments.Count() > 0)
                    {
                        List <Image> imageList = new List <Image>();
                        foreach (var itemAttach in itemAttachments)
                        {
                            Image itemImage = new Image();
                            itemImage.imageData     = fileHelper.GetBytesFromFile(fileHelper.GetFilePathByFileRefId(itemAttach.Document_RefId.ToString()));
                            itemImage.imageType     = ImageType.Jpeg;
                            itemImage.imageCategory = ImageCategory.Item;
                            imageList.Add(itemImage);
                        }
                        item1.images = new Image[] { };
                        item1.images = imageList.ToArray <Image>();
                    }
                    itemList.Add(item1);
                }

                t.items = new smART.Integration.LeadsOnline.LeadsOnlineWCF.Item[] { };
                t.items = itemList.ToArray <smART.Integration.LeadsOnline.LeadsOnlineWCF.Item>();
            }
            return(t);
        }
コード例 #7
0
        public string SaveTicketImage(String scaleId, string documentType)
        {
            var docfiles = new List <string>();

            try {
                int intScaleId = Convert.ToInt32(scaleId);
                if (intScaleId <= 0)
                {
                    throw new Exception("Invalid ticket id.");
                }

                int    intDocType = Convert.ToInt32(documentType);
                string fileName   = CommonHelper.GetFileNameByDocType(intDocType);
                if (string.IsNullOrEmpty(fileName))
                {
                    throw new Exception("Invalid document type.");
                }


                var httpRequest = HttpContext.Current.Request;
                if (httpRequest.Files.Count > 0)
                {
                    // Get scale
                    Scale scale = new ScaleLibrary(ConfigurationHelper.GetsmARTDBContextConnectionString()).GetByID(scaleId, new string[] { "Party_ID" });
                    if (scale == null)
                    {
                        throw new Exception("Given scale id not found in database.");
                    }

                    FilelHelper fileHelper = new FilelHelper();
                    foreach (string file in httpRequest.Files)
                    {
                        // Save file
                        string docRefID        = Guid.NewGuid().ToString();
                        var    destinationPath = fileHelper.GetSourceDirByFileRefId(docRefID); // Path.Combine(Configuration.GetsmARTTempDocPath(), docRefID);
                        fileHelper.CreateDirectory(destinationPath);
                        var postedFile = httpRequest.Files[file];
                        postedFile.SaveAs(Path.Combine(destinationPath, fileName));
                        docfiles.Add(docRefID);

                        // Add attachment
                        ScaleAttachments attachments = new ScaleAttachments();
                        attachments.Document_Name  = fileName;
                        attachments.Document_RefId = new Guid(docRefID);
                        attachments.Document_Size  = 0;
                        attachments.Document_Title = fileName;
                        attachments.Document_Type  = "jpeg";
                        attachments.Ref_Type       = intDocType;

                        attachments.Updated_By        = User.Identity.Name;
                        attachments.Created_By        = User.Identity.Name;
                        attachments.Created_Date      = DateTime.Now;
                        attachments.Last_Updated_Date = DateTime.Now;
                        attachments.Parent            = new Scale {
                            ID = intScaleId
                        };
                        attachments.Document_Path = destinationPath;

                        ScaleAttachmentsLibrary ScaleLibrary = new ScaleAttachmentsLibrary(ConfigurationHelper.GetsmARTDBContextConnectionString());
                        attachments.Document_Name = fileName;
                        ScaleAttachments scaleAttachment = ScaleLibrary.Add(attachments);

                        // Update file ref in party master
                        if (scale.Party_ID != null && scale.Party_ID.ID > 0)
                        {
                            PartyLibrary partyLib = new PartyLibrary(ConfigurationHelper.GetsmARTDBContextConnectionString());
                            Party        party    = partyLib.GetByID(scale.Party_ID.ID.ToString());
                            if (party != null)
                            {
                                SetPartyImageRefByDocType(intDocType, scaleAttachment.Document_RefId.ToString(), party);
                                partyLib.Modify(party);
                            }
                        }
                    }
                }
            }
            catch (Exception ex) {
                //string details = string.Format("Method: {1} {0} Message: {2} {0} Stack Trace: {3}", System.Environment.NewLine, "SaveTicketImage", ex.Message, ex.StackTrace.ToString());
                ExceptionHandler.HandleException(ex, "An error occured in SaveTicketImage utils.");
                //smART.Common.MessageLogger.Instance.LogMessage(ex, details, Common.Priority.High, 0, System.Diagnostics.TraceEventType.Error, "Service Error", "Service");
            }
            return(docfiles.FirstOrDefault());
        }