public ActionResult ScheduledMessage(string scheduledmessage, string scheduleddate, string scheduledtime, string profiles, string clienttime)
        {
            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/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.Myfashion.Domain.User          objUser = (Domain.Myfashion.Domain.User)Session["User"];
            Api.ScheduledMessage.ScheduledMessage ApiobjScheduledMessage = new Api.ScheduledMessage.ScheduledMessage();
            string retmsg = ApiobjScheduledMessage.AddAllScheduledMessage(profiles, scheduledmessage, clienttime, scheduleddate, scheduledtime, objUser.Id.ToString(), file);

            return(Content("_ComposeMessagePartial"));
        }
        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;
        }
예제 #3
0
        public string Login(string EmailId, string Password)
        {
            logger.Error("Checking Abhay123");
            try
            {
                UserRepository userrepo = new UserRepository();

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

                Domain.Myfashion.Domain.User user = userrepo.GetUserInfo(EmailId, Utility.MD5Hash(Password));
                if (user != null)
                {
                    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 GetAllUsers(string Objuser)
        {
            try
            {
                Domain.Myfashion.Domain.User ObjUser = (Domain.Myfashion.Domain.User)(new JavaScriptSerializer().Deserialize(Objuser, typeof(Domain.Myfashion.Domain.User)));

                if (ObjUser.UserType == "SuperAdmin")
                {
                    List <Domain.Myfashion.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);
            }
        }
예제 #5
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.Myfashion.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);
                    }
                }
            }
        }
        //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);

                    }


                }
            }
        }
        public ActionResult SaveDraft(string scheduledmessage)
        {
            Domain.Myfashion.Domain.User objUser      = (Domain.Myfashion.Domain.User)Session["User"];
            Api.Drafts.Drafts            ApiobjDrafts = new Api.Drafts.Drafts();
            string retmsg = ApiobjDrafts.AddDraft(objUser.Id.ToString(), Session["group"].ToString(), DateTime.Now, scheduledmessage);

            return(Content(retmsg));
        }
        public ActionResult loaddrafts()
        {
            Domain.Myfashion.Domain.User objUser      = (Domain.Myfashion.Domain.User)Session["User"];
            Api.Drafts.Drafts            ApiobjDrafts = new Api.Drafts.Drafts();
            List <Drafts> lstScheduledMessage         = (List <Drafts>)(new JavaScriptSerializer().Deserialize(ApiobjDrafts.GetDraftMessageByUserIdAndGroupId(objUser.Id.ToString(), Session["group"].ToString()), typeof(List <Drafts>)));

            return(PartialView("_DraftPartial", lstScheduledMessage));
        }
        public ActionResult ModifyDraftMessage(string draftid, string draftmsg)
        {
            Domain.Myfashion.Domain.User objUser      = (Domain.Myfashion.Domain.User)Session["User"];
            Api.Drafts.Drafts            ApiobjDrafts = new Api.Drafts.Drafts();
            string retmsg = ApiobjDrafts.UpdateDraftsMessage(draftid, objUser.Id.ToString(), Session["group"].ToString(), draftmsg);

            return(Content(retmsg));
        }
        public ActionResult DeleteDraftMessage(string draftid)
        {
            Domain.Myfashion.Domain.User objUser      = (Domain.Myfashion.Domain.User)Session["User"];
            Api.Drafts.Drafts            ApiobjDrafts = new Api.Drafts.Drafts();
            string retmsg = ApiobjDrafts.DeleteDrafts(draftid);

            return(Content(retmsg));
        }
        public ActionResult EditSocioQueueMessage(string msgid, string msg)
        {
            Domain.Myfashion.Domain.User          objUser = (Domain.Myfashion.Domain.User)Session["User"];
            Api.ScheduledMessage.ScheduledMessage ApiobjScheduledMessage = new Api.ScheduledMessage.ScheduledMessage();
            string retmsg = ApiobjScheduledMessage.EditSchecduledMessage(msgid, msg);

            return(Content(retmsg));
        }
