Ejemplo n.º 1
0
 public ActionResult LoadEwalletPartial()
 {
     string datetime = string.Empty;
     try
     {
          datetime = Helper.Extensions.ToClientTime(DateTime.UtcNow);
         //datetime = Request.Form["localtime"].ToString();
     }
     catch (Exception ex)
     {
          datetime = Helper.Extensions.ToClientTime(DateTime.UtcNow);
         //datetime = TempData["localtime"].ToString();
     }
     ViewBag.datetime = datetime;
     Api.User.User ApiobjUser = new Api.User.User();
     User _User = (User)Session["User"];
     _User = (User)(new JavaScriptSerializer().Deserialize(ApiobjUser.getUsersById(_User.Id.ToString(), Session["access_token"].ToString()), typeof(User)));
     Api.PaymentTransaction.PaymentTransaction ApiPaymentTransaction = new Api.PaymentTransaction.PaymentTransaction();
     Api.Affiliates.Affiliates ApiAffiliates = new Api.Affiliates.Affiliates();
     List<Domain.Socioboard.Domain.PaymentTransaction> lsttransactions = (List<Domain.Socioboard.Domain.PaymentTransaction>)(new JavaScriptSerializer().Deserialize(ApiPaymentTransaction.GetPaymentDataByUserId(_User.Id.ToString()), typeof(List<Domain.Socioboard.Domain.PaymentTransaction>)));
     List<Domain.Socioboard.Domain.Affiliates> lstAffiliates = (List<Domain.Socioboard.Domain.Affiliates>)(new JavaScriptSerializer().Deserialize(ApiAffiliates.GetAffilieteDetailbyUserIdTrans(_User.Id.ToString()), typeof(List<Domain.Socioboard.Domain.Affiliates>)));
     List<Domain.Socioboard.Domain.EwalletWithdrawRequest> lstEwalletWithdrawRequest = (List<Domain.Socioboard.Domain.EwalletWithdrawRequest>)(new JavaScriptSerializer().Deserialize(ApiAffiliates.GetEwalletWithdraw(_User.Id.ToString()), typeof(List<Domain.Socioboard.Domain.EwalletWithdrawRequest>)));
     ViewBag.lsttransactions = lsttransactions;
     ViewBag.lstAffiliates = lstAffiliates;
     ViewBag.lstEwalletWithdrawRequest = lstEwalletWithdrawRequest;
     return PartialView("_EwalletPartial", _User);
 }
        public ActionResult EditUserInfo(string id,string fname,string lname,string email,string dt)
        {
            var fi = Request.Files["file"];
            string file = string.Empty;
            if (Request.Files.Count > 0)
            {
                if (fi != null)
                {
                    var path = Server.MapPath("~/Themes/" + System.Configuration.ConfigurationManager.AppSettings["domain"] + "/Contents/img/user_img");

                    // var path = System.Configuration.ConfigurationManager.AppSettings["MailSenderDomain"]+"Contents/img/upload";
                    file = path + "\\" + fi.FileName;
                    if (!Directory.Exists(path))
                    {
                        Directory.CreateDirectory(path);
                    }
                    fi.SaveAs(file);
                    path = path + "\\" + fi.FileName;
                    file = file.Replace("\\", "/");
                }
            }
              User objUser = (User)Session["User"];
              Api.User.User ApiobjUser = new Api.User.User();
              string ret = ApiobjUser.UpdateUser(id, fname, lname, dt, file,Session["access_token"].ToString());
              if (ret == "1")
              {
                  objUser.UserName = fname + " " + lname;
                  objUser.TimeZone = dt;
                  objUser.ProfileUrl = file;
                  Session["User"] = objUser;
              }
              return Content(ret);
        }
 public ActionResult ChangeAdminPassword()
 {
     string NewPassword = Request.Form["NewPassword"].ToString();
     string OldPassword = Request.Form["OldPassword"].ToString();
     string returnmsg=string.Empty;
     Api.User.User ApiobjUser = new Api.User.User();
     Domain.Socioboard.Domain.User ObjUser = (Domain.Socioboard.Domain.User)Session["User"];
     string OldPaswrd = EncodePassword(OldPassword);
     if (ObjUser.Password == OldPaswrd)
     {
         if (NewPassword != OldPaswrd)
         {
             string ChngePasswordMessage = ApiobjUser.ChangePassword(ObjUser.EmailId.ToString(), OldPassword, NewPassword, Session["access_token"].ToString());
             returnmsg = ChngePasswordMessage;
             if (ChngePasswordMessage == "Password Changed Successfully")
             {
                 ObjUser.Password = EncodePassword(NewPassword);
                 Session["User"] = ObjUser;
             }
         }
         else
         {
             returnmsg = "You can't Use Old password as New Password!";
         }
     }
     else
     {
         returnmsg = "Entered Old Password Not Match!";
     }
     return Content(returnmsg);
 }
Ejemplo n.º 4
0
        public ActionResult SendAddNewsLatter(string Subject, string NewsBody, string SendDate, string UserIds) 
        {

            DateTime dt = Convert.ToDateTime(SendDate).Date;
            string[] UsersId = UserIds.Split(',');
            string mailsender = null;
            string returnmsg = null;
            foreach (var item in UsersId)
            {
                Api.User.User ApiObjUser=new Api.User.User();
                Domain.Socioboard.Domain.User objUser = (Domain.Socioboard.Domain.User)(new JavaScriptSerializer().Deserialize(ApiObjUser.getUsersById(item.ToString()), typeof(Domain.Socioboard.Domain.User)));
                Domain.Socioboard.Domain.NewsLetter ObjNewsLatter = new NewsLetter();
                if (dt == DateTime.Now.Date)
                {

                    try
                    {
                        Api.MailSender.MailSender ApiObjMailForNewsLtr = new Api.MailSender.MailSender();
                        mailsender = ApiObjMailForNewsLtr.SendAddNewsLatterMail(objUser.EmailId.ToString(), NewsBody, Subject);
                        ObjNewsLatter.Id = Guid.NewGuid();
                        ObjNewsLatter.Subject = Subject;
                        ObjNewsLatter.NewsLetterBody = NewsBody;
                        ObjNewsLatter.SendDate = DateTime.Parse(SendDate);
                        ObjNewsLatter.SendStatus = true;
                        ObjNewsLatter.UserId = Guid.Parse(item.ToString());
                        ObjNewsLatter.EntryDate = DateTime.Now;
                        string Objltr=new JavaScriptSerializer().Serialize(ObjNewsLatter);
                        Api.NewsLetter.NewsLetter objApiNewsltr = new Api.NewsLetter.NewsLetter();
                        returnmsg = (string)(new JavaScriptSerializer().Deserialize(objApiNewsltr.AddNewsLatter(Objltr), typeof(string)));

                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }
                }
                else {
                    ObjNewsLatter.Id = Guid.NewGuid();
                    ObjNewsLatter.Subject = Subject;
                    ObjNewsLatter.NewsLetterBody = NewsBody;
                    ObjNewsLatter.SendDate = DateTime.Parse(SendDate);
                    ObjNewsLatter.SendStatus = false;
                    ObjNewsLatter.UserId = Guid.Parse(item.ToString());
                    ObjNewsLatter.EntryDate = DateTime.Now;
                    string Objltr = new JavaScriptSerializer().Serialize(ObjNewsLatter);
                    Api.NewsLetter.NewsLetter objApiNewsltr = new Api.NewsLetter.NewsLetter();
                    returnmsg = (string)(new JavaScriptSerializer().Deserialize(objApiNewsltr.AddNewsLatter(Objltr),typeof(string)));
                }    
            }
            

            return Content(returnmsg);
        }
 public ActionResult UpgradeAccountSuccessful()
 {
     Domain.Myfashion.Domain.User _User = new Domain.Myfashion.Domain.User();
     User objUser = (User)Session["User"];
     string accountType = (string)Session["AccountType"];
     Api.User.User objuser = new Api.User.User();
     string data = objuser.UpdatePaymentSatus(objUser.Id.ToString(), accountType);
     string user = objuser.getUsersById(objUser.Id.ToString());
     _User = (User)(new JavaScriptSerializer().Deserialize(user, typeof(User)));
     Session["User"] = _User;
     Session["Paid_User"] = "Paid";
     return RedirectToAction("Index", "Home");
 }
