Пример #1
0
 public void FillByIdGivenUserIDDoNotExistsReturnsEmptyUser()
 {
     dataContext.User_Master.Add(GetTestUser());
     UserBO testUser = new UserBO();
     testUser.FillById("nilesh");
     Assert.IsNull(testUser.UserId);
 }
Пример #2
0
        protected override void ExecuteCore()
        {
            //si l'utilisateur est connecté, on le récupère depuis la session
            if(HttpContext.User != null && HttpContext.User.Identity.IsAuthenticated) {

                if(!string.IsNullOrEmpty(HttpContext.User.Identity.Name)) {

                    //si l'utilisateur n'est pas présent en session, on tente de l'insérer
                    if(Session["userConnected"] == null) {

                        long userId = 0;

                        if(long.TryParse(User.Identity.Name, out userId)) {

                            //insére le bo de l'utilisateur en session afin de le récupérer ailleurs
                            Session["userConnected"] = new UserBO(userId);
                        }
                    }

                    //on set la property de notre controlleur afin d'y avoir accès partout dans nos controleurs
                    UserConnected = (UserBO)Session["userConnected"];
                }
            }

            base.ExecuteCore();
        }
Пример #3
0
 public void FillByIdGivenValidUserReturnsSameUser()
 {
     dataContext.User_Master.Add(GetTestUser());
     UserBO testUser = new UserBO();
     testUser.FillById("abc");
     Assert.AreEqual("abc", testUser.UserId);
 }
Пример #4
0
        public void IsExistsGivenValidUserIDReturnsTrue()
        {
          
            IUROCareEntities dataContext = DataAccessLayer.GetDataContext();
            dataContext.User_Master.Add(GetTestUser());

            UserBO userBusinessObject = new UserBO();
            Assert.IsTrue(userBusinessObject.IsExists("abc"));
        }
Пример #5
0
    public string GetDynamicContent(string contextKey)
    {
        MongoCollection<User> objCollection = BaseClass.db.GetCollection<User>("c_User");

        UserBO objClass = new UserBO();
        foreach (User item in objCollection.Find(Query.EQ("_id", ObjectId.Parse(contextKey))))
        {
            objClass.Id = item._id.ToString();
            objClass.Email = item.Email.ToString();
            objClass.UserName = item.UserName;
            objClass.Password = item.Password;
            objClass.FirstName = item.FirstName;
            objClass.DateOfBirth = item.DateOfBirth;
            objClass.LastName = item.LastName;
            objClass.PhoneNumber = item.PhoneNumber;
            objClass.PasswordResetCode = item.PasswordResetCode;
            objClass.IsMobileAlert = item.IsMobileAlert;
            objClass.PhoneNumber = item.PhoneNumber;
            objClass.Gender = item.Gender;
            objClass.UserStatus = item.UserStatus;
            break;
        }
        MongoCollection<BasicInfo> objCollection2 = BaseClass.db.GetCollection<BasicInfo>("c_BasicInfo");

        BasicInfoBO objClassBasicInfo = new BasicInfoBO();
        foreach (BasicInfo item in objCollection2.Find(Query.EQ("UserId", ObjectId.Parse(contextKey))).SetLimit(1))
        {
            objClassBasicInfo.Id = item._id.ToString();
            objClassBasicInfo.UserId = item.UserId.ToString();
            objClassBasicInfo.CurrentCity = item.CurrentCity;
            objClassBasicInfo.HomeTown = item.HomeTown;
            objClassBasicInfo.Address = item.Address;
            objClassBasicInfo.CityTown = item.CityTown;
            objClassBasicInfo.ZipCode = item.ZipCode;
            objClassBasicInfo.Neighbourhood = item.Neighbourhood;
            objClassBasicInfo.RelationshipStatus = item.RelationshipStatus;
            break;
        }
        StringBuilder b = new StringBuilder();
        b.Append("<table ");
        b.Append("width:200px; font-size:10pt; font-family:Verdana;' cellspacing='0' cellpadding='3'>");

          //  b.Append("<tr><td colspan='3' style='background-color:#336699; color:white;'></td>View Post</tr>");
        b.Append("<tr><td><img src='../../Resources/ProfilePictures/" +contextKey+".jpg' width='50px'/> </td></tr>");
        b.Append("<tr><td><b>" + objClass.FirstName + " " + objClass.LastName + "</b> </td></tr>");
        b.Append("<tr><td>" + objClass.DateOfBirth.ToLongDateString() + " </td></tr>");
        b.Append("<tr><td>" + objClass.Gender + " </td></tr>");
        b.Append("<tr><td>" + objClassBasicInfo.CurrentCity + " </td></tr>");
        // b.Append("<asp:ImageButton ID="ImageButton1" runat="server" ImageUrl='../../Resources/CompressedVideo/play.png' Visible='<%# (((int)Eval("Type")) == Global.VIDEO)||(((int)Eval("Type")) == Global.TAG_VIDEOLINK)||(((int)Eval("Type")) == Global.TAG_VIDEO)||(((int)Eval("Type")) == Global.POST_VIDEOLINK)?true:false %>' CommandName="show" style='<%# "background:url(" +Eval("EmbedPost") + ")" %>'  />

        b.Append("</table>");

        return b.ToString();
    }
Пример #6
0
    protected void WallPost(string photoid)
    {
        UserBO objUser = new UserBO();
        objUser = UserBLL.getUserByUserId(Userid);

        WallBO objWall = new WallBO();
        objWall.PostedByUserId = Userid;
        objWall.WallOwnerUserId = Userid;
        objWall.FirstName = objUser.FirstName;
        objWall.LastName = objUser.LastName;
        objWall.Post = "added a new photo";
        objWall.AddedDate = DateTime.Now;
        objWall.Type = Global.PHOTO;
        objWall.EmbedPost = photoid;
        string wid = WallBLL.insertWall(objWall);
        ////////////////////////////////////TICKER CODE //////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////
        List<UserFriendsBO> listtag = FriendsBLL.getAllFriendsListName(Session["UserId"].ToString(), Global.CONFIRMED);
        //get the education,hometown and employer of people in list
        foreach (UserFriendsBO Useritem in listtag)
        {
            TickerBO objTicker = new TickerBO();

            objTicker.PostedByUserId = objWall.PostedByUserId;
            objTicker.TickerOwnerUserId = Useritem.FriendUserId;
            objTicker.FirstName = objWall.FirstName;
            objTicker.LastName = objWall.LastName;
            objTicker.Post = objWall.Post;
            objTicker.Title = "added a new photo";
            objTicker.AddedDate = DateTime.UtcNow;
            objTicker.Type = Global.PHOTO;
            objTicker.EmbedPost = objWall.EmbedPost;
            objTicker.WallId = wid;
            TickerBLL.insertTicker(objTicker);

        }
        TickerBO objTickerUserTag = new TickerBO();

        objTickerUserTag.PostedByUserId = Session["UserId"].ToString();
        objTickerUserTag.TickerOwnerUserId = Session["UserId"].ToString();
        objTickerUserTag.FirstName = objUser.FirstName;
        objTickerUserTag.LastName = objUser.LastName;
        objTickerUserTag.Post = objWall.Post;
        objTickerUserTag.Title = "added a new photo";
        objTickerUserTag.AddedDate = DateTime.UtcNow;
        objTickerUserTag.Type = Global.PHOTO;
        objTickerUserTag.EmbedPost = objWall.EmbedPost;
        objTickerUserTag.WallId = wid;
        TickerBLL.insertTicker(objTickerUserTag);

        ////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////
    }