예제 #12
0
        public string getUserInfoByEmail(string userEmail)
        {
            UserRepository userrepo = new UserRepository();

            Domain.Myfashion.Domain.User objUser = new Domain.Myfashion.Domain.User();
            objUser = userrepo.getUserInfoByEmail(userEmail);

            return(new JavaScriptSerializer().Serialize(objUser));
        }
        public ActionResult loadsocialqueue()
        {
            Domain.Myfashion.Domain.User          objUser = (Domain.Myfashion.Domain.User)Session["User"];
            Api.ScheduledMessage.ScheduledMessage ApiobjScheduledMessage = new Api.ScheduledMessage.ScheduledMessage();
            //ApiobjScheduledMessage.GetSociaoQueueMessageByUserIdAndGroupId(objUser.Id.ToString(), Session["group"].ToString());
            List <ScheduledMessage> lstScheduledMessage = (List <ScheduledMessage>)(new JavaScriptSerializer().Deserialize(ApiobjScheduledMessage.GetSociaoQueueMessageByUserIdAndGroupId(objUser.Id.ToString(), Session["group"].ToString()), typeof(List <ScheduledMessage>)));

            return(PartialView("_SocialQueuePartial", lstScheduledMessage));
        }
예제 #14
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.Myfashion.Domain.Tasks>      taskdata   = new List <Domain.Myfashion.Domain.Tasks>();
            List <Domain.Myfashion.Domain.TaskByUser> taskbyuser = new List <Domain.Myfashion.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.Myfashion.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.Myfashion.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));
        }
 /// <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();
         }
     }
 }
        public ActionResult ComposeScheduledMessage()
        {
            Domain.Myfashion.Domain.User           objUser         = (Domain.Myfashion.Domain.User)Session["User"];
            Dictionary <TeamMemberProfile, object> dict_TeamMember = new Dictionary <TeamMemberProfile, object>();

            if (Session["group"] != null)
            {
                dict_TeamMember = SBUtils.GetUserProfilesccordingToGroup();
            }
            return(PartialView("_ComposeMessageSchedulerPartial", dict_TeamMember));
        }
예제 #17
0
        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));
        }
예제 #18
0
        public string getUsersById(string UserId)
        {
            UserRepository userrepo = new UserRepository();

            if (!User.Identity.IsAuthenticated)
            {
                return("Unauthorized access");
            }
            Domain.Myfashion.Domain.User objUser = new Domain.Myfashion.Domain.User();
            objUser = userrepo.getUsersById(Guid.Parse(UserId));

            return(new JavaScriptSerializer().Serialize(objUser));
        }
 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"] = "******";
     return RedirectToAction("Index", "Home");
 }
예제 #20
0
        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 string GetUserById(string Id)
 {
     try
     {
         Domain.Myfashion.Domain.User user = new Domain.Myfashion.Domain.User();
         user = objUserRepo.getUsersById(Guid.Parse(Id));
         return(new JavaScriptSerializer().Serialize(user));
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.StackTrace);
         return(null);
     }
 }
