Ejemplo n.º 1
0
 public IHttpActionResult Authenticate()
 {
     try
     {
         BasicAuthenticationDTO _basicAuthIdentity = Thread.CurrentPrincipal.Identity as BasicAuthenticationDTO;
         //  return Json(tokenEntities);
         return(Content(HttpStatusCode.OK, _basicAuthIdentity._AuthUserDTO));
     }
     catch (Exception Ex)
     { MyUELHelpers.ErrorLog(typeof(AccountsController).ToString(), "Authenticate", Ex.ToString()); }
     return(null);
 }
Ejemplo n.º 2
0
 public int CreditLimitDecrement(UserInfo userinfo)
 {
     try
     {
         int Credits = m_IRegisterBusiness.CreditLimitDecrement(userinfo);
         return(Credits);
     }
     catch (Exception Ex)
     {
         MyUELHelpers.ErrorLog(typeof(RegisterController).ToString(), "CreditLimitDecrement", Ex.ToString());
     }
     return(0);
 }
Ejemplo n.º 3
0
        public ResultMessagesReponse Renewpassword(UserInfo userinfo)
        {
            ResultMessagesReponse MyResultMessagesReponse = new ResultMessagesReponse();

            try
            {
                MyResultMessagesReponse = m_IRegisterBusiness.Renewpassword(userinfo);
            }
            catch (Exception Ex)
            {
                MyUELHelpers.ErrorLog(typeof(RegisterController).ToString(), "Renewpassword", Ex.ToString());
            }
            return(MyResultMessagesReponse);
        }
Ejemplo n.º 4
0
        public IHttpActionResult CheckEmailExists(EmailCheckDTO Email)
        {
            ResultReponse MyResultReponse = new ResultReponse();
            UserDTO       UserInfo        = new UserDTO();

            try
            {
                MyUELHelpers.Info(typeof(RegisterController).ToString(), "CheckEmailExists", "Started " + DateTime.Now.ToString());

                UserInfo = m_IRegisterBusiness.CheckEmailExists(Email.Email);
                if (UserInfo != null)
                {
                    if (UserInfo.Id > 0)
                    {
                        MyResultReponse.Status     = "EMAILEXISTS";
                        MyResultReponse.StatusCode = "EMAILEXISTS";
                        MyResultReponse.Message    = "Email already exists";
                    }
                    else
                    {
                        MyResultReponse.Status     = "EMAILNOTEXISTS";
                        MyResultReponse.StatusCode = "EMAILNOTEXISTS";
                        MyResultReponse.Message    = "Email not exists";
                    }
                }
                else
                {
                    MyResultReponse.Status     = "EMAILNOTEXISTS";
                    MyResultReponse.StatusCode = "EMAILNOTEXISTS";
                    MyResultReponse.Message    = "Email not exists";
                }
                MyUELHelpers.Info(typeof(RegisterController).ToString(), "CheckEmailExists", "Done " + DateTime.Now.ToString());

                return(Json(MyResultReponse));
            }
            catch (Exception Ex)
            {
                MyUELHelpers.ErrorLog(typeof(RegisterController).ToString(), "CheckEmailExists", Ex.ToString());
            }
            return(null);
        }