Пример #7
0
 private void btnLogin_Click(object sender, EventArgs e)
 {
     UserBO user = new UserBO();
     string username = txtUserName.Text;
     string password = txtPassword.Text;
     if (user.Login(username, password) == true)
     {
         Main aMain = new Main();
         aMain.Show();
         this.Visible = false;
     }
     else
     {
         MessageBox.Show("Sai tên đăng nhập hoặc mật khẩu.", "Thất bại", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Пример #8
0
    protected void lbtnremove_Click(object sender, EventArgs e)
    {
        UserBO objUser = new UserBO();
        objUser = UserBLL.getUserByUserId(Userid);

        string oldfile = Server.MapPath("../../Resources/images/"+objUser.Gender+".png");
        string newfile = Server.MapPath(Global.PROFILE_PICTURE) + Userid + ".jpg";
              string backup = Server.MapPath(Global.PROFILE_PICTURE) +"backup.jpg";
              if (System.IO.File.Exists(newfile))
              {
                  System.IO.File.Delete(newfile);

                  System.IO.File.Copy(oldfile, newfile);
              }

        imgProfile.ImageUrl = Global.PROFILE_PICTURE + Userid + ".jpg";
    }
Пример #9
0
    protected void SubmitPhoneNo_Click(object sender, EventArgs e)
    {
        string Email = Session["UserEmail"].ToString();
        string phone = phoneNo.Text;

        UserBO objUser = new UserBO();
        objUser.Id = Session["SignUpUserId"].ToString();
        objUser.PhoneNumber = phone;
        BuinessLayer.UserBLL.UpdatePhoneNo(objUser); //update phone no

        Session["UserEmail"] = null;

        // for sending sms request to js
        string sms = "Please Check your INBOX by Clicking on Confirmation Link. ";

        Page.ClientScript.RegisterStartupScript(this.GetType(), "Test", "sending_sms('" + phoneNo.Text + "','" + sms + "');", true);

         //Response.Redirect("../../Default.aspx");
    }
Пример #10
0
        /// <summary>
        /// Vérifie si le couple email/mot de passe correspond à un utilisateur valide
        /// </summary>
        /// <param name="email">Email de l'utilisateur</param>
        /// <param name="password">Mot de passe en clair de l'utilisateur</param>
        /// <returns>Le userId si valide, null sinon</returns>
        public static long? IsAuthenticationValid(string email, string password)
        {
            //charge l'utilisateur depuis son email afin de récupérer son id
            UserBO user = new UserBO(email);

            //aucun utilisateur n'existe avec cet email
            if(user.Id == 0)
                return null;

            //vérification du mot de passe sur l'utilisateur
            //on formatte le mot de passe userId!password et on récupère le hash
            string passwordHash = Encrypt.GetHash(string.Format("{0}!{1}", user.Id, password));

            //si le pass match, on retourne l'id de l'utilisateur
            if (user.Password == passwordHash)
                return user.Id;

            return null;
        }
Пример #11
0
        //Confirm User Account
        public static string ConfirmUser(UserBO objClass)
        {
            MongoCollection<User> objCollection = db.GetCollection<User>("c_User");

            bool found = true;
            var query = Query.And(
              Query.EQ("PasswordResetCode", objClass.PasswordResetCode),
              Query.EQ("_id", ObjectId.Parse(objClass.Id)));
            var sortBy = SortBy.Descending("_id");
            var update = Update.Set("UserStatus", found);

            var result = objCollection.FindAndModify(query, sortBy, update, true);
            string found_ok = "No";
            foreach (User item in objCollection.Find(query))
            {
                found_ok = "Yes";
                //UserId = item._id.ToString();
                break;
            }
            return found_ok;
        }
Пример #12
0
        protected void gvUser_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            GridViewRow row             = (GridViewRow)gvUser.Rows[e.RowIndex];
            Label       lblName         = (Label)row.FindControl("lblName");
            TextBox     txtEmail        = (TextBox)row.FindControl("txtGvEmail");
            TextBox     txtUserType     = (TextBox)row.FindControl("txtGvUserType");
            TextBox     txtPhone        = (TextBox)row.FindControl("txtGvMobile");
            TextBox     txtQual         = (TextBox)row.FindControl("txtGvQualification");
            TextBox     txtGvInstitute  = (TextBox)row.FindControl("txtGvInstitute");
            TextBox     txtGvCompany    = (TextBox)row.FindControl("txtGvCompany");
            TextBox     txtGvExperience = (TextBox)row.FindControl("txtGvExperience");
            TextBox     txtGvCity       = (TextBox)row.FindControl("txtGvCity");

            gvJobs.EditIndex = -1;
            User user = new User(lblName.Text, txtEmail.Text, txtUserType.Text, txtPhone.Text, txtQual.Text, txtGvInstitute.Text, txtGvCompany.Text, txtGvExperience.Text, txtGvCity.Text, string.Empty);

            if (UserBO.UpdateUser(user))
            {
                ApplicationSession.Current.Users.Clear();
            }
            FillUserGrid();
        }
Пример #13
0
        public static UserBO GetUserByUserName(string username)
        {
            try
            {
                UserBO user          = new UserBO();
                var    collection    = MongoClientHelper.Current.ConnectDatabase().GetCollection <BsonDocument>("account");
                var    filterBuilder = Builders <BsonDocument> .Filter;
                var    filter        = filterBuilder.Eq("username", username) & filterBuilder.Eq("isactive", 1);
                var    cursor        = collection.Find(filter).FirstOrDefault();
                if (cursor == null)
                {
                    return(null);               //không tồn tại
                }
                user = BsonSerializer.Deserialize <UserBO>(cursor);

                return(user);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #14
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            UserBO obj = new UserBO();

            obj.UserName = txtUserName.Text;
            obj.Password = txtPassword.Text;
            int result = obj.GetUserbtUsernameAndPassword(txtUserName.Text, txtPassword.Text);

            switch (result)
            {
            case 1:
            {
                Session["UserName"] = txtUserName.Text.Trim();
                Session["Role"]     = result.ToString();
                Response.Redirect("Admin.aspx?role=" + result.ToString() + "&username="******"UserName"] = txtUserName.Text.Trim();
                Session["Role"]     = result.ToString();
                Response.Redirect("Supplier.aspx?role=" + result.ToString() + "&username="******"UserName"] = txtUserName.Text.Trim();
                Session["Role"]     = result.ToString();
                Response.Redirect("Landing.aspx?role=" + result.ToString() + "&username="******"Invalid Username and Password";
                break;
            }
        }
Пример #15
0
    protected void CourseDataMaterial_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        myframe.Visible = true;
        if (e.CommandName == "Select")
        {
            int rowIndex = Convert.ToInt32(e.CommandArgument);

            GridViewRow row = CourseDataMaterial.Rows[rowIndex];

            string country = row.Cells[2].Text;

            TakeAssessment.Visible = true;

            UserBO ob = new UserBO();
            ob.userid     = Session["User"].ToString();
            ob.coursecode = Session["CourseSelected"].ToString();
            clsBLL obj = new clsBLL();
            obj.onupdateQuantifierBLL(ob);

            myframe.Attributes.Add("src", country);
        }
    }
Пример #16
0
        public static DataSet ChangePassword(UserBO userdetails)
        {
            string  PasswordSalt   = string.Empty;
            string  HashedPassword = string.Empty;
            DataSet ds             = new DataSet();



            PasswordSalt             = Utility.GetSalt();
            HashedPassword           = Utility.GetHashedPassword(userdetails.NewPassword, PasswordSalt);
            userdetails.PasswordSalt = PasswordSalt;
            userdetails.NewPassword  = HashedPassword; //NewPassword variable storing the Newly generated password's Hash.
            try
            {
                ds = CommonDAL.ChangePassword(userdetails);
            }
            catch (Exception ex)
            {
                Log(ex, System.Reflection.MethodBase.GetCurrentMethod().Name);
            }
            return(ds);
        }
Пример #17
0
        public ActionResult Update([FromBody] UserBO userBO)
        {
            UserAppService userAppService = new UserAppService();
            ApiResponseBO  _apiResponse   = new ApiResponseBO();

            try
            {
                userAppService.Create(userBO);

                _apiResponse.HttpStatusCode = "200";
                _apiResponse.Message        = "User successfully created";
                _apiResponse.Status         = "Success";
            }
            catch (Exception ex)
            {
                _apiResponse.HttpStatusCode = "500";
                _apiResponse.Message        = ex.InnerException.Message;
                _apiResponse.Status         = "Error";
            }

            return(Ok(_apiResponse));
        }
Пример #18
0
        public ActionResult Post([FromBody] UserBO userBO)
        {
            UserAppService   userAppService = new UserAppService();
            UserAuthResponse _apiResponse   = new UserAuthResponse();

            if (ModelState.IsValid)
            {
                try
                {
                    UserAuthResponse userAuthResponse = userAppService.Authenticate(userBO);

                    _apiResponse.UserInfo   = userAuthResponse.UserInfo;
                    _apiResponse.UserWallet = userAuthResponse.UserWallet;

                    // SET SESSIONS
                    SessionController sessionController = new SessionController();
                    sessionController.CreateSession(userAuthResponse, HttpContext.Session);


                    _apiResponse.HttpStatusCode = "200";
                    _apiResponse.Message        = "User successfully authenticated";
                    _apiResponse.Status         = "Success";
                }
                catch (Exception ex)
                {
                    _apiResponse.HttpStatusCode = "500";
                    _apiResponse.Message        = ex.Message;
                    _apiResponse.Status         = "Error";
                }
            }
            else
            {
                _apiResponse.HttpStatusCode = "500";
                _apiResponse.Message        = "Please input the required credentials";
                _apiResponse.Status         = "Error";
            }
            return(Ok(_apiResponse));
        }
Пример #19
0
        public IEnumerable <ModelView.UserCardModel> GetCardList(Guid boothId, Guid userId)
        {
            try
            {
                var userBo         = new UserBO();
                var boothOfficerBo = new BoothOfficerBO();
                var user           = userBo.Get(this.ConnectionHandler, userId);

                var homa = new HomaBO().Get(this.ConnectionHandler, user.CongressId);

                var configcontent = new ConfigurationContentBO().Get(this.ConnectionHandler, user.CongressId,
                                                                     homa.Configuration.CardLanguageId);
                var list      = new List <ModelView.UserCardModel>();
                var userBooth = new UserBoothBO().Get(this.ConnectionHandler, userId, boothId);
                if (userBooth.Status == (byte)Enums.RezervState.PayConfirm ||
                    userBooth.Status == (byte)Enums.RezervState.Finalconfirm)
                {
                    var boothOfficers = boothOfficerBo.Where(this.ConnectionHandler, x =>

                                                             x.BoothId == boothId &&
                                                             x.UserId == userId
                                                             );
                    list = boothOfficerBo.GetCardList(this.ConnectionHandler, user, configcontent, homa,
                                                      boothOfficers);
                }
                return(list);
            }
            catch (KnownException ex)
            {
                Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace);
                throw new KnownException(ex.Message, ex);
            }
            catch (Exception ex)
            {
                Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace);
                throw new KnownException(ex.Message, ex);
            }
        }
Пример #20
0
        private IActionResult GenerateToken(UserBO user)
        {
            var claims = new List <Claim>
            {
                new Claim("workEmail", user.WorkEmail),
                new Claim("firstName", user.FirstName),
                new Claim("lastName", user.LastName),
                new Claim(JwtRegisteredClaimNames.Nbf, new DateTimeOffset(DateTime.Now).ToUnixTimeSeconds().ToString()),
                new Claim(JwtRegisteredClaimNames.Exp, new DateTimeOffset(DateTime.Now.AddDays(1)).ToUnixTimeSeconds().ToString()),
            };

            switch (user.WorkTitle)
            {
            case "Workshop":
                claims.Add(new Claim("workTitle", "Workshop"));
                break;

            case "Office":
                claims.Add(new Claim("workTitle", "Office"));
                break;

            case "Admin":
                claims.Add(new Claim("workTitle", "Admin"));
                break;

            default:
                break;
            }


            var token = new JwtSecurityToken(
                new JwtHeader(new SigningCredentials(
                                  new SymmetricSecurityKey(Encoding.UTF8.GetBytes("NoTMyPRObl3mSup£rF4ncyKey")),
                                  SecurityAlgorithms.HmacSha256)),
                new JwtPayload(claims));

            return(Ok(new JwtSecurityTokenHandler().WriteToken(token)));
        }
Пример #21
0
        public ModelView.UserCardModel SearchChipFoodReport(Guid chipfoodId, Guid userId)
        {
            try
            {
                var userCardModels  = new ModelView.UserCardModel();
                var userBo          = new UserBO();
                var user            = userBo.Get(this.ConnectionHandler, userId);
                var config          = new ConfigurationBO().Get(this.ConnectionHandler, user.CongressId);
                var configcontent   = new ConfigurationContentBO().Get(this.ConnectionHandler, user.CongressId, config.CardLanguageId);
                var homa            = new HomaBO().Get(this.ConnectionHandler, user.CongressId);
                var chipsFoodUserBo = new ChipsFoodUserBO();
                var chipsFoodUsers  = chipsFoodUserBo.Get(this.ConnectionHandler, chipfoodId, user.Id);
                var chipsFoodBo     = new ChipsFoodBO();
                if (chipsFoodUsers != null)
                {
                    var chipsFood  = chipsFoodBo.Get(this.ConnectionHandler, chipsFoodUsers.ChipsFoodId);
                    var cardModels = userBo.GetChipFootUser(this.ConnectionHandler, user, configcontent, homa, new List <ChipsFood> {
                        chipsFood
                    });
                    if (cardModels.Count > 0)
                    {
                        userCardModels = cardModels.FirstOrDefault();
                    }
                }

                return(userCardModels);
            }
            catch (KnownException ex)
            {
                Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace);
                throw new KnownException(ex.Message, ex);
            }
            catch (Exception ex)
            {
                Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace);
                throw new KnownException(ex.Message, ex);
            }
        }