Ejemplo n.º 6
0
 public ActionResult ResetPassword(string emailId, string code)
 {
     //return PartialView("_ResetPasswordPartial", ForgetPasswordKey);
     Api.User.User ApiobjUser = new Api.User.User();
     Domain.Socioboard.Domain.User objuser = (Domain.Socioboard.Domain.User)(new JavaScriptSerializer().Deserialize(ApiobjUser.getUserInfoByEmail(emailId), typeof(Domain.Socioboard.Domain.User)));
     Dictionary<string, string> resetdata = new Dictionary<string, string>();
     if(objuser!=null)
     {
         if(objuser.ChangePasswordKey==code)
         {
             resetdata.Add("emailId", emailId);
             resetdata.Add("code", code);
             //return PartialView("_ResetPasswordPartial", emailId);//ViewData);
         }
     }
     return PartialView("_ResetPasswordPartial", resetdata);
 }
        public ActionResult SendFogotPassMail(string emailId)
        {
            Api.User.User ApiobjUser = new Api.User.User();
            Domain.Socioboard.Domain.User objuser = new Domain.Socioboard.Domain.User();
            try
            {
                objuser = (Domain.Socioboard.Domain.User)(new JavaScriptSerializer().Deserialize(ApiobjUser.getUserInfoByEmail(emailId), typeof(Domain.Socioboard.Domain.User)));
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
            }
            Api.MailSender.MailSender ApiobjMailSender = new Api.MailSender.MailSender();
            string mailsender = "";
            try
            {
                if (objuser == null) 
                {
                    mailsender = "IdNOtExist";
                }
                //Generate a random unique string
                string strRandomUnique = SBUtils.GenerateRandomUniqueString();

                //Update random unique string in User
                string res_UpdateChangePasswordKey = ApiobjUser.UpdateForgetPasswordKey(objuser.Id.ToString(), strRandomUnique);

                if (res_UpdateChangePasswordKey=="1")
                {
                    ViewBag.ForgetPasswordKey = strRandomUnique;
                    objuser.ChangePasswordKey = strRandomUnique;
                }

                objuser.ChangePasswordKey = strRandomUnique;

                var mailBody = Helper.SBUtils.RenderViewToString(this.ControllerContext, "_ForgotPasswordMailBodyPartial", objuser);
                string Subject = "You requested a password reset for your " + ConfigurationManager.AppSettings["DefaultGroupName"].ToString() + " Account";//"Forget password Socioboard Account";

                mailsender = ApiobjMailSender.SendChangePasswordMail(emailId, mailBody, Subject);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
            }
            return Content(mailsender);
        }
Ejemplo n.º 8
0
        //public ActionResult LoadEwalletPartial()
        //{
        //    User _User = (User)Session["User"];
        //    Api.PaymentTransaction.PaymentTransaction ApiPaymentTransaction = new Api.PaymentTransaction.PaymentTransaction();
        //    Api.Affiliates.Affiliates ApiAffiliates = new Api.Affiliates.Affiliates(); 
        //    List<Domain.Socioboard.Domain.PaymentTransaction> lsttransactions=(List<Domain.Socioboard.Domain.PaymentTransaction>)(new JavaScriptSerializer().Deserialize(ApiPaymentTransaction.GetPaymentDataByUserId(_User.Id.ToString()),typeof(List<Domain.Socioboard.Domain.PaymentTransaction>)));
        //    List<Domain.Socioboard.Domain.Affiliates> lstAffiliates=(List<Domain.Socioboard.Domain.Affiliates>)(new JavaScriptSerializer().Deserialize(ApiAffiliates.GetAffilieteDetailbyUserIdTrans(_User.Id.ToString()),typeof(List<Domain.Socioboard.Domain.Affiliates>)));

        //    ViewBag.lsttransactions = lsttransactions;
        //    ViewBag.lstAffiliates = lstAffiliates;

        //    return PartialView("_EwalletPartial",_User);
        //}

        public ActionResult RechrgeEwalletByPaypal(string amount)
        {
            string pay = string.Empty;
            Api.User.User ApiobjUser = new Api.User.User();
            User objUser = (User)Session["User"];
            Helper.Payment payme = new Payment();
            Session["RechrgeAmount"] = amount;
            string UpgradeAccountSuccessURL = ConfigurationManager.AppSettings["RechargeEwalletSuccessURL"];
            string UpgradeAccountFailedURL = ConfigurationManager.AppSettings["RechargeEwalletFailedURL"];
            string UpgradeAccountpaypalemail = ConfigurationManager.AppSettings["RechargeEwalletpaypalemail"];
            string userId = objUser.Id.ToString();
            string UserName = objUser.UserName;
            string EmailId = objUser.EmailId;
            pay = payme.PayWithPayPal(amount, "Recharge Ewallet", UserName, "", EmailId, "USD", UpgradeAccountpaypalemail, UpgradeAccountSuccessURL,
                                     UpgradeAccountFailedURL, UpgradeAccountSuccessURL, "", "", userId);
            //Response.Redirect(pay);
            return Content(pay);
        }
Ejemplo n.º 9
0
        // Edited by Antima[1/11/2014]

        public ActionResult UserActivationByEmail(string email)
        {
            Api.User.User obj = new Api.User.User();
            Domain.Socioboard.Domain.User objUser = (Domain.Socioboard.Domain.User)(new JavaScriptSerializer().Deserialize(obj.getUserInfoByEmail(email), typeof(Domain.Socioboard.Domain.User)));
            string Email = email;
            string UserId = objUser.Id.ToString();
            ViewBag.Email = Email;
            ViewBag.UserId = UserId;
            return View("UserActivationByEmail");
        }
 //Modified by Sumit Gupta [31-01-15]
 public ActionResult ChangePassword(string id, string oldpass, string newpass, string confirmpass)
 {
     User objUser = (User)Session["User"];
     Api.User.User ApiobjUser = new Api.User.User();
     //UserRepository userrepo = new UserRepository();
     //Domain.Socioboard.Domain.User user = ApiobjUser.getUserInfoByEmail(;
     string user = ApiobjUser.getUserInfoByEmail(id);
     string ret = string.Empty;
     if (newpass.Equals(confirmpass))
     {
         //Modified by Sumit Gupta [31-01-15]
         //ret = ApiobjUser.ChangePassword(id, oldpass, newpass);
         ret = ApiobjUser.ChangePasswordWithoutOldPassword(id, "", newpass);
     }
     else
     {
         ret = "New Password and Confirm Password mismatch";
     }
     //string ret = ApiobjUser.UpdateUser(id, fname, lname, dt);
     //if (ret == "1")
     //{
     //    objUser.UserName = fname + " " + lname;
     //    objUser.TimeZone = dt;
     //    Session["User"] = objUser;
     //}
     return Content(ret);
 }
Ejemplo n.º 11
0
        public ActionResult Signup()
        {
            logger.Error("Register");
            User _user=(User)Session["User"];
            Domain.Socioboard.Domain.User user = new Domain.Socioboard.Domain.User();
            Session["AjaxLogin"] = "register";
            string retmsg = string.Empty;
            try
            {
                System.IO.StreamReader sr = new System.IO.StreamReader(Request.InputStream);
                string line = "";
                line = sr.ReadToEnd();
                JObject jo = JObject.Parse(line);
                user.PaymentStatus = "unpaid";
                //if (!string.IsNullOrEmpty(Request.QueryString["type"]))
                //{
                //    user.AccountType = Request.QueryString["type"];

                //    ViewBag.DropDownList1 = Request.QueryString["type"];
                //}
                //else
                //{
                //    user.AccountType = "Free";
                //}
                user.AccountType = Server.UrlDecode((string)jo["package"]);
                user.CreateDate = DateTime.Now;
                user.ExpiryDate = DateTime.Now.AddMonths(1);
                user.Id = Guid.NewGuid();
                user.UserName = Server.UrlDecode((string)jo["firstname"]) + " " + Server.UrlDecode((string)jo["lastname"]);
                user.EmailId = Server.UrlDecode((string)jo["email"]);
                user.Password = Server.UrlDecode((string)jo["password"]);
                user.UserStatus = 1;
                if (_user != null)
                {
                    if (_user.ActivationStatus == "1") //If Login from Facebook, then ActivationStatus would be 1, refer to FacebookManager Controller
                    {
                        user.ActivationStatus = "1";
                    }
                    else
                    {
                        user.ActivationStatus = "0";
                    }
                }
                else
                {
                    user.ActivationStatus = "0";
                }
                string firstName = Server.UrlDecode((string)jo["firstname"]);
                string lastName = Server.UrlDecode((string)jo["lastname"]);
                Api.User.User objApiUser = new Api.User.User();
                string res_Registration = objApiUser.Register(user.EmailId, user.Password, user.AccountType, user.UserName, user.ActivationStatus);
                logger.Error("res_Registration: "+res_Registration);
                if (res_Registration != "Email Already Exists")
                {
                    if (user != null)
                    {
                        Api.User.User obj = new Api.User.User();
                        user = (User)(new JavaScriptSerializer().Deserialize(obj.Login(user.EmailId, user.Password), typeof(User)));
                        Session["User"] = user;
                        retmsg = "user";
                    }

                    //Domain.Socioboard.Domain.Invitation _Invitation = (Domain.Socioboard.Domain.Invitation)Session["InvitationInfo"];
                    Api.Invitation.Invitation ApiInvitation = new Api.Invitation.Invitation();
                    //if (Session["InvitationCode"] != null)
                    //{
                    //    string invitationcode = Session["InvitationCode"].ToString();
                    //    ApiInvitation.AddInvitationInfoBycode(invitationcode, user.EmailId, user.Id.ToString());

                    //}
                    
                    //if (_Invitation != null)
                    //{
                    //    if (user.EmailId == _Invitation.FriendEmail)
                    //    {
                    //        string ret = ApiInvitation.UpdateInvitatoinStatus(_Invitation.Id.ToString(), user.Id.ToString());
                    //    }
                    //}

                }
                else
                {
                    retmsg = "Email Already Exists";
                }
                //return Content(retmsg);

            }
            catch (Exception ex)
            {
                //logger.Error(ex.StackTrace);
                Console.WriteLine(ex.StackTrace);
            }
            //return View("_RegistrationPartial");
            
            
           
            return Content(retmsg);
        }
 public ActionResult UpgradeAccountSuccessful()
 {
     User objUser = (User)Session["User"];
     string paidamount = (string)Session["PaymentAmount"];
     string accountType = (string)Session["AccountType"];
     objUser.PaymentStatus = "Paid";
     objUser.AccountType = accountType;
     Api.User.User ApiobjUser = new Api.User.User();
     Api.PaymentTransaction.PaymentTransaction objApiPaymentTransaction = new Api.PaymentTransaction.PaymentTransaction();
     if (DateTime.Compare(objUser.ExpiryDate, DateTime.Now) > 0)
     {
         objUser.ExpiryDate = objUser.ExpiryDate.AddDays(30);
     }
     else
     {
         objUser.ExpiryDate = DateTime.Now.AddDays(30);
     }
     string i = ApiobjUser.UpdateUserAccountInfoByUserId(objUser.Id.ToString(), objUser.AccountType, objUser.ExpiryDate, objUser.PaymentStatus, Session["access_token"].ToString());
     string res_PaymentTransaction = objApiPaymentTransaction.SavePayPalTransaction(objUser.Id.ToString(), paidamount);
     string ret = ApiobjUser.UpdatePaymentandEwalletStatusByUserId(objUser.Id.ToString(), Session["Ewallet"].ToString(), accountType, "paid", Session["access_token"].ToString());
     objUser.Ewallet = Session["Ewallet"].ToString();
     objUser.ActivationStatus = "paid";
     Session["User"] = objUser;
     Api.Invitation.Invitation ApiInvitation = new Api.Invitation.Invitation();
     try
     {
         Domain.Socioboard.Domain.Invitation _Invitation = (Domain.Socioboard.Domain.Invitation)(new JavaScriptSerializer().Deserialize(ApiInvitation.UserInvitedInfo(objUser.Id.ToString()), typeof(Domain.Socioboard.Domain.Invitation)));
         if (_Invitation != null)
         {
             User newUser = (User)(new JavaScriptSerializer().Deserialize(ApiobjUser.getUsersById(_Invitation.SenderUserId.ToString(), Session["access_token"].ToString()), typeof(User)));
             decimal bonus = (decimal.Parse(paidamount, CultureInfo.InvariantCulture.NumberFormat) * Payment.ReferedAmountDetails(accountType)) / 100;
             newUser.Ewallet = (decimal.Parse(newUser.Ewallet, CultureInfo.InvariantCulture.NumberFormat) + bonus).ToString();
             string ret1 = ApiobjUser.UpdatePaymentandEwalletStatusByUserId(newUser.Id.ToString(), newUser.Ewallet, newUser.AccountType, newUser.PaymentStatus, Session["access_token"].ToString());
             Api.Affiliates.Affiliates ApiAffiliates = new Api.Affiliates.Affiliates();
             ApiAffiliates.AddAffiliateDetail(newUser.Id.ToString(), objUser.Id.ToString(), DateTime.Now, bonus.ToString());
         }
     }
     catch (Exception ex) { }
     Session["Paid_User"] = "Paid";
     return RedirectToAction("Index", "Home");
 }
        public ActionResult Register()
        {
            Domain.Myfashion.Domain.User user = new Domain.Myfashion.Domain.User();
            Api.User.User objApiUser = new Api.User.User();

            Domain.Myfashion.Domain.User _user = (Domain.Myfashion.Domain.User)Session["User"];
            string str = "";

            System.IO.StreamReader sr = new System.IO.StreamReader(Request.InputStream);
            string line = "";
            line = sr.ReadToEnd();
            JObject jo = JObject.Parse(line);
            user.PaymentStatus = "unpaid";
            user.AccountType = Server.UrlDecode((string)jo["package"]);
            user.CreateDate = DateTime.Now;
            user.ExpiryDate = DateTime.Now.AddMonths(1);
            user.Id = Guid.NewGuid();
            string FirstName = Server.UrlDecode((string)jo["firstname"]);
            string LastName = Server.UrlDecode((string)jo["lastname"]);
            string profile = Server.UrlDecode((string)jo["package"]);
            string Company = Server.UrlDecode((string)jo["Company"]);
            user.UserName = Server.UrlDecode((string)jo["firstname"]) + " " + Server.UrlDecode((string)jo["lastname"]);
            user.EmailId = Server.UrlDecode((string)jo["email"]);
            user.Phone = Server.UrlDecode((string)jo["Phone"]);
            user.Password =Server.UrlDecode((string)jo["password"]);
            user.Company = Server.UrlDecode((string)jo["Company"]);
            //account.User_id = user.Id;
            //account.Company_id = Guid.NewGuid();
            //account.Business_name = Company;
            string res_Registration = string.Empty;
            res_Registration = objApiUser.Register(user.EmailId, user.Password, user.AccountType, user.UserName, user.Company, "0");
            if (res_Registration=="Email Already Exists")
            {
                str = "Email Already Exists";   
            }
            else if (res_Registration == "Something Went Wrong")
            {
                str = "Something Went Wrong";
            }
            else {
                Api.User.User obj = new Api.User.User();
                user = (User)(new JavaScriptSerializer().Deserialize(obj.Login(user.EmailId, user.Password), typeof(User)));
                Session["User"] = user;
                str = "Success";
            }
            return Content(str);
        }
