public static CampaignLogXML CampaignLogXMLToDomain(CampaignLogXMLDTO CampaignLogXMLDTO)
 {
     if (CampaignLogXMLDTO == null) return null;
      Mapper.CreateMap<CampaignLogXMLDTO, CampaignLogXML>();
      CampaignLogXML CampaignLogXML = Mapper.Map<CampaignLogXML>(CampaignLogXMLDTO);
      return CampaignLogXML;
 }
        /////// <summary>
        /////// Create xml packet to send Alerts message to recpective people.
        /////// </summary>
        /////// <param name="message"></param>
        /////// <param name="alertType"></param>
        /////// <param name="_oClsClients"></param>
        ////private void SendAlertMsg(string message, string alertType, Client _oClsClients)
        ////{
        ////    try
        ////    {
        ////        sErrlocation = "Creating XmlPackets for sending Alerts -Line 560";
        ////        string messageSource = queuesettingsXML.DocumentElement["messagesource"].InnerText;
        ////        string alertMsgPacket = "<?xml version=" + "\"1.0\"?>" +
        ////                      "<packet>" +
        ////                              "<messagesource>" + messageSource + "</messagesource>" +
        ////                              "<campaignId>" + _oClsClients.campaignId + "</campaignId>" +
        ////                              "<clientId>" + _oClsClients.clientId + "</clientId>" +
        ////                              "<campaignname>" + alertType + "</campaignname>" +
        ////                              "<senddate>" + System.DateTime.Now.ToString("d/MMM/yyyy") + "</senddate>" +
        ////                              "<messagetype>ALERT</messagetype>" +
        ////                              "<messagecount>1</messagecount>" +
        ////                              "<sender>" + queuesettingsXML.DocumentElement["sender"].InnerText + "</sender>" +
        ////                              "<requiredcredits>1</requiredcredits>" +
        ////                              "<numbers>" +
        ////                                  "<number>" + _oClsClients.RegisteredPhone + "</number>" +
        ////                                  "<message>" + message + "</message>" +
        ////                              "</numbers>" +
        ////                      "</packet>";
        ////        // Load this packet into xml
        ////        XmlDocument alertPacket = new XmlDocument();
        ////        alertPacket.LoadXml(alertMsgPacket);
        ////        DateTime DateAndTime = System.DateTime.Now;
        ////        sErrlocation = "Saving XmlPackets -Line 583";
        ////        alertPacket.Save(SMSQDIR + _oClsClients.campaignId + "-" + DateAndTime.Year + DateAndTime.Month + DateAndTime.Day + "-" + DateAndTime.Hour + DateAndTime.Minute + DateAndTime.Second + "1" + "-Q.xml");
        ////        alertPacket = null;
        ////        ClientDBOperation.UpdateSMSCredits(_oClsClients, 1);
        ////    }
        ////    catch (Exception excep)
        ////    {
        ////        General.WriteInFile(sErrlocation + "\r\n" + excep.Message);
        ////    }
        ////}
        /// <summary>
        /// Maintains sent message Log.
        /// </summary>
        /// <param name="msgcount"></param>
        private void UpdateMessageLog(int CampaignId, string XMLdata)
        {
            CampaignLogXMLDTO CampaignLogXMLDTO = new CampaignLogXMLDTO();
            CampaignLogXMLDTO.CampaignId = CampaignId;
            CampaignLogXMLDTO.XMLLog = XMLdata;
            CampaignLogXMLService.Create(CampaignLogXMLDTO);

            //sErrlocation = "Maintain SMSLog-Line 518";
            //SMSLog oSMSLog = new SMSLog();
            //oSMSLog.campaignId = oClient.campaignId;
            //oSMSLog.CampaignName = campaignname.Replace("'", "''");
            //oSMSLog.CreditsConsumed = creditsRequired;
            //oSMSLog.LogDate = System.DateTime.Now;
            //oSMSLog.NumMessages = msgcount;
            //oSMSLog.XMLfile = baseFileName;
            //SMSLogDBOperation.Insert(oSMSLog);
        }
        /// <summary>
        /// Create CampaignLogXML
        /// </summary>
        /// <param name="CampaignLogXMLDTO">CampaignLogXML Object</param>
        /// <returns></returns>
        public static int Create(CampaignLogXMLDTO CampaignLogXMLDTO)
        {
            try
            {
                var CampaignLogXML = new CampaignLogXML();
                using (var uow = new UnitOfWork())
                {
                    CampaignLogXML = Transform.CampaignLogXMLToDomain(CampaignLogXMLDTO);
                    uow.CampaignLogXMLRepo.Insert(CampaignLogXML);
                    uow.SaveChanges();
                    return (CampaignLogXML.Id);

                }

            }
            //catch (LoggedInUserException)
            //{
            //    throw new System.TimeoutException();
            //}
            catch (Exception)
            {
                throw;
            }
        }