Пример #22
0
        public UserBO Update(UserBO user)
        {
            using (var uow = _facade.UnitOfWork)
            {
                var userFromDB = uow.UserRepository.Get(user.Id);
                if (userFromDB == null)
                {
                    throw new InvalidOperationException("User not found");
                }

                var userUpdated = conv.Convert(user);

                userFromDB.FirstName = userUpdated.FirstName;
                userFromDB.LastName  = userUpdated.LastName;
                userFromDB.Email     = userUpdated.Email;
                userFromDB.Address   = userUpdated.Address;

                if (userUpdated.Guilds != null)
                {
                    userFromDB.Guilds.RemoveAll(
                        gu => !userUpdated.Guilds.Exists(
                            g => g.GuildId == gu.GuildId &&
                            g.UserId == gu.UserId));

                    userUpdated.Guilds.RemoveAll(
                        gu => userFromDB.Guilds.Exists(
                            g => g.GuildId == gu.GuildId &&
                            g.UserId == gu.UserId));

                    userFromDB.Guilds.AddRange(
                        userUpdated.Guilds);
                }


                uow.Complete();
                return(conv.Convert(userFromDB));
            }
        }
Пример #23
0
        /// <summary>
        /// Initializes Job BEO
        /// </summary>
        /// <param name="jobId">Create ReviewSet Job Identifier</param>
        /// <param name="jobRunId">Create ReviewSet Run Identifier</param>
        /// <param name="bootParameters">Boot parameters</param>
        /// <param name="createdBy">Create Reviewset created by</param>
        /// <returns>Create Reviewset Job Business Entity</returns>
        protected override MergeReviewSetJobBEO Initialize(int jobId, int jobRunId, string bootParameters, string createdBy)
        {
            MergeReviewSetJobBEO mergeReviewSetJobBeo = null;

            try
            {
                //Message that job has been initialized.
                EvLog.WriteEntry(jobId + Constants.InitMessage, Constants.JobStartMessage, EventLogEntryType.Information);
                //Populate the the UpdateReviewSetJobBEO from the boot Parameters
                mergeReviewSetJobBeo = GetUpdateRsJobBeo(bootParameters);

                if (mergeReviewSetJobBeo != null)
                {
                    mergeReviewSetJobBeo.JobId    = jobId;
                    mergeReviewSetJobBeo.JobRunId = jobRunId;
                    _userGuid = createdBy;
                    UserBusinessEntity userBusinessEntity = UserBO.GetUserUsingGuid(createdBy);
                    mergeReviewSetJobBeo.JobScheduleCreatedBy = userBusinessEntity.UserId;
                    mergeReviewSetJobBeo.JobTypeName          = Constants.JobName;
                    mergeReviewSetJobBeo.JobName = Constants.JobName + DateTime.Now.ToString(CultureInfo.InvariantCulture);
                }
                EvLog.WriteEntry(jobId + Constants.InitMessage, Constants.JobEndMessage, EventLogEntryType.Information);
            }
            catch (EVException ex)
            {
                HandleEVException();
                LogException(JobLogInfo, ex, LogCategory.Job, string.Empty, ErrorCodes.ProblemInJobInitialization);
            }
            catch (Exception ex)
            {
                //Handle exception in intialize
                EvLog.WriteEntry(jobId + Constants.JobError, ex.Message, EventLogEntryType.Error);
                LogException(JobLogInfo, ex, LogCategory.Job, string.Empty, ErrorCodes.ProblemInJobInitialization);
            }

            //return merge reviewset Job Business Entity
            return(mergeReviewSetJobBeo);
        }
Пример #24
0
        public static async Task <IActionResult> Run(
            [HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = "V0")] HttpRequest req, ILogger log)
        {
            try
            {
                string         requestBody     = await new StreamReader(req.Body).ReadToEndAsync();
                UserBO         data            = JsonConvert.DeserializeObject <UserBO>(requestBody);
                Uri            serviceEndpoint = new Uri(Environment.GetEnvironmentVariable("CosmosEndPoint"));
                string         key             = Environment.GetEnvironmentVariable("ConnectionStringCosmosDB");
                DocumentClient client          = new DocumentClient(serviceEndpoint, key);
                var            collectionUrl   = UriFactory.CreateDocumentCollectionUri("StapOutData", "StepOutLogin");

                await client.CreateDocumentAsync(collectionUrl, data);
            }
            catch (Exception ex)
            {
                //om makklijk fouten te kunnen opsporen.
                return(new OkObjectResult(ex.Message));
                //return new StatusCodeResult(500);
            }

            return(new StatusCodeResult(200));
        }
        public string SkillSearch(UserBO ob)
        {
            string s = "";

            try
            {
                SqlCommand cmd = new SqlCommand("SkillSearch", con);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@SkillName", ob.skillName);
                con.Open();
                SqlDataReader rdr = cmd.ExecuteReader();
                if (rdr.Read())
                {
                    s = rdr[0].ToString();
                }
            }
            catch
            {
                s = "";
            }
            con.Close();
            return(s);
        }
        public ActionResult UserDetails(string username)
        {
            UserBO user = new UserBO();

            using (var client = new System.Net.Http.HttpClient())
            {
                client.BaseAddress = new Uri(WebApiKey);

                var responseTask = client.GetAsync("/api/PatientMain/getuserbyusername?username=" + username);
                responseTask.Wait();

                var result = responseTask.Result;
                if (result.IsSuccessStatusCode)
                {
                    var readTask = result.Content.ReadAsAsync <UserBO>();
                    readTask.Wait();
                    user = readTask.Result;
                }
            }


            return(View(user));
        }
Пример #27
0
        public static UserBO GetUserDetailsByToken(string Token, string Ref1)
        {
            UserBO objUser = null;

            MySqlParameter[] param = new MySqlParameter[2];
            param[0] = new MySqlParameter("p_Token", Token);
            param[1] = new MySqlParameter("p_Ref1", Ref1);

            MySqlCommand cmd = new MySqlCommand();

            cmd.Parameters.AddRange(param);
            DataTable dt = DBConnection.GetDataTable("spGetUserDetailsbyToken", cmd, "");

            if (dt.Rows.Count > 0)
            {
                objUser         = new UserBO();
                objUser.CompId  = Convert.ToInt32(dt.Rows[0]["CompID"]);
                objUser.UserID  = dt.Rows[0]["UserID"].ToString();
                objUser.EmailID = dt.Rows[0]["EmailID"].ToString();
                objUser.Token   = dt.Rows[0]["Token"].ToString();
            }
            return(objUser);
        }
Пример #28
0
        protected override void BeginWork()
        {
            try
            {
                base.BeginWork();
                _jobParams = GetImportBEO(BootParameters);

                if (_jobParams != null && !string.IsNullOrEmpty(_jobParams.CreatedBy))
                {
                    //Get User Information , Its needed for search
                    _userInfo            = UserBO.AuthenticateUsingUserGuid(_jobParams.CreatedBy);
                    _userInfo.CreatedBy  = _jobParams.CreatedBy;
                    _isIncludeNativeFile = (_jobParams.IsImportNative);
                }
                //Law import batch size for documents
                _batchSize = GetMessageBatchSize();
            }
            catch (Exception ex)
            {
                ReportToDirector(ex.ToUserString());
                ex.Trace().Swallow();
            }
        }
Пример #29
0
        public int AddUser(UserBO objDO)
        {
            try
            {
                using (OracleCommand cmd = new OracleCommand("fsp_insert_user", _con))
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.Add("@pname", objDO.Name);
                    cmd.Parameters.Add("@paddress", objDO.Address);
                    cmd.Parameters.Add("@pemail", objDO.Email);
                    cmd.Parameters.Add("@mob", objDO.Mobile);

                    _con.Open();
                    int result = cmd.ExecuteNonQuery();
                    cmd.Dispose();
                    return(result);
                }
            }
            catch (Exception ex)
            {
                string error = ex.Message;
            }
        }
Пример #30
0
        ///////////////////////////////////////////////////////////////
        //                       INSERT FUNCTION
        //////////////////////////////////////////////////////////////
        public static string UserSignup(UserBO objClass)
        {
            MongoCollection <BsonDocument> objCollection = db.GetCollection <BsonDocument>("c_User");


            BsonDocument doc = new BsonDocument {
                { "Email", objClass.Email },
                { "UserName", objClass.UserName },
                { "Password", objClass.Password },
                { "FirstName", objClass.FirstName },
                { "LastName", objClass.LastName },
                { "Gender", objClass.Gender },
                { "PhoneNumber", objClass.PhoneNumber },
                { "DateOfBirth", objClass.DateOfBirth },
                { "PasswordResetCode", objClass.PasswordResetCode },
                { "UserStatus", objClass.UserStatus },
                { "IsMobileAlert", objClass.IsMobileAlert },
            };

            var rt = objCollection.Insert(doc);

            return(doc["_id"].ToString());
        }
Пример #31
0
        public async Task <IActionResult> Login(LoginUserRequest request)
        {
            UserBO login = new UserBO();

            login.TenTaiKhoan = request.tenDangNhap;
            login.MatKhau     = request.matKhau;

            IActionResult response = Unauthorized();

            var user = AuthenticateUser(login);

            if (user != null)
            {
                var stringToken = GetJSONWebToken(user);

                var stringRefreshToken = TokenService.GenerateRefreshToken();
                user.RefreshToken = stringRefreshToken;
                var result = _userService.UpdateRefreshToken(user.MaTk, user.RefreshToken);
                response = Ok(new { user, token = stringToken });
            }

            return(response);
        }
Пример #32
0
        public string UpdateLoginStatus()
        {
            try
            {
                _objUserBO = (UserBO)HttpContext.Current.Session["UserBO"];
                SqlCommand _sqlcmd = new SqlCommand("sp_UpdateLogin_Signout", _sqlcon);
                _sqlcmd.CommandType = CommandType.StoredProcedure;
                _sqlcmd.Parameters.AddWithValue("@UserID", _objUserBO.UserID);
                _sqlcon.Open();
                string ID = Convert.ToString(_sqlcmd.ExecuteNonQuery());
                _sqlcon.Close();

                return(ID);
            }
            catch (Exception)
            {
                return(string.Empty);
            }
            finally
            {
                _sqlcon.Close();
            }
        }
Пример #33
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     UserBO objUser = new UserBO();
     objUser.Email = txtEmail.Text.Trim();
     objUser.Password = txtPassword.Text.Trim();
     int retval = UserManager.AuthenticateUser(objUser);
     if (retval <= 0)
     {
         Label1.Visible = true;
         Label1.Text = "Invalid User or Password";
     }
     else
     {
         string lasturl="";
         if(ViewState["lastURL"]!=null)
         lasturl = ViewState["lastURL"].ToString();
         if (lasturl.Length <= 0)
         {
             Response.Redirect("../General/commonhome.aspx");
         }
         Response.Redirect(lasturl);
     }
 }
        public ActionResult SignupUser()
        {
            Models.UsersTable u = new Models.UsersTable();
            //u.UserId =Convert.ToInt32(Request["UserId"]);
            u.Login       = Request["name"];
            u.Password    = Request["Password"];
            u.Designation = Request["Designation"];
            u.Email       = Request["Email"];
            u.isActive    = true /*Convert.ToBoolean(Request["isActive"])*/;
            u.UsersType   = 2 /*Convert.ToInt32(Request["UsersType"])*/;
            var obj = UserBO.Save(u);

            if (obj > 0)
            {
                return(Content("<script>alert('thanks for registering!!!');document.location='NormalUser'</script>"));
                // int i = 0;
                // Session["user"] = obj;
            }
            else
            {
                return(Content("<script>alert('registering unsuccessful!!!');document.location='login'</script>"));
            }
        }
Пример #35
0
        private IActionResult GenerateToken(UserBO user)
        {
            var claims = new List <Claim>
            {
                new Claim("username", user.Username),
                new Claim(JwtRegisteredClaimNames.Nbf, new DateTimeOffset(DateTime.Now).ToUnixTimeSeconds().ToString()),
                new Claim(JwtRegisteredClaimNames.Exp, new DateTimeOffset(DateTime.Now.AddDays(1)).ToUnixTimeSeconds().ToString()),
            };

            if (user.Role == "Administrator")
            {
                claims.Add(new Claim("role", "Administrator"));
            }


            var token = new JwtSecurityToken(
                new JwtHeader(new SigningCredentials(
                                  new SymmetricSecurityKey(Encoding.UTF8.GetBytes("BOErgeOsTSpiser AErter 123 STK I ALT!")),
                                  SecurityAlgorithms.HmacSha256)),
                new JwtPayload(claims));

            return(Ok(new JwtSecurityTokenHandler().WriteToken(token)));
        }
Пример #36
0
        public HttpResponseMessage getinvenchgrecordbycode(string barcode, string inno)
        {
            List <PRoStockinBarcodeModel> list  = new List <PRoStockinBarcodeModel>();
            PRoStockinBarcodeModel        model = new PRoStockinBarcodeModel();
            UserVO        userByPk = UserBO.GetUserByPk(base.User.Identity.Name);
            List <DBData> list2    = StockInBO.inventorychange_bybarcode(barcode, userByPk.Code, inno);

            foreach (DBData data in list2)
            {
                PRoStockinBarcodeModel item = new PRoStockinBarcodeModel {
                    Barcode   = data["barcode"].ToString(),
                    Custno    = data["custno"].ToString(),
                    Inno      = data["inno"].ToString(),
                    Mcode     = data["mcode"].ToString(),
                    Mname     = data["mname"].ToString(),
                    Qty       = Convert.ToDecimal(data["qty"]),
                    Storageno = data["storageno"].ToString(),
                    Zhoushu   = Convert.ToInt16(data["zhoushu"])
                };
                list.Add(item);
            }
            return(model.toJson(list));
        }
Пример #37
0
        public static async Task AddToken(UserBO user)
        {
            using (HttpClient client = new HttpClient())
            {
                string url = "https://stepoutapi.azurewebsites.net/api/UpdateToken"; //nog aan te passen naar login api

                try
                {
                    string      json     = JsonConvert.SerializeObject(user);
                    HttpContent content  = new StringContent(json, Encoding.UTF8, "application/json");
                    var         response = await client.PostAsync(url, content);

                    if (response.IsSuccessStatusCode)
                    {
                        Debug.WriteLine("Succesfully added");
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
        }
Пример #38
0
        //Login Event
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            //Get the data
            string userName  = txtUserName.Text;
            string password  = txtPassword.Text;
            string sessionID = Session.SessionID;

            //Check the logined in user is correct or not
            UserBO ubo = bl.LoggedInUser(userName, password, sessionID);

            if (ubo == null)
            {
                //If the user name and password are not correct
                ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "alert('User Name and Password is not correct')", true);
            }
            else
            {
                //User Name and Password are correct
                Session["userLoggedIn"] = ubo;
                Session["login"]        = bl.getLoginInfo(ubo.UserID);

                if (ubo.PrimaryRole.Equals("Employee") || ubo.PrimaryRole.Equals("Dept Head"))
                {
                    //to check emplyee role
                    checkEmployee(ubo);
                }
                else if (ubo.PrimaryRole.Equals("Store Clerk") || ubo.PrimaryRole.Equals("Store Supervisor") || ubo.PrimaryRole.Equals("Store Manager"))
                {
                    //To check Store role
                    checkStoreClerk(ubo);
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "alert('Wrong Role')", true);
                }
            }
        }
        public async Task <ActionResult> Account(AccountSettingsViewModel model, HttpPostedFileBase Image)
        {
            try
            {
                UserBO user = await UserManager.FindByIdAsync(CurrentUserId);

                user.FirstName  = model.Firstname;
                user.MiddleName = model.Middlename;
                user.LastName   = model.Lastname;
                user.Email      = model.Email;

                if (Image != null)
                {
                    string ImageCode  = model.imageCode;
                    var    base64Data = Regex.Match(ImageCode, @"data:image/(?<type>.+?),(?<data>.+)").Groups["data"].Value;
                    byte[] binData    = Convert.FromBase64String(base64Data);

                    user.ImageMimeType = "image/png";
                    int imgLength = (int)binData.Length;
                    user.ImageContent = new byte[imgLength];

                    using (MemoryStream stream = new MemoryStream(binData))
                    {
                        stream.Read(user.ImageContent, 0, imgLength);
                    };
                }

                await UserManager.UpdateAsync(user);

                return(RedirectToAction("account", "settings"));
            }
            catch (Exception ex)
            {
                LogError(ex, CurrentUserId);
                return(View("Error"));
            }
        }
Пример #40
0
        public static DataSet SetProfileDetails(UserBO u)
        {
            DataSet         ds   = new DataSet();
            MySqlConnection conn = new MySqlConnection(ConnectionManager.connectionString);

            try
            {
                conn.Open();
                string       stm = "spSetProfileDetails";
                MySqlCommand cmd = new MySqlCommand(stm, conn);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("p_CompId", u.CompId);
                cmd.Parameters.AddWithValue("p_UserId", u.UserID);
                cmd.Parameters.AddWithValue("p_FirstName", u.FirstName);
                cmd.Parameters.AddWithValue("p_LastName", u.LastName);
                cmd.Parameters.AddWithValue("p_ThemeColor", u.ThemeColor);
                cmd.Parameters.AddWithValue("p_Logo", u.Logo);
                cmd.Parameters.AddWithValue("p_ProfilePic", u.ProfilePicFileID);
                cmd.Parameters.AddWithValue("p_EmailId", u.EmailID);
                cmd.Parameters.AddWithValue("p_MobileNo", u.MobileNum);
                cmd.Parameters.AddWithValue("p_Position", u.Position);
                cmd.Parameters.AddWithValue("p_GroupId", u.GroupId);
                cmd.Parameters.AddWithValue("p_CreatedBy", u.UserID);
                MySqlDataAdapter da = new MySqlDataAdapter(cmd);
                da.Fill(ds, "Data");
                return(ds);
            }
            catch (Exception ex)
            {
                Log(ex, System.Reflection.MethodBase.GetCurrentMethod().Name);
            }
            finally
            {
                conn.Close();
            }
            return(ds);
        }
Пример #41
0
        public int registerUser(UserBO ub)
        {
            string constr = @"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=D:\BCS DATA\Samester 6\C Sharp\Assingment 1\DAL\styloDatabase.mdf;Integrated Security=True";

            using (DataClassesDataContext data = new DataClassesDataContext(constr))
            {
                var check = from a in data.Users
                            where a.Username == ub.Username
                            select a;


                if (check.Any())
                {
                    return(3);
                }



                User newUser = new User
                {
                    Username = ub.Username,
                    Password = ub.Password,
                    Role     = ub.Role
                };

                data.Users.InsertOnSubmit(newUser);
                try
                {
                    data.SubmitChanges();
                    return(0);
                }
                catch (Exception e)
                {
                    return(1);
                }
            }
        }
        public IHttpActionResult GetAdminUsers()
        {
            var data     = "";
            var identity = MyAuthorizationServerProvider.AuthenticateUser();

            if (identity != null)
            {
                UserBO objUser = new UserBO();

                if (identity.Role == ConstantMessages.Roles.companyadmin || identity.Role == ConstantMessages.Roles.superadmin)
                {
                    objUser.UserID = identity.UserID;
                    objUser.CompId = identity.CompId;
                    objUser.Role   = identity.Role;

                    var ds = OrganizationBL.GetAdminUsers(objUser);
                    if (ds.Tables.Count > 0)
                    {
                        data = Utility.ConvertDataSetToJSONString(ds.Tables[0]);
                        data = Utility.Successful(data);
                    }
                    else
                    {
                        data = Utility.API_Status("2", "No user found");
                    }
                }
                else
                {
                    data = Utility.API_Status("3", "You do not have access for this functionality");
                }
            }
            else
            {
                data = Utility.AuthenticationError();
            }
            return(new APIResult(Request, data));
        }
Пример #43
0
    protected void ShareStatus(string post)
    {
        string status = post;

        if (lblFriendsWith.Text != "")
            status += "-- with " + lblFriendsWith.Text.Remove(lblFriendsWith.Text.LastIndexOf(","));

        if (lblLocation.Text != "")
            status += lblLocation.Text;

        if (lblFriendsTag.Text != "")
            status += " and Tag to " + lblFriendsTag.Text.Remove(lblFriendsTag.Text.LastIndexOf(","));

        UserBO objUser = new UserBO();
        objUser = UserBLL.getUserByUserId(Session["UserId"].ToString());

        WallBO objWall = new WallBO();
        objWall.PostedByUserId = Session["UserId"].ToString();

        //string temp = Session["ShareWithID"].ToString();
        //string temp = Session["ShareWithID"].ToString();

        string id = Session["hello"].ToString();

        if (Session["ShareWithID"] != null)
        {
            if (Session["ShareWithID"].ToString() != "")
            {
                objWall.WallOwnerUserId = Session["ShareWithID"].ToString();
                UserBO objFriendObj = new UserBO();
                objFriendObj = UserBLL.getUserByUserId(Session["ShareWithID"].ToString());

                // Sending notification with which the post is beind shared
                sendEmail(objFriendObj.Email);
            }
            else
            {
                objWall.WallOwnerUserId = Session["UserId"].ToString();
                UserBO objUserEmail = new UserBO();
                objUserEmail = UserBLL.getUserByUserId(Session["UserId"].ToString());
                sendEmail(objUserEmail.Email);
            }
        }
        else
        {
            objWall.WallOwnerUserId = Session["UserId"].ToString();
            UserBO objUserEmail = new UserBO();
            objUserEmail = UserBLL.getUserByUserId(Session["UserId"].ToString());
            sendEmail(objUserEmail.Email);
        }

        objWall.FirstName = objUser.FirstName;
        objWall.LastName = objUser.LastName;
        objWall.Post = status;
        objWall.AddedDate = DateTime.Now;
        objWall.Type = Global.TEXT_POST;
        WallBLL.insertWall(objWall);
        ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "myScript", "document.getElementById('" + txtUpdatePost.ClientID + "').value = '';", true);
        lblLocation.Text = "";
        lblFriendsWith.Text = "";
        LoadWall(100);
        Session["ShareWithID"] = "";
    }
Пример #44
0
    protected void txtFriendSearch_TextChanged(object sender, EventArgs e)
    {
        string fid = HiddenField1.Value;
        if (fid.Length > 20)
        {
            UserBO objFriend = new UserBO();
            objFriend = UserBLL.getUserByUserId(fid);
            UserBO objUser = new UserBO();
            objUser = UserBLL.getUserByUserId(Userid);

            //Response.Write(fid);

            TagsBO objTags = new TagsBO();
            objTags.AtId = Photoid;
            objTags.Type = Global.VIDEO;
            objTags.UserId = Userid;
            objTags.FirstName = objUser.FirstName;
            objTags.LastName = objUser.LastName;
            objTags.FriendId = fid;
            objTags.FriendFName = objFriend.FirstName;
            objTags.FriendLName = objFriend.LastName;

            TagsBLL.insertTags(objTags);
            LoadDataListTags();

            List<string> lst = new List<string>();
            lst = TagsBLL.getTagsFriendId(Global.VIDEO, Photoid);

            LoadDataListComments();

            foreach (string item in lst)
            {

                UserBO objUserNotify = new UserBO();
                objUserNotify = UserBLL.getUserByUserId(item);
                NotificationBO objNotify = new NotificationBO();
                objNotify.MyNotification = "<a  href=\"ViewProfile.aspx?UserId=" + Userid + "\">" + objUser.FirstName + " " + objUser.LastName + "</a> tags on <a  href=\"ViewVideo.aspx?VideoId=" + Photoid + "\">video</a>";
                objNotify.AtId = Photoid;
                objNotify.Type = Global.VIDEO;
                objNotify.UserId = item;
                objNotify.FirstName = objUserNotify.FirstName;
                objNotify.LastName = objUserNotify.LastName;
                objNotify.FriendId = Userid;
                objNotify.FriendFName = objUser.FirstName;
                objNotify.FriendLName = objUser.LastName;
                msgtext = "Dear Pyramid Plus user," + objUser.FirstName + " " + objUser.LastName + " tags you photo ";

               // ThreadPool.QueueUserWorkItem(new WaitCallback(sendEmail), (object)objUserNotify.Email);
                //sendEmail(objUserNotify.Email);

                NotificationBLL.insertNotification(objNotify);
            }
        }
    }
Пример #45
0
    protected void WallPost(string photoid)
    {
        UserBO objUser = new UserBO();
        objUser = UserBLL.getUserByUserId(Session["UserId"].ToString());

        WallBO objWall = new WallBO();
        objWall.PostedByUserId = Session["UserId"].ToString();

        // Whether the wall is owned by some other person or by me

        try
        {
            if (Request.QueryString[0] != null)
            {
                objWall.WallOwnerUserId = Request.QueryString[0];
                objWall.Type = Global.SHARE;
            }
            else
            {
                objWall.WallOwnerUserId = userid;
                objWall.Type = Global.TEXT_POST;
            }
        }
        catch
        {
            objWall.WallOwnerUserId = userid;
            objWall.Type = Global.TEXT_POST;
        }

        objWall.FirstName = objUser.FirstName;
        objWall.LastName = objUser.LastName;

        if (txtUpdatePost.Text != "")
            objWall.Post = "added a new photo <br/>" + txtUpdatePost.Text + " </br></br><a href='ViewPhoto.aspx?PhotoId=" + photoid + "'><img src='../../Resources/ThumbnailPhotos/" + photoid + ".jpg' width='150' height='150' border='0' alt='No Image'/> <a/>";
        else
            objWall.Post = "added a new photo </br></br><a href='ViewPhoto.aspx?PhotoId=" + photoid + "'><img src='../../Resources/ThumbnailPhotos/" + photoid + ".jpg' width='150' height='150' border='0' alt='No Image'/> <a/>";

        objWall.AddedDate = DateTime.Now;

        WallBLL.insertWall(objWall);
    }
Пример #46
0
    // @@@@@@@@@@@@@@@@@@@@ by Nabeel
    protected void txtFriendWallTag_TextChanged(object sender, EventArgs e)
    {
        string tagstatus="tagged a post";
        GridViewRow row = ((GridViewRow)((TextBox)sender).NamingContainer);
        HiddenField hfId = (HiddenField)row.FindControl("HiddenFieldId");
        HiddenField hfType = (HiddenField)row.FindControl("HiddenFieldType");
        HiddenField hfEmbedPost = (HiddenField)row.FindControl("HiddenFieldEmbedPost");
        Literal post = (Literal)row.FindControl("LiteralPost");
        TextBox TagExsitingFreindsPost = (TextBox)row.FindControl("txtFriendWallTag");
        WallBO objWall2 = new WallBO();
        UserBO objUser = new UserBO();
        objUser = UserBLL.getUserByUserId(Session["UserId"].ToString());
        string tagpost = post.Text + "<br/><font color='#838181'> was Tagged by <font/> <a  href=\"ViewProfile.aspx?UserId=" + Session["UserId"].ToString() + "\">" + objUser.FirstName + " " + objUser.LastName + "</a>.";
        UserBO objUser2 = new UserBO();
        objUser2 = UserBLL.getUserByUserId(HiddenFieldWallTagId.Value);
        objWall2.PostedByUserId = HiddenFieldWallTagId.Value;
        objWall2.WallOwnerUserId = HiddenFieldWallTagId.Value;
        objWall2.FirstName = objUser2.FirstName;
        objWall2.LastName = objUser2.LastName;
        objWall2.Post = tagpost;
        objWall2.AddedDate = DateTime.Now;
        objWall2.Type = Global.TAG_POST;

        if (hfType.Value.Equals(Global.VIDEO.ToString()))
        {
            objWall2.Type = Global.TAG_VIDEO;
            objWall2.EmbedPost = Global.PATH_COMPRESSED_USER_VIDEO + "Thumb/" + uploadedvideothumbname;
            notify_Tag(HiddenFieldWallTagId.Value, userid);
            tagstatus = "tagged a video";
        }
        if (hfType.Value.Equals(Global.POST_VIDEOLINK.ToString()))
        {
            objWall2.Type = Global.TAG_VIDEOLINK;
            objWall2.EmbedPost = hfEmbedPost.Value;
            notify_Tag(HiddenFieldWallTagId.Value, userid);
            tagstatus = "tagged a video";
        }

        if (hfType.Value.Equals(Global.PHOTO.ToString()))
        {
            TagsBO objTags = new TagsBO();
            objTags.AtId = hfEmbedPost.Value;
            objTags.Type = Global.PHOTO;
            objTags.UserId = Session["UserId"].ToString();
            objTags.FirstName = objUser.FirstName;
            objTags.LastName = objUser.LastName;
            objTags.FriendId = HiddenFieldWallTagId.Value;
            objTags.FriendFName = objUser2.FirstName;
            objTags.FriendLName = objUser2.LastName;
            notify_Tag(HiddenFieldWallTagId.Value, hfEmbedPost.Value);
            TagsBLL.insertTags(objTags);
            objWall2.Type = Global.TAG_PHOTO;
            objWall2.EmbedPost = hfEmbedPost.Value;
            tagstatus = "tagged a photo";
        }
        RWallPost(" Tag post to <a  href=\"ViewProfile.aspx?UserId=" + HiddenFieldWallTagId.Value + "\">" + objUser2.FirstName + " " + objUser2.LastName + "</a>");

        string twid=WallBLL.insertWall(objWall2);
        TagExsitingFreindsPost.Visible = false;
        //Response.Redirect("~main.aspx?a=" + HiddenFieldWallTagId.Value + "b=" + aa);

        //if (txtFriendTag.Text != "" && HiddenFieldTagId.Value.Length > 20)
        //{
        //    lblFriendsTag.Text += "<a  href=\"ViewProfile.aspx?UserId=" + HiddenFieldTagId.Value + "\">" + txtFriendTag.Text + "</a>,";
        //    lstTag.Add(HiddenFieldTagId.Value);
        //    txtFriendTag.Text = "";
        //    HiddenFieldTagId.Value = "";
        //}

        ////////////////////////////////////TICKER CODE //////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////
        List<UserFriendsBO> listtag = FriendsBLL.getAllFriendsListName(Session["UserId"].ToString(), Global.CONFIRMED);
        //get the education,hometown and employer of people in list
        foreach (UserFriendsBO Useritem in listtag)
        {
            TickerBO objTicker = new TickerBO();
            objTicker.PostedByUserId = objWall2.PostedByUserId;
            objTicker.TickerOwnerUserId = Useritem.FriendUserId;
            objTicker.FirstName = objWall2.FirstName;
            objTicker.LastName = objWall2.LastName;
            objTicker.Post = objWall2.Post;
            objTicker.Title = ConvertUrlsToLinks(tagstatus);
            objTicker.AddedDate = DateTime.UtcNow;
            objTicker.Type = objWall2.Type;
            objTicker.EmbedPost = objWall2.EmbedPost;
            objTicker.WallId = twid;
            TickerBLL.insertTicker(objTicker);

        }
        TickerBO objTickerUserTag = new TickerBO();

        objTickerUserTag.PostedByUserId = Session["UserId"].ToString();
        objTickerUserTag.TickerOwnerUserId = Session["UserId"].ToString();
        objTickerUserTag.FirstName = objUser.FirstName;
        objTickerUserTag.LastName = objUser.LastName;
        objTickerUserTag.Post = objWall2.Post;
        objTickerUserTag.Title = "you tag a post";
        objTickerUserTag.AddedDate = DateTime.UtcNow;
        objTickerUserTag.Type = objWall2.Type;
        objTickerUserTag.EmbedPost = objWall2.EmbedPost;
        objTickerUserTag.WallId = twid;
        TickerBLL.insertTicker(objTickerUserTag);

        ////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////
    }