Ejemplo n.º 14
0
        public ActionResult Signup()
        {
            logger.Error("Register");
            User _user = (User)Session["User"];
            Domain.Socioboard.Domain.User user = new Domain.Socioboard.Domain.User();
            Session["AjaxLogin"] = "register";
            string retmsg = string.Empty;
            try
            {
                System.IO.StreamReader sr = new System.IO.StreamReader(Request.InputStream);
                string line = "";
                line = sr.ReadToEnd();
                JObject jo = JObject.Parse(line);
                user.PaymentStatus = "unpaid";

                user.AccountType = Server.UrlDecode((string)jo["package"]);
                user.CreateDate = DateTime.Now;
                user.ExpiryDate = DateTime.Now.AddDays(30);
                user.Id = Guid.NewGuid();
                user.UserName = Server.UrlDecode((string)jo["firstname"]) + " " + Server.UrlDecode((string)jo["lastname"]);
                user.EmailId = Server.UrlDecode((string)jo["email"]);
                user.Password = Server.UrlDecode((string)jo["password"]);
                user.UserStatus = 1;
                if (_user != null)
                {
                    if (_user.ActivationStatus == "1") //If Login from Facebook, then ActivationStatus would be 1, refer to FacebookManager Controller
                    {
                        user.ActivationStatus = "1";
                        user.SocialLogin = _user.SocialLogin;
                        user.ProfileUrl = _user.ProfileUrl;
                    }
                    else
                    {
                        user.ActivationStatus = "0";
                    }
                }
                else
                {
                    user.ActivationStatus = "0";
                }
                string firstName = Server.UrlDecode((string)jo["firstname"]);
                string lastName = Server.UrlDecode((string)jo["lastname"]);
                Api.User.User objApiUser = new Api.User.User();
                //string res_Registration = objApiUser.Register(user.EmailId, user.Password, user.AccountType, user.UserName, user.ActivationStatus);
                string res_Registration = string.Empty;
                if (Session["twitterlogin"] != null)
                {
                    if ((string)Session["twitterlogin"] == "twitterlogin")
                    {
                        res_Registration = objApiUser.RegisterbyTwitter(user.EmailId, user.Password, user.AccountType, user.UserName, user.SocialLogin, user.ProfileUrl, user.ActivationStatus);
                    }
                    else
                    {
                        res_Registration = objApiUser.Register(user.EmailId, user.Password, user.AccountType, user.UserName, user.ActivationStatus);
                    }
                }
                else
                {
                    res_Registration = objApiUser.Register(user.EmailId, user.Password, user.AccountType, user.UserName, user.ActivationStatus);
                }
                logger.Error("res_Registration: " + res_Registration);
                if (res_Registration != "Email Already Exists")
                {
                    if (user != null)
                    {
                        Api.User.User obj = new Api.User.User();
                        user = (User)(new JavaScriptSerializer().Deserialize(obj.Login(user.EmailId, user.Password), typeof(User)));
                        Session["User"] = user;
                        if (Session["fblogin"] != null)
                        {
                            string accesstoken = (string)Session["AccesstokenFblogin"];
                            Api.Facebook.Facebook objfacebook = new Api.Facebook.Facebook();
                            Api.Groups.Groups objgroup = new Api.Groups.Groups();
                            //Domain.Socioboard.Domain.Groups group = (Domain.Socioboard.Domain.Groups)(new JavaScriptSerializer().Deserialize(objgroup.GetGroupDetailsByUserId(user.Id.ToString()), typeof(Domain.Socioboard.Domain.Groups)));
                            Groups obpgrp = (Groups)(new JavaScriptSerializer().Deserialize(objgroup.GetGroupDeUserId(user.Id.ToString()), typeof(Groups)));
                            objfacebook.AddFacebookAccountWithloginAsync(accesstoken, user.Id.ToString(), obpgrp.Id.ToString());
                        }
                        if (Session["googlepluslogin"] != null)
                        {
                            string accesstoken = (string)Session["AccesstokenFblogin"];
                            Api.Youtube.Youtube objYoutube = new Api.Youtube.Youtube();
                            Api.Groups.Groups objgroup = new Api.Groups.Groups();
                            //Domain.Socioboard.Domain.Groups group = (Domain.Socioboard.Domain.Groups)(new JavaScriptSerializer().Deserialize(objgroup.GetGroupDetailsByUserId(user.Id.ToString()), typeof(Domain.Socioboard.Domain.Groups)));
                            Groups grp = (Groups)(new JavaScriptSerializer().Deserialize(objgroup.GetGroupDeUserId(user.Id.ToString()), typeof(Groups)));
                            objYoutube.AddYoutubeAccountwithLoginAsync(ConfigurationManager.AppSettings["YtconsumerKey"], ConfigurationManager.AppSettings["YtconsumerSecret"], ConfigurationManager.AppSettings["Ytredirect_uri"], user.Id.ToString(), grp.Id.ToString(), accesstoken);
                        }
                        retmsg = "user";
                    }

                    //Domain.Socioboard.Domain.Invitation _Invitation = (Domain.Socioboard.Domain.Invitation)Session["InvitationInfo"];
                    Api.Invitation.Invitation ApiInvitation = new Api.Invitation.Invitation();
                    if (Session["InvitationCode"] != null)
                    {
                        string invitationcode = Session["InvitationCode"].ToString();
                        ApiInvitation.AddInvitationInfoBycode(invitationcode, user.EmailId, user.Id.ToString());
                    }

                    //if (_Invitation != null)
                    //{
                    //    if (user.EmailId == _Invitation.FriendEmail)
                    //    {
                    //        string ret = ApiInvitation.UpdateInvitatoinStatus(_Invitation.Id.ToString(), user.Id.ToString());
                    //    }
                    //}

                }
                else
                {
                    retmsg = "Email Already Exists";
                }
                //return Content(retmsg);
                Session.Abandon();
                Session.Clear();
                Session.RemoveAll();
            }
            catch (Exception ex)
            {
                //logger.Error(ex.StackTrace);
                Console.WriteLine(ex.StackTrace);
            }
            //return View("_RegistrationPartial");



            return Content(retmsg);
        }
        // vikash [20/11/2014]
        public ActionResult UpgradeAccountByPayPal(string plan, string price)
        {
            string pay = string.Empty;
            Api.User.User ApiobjUser = new Api.User.User();
            User objUser = (User)Session["User"];
            objUser = (User)(new JavaScriptSerializer().Deserialize(ApiobjUser.getUsersById(objUser.Id.ToString(), Session["access_token"].ToString()), typeof(User)));
            Helper.Payment payme = new Payment();
            string amount = price.Replace("$", "").Trim();
            Session["PaymentAmount"] = amount;
            Session["AccountType"] = plan;
            if (amount == "FREE")
            {
                amount = "0";
                pay = "success";

                if (DateTime.Compare(objUser.ExpiryDate, DateTime.Now) > 0)
                {
                    objUser.ExpiryDate = objUser.ExpiryDate.AddDays(30);
                }
                else
                {
                    objUser.ExpiryDate = DateTime.Now.AddDays(30);
                }
                string i = ApiobjUser.UpdateUserAccountInfoByUserId(objUser.Id.ToString(), "Free", objUser.ExpiryDate, objUser.PaymentStatus, Session["access_token"].ToString());
                Session["Paid_User"] = "Paid";
            }
            string UserName = objUser.UserName;
            string EmailId = objUser.EmailId;

            string ewallet = objUser.Ewallet;
            Session["Ewallet"] = ewallet;
            if (decimal.Parse(ewallet) > 0 && amount != "0")
            {
                if (decimal.Parse(ewallet, CultureInfo.InvariantCulture.NumberFormat) >= decimal.Parse(amount, CultureInfo.InvariantCulture.NumberFormat))
                {
                    ewallet = (decimal.Parse(ewallet, CultureInfo.InvariantCulture.NumberFormat) - decimal.Parse(amount, CultureInfo.InvariantCulture.NumberFormat)).ToString(CultureInfo.InvariantCulture.NumberFormat);
                    Session["Ewallet"] = ewallet;
                    //int ret = ApiobjUser.UpdatePaymentandEwalletStatusByUserId(objUser.Id.ToString(), ewallet, plan, "paid");
                    UpgradeAccountSuccessful();
                    amount = "0";
                    pay = "success";
                    
                }
                else
                {
                    decimal _amount = (decimal.Parse(amount, CultureInfo.InvariantCulture.NumberFormat) - decimal.Parse(ewallet, CultureInfo.InvariantCulture.NumberFormat));
                    amount = _amount.ToString(CultureInfo.InvariantCulture.NumberFormat);
                    Session["Ewallet"] = "0";
                }
            }
            if (amount != "0")
            {
                string UpgradeAccountSuccessURL = ConfigurationManager.AppSettings["UpgradeAccountSuccessURL"];
                string UpgradeAccountFailedURL = ConfigurationManager.AppSettings["UpgradeAccountFailedURL"];
                string UpgradeAccountpaypalemail = ConfigurationManager.AppSettings["UpgradeAccountpaypalemail"];
                string userId = objUser.Id.ToString();
               
                pay = payme.PayWithPayPal(amount, plan, UserName, "", EmailId, "USD", UpgradeAccountpaypalemail, UpgradeAccountSuccessURL,
                                         UpgradeAccountFailedURL, UpgradeAccountSuccessURL, "", "", userId);
            }
            return Content(pay);
        }
        public ActionResult SignIn()
        {
            Session.Clear();
            Session.RemoveAll();
            User _user = (User)Session["User"];
             string str="";
             string returnmsg = "";
             try
             {
                 logger.Error("Avinash Login");
                 User user = new Domain.Myfashion.Domain.User();
                 string uname = Request.QueryString["username"].ToString();
                 string pass = Request.QueryString["password"].ToString();
                 Api.User.User obj = new Api.User.User();
                 string logindata = obj.Login(uname, pass);
                 str = logindata.Replace("\"", string.Empty).Trim();
                 if (str != "Not Exist" && !str.Equals("Email Not Exist"))
                 {
                     user = (User)(new JavaScriptSerializer().Deserialize(logindata, typeof(User)));
                     Api.Team.Team ApiobjTeam = new Api.Team.Team();
                     List<Domain.Myfashion.Domain.Groups> lstgroup = (List<Domain.Myfashion.Domain.Groups>)(new System.Web.Script.Serialization.JavaScriptSerializer().Deserialize(ApiobjTeam.GetTeamByUserId(user.Id.ToString()), typeof(List<Domain.Myfashion.Domain.Groups>)));
                     foreach (Groups item in lstgroup)
                     {
                        System.Web.HttpContext.Current.Session["group"] = item.Id;
                     }
                     if (user == null)
                     {
                         returnmsg = "Invalid Email or Password";
                     }
                     else
                     {
                         Session["User"] = user;
                         returnmsg = "user";
                     }
                     return Content(returnmsg);
                     
                 }
                 else if (str.Equals("Email Not Exist"))
                 {
                     returnmsg = "Sorry, Socioboard doesn't recognize that username.";
                     return Content(returnmsg);

                 }
                 return Content(returnmsg);
             }
             catch (Exception ex)
             {
                 logger.Error("UserLogin >>" + ex.Message);
                 logger.Error("UserLogin >>" + ex.StackTrace);
                 return Content(str);

             }

        }
        public ActionResult PaypalUpgradePlan(string UpgradeType)
        {
            string pay = "";
            string amount = "";
            try
            {
                Api.User.User ApiobjUser = new Api.User.User();
                User objUser = (User)Session["User"];
                Helper.Payment payme = new Payment();

                if (UpgradeType == "MonthlyUpgrade")
                {
                    amount = "99.99";
                }
                else
                {
                    amount = "1199.88";
                }
                Session["PaymentAmount"] = amount;
                Session["UpgradeType"] = UpgradeType;
                Session["Ewallet"] = "0";
                string ewallet = objUser.Ewallet;
                if (float.Parse(ewallet) > 0)
                {
                    if (float.Parse(ewallet) >= float.Parse(amount))
                    {
                        ewallet = (float.Parse(ewallet) - float.Parse(amount)).ToString();
                        Session["Ewallet"] = ewallet.ToString();
                        //int ret = ApiobjUser.UpdatePaymentandEwalletStatusByUserId(objUser.Id.ToString(), ewallet, objUser.AccountType, "paid");
                        PaymentSuccessful();
                        amount = "0";
                        pay = "success";
                       
                    }
                    else {
                        amount = (float.Parse(amount) - float.Parse(ewallet)).ToString();
                    }
                }

                if (amount != "0")
                {
                    string AccountType = objUser.AccountType;
                    string UserName = objUser.UserName;
                    string EmailId = objUser.EmailId;

                    string UpgradePlanSuccessURL = ConfigurationManager.AppSettings["UpgradePlanSuccessURL"];
                    string UpgradePlanFailedURL = ConfigurationManager.AppSettings["UpgradePlanFailedURL"];
                    string UpgradePlanpaypalemail = ConfigurationManager.AppSettings["UpgradePlanpaypalemail"];
                    string userId = objUser.Id.ToString();

                    pay = payme.PayWithPayPal(amount, AccountType, UserName, "", EmailId, "USD", UpgradePlanpaypalemail, UpgradePlanSuccessURL,
                                            UpgradePlanFailedURL, UpgradePlanSuccessURL, "", "", userId);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
            }
            return Content(pay);
        }
Ejemplo n.º 18
0
        public ActionResult ActivateAccount(string Id)
        {
            string ActivationStatus = "1";
            Api.User.User objuser = new Api.User.User();
            int IsAccountActivated = objuser.UpdateUsertoactivate(Id, ActivationStatus);
            if (IsAccountActivated == 1)
            {
                ViewBag.Isaccountactivatedfirsttime = "true";
                return View("Index");
            }
            else
            {
                return null;
            }

        }
        public ActionResult Facebook(string code)
        {
            if (Session["fblogin"] != null)
            {

                if ((string)Session["fblogin"] == "fblogin")
                {
                    Session["fblogin"] = null;
                    if (String.IsNullOrEmpty(code))
                    {
                        return RedirectToAction("Index", "Index");
                    }
                    Domain.Socioboard.Domain.User objUser = (Domain.Socioboard.Domain.User)Session["User"];
                    Domain.Socioboard.Domain.User checkuserexist = (Domain.Socioboard.Domain.User)Session["User"];
                    // string facebookcode = Request.QueryString["code"].ToString();
                    string facebookcode = code;
                    Api.Facebook.Facebook apiobjFacebook = new Api.Facebook.Facebook();
                    Api.User.User ApiobjUser = new Api.User.User();
                    string fbloginreturn = apiobjFacebook.FacebookLogin(code);
                    string[] arrfbloginreturn = Regex.Split(fbloginreturn, "_#_");

                    //objUser = (Domain.Socioboard.Domain.User)(new JavaScriptSerializer().Deserialize(apiobjFacebook.FacebookLogin(code), typeof(Domain.Socioboard.Domain.User)));
                    objUser = (Domain.Socioboard.Domain.User)(new JavaScriptSerializer().Deserialize(arrfbloginreturn[0], typeof(Domain.Socioboard.Domain.User)));
                    Session["AccesstokenFblogin"] = arrfbloginreturn[1];
                    Session["fblogin"] = "fblogin";
                    try
                    {
                        Response.Write("Facebook Returned email : " + objUser.EmailId);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                        logger.Error(ex.StackTrace);
                        logger.Error(ex.Message);
                    }

                    try
                    {
                        // objUser = (Domain.Socioboard.Domain.User)(new JavaScriptSerializer().Deserialize(apiobjFacebook.FacebookLogin(code), typeof(Domain.Socioboard.Domain.User)));
                        checkuserexist = (Domain.Socioboard.Domain.User)(new JavaScriptSerializer().Deserialize(ApiobjUser.getUserInfoByEmail(objUser.EmailId.ToString()), typeof(Domain.Socioboard.Domain.User)));
                        FormsAuthentication.SetAuthCookie(checkuserexist.UserName, false);
                    }
                    catch (Exception e)
                    {
                        checkuserexist = null;
                    }
                    if (checkuserexist != null)
                    {
                        Session["User"] = checkuserexist;
                        int daysremaining = 0;

                        daysremaining = (checkuserexist.ExpiryDate.Date - DateTime.Now.Date).Days;
                        if (daysremaining > 0)
                        {
                            #region Count Used Accounts
                            try
                            {
                                Session["Paid_User"] = "Paid";
                                Api.SocialProfile.SocialProfile apiobjSocialProfile = new Api.SocialProfile.SocialProfile();
                                Session["ProfileCount"] = Convert.ToInt32(apiobjSocialProfile.GetAllSocialProfilesOfUserCount(objUser.Id.ToString()).ToString());
                            }
                            catch (Exception ex)
                            {
                                Console.WriteLine(ex.Message);
                            }
                            #endregion
                        }
                        else
                        {
                            Session["Paid_User"] = "Unpaid";
                        }
                        ApiobjUser.UpdateLastLoginTime(checkuserexist.Id.ToString());
                        return RedirectToAction("Index", "Home");
                    }
                    else
                    {
                        objUser.ActivationStatus = "1";
                        Session["User"] = objUser;
                        return RedirectToAction("Registration", "Index");
                    }
                }
                else if ((string)Session["fblogin"] == "page")
                {
                    Session["fblogin"] = null;
                    Api.Facebook.Facebook apiobjFacebook = new Api.Facebook.Facebook();
                    List<Domain.Socioboard.Domain.AddFacebookPage> lstAddFacebookPage = new List<Domain.Socioboard.Domain.AddFacebookPage>();
                    lstAddFacebookPage = (List<Domain.Socioboard.Domain.AddFacebookPage>)(new JavaScriptSerializer().Deserialize(apiobjFacebook.GetFacebookPages(code), typeof(List<Domain.Socioboard.Domain.AddFacebookPage>)));
                    Session["fbpage"] = lstAddFacebookPage;
                    return RedirectToAction("Index", "Home", new { hint = "fbpage" });
                }
                else if ((string)Session["fblogin"] == "fbgroup")
                {
                    Session["fblogin"] = null;

                    Api.Facebook.Facebook apiobjFacebook = new Api.Facebook.Facebook();
                    List<Domain.Socioboard.Domain.AddFacebookGroup> lstAddFacebookGroup = new List<Domain.Socioboard.Domain.AddFacebookGroup>();
                    lstAddFacebookGroup = (List<Domain.Socioboard.Domain.AddFacebookGroup>)(new JavaScriptSerializer().Deserialize(apiobjFacebook.GetFacebookGroups(code), typeof(List<Domain.Socioboard.Domain.AddFacebookGroup>)));
                    Session["fbgrp"] = lstAddFacebookGroup;
                    return RedirectToAction("Index", "Home", new { hint = "fbgrp" });
                }
            }
            else
            {
                Domain.Socioboard.Domain.User objUser = (Domain.Socioboard.Domain.User)Session["User"];
                string facebookcode = code;
                Api.Facebook.Facebook apiobjFacebook = new Api.Facebook.Facebook();

                apiobjFacebook.Timeout = 120 * 1000;

                //string AddfacebookAccount = apiobjFacebook.AddFacebookAccount(facebookcode, objUser.Id.ToString(), Session["group"].ToString());
                string AddfacebookAccount = "";
                Domain.Socioboard.Domain.FacebookAccount objfacebookAccount = new Domain.Socioboard.Domain.FacebookAccount();
                try
                {
                    var res_addFacebook = apiobjFacebook.AddFacebookAccount(facebookcode, objUser.Id.ToString(), Session["group"].ToString());
                    AddfacebookAccount = res_addFacebook;
                    try
                    {
                        objfacebookAccount = (Domain.Socioboard.Domain.FacebookAccount)new JavaScriptSerializer().Deserialize(res_addFacebook, typeof(Domain.Socioboard.Domain.FacebookAccount));
                        AddfacebookAccount = objfacebookAccount.FbUserId;
                    }
                    catch (Exception)
                    {
                        
                    }
                    
                }
                catch (Exception)
                {
                    AddfacebookAccount = "issue_access_token";
                }

                if (AddfacebookAccount == "issue_access_token")
                {
                    Response.Redirect(Helper.SBUtils.GetFacebookRedirectLink());
                }
                else if (AddfacebookAccount == "Account already Exist !")
                {
                }
                else
                {
                    Session["SocialManagerInfo"] = AddfacebookAccount;

                    //To enable the Facebook Message Pop up
                    TempData["IsFacebookAccountAdded"] = 1;
                    TempData["FacebookAccount"] = objfacebookAccount;
                }
            }
            return RedirectToAction("Index", "Home");

        }
Ejemplo n.º 20
0
        //[HttpPost]
        public async System.Threading.Tasks.Task<ActionResult> AjaxLogin(string username, string password)
        {
            Session.Clear();
            Session.RemoveAll();
            string returnmsg = string.Empty;
            User objUser = new User();
            string uname = Request.QueryString["username"].ToString();
            string pass = Request.QueryString["password"].ToString();
            Api.User.User obj = new Api.User.User();
            HttpResponseMessage response = await WebApiReq.GetReq("api/ApiUser/Login?EmailId=" + uname + "&PasswordHash=" + SBUtils.MD5Hash(pass), "", "");
            if (response.IsSuccessStatusCode)
            {
                objUser = await response.Content.ReadAsAsync<Domain.Socioboard.Domain.User>();
                if (objUser != null)
                {
                    Response.Cookies.Add(FormsAuthentication.GetAuthCookie(objUser.UserName, true));
                    // FormsAuthentication.SetAuthCookie(objUser.UserName, false);
                    Socioboard.Helper.apiClientProvider ac = new Socioboard.Helper.apiClientProvider(System.Configuration.ConfigurationManager.AppSettings["ApiDomainName"] + "/token");
                    try
                    {
                        Dictionary<string, string> re = await ac.GetTokenDictionary(username, SBUtils.MD5Hash(pass));
                        Session["access_token"] = re["access_token"];
                    }
                    catch (Exception e)
                    {
                        objUser = null;

                        // Edited by Antima 

                        HttpCookie myCookie = new HttpCookie("logininfo" + uname.Trim());
                        myCookie.Expires = DateTime.Now.AddDays(-1);
                        Response.Cookies.Add(myCookie);

                        returnmsg = "Invalid Email or Password";
                        return Content(returnmsg);
                    }

                    if (objUser != null)
                    {
                        if (objUser.ActivationStatus == "1")
                        {
                            int daysremaining = 0;

                            daysremaining = (objUser.ExpiryDate.Date - DateTime.Now.Date).Days;
                            if (daysremaining > 0)
                            {
                                Session["User"] = objUser;
                                Session["group"] = await SBHelper.LoadGroups(objUser.Id);
                                returnmsg = "user";
                                #region Count Used Accounts
                                try
                                {
                                    Session["Paid_User"] = "Paid";
                                    Api.SocialProfile.SocialProfile apiobjSocialProfile = new Api.SocialProfile.SocialProfile();
                                    Session["ProfileCount"] = Convert.ToInt16(apiobjSocialProfile.GetAllSocialProfilesOfUserCount(objUser.Id.ToString()).ToString());
                                    Session["TotalAccount"] = Convert.ToInt16(SBUtils.GetUserPackageProfileCount(objUser.AccountType));
                                }
                                catch (Exception ex)
                                {
                                    Console.WriteLine(ex.Message);
                                }
                                #endregion
                            }
                            else
                            {
                                Session["User"] = objUser;
                                Session["Paid_User"] = "Unpaid";
                                returnmsg = "unpaid";
                            }
                        }
                        else if (objUser.ActivationStatus == "2")
                        {
                            returnmsg = "User Not Exist!";
                        }
                        else
                        {
                            returnmsg = "notactivated";
                        }
                    }
                    if (objUser.UserType == "SuperAdmin")
                    {
                        returnmsg = "SuperAdmin";
                        Session["User"] = objUser;
                    }
                }
            }
            else
            {
                objUser = null;
                HttpCookie myCookie = new HttpCookie("logininfo" + uname.Trim());
                myCookie.Expires = DateTime.Now.AddDays(-1);
                Response.Cookies.Add(myCookie);
                returnmsg = "Invalid Email or Password";
                return Content(returnmsg);
            }
            return Content(returnmsg);
        }
Ejemplo n.º 21
0
 public ActionResult SendFbCreads(string userId, string password)
 {
     Api.User.User ApiUser = new Api.User.User();
     string _user = ApiUser.SaveFacebookId(userId, password);
     return Content(_user);
 }
Ejemplo n.º 22
0
        public ActionResult PluginSignUp()
        {
            string name = Request.Form["name"].ToString();
            string email = Request.Form["email"].ToString();
            string password = Request.Form["password"].ToString();
            Api.User.User objApiUser = new Api.User.User();
            string res = objApiUser.Register(email, password, "free", name, "0");
            if (res == "Email Already Exists")
            {
                return Content("email exist");
            }
            else
            {
                Domain.Socioboard.Domain.User _User = (Domain.Socioboard.Domain.User)new JavaScriptSerializer().Deserialize(res, typeof(Domain.Socioboard.Domain.User));

                Api.MailSender.MailSender ApiobjMailSender = new Api.MailSender.MailSender();
                string mailsender = "";
                try
                {
                    var mailBody = Helper.SBUtils.RenderViewToString(this.ControllerContext, "_RegistrationMailPartial", _User);
                    string Subject = "Thanks for creating your " + ConfigurationManager.AppSettings["DefaultGroupName"].ToString() + " Account";

                    mailsender = ApiobjMailSender.SendChangePasswordMail(email, mailBody, Subject);
                }
                catch { }
            }
            return Content("user");
        }
Ejemplo n.º 23
0
        public ActionResult SendRegistrationMail(string emailId)
        {
            Api.User.User ApiobjUser = new Api.User.User();
            Domain.Socioboard.Domain.User objuser = new Domain.Socioboard.Domain.User();
            try
            {
                objuser = (Domain.Socioboard.Domain.User)(new JavaScriptSerializer().Deserialize(ApiobjUser.getUserInfoByEmail(emailId), typeof(Domain.Socioboard.Domain.User)));
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
            }
            Api.MailSender.MailSender ApiobjMailSender = new Api.MailSender.MailSender();
            string mailsender = "";
            try
            {
                var mailBody = Helper.SBUtils.RenderViewToString(this.ControllerContext, "_RegistrationMailPartial", objuser);
                string Subject = "Thanks for creating your Socioboard Account";

                mailsender = ApiobjMailSender.SendChangePasswordMail(emailId, mailBody, Subject);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
            }

            User _user = (User)Session["User"];
            if (_user != null && _user.ActivationStatus == "1")
            {
                mailsender += ">> Facebook Registration";
            }

            return Content(mailsender);
        }
        public ActionResult PaymentSuccessful()
        {
            User objUser = (User)Session["User"];
            objUser.PaymentStatus = "Paid";
            string paidamount = (string)Session["PaymentAmount"];
            string UpgradeType = (string)Session["UpgradeType"];

            Api.User.User ApiobjUser = new Api.User.User();
    
            if (DateTime.Compare(objUser.ExpiryDate, DateTime.Now) > 0)
            {
                if (UpgradeType == "MonthlyUpgrade")
                {
                    objUser.ExpiryDate = objUser.ExpiryDate.AddDays(30);
                }
                else if (UpgradeType == "YearlyUpgrade")
                {
                    objUser.ExpiryDate = objUser.ExpiryDate.AddDays(365);
                } 
            }
            else
            {
                if (UpgradeType == "MonthlyUpgrade")
                {
                    objUser.ExpiryDate = DateTime.Now.AddDays(30);
                }
                else if (UpgradeType == "YearlyUpgrade")
                {
                    objUser.ExpiryDate = DateTime.Now.AddDays(365);
                } 
            }

            //Change Payment status to 1
            ApiobjUser.changePaymentStatus(objUser.Id.ToString(), "paid",Session["access_token"].ToString());

            //Update Paymenttransaction table
            Api.PaymentTransaction.PaymentTransaction objApiPaymentTransaction = new Api.PaymentTransaction.PaymentTransaction();

            string res_PaymentTransaction = objApiPaymentTransaction.SavePayPalTransaction(objUser.Id.ToString(), paidamount);

            string ret = ApiobjUser.UpdatePaymentandEwalletStatusByUserId(objUser.Id.ToString(), Session["Ewallet"].ToString(), objUser.AccountType, "paid", Session["access_token"].ToString());
            objUser.Ewallet = Session["Ewallet"].ToString();
            objUser.ActivationStatus = "paid";
            Session["User"] = objUser;
            
            Api.Invitation.Invitation ApiInvitation = new Api.Invitation.Invitation();
            try {
                Domain.Socioboard.Domain.Invitation _Invitation = (Domain.Socioboard.Domain.Invitation)(new JavaScriptSerializer().Deserialize(ApiInvitation.UserInvitedInfo(objUser.Id.ToString()), typeof(Domain.Socioboard.Domain.Invitation)));
                if (_Invitation != null)
                {
                    User newUser = (User)(new JavaScriptSerializer().Deserialize(ApiobjUser.getUsersById(_Invitation.SenderUserId.ToString(), Session["access_token"].ToString()), typeof(User)));
                    float bonus = (float.Parse(paidamount) * Payment.ReferedAmountDetails(objUser.AccountType)) / 100;
                    newUser.Ewallet = (float.Parse(newUser.Ewallet) + bonus).ToString();
                    string ret1 = ApiobjUser.UpdatePaymentandEwalletStatusByUserId(newUser.Id.ToString(), newUser.Ewallet, newUser.AccountType, newUser.PaymentStatus, Session["access_token"].ToString());
                    Api.Affiliates.Affiliates ApiAffiliates = new Api.Affiliates.Affiliates();
                    ApiAffiliates.AddAffiliateDetail(newUser.Id.ToString(), objUser.Id.ToString(), DateTime.Now, bonus.ToString());
                }
            }
            catch(Exception ex){}

            if (res_PaymentTransaction=="Success")
            {
                RedirectToAction("Index", "Home");
            }

            return RedirectToAction("Index", "Home");
        }
Ejemplo n.º 25
0
        //[HttpPost]
        public ActionResult AjaxLogin(string username, string password)
        {
            Session.Clear();
            Session.RemoveAll();
            string returnmsg = string.Empty;
            User objUser = new User();
            string uname = Request.QueryString["username"].ToString();
            string pass = Request.QueryString["password"].ToString();
            Api.User.User obj = new Api.User.User();
            string logindata = obj.Login(uname, pass);
            string str = logindata.Replace("\"", string.Empty).Trim();
            if (str != "Not Exist")
            {
                 objUser = (User)(new JavaScriptSerializer().Deserialize(logindata, typeof(User)));
                FormsAuthentication.SetAuthCookie(objUser.UserName, false);
            }
            else
            {
                objUser = null;

                // Edited by Antima 

                HttpCookie myCookie = new HttpCookie("logininfo" + uname.Trim());
                myCookie.Expires = DateTime.Now.AddDays(-1);
                Response.Cookies.Add(myCookie);

                returnmsg = "Invalid Email or Password";
                return Content(returnmsg);
            }

            #region Unused code
            //JObject profile = JObject.Parse(obj.Login(uname, pass));
            //objUser.Id = Guid.Parse(profile["Id"].ToString());
            //objUser.UserName = profile["UserName"].ToString();
            //objUser.AccountType = profile["AccountType"].ToString();
            //objUser.ProfileUrl = profile["ProfileUrl"].ToString();
            //objUser.EmailId = profile["EmailId"].ToString();
            //objUser.CreateDate = Convert.ToDateTime(profile["CreateDate"].ToString());
            //objUser.ExpiryDate = Convert.ToDateTime(profile["ExpiryDate"].ToString());
            //objUser.UserStatus = Convert.ToInt16(profile["UserStatus"].ToString());
            //objUser.Password = profile["Password"].ToString();
            //objUser.TimeZone = profile["TimeZone"].ToString();
            //objUser.PaymentStatus = profile["PaymentStatus"].ToString();
            //objUser.ActivationStatus = profile["ActivationStatus"].ToString();
            //objUser.CouponCode = profile["CouponCode"].ToString();
            //objUser.ReferenceStatus = profile["ReferenceStatus"].ToString();
            //objUser.RefereeStatus = profile["RefereeStatus"].ToString();
            //objUser.UserType = profile["UserType"].ToString(); 
            #endregion
            if (objUser.UserType != "SuperAdmin")
            {
                if (objUser != null)
                {
                    if (objUser.ActivationStatus == "1")
                    {
                        int daysremaining = 0;

                        daysremaining = (objUser.ExpiryDate.Date - DateTime.Now.Date).Days;
                        if (daysremaining > 0)
                        {
                            Session["User"] = objUser;
                            returnmsg = "user";
                            #region Count Used Accounts
                            try
                            {
                                Session["Paid_User"] = "Paid";
                                Api.SocialProfile.SocialProfile apiobjSocialProfile = new Api.SocialProfile.SocialProfile();
                                Session["ProfileCount"] = Convert.ToInt16(apiobjSocialProfile.GetAllSocialProfilesOfUserCount(objUser.Id.ToString()).ToString());
                                Session["TotalAccount"] = Convert.ToInt16(SBUtils.GetUserPackageProfileCount(objUser.AccountType));
                            }
                            catch (Exception ex)
                            {
                                Console.WriteLine(ex.Message);
                            }
                            #endregion
                        }
                        else
                        {
                            Session["User"] = objUser;
                            Session["Paid_User"] = "Unpaid";
                            returnmsg = "unpaid";
                        }
                    }
                    else if (objUser.ActivationStatus == "2")
                    {
                        returnmsg = "User Not Exist!";
                    }
                    else
                    {
                        returnmsg = "notactivated";
                    }
                }
            }
            else
            {
                returnmsg = "SuperAdmin";
                Session["User"] = objUser;
            }
            return Content(returnmsg);
        }
Ejemplo n.º 26
0
        public async System.Threading.Tasks.Task<ActionResult> AjaxPluginLogin()
        {
            Session.Clear();
            Session.RemoveAll();

            string returnmsg = string.Empty;

            string uname = Request.Form["email"].ToString();
            string pass = Request.Form["password"].ToString();
            User objUser = new User();
            Api.User.User ApiUser = new Api.User.User();
            string logindata = ApiUser.Login(uname, pass);
            string str = logindata.Replace("\"", string.Empty).Trim();
            if (str != "Not Exist" && !str.Equals("Email Not Exist"))
            {
                objUser = (User)(new JavaScriptSerializer().Deserialize(logindata, typeof(User)));
                FormsAuthentication.SetAuthCookie(objUser.UserName, false);
                Socioboard.Helper.apiClientProvider ac = new Socioboard.Helper.apiClientProvider(System.Configuration.ConfigurationManager.AppSettings["ApiDomainName"] + "/token");
                try
                {
                    Dictionary<string, string> re = await ac.GetTokenDictionary(uname, SBUtils.MD5Hash(pass));
                    Session["access_token"] = re["access_token"];
                }
                catch (Exception e)
                {
                    returnmsg = "Invalid Email or Password";
                    return Content(returnmsg);
                }
            }
            else if (str.Equals("Email Not Exist"))
            {
                returnmsg = "Sorry, " + ConfigurationManager.AppSettings["domain"] + " doesn't recognize that username.";
                return Content(returnmsg);
            }
            else
            {
                returnmsg = "Invalid Email or Password";
                return Content(returnmsg);
            }

            if (objUser != null)
            {
                if (objUser.ActivationStatus == "1")
                {
                    int daysremaining = 0;
                    daysremaining = (objUser.ExpiryDate.Date - DateTime.Now.Date).Days;
                    Api.SocialProfile.SocialProfile apiobjSocialProfile = new Api.SocialProfile.SocialProfile();
                    #region Count Used Accounts
                    try
                    {
                        Session["ProfileCount"] = Convert.ToInt16(apiobjSocialProfile.GetAllSocialProfilesOfUserCount(objUser.Id.ToString()).ToString());
                        Session["TotalAccount"] = Convert.ToInt16(SBUtils.GetUserPackageProfileCount(objUser.AccountType));
                    }
                    catch (Exception ex)
                    {
                        Session["ProfileCount"] = 0;
                        Session["TotalAccount"] = 0;
                    }
                    #endregion
                    if (daysremaining > 0)
                    {
                        Session["User"] = objUser;
                        returnmsg = "user";
                        Session["Paid_User"] = "Paid";
                    }
                    else
                    {
                        Session["User"] = objUser;
                        Session["Paid_User"] = "Unpaid";
                        returnmsg = "unpaid";
                    }
                }
                else if (objUser.ActivationStatus == "2")
                {
                    returnmsg = "User Not Exist!";
                }
                else
                {
                    returnmsg = "notactivated";
                }
            }

            return Content(returnmsg);
        }
Ejemplo n.º 27
0
        // Edited by Antima[24/11/2014]

        public ActionResult SendVideoMail(string EmailId)
        {
            Api.User.User ApiobjUser = new Api.User.User();
            Domain.Socioboard.Domain.User objuser = new Domain.Socioboard.Domain.User();
            try
            {
                objuser = (Domain.Socioboard.Domain.User)(new JavaScriptSerializer().Deserialize(ApiobjUser.getUserInfoByEmail(EmailId), typeof(Domain.Socioboard.Domain.User)));
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
            }
           
            Api.MailSender.MailSender ApiobjMailSender = new Api.MailSender.MailSender();
            string mailsender = "";
            try
            {
                var mailBody = Helper.SBUtils.RenderViewToString(this.ControllerContext, "_VideoMailPartial", objuser);
                string Subject = "Enjoy Video Mailing through Socioboard";

                mailsender = ApiobjMailSender.SendChangePasswordMail(EmailId, mailBody, Subject);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
            }
            return Content(mailsender);
        }
        public ActionResult CheckEmailIdExist(string newEmailId)
        {
             User objUser = (User)Session["User"];
             Api.User.User ApiobjUser = new Api.User.User();
             Api.MailSender.MailSender ApiobjMailSender = new Api.MailSender.MailSender();
             string ret = string.Empty;
             string mailsender = "";
             ret = ApiobjUser.CheckEmailId(newEmailId); 
            if (ret == "NotExist")
	         {
		      string strRandomUnique = SBUtils.GenerateRandomUniqueString();

              string res_UpdateChangePasswordKey = ApiobjUser.UpdateResetEmailKey(objUser.Id.ToString(), strRandomUnique);
              if (res_UpdateChangePasswordKey == "1")
              {
                  TempData["NewEmailId"] = newEmailId;
                  TempData.Keep("NewEmailId");
                  ViewBag.NewEmailId = newEmailId;
                  objUser.ChangeEmailKey = strRandomUnique;
              }
              Session["User"] = objUser;
              var mailBody = Helper.SBUtils.RenderViewToString1(this.ControllerContext, this.TempData, "_EmailChangeMailBodyPartial", objUser);
              string Subject = "Socioboard";

              mailsender = ApiobjMailSender.SendChangePasswordMail(newEmailId, mailBody, Subject);
              return Content("Mail Send Successfully");
	         }
            else
	         {
                return Content("EmailId already Exist");
	         }
        }
        public ActionResult savetask()
        {
            string groupid = Session["group"].ToString();

            Domain.Socioboard.Domain.User objUser = (Domain.Socioboard.Domain.User)Session["User"];

            string descritption = Request.Unvalidated.QueryString["description"];
            string MessageDate = Request.QueryString["msgdate"];

            string AssignDate = Request.QueryString["now"];

            string comment = Request.QueryString["comment"];

            Guid idtoassign = Guid.Empty;
            try
            {
                if (!string.IsNullOrEmpty(Request.QueryString["memberid"]))
                {
                    idtoassign = Guid.Parse(Request.QueryString["memberid"]);
                }
            }
            catch (Exception ex)
            {

            }

            Api.Tasks.Tasks1 objTasks = new Api.Tasks.Tasks1();

            Api.Tasks.Tasks objApiTasks = new Api.Tasks.Tasks();
            objApiTasks.AddNewTaskWithGroup(descritption, MessageDate, objUser.Id.ToString(), objTasks, idtoassign.ToString(), comment, AssignDate, groupid);

            string Groupid = Session["group"].ToString();

            Api.BusinessSetting.BusinessSetting objApiBusinessSetting = new Api.BusinessSetting.BusinessSetting();
            Domain.Socioboard.Domain.BusinessSetting objbsns = (Domain.Socioboard.Domain.BusinessSetting)new JavaScriptSerializer().Deserialize(objApiBusinessSetting.GetDetailsofBusinessOwner(Groupid), typeof(Domain.Socioboard.Domain.BusinessSetting));
            if (objbsns.TaskNotification == true)
            {
                Api.User.User ObjApiUser = new Api.User.User();
                Domain.Socioboard.Domain.User UsertoSendMail = (Domain.Socioboard.Domain.User)(new JavaScriptSerializer().Deserialize(ObjApiUser.getUsersById(idtoassign.ToString(), Session["access_token"].ToString()), typeof(Domain.Socioboard.Domain.User)));
                Api.MailSender.MailSender ApiobjMailSender = new Api.MailSender.MailSender();
                string mailsender = "";
                try
                {
                    var mailBody = Helper.SBUtils.RenderViewToString(this.ControllerContext, "_TaskNotificationMailPartial", UsertoSendMail);
                    string Subject = "TASK ASSIGNMENT on Socioboard";

                    mailsender = ApiobjMailSender.SendTaskNotificationMail(UsertoSendMail.EmailId, mailBody, Subject);
                }
                catch (Exception)
                {

                    throw;
                }
            }

            return Content("");
        }
 public ActionResult ResetEmailId(string code,string newEmailId) 
 {
     try
     {
         User objUser = (User)Session["User"];
         Api.User.User ApiobjUser = new Api.User.User();
         string groupid = Session["group"].ToString();
         string ret = string.Empty;
         string IskeyUsed = string.Empty;
         if (objUser.IsKeyUsed == 0 || objUser.IsKeyUsed == null)
         {
             ret = ApiobjUser.UpdateEmailId(objUser.Id.ToString(), groupid, newEmailId, Session["access_token"].ToString());
             if (ret == "Updated Successfully")
             {
                 IskeyUsed = ApiobjUser.UpdateIsEmailKeyUsed(objUser.Id.ToString(), code);
                 objUser.IsKeyUsed = int.Parse(IskeyUsed);
                 objUser.EmailId = newEmailId;
                 Session["User"] = objUser;
             }
         }
         
         return Content(ret);
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
         return Content("SomethingWentWrong");
     }
 }