public List<UserPackageRelation> getAllUserPackageRelationByUserId(User objuser)
        {
            List<UserPackageRelation> alstFBAccounts = null;
            try
            {
                using (NHibernate.ISession session = SessionFactory.GetNewSession())
                {
                    using (NHibernate.ITransaction transaction = session.BeginTransaction())
                    {
                        try
                        {
                            alstFBAccounts = session.CreateQuery("from  UserPackageRelation  where UserId = : UserId")
                            .SetParameter("UserId", objuser.Id)
                            .List<UserPackageRelation>().ToList<UserPackageRelation>();
                        }
                        catch (Exception ex)
                        {
                            logger.Error("Error : " + ex.StackTrace);
                            Console.WriteLine("Error : " + ex.StackTrace);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Error("Error : " + ex.StackTrace);
                Console.WriteLine("Error : " + ex.StackTrace);
            }

            return alstFBAccounts;
        }
Esempio n. 2
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"));
        }
Esempio n. 3
0
        public string getUsersById(string UserId)
        {
            Domain.Socioboard.Domain.User objUser = new Domain.Socioboard.Domain.User();
            objUser = userrepo.getUsersById(Guid.Parse(UserId));

            return(new JavaScriptSerializer().Serialize(objUser));
        }
Esempio n. 4
0
        private static Domain.Socioboard.Domain.Groups AddGroupByUserId(Guid userId)
        {
            Domain.Socioboard.Domain.Groups groups    = new Domain.Socioboard.Domain.Groups();
            GroupsRepository       objGroupRepository = new GroupsRepository();
            UserRepository         userRepo           = new UserRepository();
            GroupMembersRepository grpMemberRepo      = new GroupMembersRepository();

            groups.Id        = Guid.NewGuid();
            groups.GroupName = ConfigurationManager.AppSettings["DefaultGroupName"];
            groups.UserId    = userId;
            groups.EntryDate = DateTime.UtcNow;

            objGroupRepository.AddGroup(groups);

            Domain.Socioboard.Domain.User         objUser   = userRepo.getUsersById(groups.UserId);
            Domain.Socioboard.Domain.Groupmembers grpMember = new Domain.Socioboard.Domain.Groupmembers();
            grpMember.Id      = Guid.NewGuid();
            grpMember.Groupid = groups.Id.ToString();
            grpMember.Userid  = groups.UserId.ToString();
            grpMember.Status  = Domain.Socioboard.Domain.GroupUserStatus.Accepted;
            grpMember.Emailid = objUser.EmailId;
            grpMember.IsAdmin = true;
            grpMemberRepo.AddGroupMemeber(grpMember);


            return(groups);
        }
        public string GetAllUsers(string Objuser)
        {
            try
            {
                Domain.Socioboard.Domain.User ObjUser = (Domain.Socioboard.Domain.User)(new JavaScriptSerializer().Deserialize(Objuser, typeof(Domain.Socioboard.Domain.User)));

                if (ObjUser.UserType == "SuperAdmin")
                {
                    List <Domain.Socioboard.Domain.User> lstUser = objUserRepo.getAllUsersByAdmin();
                    if (lstUser != null)
                    {
                        return(new JavaScriptSerializer().Serialize(lstUser));
                    }
                    else
                    {
                        return(new JavaScriptSerializer().Serialize("Not User Found"));
                    }
                }
                else
                {
                    return(new JavaScriptSerializer().Serialize("You have no Authentication to call this method!"));
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
                return(null);
            }
        }
Esempio n. 6
0
        //
        // GET: /AddNewsLatter/

        //public ActionResult ManageAddNewsLatter()
        //{
        //    return View();
        //}
        public ActionResult LoadAddNewsLatter()
        {
            if (Session["User"] != null)
            {
                Domain.Socioboard.Domain.User _User = (Domain.Socioboard.Domain.User)Session["User"];
                if (_User.UserType != "SuperAdmin")
                {
                    return(RedirectToAction("Index", "Index"));
                }
            }
            else
            {
                return(RedirectToAction("Index", "Index"));
            }
            JavaScriptSerializer serializer = new JavaScriptSerializer();

            serializer.MaxJsonLength = 2147483647;

            Domain.Socioboard.Domain.User ObjUser = (Domain.Socioboard.Domain.User)Session["User"];
            string Objuser = (new JavaScriptSerializer().Serialize(ObjUser));

            Api.AdminUserDetails.AdminUserDetails ApiObjuserdetails = new Api.AdminUserDetails.AdminUserDetails();
            List <User> lstUser = (List <User>)(serializer.Deserialize(ApiObjuserdetails.GetAllUsers(Objuser), typeof(List <User>)));

            return(View(lstUser));
        }
Esempio n. 7
0
        public string getUserInfoByEmail(string userEmail)
        {
            Domain.Socioboard.Domain.User objUser = new Domain.Socioboard.Domain.User();
            objUser = userrepo.getUserInfoByEmail(userEmail);

            return(new JavaScriptSerializer().Serialize(objUser));
        }
Esempio n. 8
0
        public ActionResult EditUserDetails(string Id)
        {
            Api.AdminUserDetails.AdminUserDetails ApiobjUser = new Api.AdminUserDetails.AdminUserDetails();
            Domain.Socioboard.Domain.User         user       = (Domain.Socioboard.Domain.User)(new JavaScriptSerializer().Deserialize(ApiobjUser.GetUserById(Id), typeof(Domain.Socioboard.Domain.User)));

            return(View(user));
        }
Esempio n. 9
0
        public string getUserInfoForSocialLogin(string logintype)
        {
            Domain.Socioboard.Domain.User objUser = new Domain.Socioboard.Domain.User();
            objUser = userrepo.getUserInfoForSocialLogin(logintype);

            return(new JavaScriptSerializer().Serialize(objUser));
        }
        public ActionResult UpdateBuisnessSetting(FormCollection ObjFrmcollction)
        {
            Api.BusinessSetting.BusinessSetting      ApiobjAddBusiness  = new Api.BusinessSetting.BusinessSetting();
            Domain.Socioboard.Domain.BusinessSetting ObjbusinessSetting = new Domain.Socioboard.Domain.BusinessSetting();

            string BuisnessName = string.Empty;
            bool   AssignTask;
            bool   TaskNotification;

            BuisnessName     = ObjFrmcollction["BuisnessName"].ToString();
            AssignTask       = Convert.ToBoolean(ObjFrmcollction["IsTaskAssigned"].ToString());
            TaskNotification = Convert.ToBoolean(ObjFrmcollction["IsNotificationEnabled"].ToString());
            var SelectedGroupId = "";

            SelectedGroupId       = ObjFrmcollction["BuisNessId"].ToString();
            ObjbusinessSetting.Id = Guid.Parse(SelectedGroupId);
            Domain.Socioboard.Domain.User ObjUser = (Domain.Socioboard.Domain.User)Session["User"];
            ObjbusinessSetting.UserId           = ObjUser.Id;
            ObjbusinessSetting.GroupId          = Guid.Parse(Session["group"].ToString());
            ObjbusinessSetting.BusinessName     = BuisnessName;
            ObjbusinessSetting.EntryDate        = DateTime.Now;
            ObjbusinessSetting.AssigningTasks   = AssignTask;
            ObjbusinessSetting.TaskNotification = TaskNotification;
            ObjbusinessSetting.FbPhotoUpload    = 0;
            string ObjBsnsstng = (new JavaScriptSerializer().Serialize(ObjbusinessSetting));

            ApiobjAddBusiness.UpdateBuisnessSetting(ObjBsnsstng);
            return(Content("Updated Successfully"));
        }
        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));
        }
Esempio n. 12
0
        public ActionResult NotificationTickets()
        {
            try
            {
                Domain.Socioboard.Domain.User objuser = (Domain.Socioboard.Domain.User)Session["User"];

                DataSet             ds = null;
                clsFeedsAndMessages clsfeedsandmess = new clsFeedsAndMessages();

                ds = clsfeedsandmess.bindMyTickets(objuser.Id);
                if (ds.Tables.Count > 0 && ds != null)
                {
                    return(PartialView("_TicketsNotificationPartial", ds));
                }
                else
                {
                    return(Content("nodata"));
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
                return(Content("SomethingWentWrong"));
            }
        }
        public string GetAllUsers(string Objuser)
        {
            JavaScriptSerializer serializer = new JavaScriptSerializer();

            serializer.MaxJsonLength = 2147483647;
            try
            {
                Domain.Socioboard.Domain.User ObjUser = (Domain.Socioboard.Domain.User)(new JavaScriptSerializer().Deserialize(Objuser, typeof(Domain.Socioboard.Domain.User)));

                if (ObjUser.UserType == "SuperAdmin")
                {
                    List <Domain.Socioboard.Domain.User> lstUser = objUserRepo.getAllUsersByAdmin();
                    if (lstUser.Count > 0)
                    {
                        return(serializer.Serialize(lstUser));
                    }
                    else
                    {
                        return(new JavaScriptSerializer().Serialize(new List <Domain.Socioboard.Domain.User>()));
                    }
                }
                else
                {
                    return(new JavaScriptSerializer().Serialize(new List <Domain.Socioboard.Domain.User>()));
                }
            }
            catch (Exception ex)
            {
                logger.Error("GetAllUsers => " + ex.Message);
                Console.WriteLine(ex.StackTrace);
                return(new JavaScriptSerializer().Serialize(new List <Domain.Socioboard.Domain.User>()));
            }
        }
Esempio n. 14
0
        //public User GetById(int id)
        //{
        //    using (ISession session = NHibernateHelper.OpenSession())
        //    {
        //        User user = session
        //            .CreateCriteria(typeof(User))
        //            .Add(Restrictions.Eq("UserId", id))
        //            .UniqueResult<User>();
        //        return user;
        //    }
        //}
        public static void Update(User user)
        {
            using (NHibernate.ISession session = SessionFactory.GetNewSession())
            {
                using (NHibernate.ITransaction transaction = session.BeginTransaction())
                {
                    try
                    {
                        int i = session.CreateQuery("Update User set ProfileUrl =:profileurl, UserName =: username , EmailId=:emailid,UserStatus=:userstatus,ExpiryDate=:expirydate,TimeZone=:timezone where Id = :twtuserid")
                                  .SetParameter("twtuserid", user.Id)
                                  .SetParameter("profileurl", user.ProfileUrl)
                                  .SetParameter("username", user.UserName)
                                  .SetParameter("emailid", user.EmailId)
                                  .SetParameter("userstatus", user.UserStatus)
                                  .SetParameter("expirydate", user.ExpiryDate)
                                  .SetParameter("timezone", user.TimeZone)
                                  .ExecuteUpdate();
                        transaction.Commit();
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);

                    }


                }
            }
        }
Esempio n. 15
0
        public ActionResult RemainingDays()
        {
            int    daysremaining = 0;
            string remainingday  = string.Empty;

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

            if (Session["days_remaining"] == null)
            {
                if (objUser.PaymentStatus == "unpaid" && objUser.AccountType != "Free")
                {
                    daysremaining = (objUser.ExpiryDate.Date - DateTime.Now.Date).Days;
                    if (daysremaining < 0)
                    {
                        daysremaining = -1;
                    }
                    Session["days_remaining"] = daysremaining;
                    if (daysremaining <= -1)
                    {
                    }
                    else if (daysremaining == 0)
                    {
                        remainingday = "Your trial " + objUser.AccountType.ToString() + " account will expire Today please upgrade to paid plan.";
                    }
                    else
                    {
                        remainingday = "Your trial " + objUser.AccountType.ToString() + " account will expire in " + daysremaining + " days, please upgrade to paid plan.";
                    }
                }
            }

            return(Content(remainingday));
        }
Esempio n. 16
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));
        }
Esempio n. 17
0
        public List <User> getAllUsersByAdmin()
        {
            using (NHibernate.ISession session = SessionFactory.GetNewSession())
            {
                using (NHibernate.ITransaction transaction = session.BeginTransaction())
                {
                    try
                    {
                        List <User> alstUser = session.CreateQuery("from User where Id !=null and ActivationStatus!=2")
                                               .List <User>().ToList <User>();

                        Domain.Socioboard.Domain.User ObjUser = alstUser.Single(U => U.UserType == "SuperAdmin");
                        if (ObjUser != null)
                        {
                            alstUser.Remove(ObjUser);
                        }

                        return(alstUser);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                        return(null);
                    }
                }
            }
        }
Esempio n. 18
0
 public string Login(string EmailId, string Password)
 {
     logger.Error("Checking Abhay123");
     try
     {
         UserRepository userrepo            = new UserRepository();
         Domain.Socioboard.Domain.User user = userrepo.GetUserInfo(EmailId, Utility.MD5Hash(Password));
         if (user != null)
         {
             if (user.UserCode == null || user.UserCode == "")
             {
                 string code   = Utility.GenerateRandomUniqueString();
                 int    retint = userrepo.UpdateCode(user.Id, code);
                 user = userrepo.getUsersById(user.Id);
             }
             return(new JavaScriptSerializer().Serialize(user));
         }
         else
         {
             return(new JavaScriptSerializer().Serialize("Not Exist"));
         }
     }
     catch (Exception ex)
     {
         logger.Error("Error : " + ex.Message);
         logger.Error("Error : " + ex.StackTrace);
         Console.WriteLine(ex.StackTrace);
         return(null);
     }
 }
        public string GetUserDataForDataTable(string user, string iDisplayLength, string iDisplayStart, string iSortCol_0, string sSortDir_0, string sSearch)
        {
            string strUser = string.Empty;

            Domain.Socioboard.Domain.User _User = (Domain.Socioboard.Domain.User) new JavaScriptSerializer().Deserialize(user, typeof(Domain.Socioboard.Domain.User));

            if (_User.UserType == "SuperAdmin")
            {
                int    dispalyLength = Int32.Parse(iDisplayLength);
                int    displayStart  = Int32.Parse(iDisplayStart);
                int    sortCol       = Int32.Parse(iSortCol_0);
                string sortDir       = sSortDir_0;
                string search        = sSearch;


                Domain.Socioboard.Helper.UserDetails _UserDetails = new Domain.Socioboard.Helper.UserDetails();
                _UserDetails = objUserRepo.GetUserDataForDataTable(dispalyLength, displayStart, sortCol, sortDir, search);
                strUser      = new JavaScriptSerializer().Serialize(_UserDetails);
            }
            else
            {
                Domain.Socioboard.Helper.UserDetails _UserDetails = new Domain.Socioboard.Helper.UserDetails();
                strUser = new JavaScriptSerializer().Serialize(_UserDetails);
            }

            return(strUser);
        }
Esempio n. 20
0
        public ActionResult ContactSearchTwitter(string keyword)
        {
            Domain.Socioboard.Domain.User                   objUser = (Domain.Socioboard.Domain.User)Session["User"];
            Api.DiscoverySearch.DiscoverySearch             ApiobjDiscoverySearch = new Api.DiscoverySearch.DiscoverySearch();
            List <Domain.Socioboard.Domain.DiscoverySearch> lstDiscoverySearch    = new List <Domain.Socioboard.Domain.DiscoverySearch>();

            lstDiscoverySearch = (List <Domain.Socioboard.Domain.DiscoverySearch>)(new JavaScriptSerializer().Deserialize(ApiobjDiscoverySearch.contactSearchTwitter(keyword), typeof(List <Domain.Socioboard.Domain.DiscoverySearch>)));
            return(PartialView("_TwitterContactPartial", lstDiscoverySearch));
        }
Esempio n. 21
0
        public string GetAllTaskByUserIdAndGroupId(string userid, string username, string profileurl, string days, string groupid)
        {
            UserRepository userrepo = new UserRepository();
            Guid           UserId   = Guid.Parse(userid);
            List <Domain.Socioboard.Domain.Tasks>      taskdata   = new List <Domain.Socioboard.Domain.Tasks>();
            List <Domain.Socioboard.Domain.TaskByUser> taskbyuser = new List <Domain.Socioboard.Domain.TaskByUser>();
            TaskByUser     _TaskByUser = new TaskByUser();
            TaskRepository taskrepo    = new TaskRepository();

            taskdata = taskrepo.getAllTasksOfUserBYDays(Guid.Parse(userid), Guid.Parse(groupid), Convert.ToInt32(days));
            foreach (var item in taskdata)
            {
                _TaskByUser.TaskMessage    = item.TaskMessage;
                _TaskByUser.TaskStatus     = item.TaskStatus;
                _TaskByUser.AssignDate     = item.AssignDate;
                _TaskByUser.CompletionDate = item.CompletionDate;
                try
                {
                    if (UserId == item.AssignTaskTo)
                    {
                        _TaskByUser.AssignToUserName = username;
                    }
                    else
                    {
                        Domain.Socioboard.Domain.User User = userrepo.getUsersById(item.AssignTaskTo);
                        _TaskByUser.AssignToUserName = User.UserName;
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.StackTrace);
                }
                try
                {
                    if (UserId == item.UserId)
                    {
                        _TaskByUser.AssignByUserName = username;
                    }
                    else
                    {
                        Domain.Socioboard.Domain.User User = userrepo.getUsersById(item.UserId);
                        _TaskByUser.AssignByUserName = User.UserName;
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.StackTrace);
                }

                _TaskByUser.days       = Convert.ToInt32(days);
                _TaskByUser.UserName   = username;
                _TaskByUser.ProfileUrl = profileurl;
                taskbyuser.Add(_TaskByUser);
            }
            return(new JavaScriptSerializer().Serialize(taskbyuser));
        }
Esempio n. 22
0
        //
        // GET: /AddNewsLatter/

        //public ActionResult ManageAddNewsLatter()
        //{
        //    return View();
        //}
        public ActionResult LoadAddNewsLatter()
        {
            Domain.Socioboard.Domain.User ObjUser = (Domain.Socioboard.Domain.User)Session["User"];
            string Objuser = (new JavaScriptSerializer().Serialize(ObjUser));

            Api.AdminUserDetails.AdminUserDetails ApiObjuserdetails = new Api.AdminUserDetails.AdminUserDetails();
            List <User> lstUser = (List <User>)(new JavaScriptSerializer().Deserialize(ApiObjuserdetails.GetAllUsers(Objuser), typeof(List <User>)));

            return(View(lstUser));
        }
Esempio n. 23
0
        public ActionResult SearchGplus(string keyword)
        {
            keyword = Uri.EscapeDataString(keyword);
            Domain.Socioboard.Domain.User                   objUser = (Domain.Socioboard.Domain.User)Session["User"];
            Api.DiscoverySearch.DiscoverySearch             ApiobjDiscoverySearch = new Api.DiscoverySearch.DiscoverySearch();
            List <Domain.Socioboard.Domain.DiscoverySearch> GplusDiscoverySearch  = new List <Domain.Socioboard.Domain.DiscoverySearch>();

            GplusDiscoverySearch = (List <Domain.Socioboard.Domain.DiscoverySearch>)(new JavaScriptSerializer().Deserialize(ApiobjDiscoverySearch.DiscoverySearchGplus(objUser.Id.ToString(), keyword), typeof(List <Domain.Socioboard.Domain.DiscoverySearch>)));
            return(PartialView("_SearchGplusPartial", GplusDiscoverySearch));
        }
        public ActionResult UpdateAdminSettingData()
        {
            if (Session["User"] != null)
            {
                Domain.Socioboard.Domain.User _User = (Domain.Socioboard.Domain.User)Session["User"];
                if (_User.UserType != "SuperAdmin")
                {
                    return(RedirectToAction("Index", "Index"));
                }
            }
            else
            {
                return(RedirectToAction("Index", "Index"));
            }
            Domain.Socioboard.Domain.User ObjUser = (Domain.Socioboard.Domain.User)Session["User"];
            string FirstName           = Request.Form["Adminfname"];
            string LastName            = Request.Form["Adminlname"];
            string TimeZone            = Request.Form["AdminTimeZone"];
            var    fi                  = Request.Files["adminprofileimage"];
            string file                = string.Empty;
            string UpdateChnfesMessage = string.Empty;

            if (Request.Files.Count > 0)
            {
                if (fi != null)
                {
                    var path = Server.MapPath("~/Themes/" + System.Configuration.ConfigurationManager.AppSettings["domain"] + "/Contents/img/admin");

                    // 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;
                    ObjUser.ProfileUrl = path.ToString();
                }
            }



            //string ObjAdminUpdate = (new JavaScriptSerializer().Serialize(ObjUser));
            Api.User.User ApiobjUser = new Api.User.User();
            string        ret        = ApiobjUser.UpdateAdminUser(ObjUser.Id.ToString(), FirstName, LastName, TimeZone, ObjUser.ProfileUrl);

            if (ret == "1")
            {
                ObjUser.UserName    = FirstName + " " + LastName;
                ObjUser.TimeZone    = TimeZone;
                Session["User"]     = ObjUser;
                UpdateChnfesMessage = "Setting Updated Successfully";
            }
            return(Content(UpdateChnfesMessage));
        }
Esempio n. 25
0
        public string getUsersById(string UserId, string access_token)
        {
            //if (!User.Identity.IsAuthenticated)
            //{
            //    return "Unauthorized access";
            //}
            Domain.Socioboard.Domain.User objUser = new Domain.Socioboard.Domain.User();
            objUser = userrepo.getUsersById(Guid.Parse(UserId));

            return(new JavaScriptSerializer().Serialize(objUser));
        }
Esempio n. 26
0
 /// <summary>
 /// Add a new student in the database. 
 /// </summary>
 /// <param name="student">Student object</param>
 public static void Add(User user)
 {
     using (NHibernate.ISession session = SessionFactory.GetNewSession())
     {
         using (NHibernate.ITransaction transaction = session.BeginTransaction())
         {
             session.Save(user);
             transaction.Commit();
         }
     }
 }
Esempio n. 27
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"));
        }
        public ActionResult DropBoxManager()
        {
            Api.Dropbox.Dropbox           _Dropbox = new Api.Dropbox.Dropbox();
            Domain.Socioboard.Domain.User objUser  = (Domain.Socioboard.Domain.User)Session["User"];
            string _code = Request.QueryString["code"];

            _Dropbox.AddDropboxAccount(_code, objUser.Id.ToString());
            //System.Web.UI.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "Close", "window.close()", true);

            //return RedirectToAction("DropBox");
            return(Content(""));
        }
Esempio n. 29
0
        public ActionResult LoadDiscovery()
        {
            // Edited by Antima

            Domain.Socioboard.Domain.User       objUser = (Domain.Socioboard.Domain.User)Session["User"];
            Api.DiscoverySearch.DiscoverySearch ApiobjDiscoverySearch = new Api.DiscoverySearch.DiscoverySearch();
            List <string> lstSearchHistory = new List <string>();

            lstSearchHistory = (List <string>)(new JavaScriptSerializer().Deserialize(ApiobjDiscoverySearch.getAllSearchKeywords(objUser.Id.ToString()), typeof(List <string>)));

            return(PartialView("_DiscoveryPartial", lstSearchHistory));
        }
Esempio n. 30
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));
        }
Esempio n. 31
0
 public string GetUserInfoByCode(string code)
 {
     try
     {
         Domain.Socioboard.Domain.User ret = userrepo.GetUserInfoByCode(code);
         return(new JavaScriptSerializer().Serialize(ret));
     }
     catch (Exception ex)
     {
         return("");
     }
 }
        public IHttpActionResult FacebookPostsCommentsServiceByEmail(string Email)
        {
            Facebook.FacebookClient   fb        = new Facebook.FacebookClient();
            UserRepository            userRepo  = new UserRepository();
            FacebookAccountRepository fbAccRepo = new FacebookAccountRepository();

            Api.Socioboard.Services.Facebook fbService = new Api.Socioboard.Services.Facebook();
            Domain.Socioboard.Domain.User    lstUser   = new Domain.Socioboard.Domain.User();
            lstUser = userRepo.getUserInfoByEmail(Email);

            List <Domain.Socioboard.Domain.FacebookAccount> lstFacebookAccount = fbAccRepo.GetAllFacebookAccountByUserId(lstUser.Id);

            foreach (var fbAcc in lstFacebookAccount)
            {
                if (!string.IsNullOrEmpty(fbAcc.AccessToken))
                {
                    fb.AccessToken = fbAcc.AccessToken;
                    MongoRepository boardrepo = new MongoRepository("MongoFacebookFeed");
                    try
                    {
                        var result = boardrepo.Find <MongoFacebookFeed>(x => x.ProfileId.Equals(fbAcc.FbUserId) && x.UserId.Equals(lstUser.Id.ToString())).ConfigureAwait(false);

                        var task = Task.Run(async() =>
                        {
                            return(await result);
                        });
                        IList <MongoFacebookFeed> objfbfeeds = task.Result;
                        if (objfbfeeds.Count() == 0)
                        {
                            result = boardrepo.Find <MongoFacebookFeed>(x => x.ProfileId.Equals(fbAcc.FbUserId)).ConfigureAwait(false);

                            task = Task.Run(async() =>
                            {
                                return(await result);
                            });
                        }
                        List <MongoFacebookFeed> fbfeeds = objfbfeeds.ToList();
                        foreach (var post in fbfeeds)
                        {
                            fbService.AddFbPostComments(post.FeedId, fb, lstUser.Id.ToString());
                        }
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.Message);
                        logger.Error(ex.StackTrace);
                        return(BadRequest("Something Went Wrong"));
                    }
                }
            }
            return(Ok());
        }
Esempio n. 33
0
        public ActionResult LoadRegistration(string teamid)
        {
            string ss      = Request.QueryString["teamid"];
            User   objUser = (User)Session["User"];

            if (!String.IsNullOrEmpty(teamid))
            {
                objUser = new Domain.Socioboard.Domain.User();
                Api.Team.Team ApiobjTeam  = new Api.Team.Team();
                Team          objuserinfo = (Team)(new JavaScriptSerializer().Deserialize(ApiobjTeam.GetTeamById(teamid), typeof(Team)));
                objUser.EmailId = objuserinfo.EmailId;
            }
            return(PartialView("_RegistrationPartial", objUser));
        }
Esempio n. 34
0
        public string GetUserById(string Id)
        {
            try
            {
                Domain.Socioboard.Domain.User user = new Domain.Socioboard.Domain.User();
                user = objUserRepo.getUsersById(Guid.Parse(Id));
                return new JavaScriptSerializer().Serialize(user);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
                return null;
            }


        }
Esempio n. 35
0
        //[WebMethod]
        //[ScriptMethod(UseHttpGet = false, ResponseFormat = ResponseFormat.Json)]
        public string SendNewsLetter(string body, string Subject, string userid,string NewsLetterId)
        {
            
            UserRepository objUserRepository = new UserRepository();
            Domain.Socioboard.Domain.User objUser = new Domain.Socioboard.Domain.User();
            string res = string.Empty;
            string ret = string.Empty;
            try
            {


                string from = ConfigurationManager.AppSettings["fromemail"];
                string tomail = ConfigurationManager.AppSettings["tomail"];
                string username = ConfigurationManager.AppSettings["Mandrillusername"];
                string host = ConfigurationManager.AppSettings["Mandrillhost"];
                string port = ConfigurationManager.AppSettings["Mandrillport"];
                string pass = ConfigurationManager.AppSettings["Mandrillpassword"];


                //string sss = ConfigurationSettings.AppSettings["host"];
                objUser = objUserRepository.getUsersById(Guid.Parse(userid));

                GlobusMailLib.MailHelper objMailHelper = new GlobusMailLib.MailHelper();

                ret = objMailHelper.SendMailByMandrill(host, Convert.ToInt32(port), from, "", objUser.EmailId, string.Empty, string.Empty, Subject, body, username, pass);
                //NewsLetterRepository objNewsLetterRepository = new NewsLetterRepository();

                if (ret.Contains("Success"))
                {
                    ObjNewsLetter.Id = Guid.Parse(NewsLetterId);
                    ObjNewsLetter.SendStatus = true;
                    ObjNewsLetterRepository.UpdateNewsLetter(ObjNewsLetter);
                    //lstbox.Items.Add("Mail send to : " + objUser.UserName);
                }
                //return ret;

                
            }
            catch (Exception ex)
            {

                Console.WriteLine("Error : " + ex.StackTrace);
            }
            return ret;
        }
Esempio n. 36
0
        public string Login(string EmailId, string Password)
        {
            logger.Error("Checking Abhay123");
            try
            {
                UserRepository userrepo = new UserRepository();

                Domain.Socioboard.Domain.User objUser = new Domain.Socioboard.Domain.User();
                objUser = userrepo.getUserInfoByEmail(EmailId);
                if (objUser == null)
                {
                    return new JavaScriptSerializer().Serialize("Email Not Exist");
                }

                Domain.Socioboard.Domain.User user = userrepo.GetUserInfo(EmailId, Utility.MD5Hash(Password));
                if (user != null)
                {
                    if (user.UserCode == null || user.UserCode == "")
                    {
                        string code = Utility.GenerateRandomUniqueString();
                        int retint = userrepo.UpdateCode(user.Id, code);
                        user = userrepo.getUsersById(user.Id);
                    }
                    try
                    {
                        userrepo.UpdateLastLoginTime(user.Id);
                    }
                    catch { }
                    return new JavaScriptSerializer().Serialize(user);

                }
                else
                {
                    return new JavaScriptSerializer().Serialize("Not Exist");
                }
            }
            catch (Exception ex)
            {
                logger.Error("Error : " + ex.Message);
                logger.Error("Error : " + ex.StackTrace);
                Console.WriteLine(ex.StackTrace);
                return null;
            }
        }
Esempio n. 37
0
        public int UpdateReferenceUserByUserId(User user)
        {
            int i = 0;
            try
            {
                using (NHibernate.ISession session = SessionFactory.GetNewSession())
                {
                    using (NHibernate.ITransaction transaction = session.BeginTransaction())
                    {
                        try
                        {
                            i = session.CreateQuery("Update User set ReferenceStatus =:referenceStatus where Id = :id")
                                      .SetParameter("referenceStatus", user.ReferenceStatus)
                                      .SetParameter("id", user.Id)

                                      .ExecuteUpdate();
                            transaction.Commit();
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);

                        }


                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);

            }

            return i;
        }
Esempio n. 38
0
        public ActionResult Signup()
        {
            logger.Error("Register");
            User _user=(User)Session["User"];
            Domain.Socioboard.Domain.User user = new Domain.Socioboard.Domain.User();
            Session["AjaxLogin"] = "******";
            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 Signup()
        {
            logger.Error("Register");
            User _user = (User)Session["User"];
            Domain.Socioboard.Domain.User user = new Domain.Socioboard.Domain.User();
            Session["AjaxLogin"] = "******";
            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);
        }
Esempio n. 40
0
        public List<User> GetUserByCouponCode(User user)
        {
            List<User> alstUser = new List<User>();
            try
            {
                using (NHibernate.ISession session = SessionFactory.GetNewSession())
                {
                    using (NHibernate.ITransaction transaction = session.BeginTransaction())
                    {
                        try
                        {
                            alstUser = session.CreateQuery("from User where CouponCode=:couponCode")
                            .SetParameter("couponCode", user.CouponCode)
                            .List<User>().ToList<User>();

                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);

                        }
                    }
                }
            }
            catch (Exception ex)
            {

                Console.WriteLine("Error : " + ex.StackTrace);
            }

            return alstUser;
        }
Esempio n. 41
0
        public string Register(string EmailId, string Password, string AccountType, string Username, string ActivationStatus = "0")
        {

            try
            {
                //UserRepository userrepo = new UserRepository();

                //Domain.Socioboard.Domain.UserActivation objUserActivation = new Domain.Socioboard.Domain.UserActivation();
                //UserActivationRepository objUserActivation = new UserActivationRepository();

                logger.Error("Register");

                if (!userrepo.IsUserExist(EmailId))
                {


                    Domain.Socioboard.Domain.User user = new Domain.Socioboard.Domain.User();
                    user.AccountType = AccountType;
                    user.EmailId = EmailId;
                    user.CreateDate = DateTime.Now;
                    user.ExpiryDate = DateTime.Now.AddMonths(1);
                    user.Password = Utility.MD5Hash(Password);
                    user.PaymentStatus = "unpaid";
                    user.ProfileUrl = string.Empty;
                    user.TimeZone = string.Empty;
                    user.UserName = Username;//FirstName + " " + LastName;
                    user.UserStatus = 1;
                    user.Ewallet = "0";
                    user.ActivationStatus = ActivationStatus;//"0"; 
                    user.Id = Guid.NewGuid();
                    user.UserCode = Utility.GenerateRandomUniqueString();
                    UserRepository.Add(user);

                    ////add value in UserActivation
                    //UserActivation.AddUserActivation(user);

                    //add value in userpackage
                    // UserPackageRelation.AddUserPackageRelation(user);


                    try
                    {
                        Domain.Socioboard.Domain.Groups groups = AddGroupByUserId(user.Id);
<<<<<<< HEAD


=======
                        
                        
>>>>>>> e052534b7a2a3744cad9dddbc3c6acccf394ca7b
                        BusinessSettingRepository busnrepo = new BusinessSettingRepository();
                        BusinessSetting.AddBusinessSetting(user.Id, groups.Id, groups.GroupName);
                        Team.AddTeamByGroupIdUserId(user.Id, user.EmailId, groups.Id);

                        UpdateTeam(EmailId, user.Id.ToString(), user.UserName);

                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                        logger.Error("Error : " + ex.Message);
                        logger.Error("Error : " + ex.StackTrace);
                    }


                    //MailSender.SendEMail(user.UserName, Password, EmailId);
                    return new JavaScriptSerializer().Serialize(user);
                }
                else
                {
                    return "Email Already Exists";
                }

            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
                return "Something Went Wrong";
            }



        }
 public async Task<ActionResult> linkedinpagecomentonpost(string pageid, string updatekey, string comment)
 {
    
     Domain.Socioboard.Domain.User objUser = new Domain.Socioboard.Domain.User();
     objUser = (Domain.Socioboard.Domain.User)Session["User"];
     string accesstoken = "";
     string returndata = "";
     List<KeyValuePair<string, string>> Parameters = new List<KeyValuePair<string, string>>();
     Parameters.Add(new KeyValuePair<string, string>("UserId", objUser.Id.ToString()));
     Parameters.Add(new KeyValuePair<string, string>("ProfileId", pageid));
     Parameters.Add(new KeyValuePair<string, string>("Updatekey", updatekey));
     Parameters.Add(new KeyValuePair<string, string>("comment", comment));
     if (Session["access_token"] != null)
     {
         accesstoken = Session["access_token"].ToString();
     }
     HttpResponseMessage response = await WebApiReq.PostReq("api/ApiLinkedIn/PsotCommentOnLinkedinCompanyPageUpdate", Parameters, "Bearer", accesstoken);
     if (response.IsSuccessStatusCode)
     {
         returndata = await response.Content.ReadAsAsync<string>();
     }
     return Content(returndata);
 }
Esempio n. 43
0
        public User getUserInfoByEmail(string emailId)
        {
            List<User> lstUser = new List<User>();
            User user = new User();
            using (NHibernate.ISession session = SessionFactory.GetNewSession())
            {
                using (NHibernate.ITransaction transaction = session.BeginTransaction())
                {
                    try
                    {
                        lstUser = session.CreateQuery("from  User u where u.EmailId = : email")
                        .SetParameter("email", emailId).List<User>().ToList<User>();
                        user = lstUser[0];
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                        user = null;
                    }
                }
            }

            return user;
        }
        public async Task<ActionResult> CreatePostOnPage(string Pageid, string Post)
        {
            var fi = Request.Files["fileimg"];
            string file = string.Empty;
            if (Request.Files.Count > 0)
            {
                if (fi != null)
                {
                    var path = Server.MapPath("~/Themes/" + System.Configuration.ConfigurationManager.AppSettings["domain"] + "/Contents/img/upload");

                    // 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;
                }
            }
            Domain.Socioboard.Domain.User objUser = new Domain.Socioboard.Domain.User();
            objUser = (Domain.Socioboard.Domain.User)Session["User"];
            string accesstoken = "";
            string returndata = "";
            List<KeyValuePair<string, string>> Parameters = new List<KeyValuePair<string, string>>();
            Parameters.Add(new KeyValuePair<string, string>("UserId", objUser.Id.ToString()));
            Parameters.Add(new KeyValuePair<string, string>("ProfileId", Pageid));
            Parameters.Add(new KeyValuePair<string, string>("comment", Post));
            Parameters.Add(new KeyValuePair<string, string>("ImageUrl", file));
            if (Session["access_token"] != null)
            {
                accesstoken = Session["access_token"].ToString();
            }
            HttpResponseMessage response = await WebApiReq.PostReq("api/ApiLinkedIn/CreateUpdateOnLinkedinCompanyPage", Parameters, "Bearer", accesstoken);
            if (response.IsSuccessStatusCode)
            {
                returndata = await response.Content.ReadAsAsync<string>();
            }
            return Content(returndata);
        }
Esempio n. 45
0
        public string RegisterbyTwitter(string EmailId, string Password, string AccountType, string Username, string SocioLogin, string PictureUrl, string ActivationStatus = "0")
        {
            try
            {
                logger.Error("RegisterbyTwitter");

                if (!userrepo.IsUserExist(EmailId))
                {
                    Domain.Socioboard.Domain.User user = new Domain.Socioboard.Domain.User();
                    user.AccountType = AccountType;
                    user.EmailId = EmailId;
                    user.CreateDate = DateTime.Now;
                    try
                    {
                        if (ConfigurationManager.AppSettings["expiryindays"].ToString() != "")
                        {
                            double expiryindays = double.Parse(ConfigurationManager.AppSettings["expiryindays"].ToString(), CultureInfo.InvariantCulture.NumberFormat);
                            user.ExpiryDate = DateTime.Now.AddDays(expiryindays);
                        }
                        else
                        {
                            user.ExpiryDate = DateTime.Now.AddDays(30);
                        }
                    }
                    catch (Exception)
                    {
                        user.ExpiryDate = DateTime.Now.AddDays(30);
                    }
                    user.Password = Utility.MD5Hash(Password);
                    user.PaymentStatus = "unpaid";
                    user.ProfileUrl = string.Empty;
                    user.TimeZone = string.Empty;
                    user.UserName = Username;//FirstName + " " + LastName;
                    user.UserStatus = 1;
                    user.Ewallet = "0";
                    user.ActivationStatus = ActivationStatus;//"0"; 
                    user.Id = Guid.NewGuid();
                    user.UserCode = Utility.GenerateRandomUniqueString();
                    user.SocialLogin = SocioLogin;
                    user.ProfileUrl = PictureUrl;
                    UserRepository.Add(user);

                    ////add value in UserActivation
                    //UserActivation.AddUserActivation(user);

                    //add value in userpackage
                    // UserPackageRelation.AddUserPackageRelation(user);


                    try
                    {
                        Domain.Socioboard.Domain.Groups groups = AddGroupByUserId(user.Id);


                        BusinessSettingRepository busnrepo = new BusinessSettingRepository();
                        BusinessSetting.AddBusinessSetting(user.Id, groups.Id, groups.GroupName);
                        Team.AddTeamByGroupIdUserId(user.Id, user.EmailId, groups.Id);

                        UpdateTeam(EmailId, user.Id.ToString(), user.UserName);

                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                        logger.Error("Error : " + ex.Message);
                        logger.Error("Error : " + ex.StackTrace);
                    }
                    //MailSender.SendEMail(user.UserName, Password, EmailId);
                    return new JavaScriptSerializer().Serialize(user);
                }
                else
                {
                    return "Email Already Exists";
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
                return "Something Went Wrong";
            }
        }
Esempio n. 46
0
        public string TwitterLogIn(string client_id, string client_secret, string redirect_uri, string requestToken, string requestSecret, string requestVerifier)
        {
            System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls;
            string ret = string.Empty;
            Users userinfo = new Users();
            oAuthTwitter OAuth = new oAuthTwitter(client_id, client_secret, redirect_uri);
            OAuth.AccessToken = requestToken;
            OAuth.AccessTokenSecret = requestVerifier;
            OAuth.AccessTokenGet(requestToken, requestVerifier);
            JArray profile = userinfo.Get_Users_LookUp_ByScreenName(OAuth, OAuth.TwitterScreenName);

            if (profile != null)
            {
                logger.Error("Twitter.asmx >> TwitterLogIn >> Twitter profile : " + profile);
            }
            else
            {
                logger.Error("Twitter.asmx >> TwitterLogIn >> NULL Twitter profile : " + profile);
            }
            string TwitterUserId = string.Empty;
            objTwitterAccount = new Domain.Socioboard.Domain.TwitterAccount();
            Domain.Socioboard.Domain.User objUser = new Domain.Socioboard.Domain.User();
            foreach (var item in profile)
            {
                #region Login Twitter Account
                try
                {
                    objUser.ProfileUrl = item["profile_image_url"].ToString().TrimStart('"').TrimEnd('"');
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.StackTrace);
                }
                try
                {
                    TwitterUserId = item["id_str"].ToString().TrimStart('"').TrimEnd('"');
                }
                catch (Exception er)
                {
                    try
                    {
                        TwitterUserId = item["id"].ToString().TrimStart('"').TrimEnd('"');
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.StackTrace);
                    }
                    Console.WriteLine(er.StackTrace);
                }
                objUser.SocialLogin = "******" + TwitterUserId;
                try
                {
                    objUser.UserName = item["name"].ToString().TrimStart('"').TrimEnd('"');
                }
                catch (Exception ex)
                {
                    logger.Error(ex.StackTrace);
                }

                #endregion
            }
            return new JavaScriptSerializer().Serialize(objUser);
        }
Esempio n. 47
0
        public string UpdateUserAccount(string Id, string UserName, string EmailId, string Package, string Status)
        {
            try
            {
                Domain.Socioboard.Domain.User objUser = new Domain.Socioboard.Domain.User();
                objUser.Id = Guid.Parse(Id);
                objUser.UserName = UserName;
                objUser.EmailId = EmailId;
                objUser.AccountType = Package;
                objUser.UserStatus = Convert.ToInt16(Status);
                UserRepository.UpdateAccountType(objUser);
                return new JavaScriptSerializer().Serialize("Update Successfully");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                return new JavaScriptSerializer().Serialize("Please Try Again");
            }

        }
Esempio n. 48
0
        public int UpdatePaymentStatusByUserId(User user)
        {
            int i = 0;
            try
            {
                using (NHibernate.ISession session = SessionFactory.GetNewSession())
                {
                    using (NHibernate.ITransaction transaction = session.BeginTransaction())
                    {

                        try
                        {
                            i = session.CreateQuery("Update User set PaymentStatus=:paymentStatus  where Id = :userid")
                                     .SetParameter("userid", user.Id)
                                     .SetParameter("paymentStatus", user.PaymentStatus)
                                     .ExecuteUpdate();
                            transaction.Commit();


                        }
                        catch { }
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error : " + ex.StackTrace);
            }

            return i;

        }
Esempio n. 49
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);
        }
Esempio n. 50
0
 public ActionResult LoadRegistration(string teamid)
 {
     string ss = Request.QueryString["teamid"];
     User objUser = (User)Session["User"];
     if (!String.IsNullOrEmpty(teamid))
     {
         objUser = new Domain.Socioboard.Domain.User();
         Api.Team.Team ApiobjTeam = new Api.Team.Team();
         Team objuserinfo = (Team)(new JavaScriptSerializer().Deserialize(ApiobjTeam.GetTeamById(teamid), typeof(Team)));
         objUser.EmailId = objuserinfo.EmailId;
     }
     return PartialView("_RegistrationPartial", objUser);
 }
Esempio n. 51
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);
        }