Пример #47
0
    protected void InsertComments()
    {
        UserBO objUser = new UserBO();
        objUser = UserBLL.getUserByUserId(Userid);

        CommentsBO objClass = new CommentsBO();
        objClass.MyComments = txtComments.Text;
        objClass.AtId = Photoid;
        objClass.Type = Global.VIDEO;
        objClass.UserId = Userid;
        objClass.FirstName = objUser.FirstName;
        objClass.LastName = objUser.LastName;

        if (objClass.MyComments.Equals(""))
        {
           CommentsDAL.insertComments(objClass);
        }

        ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "myScript", "document.getElementById('" + txtComments.ClientID + "').value = '';", true);

        List<string> lst = new List<string>();
        lst = CommentsDAL.getCommentsUserIdbyAtId(Global.VIDEO, Photoid);
        if (Isfollow == true)
        {
            foreach (string item in lst)
            {

                UserBO objUserNotify = new UserBO();
                objUserNotify = UserBLL.getUserByUserId(item);
                msgtext = "Dear Pyramid Plus user, Comments on your video. ";
                NotificationBO objNotify = new NotificationBO();
                objNotify.MyNotification = "<a  href=\"ViewProfile.aspx?UserId=" + Userid + "\">" + objUser.FirstName + " " + objUser.LastName + "</a> comments on <a  href=\"ViewVideo.aspx?VideoId=" + Photoid + "\">video</a>";
                objNotify.AtId = Photoid;
                objNotify.Type = Global.VIDEO;
                objNotify.UserId = item;
                objNotify.FirstName = objUserNotify.FirstName;
                objNotify.LastName = objUserNotify.LastName;
                objNotify.FriendId = Userid;
                objNotify.FriendFName = objUser.FirstName;
                objNotify.FriendLName = objUser.LastName;
                objNotify.Status = false;
                //  ThreadPool.QueueUserWorkItem(new WaitCallback(sendEmail), (object)objUserNotify.Email);
                NotificationBLL.insertNotification(objNotify);
            }
        }
        txtComments.Text = "";
        LoadDataListComments();
    }
Пример #48
0
    protected void lbtnLike_Click(object sender, EventArgs e)
    {
        string statuslike = "like a post";
        GridViewRow row = ((GridViewRow)((LinkButton)sender).NamingContainer);
        LinkButton linkLike = (LinkButton)row.FindControl("lbtnLike");
        Label labelLike = (Label)row.FindControl("lblLike");
        HiddenField hfId = (HiddenField)row.FindControl("HiddenFieldId");
        Literal literalpost = (Literal)row.FindControl("LiteralPost");
        HiddenField hfType = (HiddenField)row.FindControl("HiddenFieldType");
        HiddenField hfEmbedPost = (HiddenField)row.FindControl("HiddenFieldEmbedPost");
        UserBO objUser = new UserBO();
        objUser = UserBLL.getUserByUserId(Session["UserId"].ToString());
        if (linkLike.Text == "Like")
        {

            LikesBO objClass = new LikesBO();
            objClass.AtId = hfId.Value;
            objClass.Type = Global.WALL;
            objClass.UserId = Session["UserId"].ToString();
            objClass.FirstName = objUser.FirstName;
            objClass.LastName = objUser.LastName;
            LikesBLL.insertLikes(objClass);

            linkLike.Text = "Unlike";
            statuslike = "like a post";

        }
        else
        {
            LikesBO objClass = new LikesBO();
            objClass.AtId = hfId.Value;
            objClass.Type = Global.WALL;
            objClass.UserId = Session["UserId"].ToString();
            LikesBLL.unLikes(objClass);

            linkLike.Text = "Like";
            statuslike = "unlike a post";
        }
        LoadWall(50);

        /////////////////////////////////////Friends recent activities
        if (!userid.Equals(Session["UserId"].ToString()))
        {
            UserBO objFUser = new UserBO();
            objFUser = UserBLL.getUserByUserId(userid);

            WallBO objWall = new WallBO();
            objWall.PostedByUserId = Session["UserId"].ToString();
            objWall.WallOwnerUserId = Session["UserId"].ToString();
            objWall.FirstName = objUser.FirstName;
            objWall.LastName = objUser.LastName;
            objWall.Post = "Like a <a  href=\"ViewProfile.aspx?UserId=" + userid + "\">" + objFUser.FirstName + " " + objFUser.LastName + "</a> Wall Post";
            objWall.AddedDate = DateTime.Now;
            objWall.Type = Global.TEXT_POST;
            WallBLL.insertWall(objWall);
        }
        ////////////////////////////////////////

        ////////////////////////////////////TICKER CODE //////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////

        List<UserFriendsBO> list = FriendsBLL.getAllFriendsListName(Session["UserId"].ToString(), Global.CONFIRMED);
        //get the education,hometown and employer of people in list
        foreach (UserFriendsBO Useritem in list)
        {
            TickerBO objTicker = new TickerBO();

            objTicker.PostedByUserId = Session["UserId"].ToString();
            objTicker.TickerOwnerUserId = Useritem.FriendUserId;
            objTicker.FirstName = objUser.FirstName;
            objTicker.LastName = objUser.LastName;
            objTicker.Post = literalpost.Text;
            objTicker.Title = statuslike;
            objTicker.AddedDate = DateTime.UtcNow;
            objTicker.Type = Convert.ToInt32(hfType.Value);
            objTicker.EmbedPost = hfEmbedPost.Value;
            objTicker.WallId = hfId.Value;
            TickerBLL.insertTicker(objTicker);

        }
        TickerBO objTickerUser = new TickerBO();

        objTickerUser.PostedByUserId = Session["UserId"].ToString();
        objTickerUser.TickerOwnerUserId = Session["UserId"].ToString();
        objTickerUser.FirstName = objUser.FirstName;
        objTickerUser.LastName = objUser.LastName;
        objTickerUser.Post = literalpost.Text;
        objTickerUser.Title = statuslike;
        objTickerUser.AddedDate = DateTime.UtcNow;
        objTickerUser.Type = Convert.ToInt32(hfType.Value);
        objTickerUser.EmbedPost = hfEmbedPost.Value;
        objTickerUser.WallId = hfId.Value;

        TickerBLL.insertTicker(objTickerUser);
        ////////////////////////////////////////////////////////////////////////////////////
    }
Пример #49
0
    protected void UpdatePhoto()
    {
        string status = txtUpdatePost.Text;

        if (lblFriendsWith.Text != "")
            status += " with " + lblFriendsWith.Text.Remove(lblFriendsWith.Text.LastIndexOf(","));

        if (lblLocation.Text != "")
            status += lblLocation.Text;
        // if (lblFriendsTag.Text != "")

        // status += " and Tag to " + lblFriendsTag.Text.Remove(lblFriendsTag.Text.LastIndexOf(","));

        UserBO objUser = new UserBO();
        objUser = UserBLL.getUserByUserId(Session["UserId"].ToString());

        WallBO objWall = new WallBO();
        objWall.PostedByUserId = Session["UserId"].ToString();
        objWall.WallOwnerUserId = userid;
        objWall.FirstName = objUser.FirstName;
        objWall.LastName = objUser.LastName;
        objWall.Post = status;
        objWall.AddedDate = DateTime.Now;
        objWall.Type = Global.TEXT_POST;
        WallBLL.insertWall(objWall);
        ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "myScript", "document.getElementById('" + txtUpdatePost.ClientID + "').value = '';", true);
        lblLocation.Text = "";
        lblFriendsWith.Text = "";
        LoadWall(100);
    }
Пример #50
0
    /////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ///                                      COMMENTS LIKE MODULE                                         ////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////
    // @@@@@@@@@@@@@@@@@@@@ by Nabeel
    protected void lbtnCommentLike_Click(object sender, EventArgs e)
    {
        string statuslike = "like a post";
        GridViewRow row = ((GridViewRow)((LinkButton)sender).NamingContainer);
        HiddenField hfId = (HiddenField)row.FindControl("HiddenFieldId");
        LinkButton lbtnCommentLike = (LinkButton)row.FindControl("lbtnCommentLike");

        //GridView gv = (GridView)GridViewWall.Rows[RowIndex].FindControl("GridViewComments");
        UserBO objUser = new UserBO();
        objUser = UserBLL.getUserByUserId(Session["UserId"].ToString());
        if (lbtnCommentLike.Text == "Like")
        {

            LikesBO objClass = new LikesBO();
            objClass.AtId = hfId.Value;
            objClass.Type = Global.WALL_COMMENT;
            objClass.UserId = Session["UserId"].ToString();
            objClass.FirstName = objUser.FirstName;
            objClass.LastName = objUser.LastName;
            LikesBLL.insertLikes(objClass);
            lbtnCommentLike.Text = "Like this";
            lbtnCommentLike.Text = "Unlike";
            statuslike = "like a post comment";
        }
        else
        {
            LikesBO objClass = new LikesBO();
            objClass.AtId = hfId.Value;
            objClass.Type = Global.WALL_COMMENT;
            objClass.UserId = Session["UserId"].ToString();
            LikesBLL.unLikes(objClass);
            lbtnCommentLike.Text = "";
            lbtnCommentLike.Text = "Like";
            statuslike = "unlike a post comment";
        }
          WallBO objWall = new WallBO();

           // Comment_YouLikes();
        /////////////////////////////////////Friends recent activities
        //if (!userid.Equals(Session["UserId"].ToString()))
           // {

            UserBO objFUser = new UserBO();
            objFUser = UserBLL.getUserByUserId(userid);

            objWall.PostedByUserId = Session["UserId"].ToString();
            objWall.WallOwnerUserId = Session["UserId"].ToString();
            objWall.FirstName = objUser.FirstName;
            objWall.LastName = objUser.LastName;
            objWall.Post = " Like a Comments on <a  href=\"ViewProfile.aspx?UserId=" + userid + "\">" + objFUser.FirstName + " " + objFUser.LastName + "</a> Wall Post";
            objWall.AddedDate = DateTime.Now;
            objWall.Type = Global.TEXT_POST;
            WallBLL.insertWall(objWall);
           // }
        ////////////////////////////////////////

        ////////////////////////////////////TICKER CODE //////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////

        List<UserFriendsBO> list = FriendsBLL.getAllFriendsListName(Session["UserId"].ToString(), Global.CONFIRMED);
        //get the education,hometown and employer of people in list
        foreach (UserFriendsBO Useritem in list)
        {
            TickerBO objTicker = new TickerBO();

            objTicker.PostedByUserId = Session["UserId"].ToString();
            objTicker.TickerOwnerUserId = Useritem.FriendUserId;
            objTicker.FirstName = objUser.FirstName;
            objTicker.LastName = objUser.LastName;
            objTicker.Post = objWall.Post;
            objTicker.Title = statuslike;
            objTicker.AddedDate = DateTime.UtcNow;
            objTicker.Type = Global.TEXT_POST;
            objTicker.EmbedPost = "";
            objTicker.WallId = hfId.Value;
            TickerBLL.insertTicker(objTicker);

        }
        TickerBO objTickerUser = new TickerBO();

        objTickerUser.PostedByUserId = Session["UserId"].ToString();
        objTickerUser.TickerOwnerUserId = Session["UserId"].ToString();
        objTickerUser.FirstName = objUser.FirstName;
        objTickerUser.LastName = objUser.LastName;
        objTickerUser.Post = objWall.Post;
        objTickerUser.Title = statuslike;
        objTickerUser.AddedDate = DateTime.UtcNow;
        objTickerUser.Type = Global.TEXT_POST;
        objTickerUser.EmbedPost = "";
        objTickerUser.WallId = hfId.Value;

        TickerBLL.insertTicker(objTickerUser);
        ////////////////////////////////////////////////////////////////////////////////////
        LoadWall(50);

           // Response.Redirect("main.aspx?c="+hfId.Value);
    }
