public void InsertTransaction(B2BSERAWebService.Model.uploadRequest uploadRequest)
        {
            try
            {
                Transaction transaction = new Transaction();
                transaction.TicketNo  = uploadRequest.TicketNo;
                transaction.ClientTag = uploadRequest.ClientTag;
                EntityHelper.SetAuditForInsert(transaction, "SERA");
                repository.Add(transaction);

                for (int i = 0; i < uploadRequest.transactionData.Count(); i++)
                {
                    TransactionData transactionData = new TransactionData();
                    transactionData.Transaction     = transaction;
                    transactionData.TransGUID       = uploadRequest.transactionData[i].TransGUID;
                    transactionData.DocumentNumber  = uploadRequest.transactionData[i].DocumentNumber;
                    transactionData.FileType        = uploadRequest.transactionData[i].FileType;
                    transactionData.IPAddress       = uploadRequest.transactionData[i].IPAddress;
                    transactionData.DestinationUser = uploadRequest.transactionData[i].DestinationUser;
                    transactionData.Key1            = uploadRequest.transactionData[i].Key1;
                    transactionData.Key2            = uploadRequest.transactionData[i].Key2;
                    transactionData.Key3            = uploadRequest.transactionData[i].Key3;
                    transactionData.DataLength      = uploadRequest.transactionData[i].DataLength;
                    transactionData.RowStatus       = string.IsNullOrEmpty(uploadRequest.transactionData[i].RowStatus) ? "Inprogress" : uploadRequest.transactionData[i].RowStatus;
                    EntityHelper.SetAuditForInsert(transactionData, "SERA");
                    repository.Add(transactionData);

                    for (int j = 0; j < uploadRequest.transactionData[i].DataLength; j++)
                    {
                        TransactionDataDetail transactionDataDetail = new TransactionDataDetail();
                        transactionDataDetail.TransactionData = transactionData;
                        //TODO 10-09-2013: { Data = HS|ponumber||||||||}
                        transactionDataDetail.Data = "{ Data = " + uploadRequest.transactionData[i].Data[j] + "}"; //uploadRequest.transactionData[i].Data[j];
                        repository.Add(transactionDataDetail);
                    }
                }
                repository.UnitOfWork.SaveChanges();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public bool ValidateFileTypeIPAdressDetinationUser(B2BSERAWebService.Model.uploadRequest uploadRequest)
        {
            bool flag = false;

            try
            {
                for (int i = 0; i < uploadRequest.transactionData.Count(); i++)
                {
                    B2BAISERAEntities db = new B2BAISERAEntities();

                    var fileType = (from o in db.DocumentFileTypes
                                    where o.FileTypeName == uploadRequest.transactionData[i].FileType
                                    select o.FileTypeName).FirstOrDefault();

                    var ipAddress = (from o in db.DocumentIPAddresses
                                     where o.IPAddress == uploadRequest.transactionData[i].IPAddress
                                     select o.IPAddress).FirstOrDefault();

                    var destinationUser = (from o in db.Users
                                           where o.UserName == uploadRequest.transactionData[i].DestinationUser
                                           select o.UserName).FirstOrDefault();

                    if (string.IsNullOrEmpty(fileType) || string.IsNullOrEmpty(ipAddress) || string.IsNullOrEmpty(destinationUser))
                    {
                        flag = false;
                        break;
                    }
                    else
                    {
                        flag = true;
                    }
                }
                return(flag);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }