public string SendEvent(tk_EventCustomers msg)
        {
            try
            {
                var category  = repoEventCategory.GetNonAsync(o => o.Itbid == msg.TicketCategory);
                var eventName = repoEvent.GetNonAsync(o => o.Itbid == msg.EventId);
                if (category != null && eventName != null)
                {
                    string message = SmartObject.PopulateUserBody(3);
                    message = message.Replace("{{EventName}}", eventName.EventTitle)
                              .Replace("{{user}}", msg.Fullname)
                              .Replace("{{TKReference}}", msg.ReferenceNo == "" ? "" : msg.ReferenceNo)
                              .Replace("{{ReferenceNo}}", msg.PayStackReferenceNo == "" ? "" : msg.PayStackReferenceNo)
                              .Replace("{{EventDate}}", eventName.StartDate == null?"Unavailable": oGenericViewModel.FormatDate(eventName.StartDate))
                              .Replace("{{EventCategory}}", category.CategoryName)
                              .Replace("{{EventVenue}}", eventName.EventLocation)
                              .Replace("{{EventTime}}", eventName.EventTime)
                              .Replace("{{ContactFullname}}", msg.Fullname == "" ? "" : msg.Fullname)
                              .Replace("{{ContactEmail}}", msg.Email == "" ? "" : msg.Email)
                              .Replace("{{ContactPhoneNo}}", msg.PhoneNo == "" ? "" : msg.PhoneNo)
                              .Replace("{{Units}}", msg.NoOfPersons.ToString())
                              .Replace("{{Amount}}", msg.TotalAmount == null ? "No Fee" : FormattedAmount((decimal)msg.TotalAmount));

                    return(message);
                }



                return(null);
            }
            catch (Exception)
            {
                return(null);
            }
        }
        public ReturnValues SaveFathersTicketDetails(TicketRequestModel ctReqest, string Reference)
        {
            var returnValues = new ReturnValues();
            var counter      = repotk_BatchCounter.GetAllNonAsync().FirstOrDefault();

            try
            {
                int id        = Convert.ToInt32(ctReqest.TicketCategory);
                var eventCust = new tk_EventCustomers();
                eventCust.DateCreated = DateTime.Now;
                eventCust.Email       = ctReqest.email;
                eventCust.EventId     = ctReqest.TicketType;
                //eventCust.NoOfPersons = ctReqest.NoOfPersons;
                eventCust.PhoneNo        = ctReqest.phoneNo;
                eventCust.ReferenceNo    = Reference;
                eventCust.TicketCategory = Convert.ToInt32(ctReqest.TicketCategory);
                eventCust.NoOfPersons    = Convert.ToInt32(ctReqest.TicketCategory) == 9 ? 5 : 2;
                eventCust.Status         = "PENDING";
                eventCust.IsEmailSent    = "N";
                eventCust.Retry          = 0;
                eventCust.Fullname       = ctReqest.Fullname;
                eventCust.UnitPrice      = repoEventCategory.GetNonAsync(o => o.Itbid == id).Amount;
                eventCust.TotalAmount    = eventCust.UnitPrice;

                repoEventCustomer.Add(eventCust);
                var retV1 = unitOfWork.CommitNonAsync(1) > 0 ? true : false;
                if (retV1)
                {
                    //Update batch Counter
                    counter.BatchNo = counter.BatchNo + 1;
                    repotk_BatchCounter.Update(counter);
                    var ret = unitOfWork.CommitNonAsync(1) > 0 ? true : false;

                    returnValues.nErrorCode = 0;
                    returnValues.sErrorText = "Success";
                    return(returnValues);
                }
                else
                {
                    returnValues.nErrorCode = -1;
                    returnValues.sErrorText = "FailedInsert";
                }
                return(returnValues);
            }
            catch (Exception ex)
            {
            }
            return(returnValues);
        }
        public tk_EventCustomers SaveFreeTicketDetails(TicketRequestModel ctReqest, string Reference)
        {
            var returnValues = new tk_EventCustomers();
            var counter      = repotk_BatchCounter.GetAllNonAsync().FirstOrDefault();

            try
            {
                var eventCust = new tk_EventCustomers();
                eventCust.DateCreated = DateTime.UtcNow;
                eventCust.Email       = ctReqest.email;
                eventCust.EventId     = ctReqest.TicketType;
                eventCust.NoOfPersons = ctReqest.NoOfPersons;
                eventCust.PhoneNo     = ctReqest.phoneNo;
                eventCust.ReferenceNo = Reference;
                eventCust.Status      = "SUCCESSFULL";
                eventCust.IsEmailSent = "N";
                eventCust.Retry       = 0;
                eventCust.Fullname    = ctReqest.Fullname;

                repoEventCustomer.Add(eventCust);
                var retV1 = unitOfWork.CommitNonAsync(1) > 0 ? true : false;
                if (retV1)
                {
                    //Update batch Counter
                    counter.BatchNo = counter.BatchNo + 1;
                    repotk_BatchCounter.Update(counter);
                    var ret = unitOfWork.CommitNonAsync(1) > 0 ? true : false;

                    returnValues.Itbid  = eventCust.Itbid;
                    returnValues.Status = eventCust.Status;
                }
                else
                {
                    returnValues.Itbid = 0;
                }
                return(returnValues);
            }
            catch (Exception ex)
            {
            }
            return(returnValues);
        }