/// <summary>
        /// Save And Update Truck Document Details
        /// </summary>
        /// <param name="listTruckDetails"></param>
        public void SaveAndUpdateTruckDocumentDetails(IList<TruckDocDetailsDTO> listTruckDetail,
            IList<TruckDocumentsDTO> listTruckDocument)
        {
            using (TransactionScope transactionScope = new TransactionScope())
            {
                for (int i = 0; i < listTruckDetail.Count; i++)
                {
                    truckdocdetail truckDocDetailsEntity = new truckdocdetail();

                    TruckDocService truckDocuments = new TruckDocService();
                    TruckDocDetailsDTO truckDocDetail = truckDocuments.GetTruckDocDetailsByTruckIdAndDocId(
                        listTruckDetail[i].Truck_Doc_TruckId, listTruckDetail[i].Truck_Doc_DocId);

                    if (truckDocDetail.Truck_Doc_Id > 0)
                    {
                        AutoMapper.Mapper.Map(truckDocDetail, truckDocDetailsEntity);

                        truckDocDetailsEntity.Truck_Doc_DocNo = listTruckDetail[i].Truck_Doc_DocNo;
                        truckDocDetailsEntity.Truck_Doc_ExDate = listTruckDetail[i].Truck_Doc_ExDate;
                        truckDocDetailsEntity.Truck_Doc_FileName = listTruckDetail[i].Truck_Doc_FileName;
                        truckDocDetailsEntity.Truck_Doc_CreatedBy = listTruckDetail[i].Truck_Doc_CreatedBy;
                        truckDocDetailsEntity.Truck_Doc_CreatedDate = listTruckDetail[i].Truck_Doc_CreatedDate;
                        truckDocDetailsEntity.Truck_Doc_LastUpdatedDate = listTruckDetail[i].Truck_Doc_LastUpdatedDate;
                        ESalesUnityContainer.Container.Resolve<IGenericRepository<truckdocdetail>>().Update(truckDocDetailsEntity);
                    }
                    else
                    {
                        AutoMapper.Mapper.Map(listTruckDetail[i], truckDocDetailsEntity);
                        ESalesUnityContainer.Container.Resolve<IGenericRepository<truckdocdetail>>().Save(truckDocDetailsEntity);
                    }

                    TruckDocumentsDTO truckDocument = truckDocuments.GetTruckDocDetailsByTruckDocId(truckDocDetailsEntity.Truck_Doc_Id);
                    truckdocument truckDocumentEntity = new truckdocument();

                    if (truckDocument.TruckDoc_Id > 0)
                    {
                        AutoMapper.Mapper.Map(truckDocument, truckDocumentEntity);
                        if (listTruckDocument[i].TruckDoc_File == null)
                        {
                            truckDocumentEntity.TruckDoc_IsDeleted = true;
                        }
                        else
                        {
                            truckDocumentEntity.TruckDoc_File = listTruckDocument[i].TruckDoc_File;
                            truckDocumentEntity.TruckDoc_IsDeleted = false;
                        }
                        ESalesUnityContainer.Container.Resolve<IGenericRepository<truckdocument>>().Update(truckDocumentEntity);
                    }
                    else
                    {
                        AutoMapper.Mapper.Map(listTruckDocument[i], truckDocumentEntity);

                        truckDocumentEntity.TruckDoc_Doc_Id = truckDocDetailsEntity.Truck_Doc_Id;

                        ESalesUnityContainer.Container.Resolve<IGenericRepository<truckdocument>>().Save(truckDocumentEntity);
                    }
                }
                transactionScope.Complete();
            }
        }
        /// <summary>
        /// Delete Truck
        /// </summary>
        /// <param name="truckDetails"></param>
        public void DeleteTruck(TruckDetailsDTO truckDetails)
        {
            using (TransactionScope transactionScope = new TransactionScope())
            {
                TruckDocService truckDocuments = new TruckDocService();
                IList<TruckDocDetailsDTO> lstTruckDocDetails = truckDocuments.GetTruckDocDetailsByTruckId(truckDetails.Truck_Id);

                (from truckDocDetail in lstTruckDocDetails select truckDocDetail).Update(
                    truckDocDetail => truckDocDetail.Truck_Doc_IsDeleted = true);

                foreach (var truckDocs in lstTruckDocDetails)
                {
                    DeleteTruckDocDetails(truckDocs);
                }

                truckdetail truckEntity = new truckdetail();
                AutoMapper.Mapper.Map(truckDetails, truckEntity);

                ESalesUnityContainer.Container.Resolve<IGenericRepository<truckdetail>>().Update(truckEntity);

                transactionScope.Complete();
            }
        }