예제 #22
0
        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"] = "******";
            return(RedirectToAction("Index", "Home"));
        }
        public string GetUserById(string Id)
        {
            try
            {
                Domain.Myfashion.Domain.User user = new Domain.Myfashion.Domain.User();
                user = objUserRepo.getUsersById(Guid.Parse(Id));
                return new JavaScriptSerializer().Serialize(user);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
                return null;
            }


        }
        public string GetData(object userId, string profileId)
        {
            string ret = string.Empty;
            try
            {
                Guid UserId = (Guid)userId;
                //Api.FacebookFeed.FacebookFeed ApiObjFacebookFeed = new Api.FacebookFeed.FacebookFeed();
                //ApiObjFacebookFeed.getAllFacebookFeedsByUserIdAndProfileId(userId.ToString(), profileId);

                Api.User.User _User = new Api.User.User();

                Domain.Myfashion.Domain.User _AcUser = new User();
                //_AcUser = (Domain.Myfashion.Domain.User)(new JavaScriptSerializer().Deserialize(_User.getUserInfoByEmail("*****@*****.**"), typeof(Domain.Myfashion.Domain.User)));

                Api.FacebookAccount.FacebookAccount ApiObjFacebookAccount = new Api.FacebookAccount.FacebookAccount();
                List<Domain.Myfashion.Domain.FacebookAccount> lstFacebookAccounts = (List<Domain.Myfashion.Domain.FacebookAccount>)(new JavaScriptSerializer().Deserialize(ApiObjFacebookAccount.GetFacebookAccountByUserId(UserId.ToString()), typeof(List<Domain.Myfashion.Domain.FacebookAccount>)));
                //List<Domain.Myfashion.Domain.FacebookAccount> lstFacebookAccounts = (List<Domain.Myfashion.Domain.FacebookAccount>)(new JavaScriptSerializer().Deserialize(ApiObjFacebookAccount.GetFacebookAccountByUserId(_AcUser.Id.ToString()), typeof(List<Domain.Myfashion.Domain.FacebookAccount>)));


                foreach (FacebookAccount itemFb in lstFacebookAccounts)
                {
                    
                    try
                    {
                        if ((itemFb.Type == "Page" || itemFb.Type == "page") && (string.IsNullOrEmpty(itemFb.AccessToken)))
                        {
                            GetFbPost(itemFb);
                            //processThreadManagerAllParsersREader.CallMultithreadedMethod(mt_AllParsersReader, itemFb);
                        }
                        else if ((itemFb.Type == "Page" || itemFb.Type == "page") && (!string.IsNullOrEmpty(itemFb.AccessToken))) 
                        {
                            GetFbPageData(ret, itemFb);
                        }
                    }
                    catch (Exception Err)
                    {
                        Console.Write(Err.Message);
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            return ret;
        }
        //[WebMethod]
        //[ScriptMethod(UseHttpGet = false, ResponseFormat = ResponseFormat.Json)]
        public string SendNewsLetter(string body, string Subject, string userid,string NewsLetterId)
        {
            
            UserRepository objUserRepository = new UserRepository();
            Domain.Myfashion.Domain.User objUser = new Domain.Myfashion.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;
        }
 public string UpdateUserAccount(string Id, string UserName, string EmailId, string Package, string Status)
 {
     try
     {
         Domain.Myfashion.Domain.User objUser = new Domain.Myfashion.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"));
     }
 }
예제 #27
0
        public string UpdatePaymentSatus(string userid, string Accounttype)
        {
            UserRepository objuserreppo = new UserRepository();

            Domain.Myfashion.Domain.User objuser = new Domain.Myfashion.Domain.User();
            objuser.PaymentStatus = "paid";
            objuser.AccountType   = Accounttype;
            objuser.ExpiryDate    = DateTime.Now.AddDays(30);
            objuser.Id            = Guid.Parse(userid);
            int i = objuserreppo.UpdatePaymentStatusByUserId(objuser);

            if (i == 1)
            {
                return("success");
            }
            else
            {
                return("failed");
            }
        }
예제 #28
0
        //[WebMethod]
        //[ScriptMethod(UseHttpGet = false, ResponseFormat = ResponseFormat.Json)]
        public string SendNewsLetter(string body, string Subject, string userid, string NewsLetterId)
        {
            UserRepository objUserRepository = new UserRepository();

            Domain.Myfashion.Domain.User objUser = new Domain.Myfashion.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);
        }
예제 #29
0
        public ActionResult RemainingDays()
        {
            int    daysremaining = 0;
            string remainingday  = string.Empty;

            Domain.Myfashion.Domain.User objUser = (Domain.Myfashion.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)
                    {
                        remainingday = objUser.AccountType.ToString() + "##" + daysremaining.ToString();
                    }
                    else if (daysremaining == 0)
                    {
                        //remainingday = "Your trial " + objUser.AccountType.ToString() + " account will expire Today please upgrade to paid plan.";
                        remainingday = objUser.AccountType.ToString() + "##" + daysremaining.ToString();
                    }
                    else
                    {
                        //remainingday = "Your trial " + objUser.AccountType.ToString() + " account will expire in " + daysremaining + " days, please upgrade to paid plan.";
                        remainingday = objUser.AccountType.ToString() + "##" + daysremaining.ToString();
                    }
                }
            }

            return(Content(remainingday));
        }
        public string UpdateUserAccount(string Id, string UserName, string EmailId, string Package, string Status)
        {
            try
            {
                Domain.Myfashion.Domain.User objUser = new Domain.Myfashion.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");
            }

        }
        //vikash [06/04/2015]
        public User getUserInfoForSocialLogin(string logintype)
        {
            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.SocialLogin = : SocialLogin")
                        .SetParameter("SocialLogin", logintype).List<User>().ToList<User>();
                        user = lstUser[0];
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                        user = null;
                    }
                }
            }

            return user;
        }
        public int UpdateActivationStatusByUserId(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 ActivationStatus =:activationStatus where Id = :id")
                                      .SetParameter("activationStatus", user.ActivationStatus)
                                      .SetParameter("id", user.Id)
                                      .ExecuteUpdate();
                            transaction.Commit();
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);

                        }


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

            return i;
        }
        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 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.Myfashion.Domain.User objuser = new Domain.Myfashion.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)) + "_#_" + access_token;
        }
        public DataSet bindSentMessagesToDataTable(User user, string network)
        {
          
            List<SocialProfile> alstprofiles = (List<SocialProfile>)new JavaScriptSerializer().Deserialize(objApiSocialProfile.GetSocialProfileByUserId(user.Id.ToString()), typeof(List<SocialProfile>));
            Messages mstable = new Messages();
            DataSet ds = DataTableGenerator.CreateDataSetForTable(mstable);
            foreach (SocialProfile item in alstprofiles)
            {
                if (item.ProfileType == "facebook")
                {
                   
                    List<FacebookMessage> alstfbmsgs = (List<FacebookMessage>)new JavaScriptSerializer().Deserialize(objApiFacebookMessage.getAllSentMessages(item.ProfileId), typeof(List<FacebookMessage>)); ;

                    if (alstfbmsgs != null)
                    {
                        if (alstfbmsgs.Count != 0)
                        {
                            foreach (FacebookMessage facebookmsg in alstfbmsgs)
                            {
                                ds.Tables[0].Rows.Add(facebookmsg.ProfileId, "facebook", facebookmsg.FromId, facebookmsg.FromName, facebookmsg.FromProfileUrl, facebookmsg.MessageDate, facebookmsg.Message, facebookmsg.FbComment, facebookmsg.FbLike, facebookmsg.MessageId, facebookmsg.Type);

                            }

                        }
                    }
                }
                else if (item.ProfileType == "twitter")
                {
                   
                    List<TwitterDirectMessages> lstmsgtwtuser = (List<TwitterDirectMessages>)new JavaScriptSerializer().Deserialize(objApiTwitterDirectMessages.getAllDirectMessagesById(item.ProfileId), typeof(List<TwitterDirectMessages>));
                    foreach (TwitterDirectMessages lst in lstmsgtwtuser)
                    {
                        ds.Tables[0].Rows.Add(lst.SenderId, "twitter", lst.SenderId, lst.SenderScreenName, lst.SenderProfileUrl, lst.CreatedDate, lst.Message, "", "", lst.MessageId, lst.Type);
                    }
                }
                else if (item.ProfileType == "googleplus")
                {

                }

            }
            return ds;
        }