Esempio n. 52
0
        public int UpdateUserExpiryDateById(User user)
        {
            int i = 0;
            try
            {
                using (NHibernate.ISession session = SessionFactory.GetNewSession())
                {
                    using (NHibernate.ITransaction transaction = session.BeginTransaction())
                    {
                        try
                        {
                            i = session.CreateQuery("Update User set ExpiryDate=:expirydate, AccountType=:accounttype where Id = :id")
                                      .SetParameter("id", user.Id)
                                      .SetParameter("accounttype", user.AccountType)
                                      .SetParameter("expirydate", user.ExpiryDate)
                                      .ExecuteUpdate();
                            transaction.Commit();
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);

                        }


                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);

            }

            return i;
        }
 public string FacebookLogin(string code)
 {
     string ret = string.Empty;
     string accessToken = string.Empty;
     Domain.Socioboard.Domain.User objUser = new Domain.Socioboard.Domain.User();
     string client_id = ConfigurationManager.AppSettings["ClientId"];
     string redirect_uri = ConfigurationManager.AppSettings["RedirectUrl"];
     //string redirect_uri = redirecturl;
     string client_secret = ConfigurationManager.AppSettings["ClientSecretKey"];
     try
     {
         FacebookClient fb = new FacebookClient();
         string profileId = string.Empty;
         Dictionary<string, object> parameters = new Dictionary<string, object>();
         parameters.Add("client_id", client_id);
         parameters.Add("redirect_uri", redirect_uri);
         parameters.Add("client_secret", client_secret);
         parameters.Add("code", code);
         System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls;
         JsonObject fbaccess_token = (JsonObject)fb.Get("/oauth/access_token", parameters);
         accessToken = fbaccess_token["access_token"].ToString();
         if (accessToken != null)
         {
             string fname = string.Empty;
             string lname = string.Empty;
             fb.AccessToken = accessToken;
             dynamic profile = fb.Get("v2.0/me");
             objUser.UserName = (Convert.ToString(profile["name"]));
             objUser.EmailId = (Convert.ToString(profile["email"]));
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
     return (new JavaScriptSerializer().Serialize(objUser)) + "_#_" + accessToken;
 }
Esempio n. 54
0
        public string getUsersById(string UserId, string access_token)
        {
            //if (!User.Identity.IsAuthenticated)
            //{
            //    return "Unauthorized access";
            //}
            Domain.Socioboard.Domain.User objUser = new Domain.Socioboard.Domain.User();
            objUser = userrepo.getUsersById(Guid.Parse(UserId));

            return new JavaScriptSerializer().Serialize(objUser);
        }
        public int UpdatePackageRelationByUserIdAndPackageId(User userPackageRelation)
        {
            int i = 0;
            try
            {
                using (NHibernate.ISession session = SessionFactory.GetNewSession())
                {
                    using (NHibernate.ITransaction transaction = session.BeginTransaction())
                    {
                        try
                        {
                            i = session.CreateQuery("Update UserPackageRelation set PackageStatus =:packageStatus where UserId = :userId")
                               .SetParameter("packageStatus", false)
                               .SetParameter("userId", userPackageRelation.Id)
                               .ExecuteUpdate();
                            transaction.Commit();


                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                            // return 0;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Error("Error : " + ex.StackTrace);
                Console.WriteLine("Error : " + ex.StackTrace);
            }
            return i;
        }
Esempio n. 56
0
        public string getUserInfoByEmail(string userEmail)
        {
            Domain.Socioboard.Domain.User objUser = new Domain.Socioboard.Domain.User();
            objUser = userrepo.getUserInfoByEmail(userEmail);

            return new JavaScriptSerializer().Serialize(objUser);
        }
        public IHttpActionResult FacebookPostsCommentsServiceByEmail(string Email)
        {
            Facebook.FacebookClient fb = new Facebook.FacebookClient();
            UserRepository userRepo = new UserRepository();
            FacebookAccountRepository fbAccRepo = new FacebookAccountRepository();
            Api.Socioboard.Services.Facebook fbService = new Api.Socioboard.Services.Facebook();
            Domain.Socioboard.Domain.User lstUser = new Domain.Socioboard.Domain.User();
            lstUser = userRepo.getUserInfoByEmail(Email);

            List<Domain.Socioboard.Domain.FacebookAccount> lstFacebookAccount = fbAccRepo.GetAllFacebookAccountByUserId(lstUser.Id);

            foreach (var fbAcc in lstFacebookAccount)
            {
                if (!string.IsNullOrEmpty(fbAcc.AccessToken))
                {
                    fb.AccessToken = fbAcc.AccessToken;
                    MongoRepository boardrepo = new MongoRepository("MongoFacebookFeed");
                    try
                    {

                        var result = boardrepo.Find<MongoFacebookFeed>(x => x.ProfileId.Equals(fbAcc.FbUserId) && x.UserId.Equals(lstUser.Id.ToString())).ConfigureAwait(false);

                        var task = Task.Run(async () =>
                        {
                            return await result;
                        });
                        IList<MongoFacebookFeed> objfbfeeds = task.Result;
                        if (objfbfeeds.Count() == 0)
                        {

                            result = boardrepo.Find<MongoFacebookFeed>(x => x.ProfileId.Equals(fbAcc.FbUserId)).ConfigureAwait(false);

                            task = Task.Run(async () =>
                            {
                                return await result;
                            });
                        }
                        List<MongoFacebookFeed> fbfeeds = objfbfeeds.ToList();
                        foreach (var post in fbfeeds)
                        {
                            fbService.AddFbPostComments(post.FeedId, fb, lstUser.Id.ToString());
                        }

                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.Message);
                        logger.Error(ex.StackTrace);
                        return BadRequest("Something Went Wrong");
                    }
                }
            }
            return Ok();
        }
Esempio n. 58
0
        public string getUserInfoForSocialLogin(string logintype)
        {
            Domain.Socioboard.Domain.User objUser = new Domain.Socioboard.Domain.User();
            objUser = userrepo.getUserInfoForSocialLogin(logintype);

            return new JavaScriptSerializer().Serialize(objUser);
        }
Esempio n. 59
0
        public string GoogleLogin(string code)
        {
            string ret = string.Empty;
            string objRefresh = string.Empty;
            string refreshToken = string.Empty;
            string access_token = string.Empty;
            oAuthTokenYoutube ObjoAuthTokenYoutube = new oAuthTokenYoutube();
            oAuthToken objToken = new oAuthToken();
            Domain.Socioboard.Domain.User objuser = new Domain.Socioboard.Domain.User();
            try
            {
                logger.Error("Abhay before ObjoAuthTokenYoutube.GetRefreshToken: " + new System.Diagnostics.StackFrame(0, true).GetFileLineNumber());
                objRefresh = ObjoAuthTokenYoutube.GetRefreshToken(code, ConfigurationManager.AppSettings["YtconsumerKey"], ConfigurationManager.AppSettings["YtconsumerSecret"], ConfigurationManager.AppSettings["Ytredirect_uri"]);
                logger.Error("Abhay: " + new System.Diagnostics.StackFrame(0, true).GetFileLineNumber());

                logger.Error("1 " + code + " " + ConfigurationManager.AppSettings["YtconsumerKey"] + " " + ConfigurationManager.AppSettings["YtconsumerSecret"] + " " + ConfigurationManager.AppSettings["Ytredirect_uri"]);

            }
            catch (Exception ex)
            {
                logger.Error("2 " + code + " " + ConfigurationManager.AppSettings["YtconsumerKey"] + " " + ConfigurationManager.AppSettings["YtconsumerSecret"] + " " + ConfigurationManager.AppSettings["Ytredirect_uri"]);
                logger.Error(ex.Message);
                logger.Error(ex.StackTrace);
            }
            JObject objaccesstoken = JObject.Parse(objRefresh);
            try
            {
                refreshToken = objaccesstoken["refresh_token"].ToString();

            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            try
            {

                access_token = objaccesstoken["access_token"].ToString();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);

            }

            JArray userinfo = new JArray();
            try
            {
                userinfo = objToken.GetUserInfo("me", access_token.ToString());
            }
            catch (Exception ex)
            {
            }

            foreach (var itemEmail in userinfo)
            {
                try
                {
                    objuser.EmailId = itemEmail["email"].ToString();
                    objuser.UserName = itemEmail["given_name"].ToString();
                    objuser.ProfileUrl = itemEmail["picture"].ToString();

                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.StackTrace);
                }

            }
            return new JavaScriptSerializer().Serialize(objuser);
        }
Esempio n. 60
0
        public string getUsersById(string UserId)
        {
            Domain.Socioboard.Domain.User objUser = new Domain.Socioboard.Domain.User();
            objUser = userrepo.getUsersById(Guid.Parse(UserId));

            return new JavaScriptSerializer().Serialize(objUser);
        }