Пример #51
0
 protected void btnSuggestFriends_Click(object sender, EventArgs e)
 {
     UserBO objUser = new UserBO();
     objUser = UserBLL.getUserByUserId(userid);
     lblName.Text = objUser.FirstName + " " + objUser.LastName;
     Response.Redirect("SuggestFriends.aspx?FriendFName=" + objUser.FirstName + "&FriendLName=" + objUser.LastName);
 }
Пример #52
0
    void notify_Tag(string uid, string atid)
    {
        UserBO objUser = new UserBO();
        objUser = UserBLL.getUserByUserId(userid);
        UserBO objUserNotify = new UserBO();
        objUserNotify = getUserForNotification(uid);
        NotificationBO objNotify = new NotificationBO();
        objNotify.MyNotification = "<a  href=\"ViewProfile.aspx?UserId=" + userid + "\">" + objUser.FirstName + " " + objUser.LastName + "</a> Tag  a <a  href='UserData.aspx'>post</a>";
        objNotify.AtId = atid;
        objNotify.Type = Global.TAG_POST;
        objNotify.UserId = uid;
        objNotify.FirstName = objUserNotify.FirstName;
        objNotify.LastName = objUserNotify.LastName;
        objNotify.FriendId = userid;
        objNotify.FriendFName = objUser.FirstName;
        objNotify.FriendLName = objUser.LastName;

        insertNotification_user(objNotify);
    }
Пример #53
0
    /////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ///                                      USER INFO MODULE                                             ////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////
    protected void LoadUserData()
    {
        UserBO objUser = new UserBO();
        objUser = UserBLL.getUserByUserId(userid);
        lblName.Text = objUser.FirstName+" "+objUser.LastName;
        lblBirthDay.Text= objUser.DateOfBirth.ToLongDateString();
        lblGender.Text = objUser.Gender;
        if (isSeeFriendshipPage)
        {
            objUser = UserBLL.getUserByUserId(Session["UserId"].ToString());
            lblName.Text += " & " +objUser.FirstName + " " + objUser.LastName;

        }
    }
Пример #54
0
    /////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ///                                      COMMENTS MODULE                                                    ////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////
    protected void txtComments_TextChanged(object sender, EventArgs e)
    {
        GridViewRow row = ((GridViewRow)((TextBox)sender).NamingContainer);

        TextBox txtcomments = (TextBox)row.FindControl("txtComments");
        HiddenField hfId = (HiddenField)row.FindControl("HiddenFieldId");
        Literal literalpost = (Literal)row.FindControl("LiteralPost");
        HiddenField hfType = (HiddenField)row.FindControl("HiddenFieldType");
        HiddenField hfEmbedPost = (HiddenField)row.FindControl("HiddenFieldEmbedPost");
        UserBO objUser = new UserBO();
        objUser = UserBLL.getUserByUserId(Session["UserId"].ToString());

        CommentsBO objClass = new CommentsBO();
        objClass.MyComments = ConvertUrlsToLinks( txtcomments.Text);
        objClass.AtId = hfId.Value;
        objClass.Type = Global.WALL;
        objClass.UserId = Session["UserId"].ToString();
        objClass.FirstName = objUser.FirstName;
        objClass.LastName = objUser.LastName;

        if (!objClass.MyComments.Equals(""))
        {
            CommentsDAL.insertComments(objClass);
        }

        ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "myScript", "document.getElementById('" + txtcomments.ClientID + "').value = '';", true);

        GridView gridviewComments = (GridView)row.FindControl("GridViewComments");

        gridviewComments.DataSource = CommentsDAL.getCommentsTop(Global.WALL, hfId.Value, 2);
        gridviewComments.DataBind();

        pnlVideoLink.Visible = false;
        //LoadComments();
        Comment_YouLikes();
        YouLikes();
        pnlVideoLink.Visible = false;

         /////////////////////////////////////Friends recent activities
        if (!userid.Equals(Session["UserId"].ToString()))
        {

            UserBO objFUser = new UserBO();
            objFUser = UserBLL.getUserByUserId(userid);

            WallBO objWall = new WallBO();
            objWall.PostedByUserId = Session["UserId"].ToString();
            objWall.WallOwnerUserId = Session["UserId"].ToString();
            objWall.FirstName = objUser.FirstName;
            objWall.LastName = objUser.LastName;
            objWall.Post = " Comments on <a  href=\"ViewProfile.aspx?UserId=" + userid + "\">" + objFUser.FirstName + " " + objFUser.LastName + "</a> Wall Post";
            objWall.AddedDate = DateTime.Now;
            objWall.Type = Global.TEXT_POST;
            WallBLL.insertWall(objWall);
        }
        ////////////////////////////////////////

        ////////////////////////////////////TICKER CODE //////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////

        List<UserFriendsBO> list = FriendsBLL.getAllFriendsListName(Session["UserId"].ToString(), Global.CONFIRMED);
        //get the education,hometown and employer of people in list
        foreach (UserFriendsBO Useritem in list)
        {
            TickerBO objTicker = new TickerBO();

            objTicker.PostedByUserId = Session["UserId"].ToString();
            objTicker.TickerOwnerUserId = Useritem.FriendUserId;
            objTicker.FirstName = objUser.FirstName;
            objTicker.LastName = objUser.LastName;
            objTicker.Post = literalpost.Text;
            objTicker.Title = "comments on post";
            objTicker.AddedDate = DateTime.UtcNow;
            objTicker.Type = Global.TEXT_POST;
            objTicker.EmbedPost = hfEmbedPost.Value;
            objTicker.WallId = hfId.Value;
            TickerBLL.insertTicker(objTicker);

        }
        TickerBO objTickerUser = new TickerBO();

        objTickerUser.PostedByUserId = Session["UserId"].ToString();
        objTickerUser.TickerOwnerUserId = Session["UserId"].ToString();
        objTickerUser.FirstName = objUser.FirstName;
        objTickerUser.LastName = objUser.LastName;
        objTickerUser.Post = literalpost.Text;
        objTickerUser.Title = "comments on post";
        objTickerUser.AddedDate = DateTime.UtcNow;
        objTickerUser.Type = Global.TEXT_POST;
        objTickerUser.EmbedPost = hfEmbedPost.Value;
        objTickerUser.WallId = hfId.Value;

        TickerBLL.insertTicker(objTickerUser);
        ////////////////////////////////////////////////////////////////////////////////////
    }
Пример #55
0
    protected void lnkSubmit_Click(object sender, EventArgs e)
    {
        if (chktermsarea.Checked && Page.IsValid)
        {
            UserBO objUser = new UserBO();

            objUser.FirstName = txtYourName.Text.Trim();

            objUser.ContactNumber = txtCellNumber.Text.Trim();
            objUser.Country = txtCountry.Text;
            objUser.City = txtCity.Text.Trim();
            objUser.Email = txtEmail.Text.Trim();
            objUser.Fax = txtFax.Text.Trim();
            objUser.AddressLine1 = txtAddress.Text.Trim();
            objUser.State = txtState.Text.Trim();
            objUser.Isactive = true;

            objUser.Password = txtPassword.Text.Trim();
            objUser.PostCode = txtZip.Text.Trim();

            DataTable ret = UserManager.InserUserInformation(objUser);
            if (ret.Rows.Count > 0)
            {
                //Success\

                string strMail = GetEmailString();
                strMail = strMail.Replace("##USERNAME##", objUser.FirstName).Replace("##EMAIL##", objUser.Email).Replace("##PASSWORD##", objUser.Password).Replace("##MOBILE##", objUser.ContactNumber);

                try
                {

                    MailMessage mailmsg = new MailMessage();
                    mailmsg.From = new MailAddress(eadd);
                    mailmsg.Subject = "AVM : Registration Successful";
                    mailmsg.To.Add(txtEmail.Text);
                    // mailmsg.CC.Add("*****@*****.**");
                    mailmsg.Body = strMail;
                    mailmsg.IsBodyHtml = true;
                    SmtpClient smtp = new SmtpClient();
                    smtp.Host = "smtp.gmail.com";
                    smtp.Port = 587;
                    smtp.Credentials = new System.Net.NetworkCredential(eadd, epass);
                    smtp.EnableSsl = true;
                   smtp.Send(mailmsg);

                }
                catch (Exception ex)
                {

                }
                Response.Redirect("../UserMgmt/myHomes.aspx");
                lblMessage.Text = "you are registered successfully.";
                mdePopup.Show();
            }
            else
            {
                if (objUser.IsExist)
                {
                    lblMessage.Text = "User already exist, please login or reset password.";
                    mdePopup.Show();
                }
                else
                {
                    //Failed to insert data.
                    lblMessage.Text = "Oops! Something  went wrong, please try again.";
                    mdePopup.Show();
                }
            }
        }
        else
        {
            //Show Message to Select Terms and COndition before Registration.
        }
    }
Пример #56
0
        ///////////////////////////////////////////////////////////////
        //                       INSERT FUNCTION
        //////////////////////////////////////////////////////////////
        public static string UserSignup(UserBO objClass)
        {
            MongoCollection<BsonDocument> objCollection = db.GetCollection<BsonDocument>("c_User");

            BsonDocument doc = new BsonDocument {
                      { "Email" , objClass.Email},
                      { "UserName" , objClass.UserName},
                       { "Password" , objClass.Password },
                       { "FirstName", objClass.FirstName },
                        { "LastName", objClass.LastName  },
                        { "Gender", objClass.Gender },
                         { "PhoneNumber", objClass.PhoneNumber },
                        { "DateOfBirth", objClass. DateOfBirth },
                        { "PasswordResetCode", objClass.PasswordResetCode },
                        { "UserStatus" , objClass.UserStatus },
                         { "IsMobileAlert" , objClass.IsMobileAlert },

                        };

            var rt = objCollection.Insert(doc);
            return doc["_id"].ToString();
        }