예제 #36
0
        public string Login(string EmailId, string Password)
        {
            logger.Error("Checking Abhay123");
            try
            {
                UserRepository userrepo = new UserRepository();

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

                Domain.Myfashion.Domain.User user = userrepo.GetUserInfo(EmailId, Utility.MD5Hash(Password));
                if (user != null)
                {
                   
                    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;
            }
        }
예제 #37
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.Myfashion.Domain.User objuser = new Domain.Myfashion.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)) + "_#_" + access_token);
        }
예제 #38
0
 public string UpdatePaymentSatus(string userid, string Accounttype)
 {
     UserRepository objuserreppo = new UserRepository();
     Domain.Myfashion.Domain.User objuser = new Domain.Myfashion.Domain.User();
     objuser.PaymentStatus = "paid";
     objuser.AccountType = Accounttype;
     objuser.ExpiryDate = DateTime.Now.AddDays(30);
     objuser.Id = Guid.Parse(userid);
     int i = objuserreppo.UpdatePaymentStatusByUserId(objuser);
     if (i == 1)
     {
         return "success";
     }
     else
     {
         return "failed";
     }
 }
예제 #39
0
        public string getUsersById(string UserId)
        {
            UserRepository userrepo = new UserRepository();
            if (!User.Identity.IsAuthenticated)
            {
                return "Unauthorized access";
            }
            Domain.Myfashion.Domain.User objUser = new Domain.Myfashion.Domain.User();
            objUser = userrepo.getUsersById(Guid.Parse(UserId));

            return new JavaScriptSerializer().Serialize(objUser);
        }