Ejemplo n.º 5
0
        public IHttpActionResult RegisterForm(RegisterFormDTO registerForm)
        {
            PaymentItems    MyPaymentItems      = null;
            int             NoOfUsers           = 0;
            int             PurchaseItemsId     = 0;
            ResultReponse   MyResultResponse    = new ResultReponse();
            UserDTO         UserDTOInfo         = new UserDTO();
            SetupProcessDTO SetupProcessDTOInfo = new SetupProcessDTO();

            CardPaymentDTO  CardPaymentDTOInfo = null;
            SubscriptionDTO m_subscriptionDTO;
            //string APIKey = "sk_test_MCGUn4fT1YzFQzGcRa9HiC3v";

            string APIKey = "sk_test_ffjSM0I2xFEg7I18xCdxb9EJ";

            RegisterFormResults MyRegisterFormResults = new RegisterFormResults();
            string MessageBody      = "Welcome to MyUEL..";
            string TemplateBody     = "";
            string Subject          = "Message";
            string SubscriptionName = "";

            string        ExpMonth        = "";
            string        ExpYear         = "";
            ResultReponse MyResultReponse = new ResultReponse();

            try
            {
                //Get Stripe API Key
                //APIKey = "sk_test_ffjSM0I2xFEg7I18xCdxb9EJ";
                //m_subscriptionDTO = m_IRegisterBusiness.GetSubscriptionId(registerForm.Subscriptionid);

                //if (m_subscriptionDTO != null)
                //{
                //    NoOfUsers = m_subscriptionDTO.noOfUser;



                //    MyUELHelpers.Info(typeof(RegisterController).ToString(), "SaveUserDetails", "Started " + DateTime.Now.ToString());
                //    UserDTOInfo = m_IRegisterBusiness.creatingUsers(registerForm.FirstName, registerForm.LastName, registerForm.UserEmail,
                //        registerForm.Password, registerForm.Company, registerForm.Subscriptionid, m_subscriptionDTO);
                //    MyUELHelpers.Info(typeof(RegisterController).ToString(), "SaveUserDetails", "Done " + DateTime.Now.ToString());

                //    SubscriptionName = string.Format("{0}  {1}   {2} ", m_subscriptionDTO.SubscriptionName, m_subscriptionDTO.SubscriptionDays, m_subscriptionDTO.SubscriptionType);

                //    if (UserDTOInfo != null)
                //    {
                //        MyUserInfo.TenantId = UserDTOInfo.TenantId;
                //        MyUserInfo.UserId = UserDTOInfo.Id;
                //        MyUserInfo.UserName = UserDTOInfo.UserName;
                //        MyUserInfo.SubscriptionId = registerForm.Subscriptionid;
                //        MyUserInfo.SubscriptionName = m_subscriptionDTO.SubscriptionName;
                //        MyUserInfo.SubscriptionType = m_subscriptionDTO.SubscriptionType;
                //        MyRegisterFormResults.StatusCode = "USERREGISTER";
                //        MyRegisterFormResults.Status = "User Registration Done";
                //        MyRegisterFormResults.Message = "User Registration Done";
                //        MyUELHelpers.Info(typeof(RegisterController).ToString(), "Creating Table", "Started " + DateTime.Now.ToString());
                //        SetupProcessDTOInfo = m_ISetupProcessBusiness.CreateTable("boundhound" + MyUserInfo.TenantId, MyUserInfo);
                //        if (SetupProcessDTOInfo.Status == "SUCCESS")
                //        {
                //            MyUELHelpers.Info(typeof(RegisterController).ToString(), "Table Created Successfully", "End " + DateTime.Now.ToString());
                //            MyUserInfo.databasename = "MyUELLoyalty" + MyUserInfo.TenantId;
                //        }
                //        else
                //        {
                //            MyUELHelpers.Info(typeof(RegisterController).ToString(), "Creating Table Error", string.Format("Error {0}\n ", SetupProcessDTOInfo.Message) + DateTime.Now.ToString());
                //        }

                //        if (m_subscriptionDTO.SubscriptionType == "Paid")
                //        {


                //            registerForm.TotalAmount = m_subscriptionDTO.Amount;
                //            //create a card
                //            ExpMonth = registerForm.ExpMonth.Split('/')[0];
                //            ExpYear = registerForm.ExpMonth.Split('/')[1];

                //            MyUELHelpers.Info(typeof(RegisterController).ToString(), "SaveCardDetails", "Started " + DateTime.Now.ToString());
                //            CardDetailsDTO cardDetailsDTOInfo = null;
                //            cardDetailsDTOInfo = m_ICardDetailsBusiness.savecardDetails(registerForm.ccNo, registerForm.SecurityCode, ExpMonth, ExpYear, registerForm.UserEmail, APIKey, MyUserInfo);
                //            MyUELHelpers.Info(typeof(RegisterController).ToString(), "SaveCardDetails", "Ended " + DateTime.Now.ToString());
                //            if (cardDetailsDTOInfo != null)
                //            {
                //                //payment
                //                MyUELHelpers.Info(typeof(RegisterController).ToString(), "SavePaymentDetails", "Started " + DateTime.Now.ToString());
                //                CardPaymentDTOInfo = m_paymentDetailsBusiness.PaymentDetails(Convert.ToString(cardDetailsDTOInfo.Id), registerForm.TotalAmount, APIKey, MyUserInfo);
                //                MyUELHelpers.Info(typeof(RegisterController).ToString(), "SavePaymentDetails", "Done " + DateTime.Now.ToString());
                //                MyResultResponse.Status = CardPaymentDTOInfo.transactionstatus;
                //                MyResultResponse.Message = "Paid Subscription";

                //                MyRegisterFormResults.StatusCode = "PAYMENTDONESUCCESS";
                //                MyRegisterFormResults.Status = "Payment done subscription created";
                //                MyRegisterFormResults.Message = "Payment done subscription created";

                //                MyRegisterFormResults.PaymentId = CardPaymentDTOInfo.PaymentId;
                //                MyRegisterFormResults.TransactionId = CardPaymentDTOInfo.transactionId;
                //                //****************************************************************************************************************************************************************
                //                // Save In Payment Items
                //                //****************************************************************************************************************************************************************
                //                MyPaymentItems = new PaymentItems();

                //                MyPaymentItems.PaymentId = CardPaymentDTOInfo.id;
                //                MyPaymentItems.ItemName = "Subscription Charges";
                //                MyPaymentItems.PurchaseAmount = registerForm.TotalAmount;
                //                MyPaymentItems.NoOfUsers = NoOfUsers;
                //                PurchaseItemsId = m_IPurchaseUsersBusiness.CreatePaymentItems(MyPaymentItems, MyUserInfo);

                //                //****************************************************************************************************************************************************************

                //                //Send this Details to send the mail
                //                //MyRegisterFormResults.Subscription = m_subscriptionDTO;
                //                //MyRegisterFormResults.CardPayment = CardPaymentDTOInfo;
                //                //MyRegisterFormResults.User = UserDTOInfo;

                //                //TODO Send the email to user

                //            }
                //        }

                //        //Send Email After Register
                //        Subject = "User Registration Confirmation...";

                //        MyUserInfo.UserName = UserDTOInfo.UserName;
                //        MyUserInfo.Email = UserDTOInfo.UserEmail;
                //        MyUserInfo.Password = UserDTOInfo.UserPassword;

                //        MyUserInfo.SubscriptionName = SubscriptionName;

                //        //Template Parse
                //        TemplateParsers MyTemplateParser = new TemplateParsers(MyUserInfo);

                //        //Get After register html template from the Templates/AfterRegister.html
                //        var filePath = HttpContext.Current.Server.MapPath("~/Templates/AfterRegister.html");

                //        string html = File.ReadAllText(filePath);

                //        TemplateBody = MyTemplateParser.ParseAfterRegister(html, MyUserInfo);

                //        MessageBody = TemplateBody;

                //        //GET SMTP Settings
                //        SMTPSettings MyUELLoyaltySMTPSettings = new SMTPSettings();

                //        UtilityBusiness MyUtilityBusiness = new UtilityBusiness();
                //        BoundHoundSMTPSettings = MyUtilityBusiness.GetBoundHoundSMPTSettings(MyUserInfo);

                //        if (BoundHoundSMTPSettings != null)
                //        {
                //            if (BoundHoundSMTPSettings.Id > 0)
                //            {
                //                //string FromAddress = string.Format("{0} <{1}>", BoundHoundSMTPSettings.DisplayName, BoundHoundSMTPSettings.UserName);

                //                MyResultReponse = m_IEmailsBusiness.SendEmailAfterRegister(registerForm.UserEmail, BoundHoundSMTPSettings.HostName, BoundHoundSMTPSettings.Port, BoundHoundSMTPSettings.UserName,
                //                BoundHoundSMTPSettings.UserPassword,
                //                Subject, MessageBody, UserDTOInfo, m_subscriptionDTO, CardPaymentDTOInfo);

                //                //MyResultReponse = m_IEmailsBusiness.SendEmailAfterRegister(registerForm.UserEmail, MyUserInfo.FromUserEmail,
                //                //        MyUserInfo.FromPassword,
                //                //        Subject, MessageBody, UserDTOInfo, m_subscriptionDTO, CardPaymentDTOInfo);

                //                if (MyResultReponse.Status == "SUCCESS")
                //                {
                //                    MyRegisterFormResults.StatusCode = "USERREGISTER";
                //                    MyRegisterFormResults.Status = "User Registration Done";
                //                    MyRegisterFormResults.Message = "User Registration Done";
                //                    MyRegisterFormResults.User = UserDTOInfo;

                //                }
                //                else
                //                {
                //                    MyRegisterFormResults.StatusCode = "PAYMENTDONESUCCESS";
                //                    MyRegisterFormResults.Status = "Payment done subscription created";
                //                    MyRegisterFormResults.Message = "Payment done subscription created - Email error ";
                //                    MyRegisterFormResults.User = UserDTOInfo;
                //                }
                //            }
                //        }



                //        //SetupProcessDTOInfo = m_ISetupProcessBusiness.CreateTable("boundhound" + MyUserInfo.TenantId, MyUserInfo);

                //    }

                //}

                //else
                //{
                //    MyRegisterFormResults.Message = "InValid Subscription Id ";
                //    MyRegisterFormResults.User = UserDTOInfo;
                //}
                return(Json(MyRegisterFormResults));
            }
            catch (Exception Ex)
            {
                MyUELHelpers.ErrorLog(typeof(RegisterController).ToString(), "RegisterForm", Ex.ToString());
            }

            return(Json(MyRegisterFormResults));
        }