Пример #57
0
    protected void lbtnLike_Click(object sender, EventArgs e)
    {
        if (lbtnLike.Text == "Like")
        {
            UserBO objUser = new UserBO();
            objUser = UserBLL.getUserByUserId(Userid);
            LikesBO objClass = new LikesBO();
            objClass.AtId = Photoid;
            objClass.Type = Global.VIDEO;
            objClass.UserId = Userid;
            objClass.FirstName = objUser.FirstName;
            objClass.LastName = objUser.LastName;
            LikesBLL.insertLikes(objClass);
            lblLike.Text = "You Like this";
            lbtnLike.Text = "UnLike";

        }
        else
        {
            LikesBO objClass = new LikesBO();
            objClass.AtId = Photoid;
            objClass.Type = Global.VIDEO;
            objClass.UserId = Userid;
            LikesBLL.unLikes(objClass);
            lblLike.Text = "";
            lbtnLike.Text = "Like";
        }
    }
Пример #58
0
        //UPDATE PHONE NO
        public static void UpdatePhoneNo(UserBO objClass)
        {
            MongoCollection<User> objCollection = db.GetCollection<User>("c_User");

            var query = Query.EQ("_id", ObjectId.Parse(objClass.Id));
            var sortBy = SortBy.Descending("_id");
            var update = Update.Set("PhoneNumber", objClass.PhoneNumber);

            var result = objCollection.FindAndModify(query, sortBy, update, true);
        }
Пример #59
0
 protected void RWallPost(string post)
 {
     UserBO objUser = new UserBO();
     objUser = UserBLL.getUserByUserId(userid);
     WallBO objWall = new WallBO();
     objWall.PostedByUserId = userid;
     objWall.WallOwnerUserId = userid;
     objWall.FirstName = objUser.FirstName;
     objWall.LastName = objUser.LastName;
     objWall.Post = post;
     objWall.AddedDate = DateTime.Now;
     objWall.Type = Global.PROFILE_CHANGE;
     WallBLL.insertWall(objWall);
 }
Пример #60
0
    protected void UpdateStatus()
    {
        string status = txtUpdatePost.Text;
        bool isVideoLink = false;
        UserBLL userbll = new UserBLL();

        if(lblFriendsWith.Text!="")
            status += " <font color='#838181'> -- with <font/>" + lblFriendsWith.Text.Remove(lblFriendsWith.Text.LastIndexOf(","));
        if (lblLocation.Text != "")
            status += lblLocation.Text;

        UserBO objUser = new UserBO();
        objUser = UserBLL.getUserByUserId(Session["UserId"].ToString());

        WallBO objWall = new WallBO();
        objWall.PostedByUserId = Session["UserId"].ToString();
        objWall.WallOwnerUserId = userid;
        objWall.FirstName = objUser.FirstName;
        objWall.LastName = objUser.LastName;
        objWall.Post = ConvertUrlsToLinks(status);
        objWall.AddedDate = DateTime.UtcNow;
        objWall.Type = Global.TEXT_POST;

        if (ConvertUrlsToLinks(status).IndexOf("http") > 0)
        {
            objWall.Type = Global.LINK;
            status = "post a link";
        }

        string imagesrc="";

        if (!GetYouTubeURL(txtUpdatePost.Text).Equals(""))
        {
            string url = GetYouTubeURL(txtUpdatePost.Text);
            objWall.Post = "<br/><br/><a href='" + url + "'>" + url + "</a><br/><br/>";

        }
        if (pnlVideoLink.Visible == true)
        {

            string url = GetYouTubeURL(txtUpdatePost.Text);
            string id = GetYouTubeID(txtUpdatePost.Text);
            string embedsrc = "http://www.youtube.com/embed/" + id + "?rel=0";
            objWall.Type = Global.POST_VIDEOLINK;
            objWall.Post = "<br/><br/><a href='" + url + "'>" + url + "</a><br/><br/>";
            if (!chkThumbnail.Checked)
            {
                imagesrc = getCurrentSelectedVideoThumbnail(id);
                vidthumbdisp = true;
                objWall.EmbedPost = imagesrc;
            }
            objWall.Type = Global.POST_VIDEOLINK;
            txtUpdatePost.Text = "";
            isVideoLink = true;
            status = " added a new video";
        }
        if (videofileuploaded)
        {
            objWall.Type = Global.VIDEO;
            string wallpost = objWall.Post;
            objWall.EmbedPost = Global.PATH_COMPRESSED_USER_VIDEO + "Thumb/" + uploadedvideothumbname;
            uploadedvideoembedliteral = Video.getUploadedVideoEmbedLiteral(wallpost, uploadedvideoname);
            LiteralUploadVideo.Text = "";
            status = " added a new video";
        }
        if (photofileuploaded)
        {
            objWall.Type = Global.PHOTO;
            LiteralUploadPhoto .Text= "";
            uploadedPhotoliteral = "";
            objWall.EmbedPost = photoid;
            status = " added a new photo";
        }

        if (Session["WebCamPhotoId"] != null)
        {

            objWall.Type = Global.PHOTO;
            objWall.EmbedPost = Session["WebCamPhotoId"].ToString();
            status = " added a new photo";
        }
        if (isphotoalbum)
        {
            MediaAlbumBO objAClass = new MediaAlbumBO();
            objAClass.UserId = userid;
            objAClass.Name = txtName.Text;
            objAClass.Description = txtDescription.Text;
            objAClass.CoverPictureId = "0000000000000b0000000900";
            objAClass.Type = Global.PHOTO;
            objAClass.isFollow = true;
            string aid=MediaAlbumBLL.insertMediaAlbum(objAClass);
            objWall.Post = objWall.Post + " add new <a  href=\"ViewPhotoAlbum.aspx?AlbumId=" + aid + "\">photo album</a>.";
            objWall.Type = Global.PHOTO_ALBUM;
            status = " added a new photo album";
        }
        //////////////////////////////////////////////////////////////////////
        foreach (string item in lstTag)
        {
            string tagstatus;
            if (photofileuploaded || videofileuploaded || Session["WebCamPhotoId"] != null || isVideoLink || isphotoalbum)
            {
            WallBO objWall2 = new WallBO();
            string tagpost = objWall.Post + "<br/> <font color='#838181'> was tagged by <font/><a  href=\"ViewProfile.aspx?UserId=" + Session["UserId"].ToString() + "\">" + objUser.FirstName + " " + objUser.LastName + "</a>.";
            UserBO objUser2 = new UserBO();
            objUser2 = UserBLL.getUserByUserId(item);
            objWall2.PostedByUserId = item;
            objWall2.WallOwnerUserId = item;
            objWall2.FirstName = objUser2.FirstName;
            objWall2.LastName = objUser2.LastName;
            objWall2.Post = tagpost;
            tagstatus = "tagged a post";
            objWall2.AddedDate = DateTime.Now;

            if (isphotoalbum)
            {
                objWall2.Type = Global.TAG_PHOTO_ALBUM;
                objWall2.Post = objWall.Post + " <font color='#838181'> was tagged by <font/><a  href=\"ViewProfile.aspx?UserId=" + Session["UserId"].ToString() + "\">" + objUser.FirstName + " " + objUser.LastName + "</a>.";
                notify_Tag(item, userid);
                tagstatus = "tagged a photo album";
            }

            if (videofileuploaded)
            {
                objWall2.Type = Global.TAG_VIDEO;
                objWall2.EmbedPost = Global.PATH_COMPRESSED_USER_VIDEO + "Thumb/" + uploadedvideothumbname;
                objWall2.Post = objWall.Post + "<font color='#838181'> was tagged by <font/><a  href=\"ViewProfile.aspx?UserId=" + Session["UserId"].ToString() + "\">" + objUser.FirstName + " " + objUser.LastName + "</a>.";
                notify_Tag(item, userid);
                tagstatus = "tagged a video";
            }
           if (isVideoLink)
            {
                objWall2.Type = Global.TAG_VIDEOLINK;
                objWall2.EmbedPost = imagesrc;
                objWall2.Post = objWall.Post + "<font color='#838181'> was tagged by <font/> <a  href=\"ViewProfile.aspx?UserId=" + Session["UserId"].ToString() + "\">" + objUser.FirstName + " " + objUser.LastName + "</a>.";
                notify_Tag(item, userid);
                tagstatus = "tagged a video";

           }
            if (photofileuploaded)
            {
                TagsBO objTags = new TagsBO();
                objTags.AtId = photoid;
                objTags.Type = Global.PHOTO;
                objTags.UserId = Session["UserId"].ToString();
                objTags.FirstName = objUser.FirstName;
                objTags.LastName = objUser.LastName;
                objTags.FriendId = item;
                objTags.FriendFName = objUser2.FirstName;
                objTags.FriendLName = objUser2.LastName;
                notify_Tag(item, photoid);
                TagsBLL.insertTags(objTags);
                objWall2.Type = Global.TAG_PHOTO;
                objWall2.EmbedPost = photoid;
                tagstatus = "tagged a photo";
            }
            if (Session["WebCamPhotoId"] != null)
            {
                TagsBO objTags = new TagsBO();
                objTags.AtId = Session["WebCamPhotoId"].ToString();
                objTags.Type = Global.PHOTO;
                objTags.UserId = Session["UserId"].ToString();
                objTags.FirstName = objUser.FirstName;
                objTags.LastName = objUser.LastName;
                objTags.FriendId = item;
                objTags.FriendFName = objUser2.FirstName;
                objTags.FriendLName = objUser2.LastName;
                TagsBLL.insertTags(objTags);
                objWall2.Type = Global.TAG_PHOTO;
                objWall2.EmbedPost = Session["WebCamPhotoId"].ToString();
                notify_Tag(item, Session["WebCamPhotoId"].ToString());
                tagstatus = "tagged a photo";
            }

            RWallPost(" tag post to <a  href=\"ViewProfile.aspx?UserId=" + item + "\">" + objUser2.FirstName + " " + objUser2.LastName + "</a>");
            string twid= WallBLL.insertWall(objWall2);

            userbll.notify_subscribers(Session["UserId"].ToString(), objWall2, ConvertUrlsToLinks(tagstatus), twid);
        }
        }
        string wid= WallBLL.insertWall(objWall);
        ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "myScript", "document.getElementById('" + txtUpdatePost.ClientID + "').value = '';", true);
        lblLocation.Text = "";
        lblFriendsWith.Text = "";
        lblFriendsTag.Text = "";
        LiteralUploadPhoto.Text = "";
        LiteralUploadVideo.Text = "";
        uploadedPhotoliteral = "";
        Session["WebCamPhotoId"] = null;
        videofileuploaded = false;
        photofileuploaded = false;
        isVideoLink = false;
        isphotoalbum = false;
        lstTag.Clear();
        userbll.notify_subscribers(Session["UserId"].ToString(), objWall, ConvertUrlsToLinks(ConvertUrlsToLinks(status)), wid);
        LoadWall(100);
    }