예제 #40
0
        public string getUserInfoByEmail(string userEmail)
        {
            UserRepository userrepo = new UserRepository();
            Domain.Myfashion.Domain.User objUser = new Domain.Myfashion.Domain.User();
            objUser = userrepo.getUserInfoByEmail(userEmail);

            return new JavaScriptSerializer().Serialize(objUser);
        }
        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;
            GlobusTwitterLib.Twitter.Core.UserMethods.Users userinfo = new GlobusTwitterLib.Twitter.Core.UserMethods.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.Myfashion.Domain.TwitterAccount();
            Domain.Myfashion.Domain.User objUser = new Domain.Myfashion.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);
        }
        public string GetTicketsofGroup(string GroupId, string UserId)
        {
            string AssignedUser = string.Empty;

            try
            {
                GroupProfileRepository objGroupProfileRepository = new GroupProfileRepository();
                FacebookFeedRepository objFacebookFeedRepository = new FacebookFeedRepository();
                TwitterFeedRepository  objTwitterFeedRepository  = new TwitterFeedRepository();
                List <Domain.Myfashion.Domain.FeedSentimentalAnalysis> lstNegativeFeedsOfUser = new List <Domain.Myfashion.Domain.FeedSentimentalAnalysis>();
                List <Domain.Myfashion.Domain.GroupProfile>            objGroupProfile        = new List <Domain.Myfashion.Domain.GroupProfile>();
                List <FBTwitterFeeds> objListFBTwitterFeeds = new List <FBTwitterFeeds>();

                objGroupProfile = objGroupProfileRepository.getAllGroupProfiles(Guid.Parse(UserId), Guid.Parse(GroupId));

                if (objGroupProfile.Count > 0)
                {
                    lstNegativeFeedsOfUser = _FeedSentimentalAnalysisRepository.getAllNegativeFeedsOfUser(Guid.Parse(UserId));
                }
                else
                {
                    lstNegativeFeedsOfUser = _FeedSentimentalAnalysisRepository.getNegativeFeedsOfUser(Guid.Parse(UserId));
                }
                if (lstNegativeFeedsOfUser != null)
                {
                    foreach (var item in lstNegativeFeedsOfUser)
                    {
                        FBTwitterFeeds objFBTwitterFeeds  = new FBTwitterFeeds();
                        UserRepository objUserRepository  = new UserRepository();
                        Domain.Myfashion.Domain.User user = objUserRepository.getUsersById(item.AssigneUserId);
                        if (objGroupProfileRepository.checkProfileExistsingroup(Guid.Parse(GroupId), item.ProfileId))
                        {
                            string Network = item.Network;
                            if (Network == "facebook")
                            {
                                Domain.Myfashion.Domain.FacebookFeed facebookfeed = objFacebookFeedRepository.getFacebookFeedByProfileId(item.ProfileId, item.FeedId);
                                if (facebookfeed != null)
                                {
                                    objFBTwitterFeeds.FacebookFeed = facebookfeed;
                                }
                            }
                            if (Network == "twitter")
                            {
                                Domain.Myfashion.Domain.TwitterFeed twtfeed = objTwitterFeedRepository.getTwitterFeedByProfileId(item.ProfileId, item.FeedId);
                                if (twtfeed != null)
                                {
                                    objFBTwitterFeeds.TwitterFeed = twtfeed;
                                }
                            }
                            if (objFBTwitterFeeds.TwitterFeed != null)
                            {
                                try
                                {
                                    objFBTwitterFeeds.TicketNo = item.TicketNo;
                                    if (user != null)
                                    {
                                        objFBTwitterFeeds.AssignedUser = user.UserName;
                                    }
                                    else
                                    {
                                        objFBTwitterFeeds.AssignedUser = "";
                                    }
                                    objListFBTwitterFeeds.Add(objFBTwitterFeeds);
                                }
                                catch (Exception ex)
                                {
                                    Console.WriteLine(ex.StackTrace);
                                }
                            }
                            if (objFBTwitterFeeds.FacebookFeed != null)
                            {
                                try
                                {
                                    objFBTwitterFeeds.TicketNo = item.TicketNo;
                                    if (user != null)
                                    {
                                        objFBTwitterFeeds.AssignedUser = user.UserName;
                                    }
                                    else
                                    {
                                        objFBTwitterFeeds.AssignedUser = "";
                                    }
                                    objListFBTwitterFeeds.Add(objFBTwitterFeeds);
                                }
                                catch (Exception ex)
                                {
                                    Console.WriteLine(ex.StackTrace);
                                }
                            }
                        }
                    }
                }

                return(new JavaScriptSerializer().Serialize(objListFBTwitterFeeds));
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
                return("SomethingWentWrong");
            }
        }