Ejemplo n.º 6
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            GlobalConfiguration.Configure(WebApiConfig.Register);

            //Register All Interfaces
            System.Web.Http.GlobalConfiguration.Configure(IOCConfig.RegisterManagers);

            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);


            //*************************************************************************************************************************************************************
            var log4NetPath = Server.MapPath("~/log4net.config");

            //For Log
            log4net.Config.XmlConfigurator.ConfigureAndWatch(new System.IO.FileInfo(log4NetPath));
            LogFullPath         = Server.MapPath("~/logs/");
            Log4NetFileLocation = string.Format("{0}BoundHound-", LogFullPath);
            MyUELHelpers.ChangeFileLocation(Log4NetFileLocation);

            //Start Quartz Scheduler
            //JobScheduler.Start();


            //**************************************************************************************************************************************************************************************************************************************************
            //Add jobs here
            //**************************************************************************************************************************************************************************************************************************************************



            //**************************************************************************************************************************************************************************************************************************************************

            //**************************************************************************************************************************************************************************************************************************************************
            //Hangfire starts here
            //**************************************************************************************************************************************************************************************************************************************************
            //var storage = new SqlServerStorage(System.Configuration.ConfigurationManager.ConnectionStrings["db_HangFire"].ConnectionString); // db_HangFire is the connection string for Sql Server DB used as Job Storage for HangFire for processing

            //var options = new BackgroundJobServerOptions();

            //var _backgroundJobServer = new BackgroundJobServer(options, storage);
            //_backgroundJobServer.Start(); // start BackgroundJobServer process
            //JobStorage.Current = storage; // assign the storage to Current
            //**************************************************************************************************************************************************************************************************************************************************

            //Other way to start hangfire
            //Hangfire.GlobalConfiguration.Configuration.UseSqlServerStorage("YOUR_CONNECTION_STRING");
            //Hangfire.GlobalConfiguration.Configuration.UseSqlServerStorage("YOUR_CONNECTION_STRING");

            //MySQL
            //Hangfire.GlobalConfiguration.Configuration.UseStorage(new MySqlStorage("LinkedInConnection"));

            //Hangfire.GlobalConfiguration.Configuration.UseStorage(
            //        new MySqlStorage(
            //            MasterConnectionString,
            //            new MySqlStorageOptions
            //            {
            //                TransactionIsolationLevel = IsolationLevel.ReadCommitted,
            //                QueuePollInterval = TimeSpan.FromSeconds(15),
            //                JobExpirationCheckInterval = TimeSpan.FromHours(1),
            //                CountersAggregateInterval = TimeSpan.FromMinutes(5),
            //                PrepareSchemaIfNecessary = true,
            //                DashboardJobListLimit = 50000,
            //                TransactionTimeout = TimeSpan.FromMinutes(1),
            //                //TablesPrefix = "Hangfire"
            //            }));

            //_server = new BackgroundJobServer();
            //**************************************************************************************************************************************************************************************************************************************************

            //Hang Fire schedule starts
            // RecurringJob.AddOrUpdate(() => MyJobScheduler.RunCampaigns(), "1 0 * 1/1 *");


            //MyJobScheduler.RunCampaigns();
            //*************************************************************************************************************************************************************
        }