예제 #43
0
        public string Register(string EmailId, string Password, string AccountType, string Username, string Business_name, string ActivationStatus = "0")
        {
            UserRepository userrepo = new UserRepository();

            try
            {
                logger.Error("Register");

                if (!userrepo.IsUserExist(EmailId))
                {
                    Domain.Myfashion.Domain.User user = new Domain.Myfashion.Domain.User();
                    user.AccountType      = AccountType;
                    user.EmailId          = EmailId;
                    user.CreateDate       = DateTime.Now;
                    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;
                    user.UserStatus       = 1;
                    user.ActivationStatus = ActivationStatus;
                    user.Company          = Business_name;
                    user.Id = Guid.NewGuid();
                    Guid PId = Guid.NewGuid();
                    user.PuId       = PId.ToString() + Password;
                    user.Company_id = Guid.NewGuid();
                    UserRepository.Add(user);

                    try
                    {
                        Domain.Myfashion.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);
                        Account.AddAccountByUserId(user.Id, user.Company, user.Company_id, user.EmailId);
                        UpdateTeam(EmailId, user.Id.ToString(), user.UserName);
                        try
                        {
                            Domain.Myfashion.Domain.Customers objcust = new Customers();
                            objcust.Activekeywordcount       = 200;
                            objcust.Activeserpcampaignscount = 400;
                            objcust.Firstname             = Username;
                            objcust.Allowedcampaignscount = 200;
                            objcust.Allowedkeywordcount   = 2000;
                            Customersrepository objcustrepo = new Customersrepository();
                            objcustrepo.Add(objcust);
                            int id = objcustrepo.lastRecord();
                            Domain.Myfashion.Domain.Users objusers = new Users();
                            objcust.Customerid = id;
                            objusers.Customers = objcust;
                            objusers.Loginid   = EmailId;
                            objusers.Password  = Password;
                            objusers.Active    = 1;
                            objusers.Usertype  = 0;
                            objusers.Token     = "bcd213199780916aa7525d3972fa7bb15c1d1d31e955cfca5f7524b35ee5ee27_a373c25b036ac7ff";

                            objusers.Addeddate = DateTime.Now;
                            UsersRepository.addUsers(objusers);
                        }
                        catch (Exception ex) {
                            Console.WriteLine(ex.Message);
                            logger.Error("Error : " + ex.Message);
                            logger.Error("Error : " + ex.StackTrace);
                        }
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                        logger.Error("Error : " + ex.Message);
                        logger.Error("Error : " + ex.StackTrace);
                    }


                    return(new JavaScriptSerializer().Serialize(user));
                }
                else
                {
                    return("Email Already Exists");
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
                return("Something Went Wrong");
            }
        }
        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 DataSet bindFeedsIntoDataTable(User user, string network)
        {
            Messages mstable = new Messages();
            DataSet ds = DataTableGenerator.CreateDataSetForTable(mstable);

            if (!string.IsNullOrEmpty(network))
            {
                /*Facebook region*/
                if (network == "facebook")
                {

                    List<FacebookAccount> alstfbaccount = (List<FacebookAccount>)new JavaScriptSerializer().Deserialize(objApiFacebookAccount.getAllFacebookAccountsOfUser(user.Id.ToString()), typeof(List<FacebookAccount>));

                    foreach (FacebookAccount item in alstfbaccount)
                    {
                      
                        List<FacebookMessage> lstfbmsg = (List<FacebookMessage>)new JavaScriptSerializer().Deserialize(objApiFacebookMessage.getAllFacebookMessagesOfUser(user.Id.ToString(), item.FbUserId), typeof(List<FacebookMessage>));
                        foreach (FacebookMessage facebookmsg in lstfbmsg)
                        {
                            ds.Tables[0].Rows.Add(facebookmsg.ProfileId, "facebook", facebookmsg.FromId, facebookmsg.FromName, facebookmsg.FromProfileUrl, facebookmsg.MessageDate, facebookmsg.Message, facebookmsg.FbComment, facebookmsg.FbLike, facebookmsg.MessageId, facebookmsg.Type);
                        }
                    }
                }
                else if (network == "twitter")
                {
                  
                    List<TwitterAccount> alsttwtaccount = (List<TwitterAccount>)new JavaScriptSerializer().Deserialize(objApiTwitterAccount.getAllTwitterAccountsOfUser(user.Id.ToString()), typeof(List<TwitterAccount>));
                    foreach (TwitterAccount item in alsttwtaccount)
                    {
                     
                        List<TwitterFeed> lsttwtmsg = (List<TwitterFeed>)new JavaScriptSerializer().Deserialize(objApiTwitterFeed.getAllTwitterFeedOfUsers(user.Id.ToString(), item.TwitterUserId), typeof(List<TwitterFeed>));
                        foreach (TwitterFeed twtmsg in lsttwtmsg)
                        {
                            ds.Tables[0].Rows.Add(twtmsg.ProfileId, "twitter", twtmsg.FromId, twtmsg.FromScreenName, twtmsg.FromProfileUrl, twtmsg.FeedDate, twtmsg.Feed, "", "", twtmsg.MessageId, twtmsg.Type);
                        }
                    }

                }
                #region To be used later
                //else if (network == "linkedin")
                //{
                //    LinkedInAccountRepository liaccountrepo = new LinkedInAccountRepository();
                //    LinkedInFeedRepository lifeedrepo = new LinkedInFeedRepository();
                //    ArrayList alstliaccount = liaccountrepo.getAllLinkedinAccountsOfUser(user.Id);
                //    foreach (LinkedInAccount item in alstliaccount)
                //    {
                //        List<LinkedInFeed> lsttwtmsg = lifeedrepo.getAllLinkedInFeedsOfUser(user.Id, item.LinkedinUserId);
                //        foreach (LinkedInFeed limsg in lsttwtmsg)
                //        {
                //            ds.Tables[0].Rows.Add(limsg.ProfileId, "linkedin", limsg.FromId, limsg.FromName, limsg.FromPicUrl, limsg.FeedsDate, limsg.Feeds, "", "", "", limsg.Type);
                //        }
                //    }

                //}
                //else if (network == "instagram")
                //{
                //    InstagramAccountRepository insAccRepo = new InstagramAccountRepository();
                //    InstagramFeedRepository insFeedRepo = new InstagramFeedRepository();
                //    ArrayList alstlistaccount = insAccRepo.getAllInstagramAccountsOfUser(user.Id);
                //    foreach (InstagramAccount item in alstlistaccount)
                //    {
                //        List<InstagramFeed> lstFeeed = insFeedRepo.getAllInstagramFeedsOfUser(user.Id, item.InstagramId);
                //        foreach (InstagramFeed insFeed in lstFeeed)
                //        {
                //            ds.Tables[0].Rows.Add(insFeed.InstagramId, "instagram", "", "", "", insFeed.FeedDate, insFeed.FeedImageUrl, "", "", insFeed.FeedId, "");
                //        }
                //    }
                //} 
                #endregion

            }
            return ds;
        }
        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);
        }
예제 #47
0
        public string Register(string EmailId, string Password, string AccountType, string Username,string Business_name, string ActivationStatus = "0")
        {
            UserRepository userrepo = new UserRepository();
            try
            {
                
                logger.Error("Register");

                if (!userrepo.IsUserExist(EmailId))
                {


                    Domain.Myfashion.Domain.User user = new Domain.Myfashion.Domain.User();
                    user.AccountType = AccountType;
                    user.EmailId = EmailId;
                    user.CreateDate = DateTime.Now;
                    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;
                    user.UserStatus = 1;
                    user.ActivationStatus = ActivationStatus;
                    user.Company = Business_name;
                    user.Id = Guid.NewGuid();
                    Guid PId =Guid.NewGuid();
                    user.PuId = PId.ToString()+Password;
                    user.Company_id = Guid.NewGuid();
                    UserRepository.Add(user);

                    try
                    {
                        Domain.Myfashion.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);
                        Account.AddAccountByUserId(user.Id, user.Company, user.Company_id, user.EmailId);
                        UpdateTeam(EmailId, user.Id.ToString(), user.UserName);
                        try
                        {
                            Domain.Myfashion.Domain.Customers objcust = new Customers();
                            objcust.Activekeywordcount = 200;
                            objcust.Activeserpcampaignscount = 400;
                            objcust.Firstname = Username;
                            objcust.Allowedcampaignscount=200;
                            objcust.Allowedkeywordcount = 2000;
                            Customersrepository objcustrepo = new Customersrepository();
                            objcustrepo.Add(objcust);
                            int id= objcustrepo.lastRecord();
                            Domain.Myfashion.Domain.Users objusers = new Users();
                            objcust.Customerid = id;
                            objusers.Customers = objcust;
                            objusers.Loginid = EmailId;
                            objusers.Password = Password;
                            objusers.Active = 1;
                            objusers.Usertype = 0;
                            objusers.Token = "bcd213199780916aa7525d3972fa7bb15c1d1d31e955cfca5f7524b35ee5ee27_a373c25b036ac7ff";
                            
                            objusers.Addeddate = DateTime.Now;
                            UsersRepository.addUsers(objusers);

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

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


                    return new JavaScriptSerializer().Serialize(user);
                }
                else
                {
                    return "Email Already Exists";
                }

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



        }
        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 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;
        }
        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,ExpiryDate=:Exipreddate,AccountType =:AccountType where Id = :userid")
                                     .SetParameter("userid", user.Id).SetParameter("Exipreddate", user.ExpiryDate).SetParameter("AccountType", user.AccountType)
                                     .SetParameter("paymentStatus", user.PaymentStatus)
                                     .ExecuteUpdate();
                            transaction.Commit();


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

            return i;

        }
        public int UpdateCreatDateByUserId(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 CreateDate =:createDate, AccountType =: accountType , PaymentStatus=:paymentStatus where Id = :id")
                                      .SetParameter("createDate", user.CreateDate)
                                      .SetParameter("accountType", user.AccountType)
                                      .SetParameter("paymentStatus", user.PaymentStatus)
                                      .SetParameter("id", user.Id)
                                      .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.Myfashion.Domain.User objUser = new Domain.Myfashion.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;
 }