private void label3_Click(object sender, EventArgs e)
        {
            this.Hide();
            User_Information u = new User_Information();

            u.Show();
        }
Exemplo n.º 2
0
        public JsonResult CreateRecord(User_Information userInformation)
        {
            _userRepo.CreateUser(userInformation);
            string res = "Inserted";

            return(Json(res, JsonRequestBehavior.AllowGet));
        }
    void Add_Suggested(User_Information info)
    {
        Notification_User_Target target = Instantiate(suggested_prefab, suggested_parent).GetComponent <Notification_User_Target>();

        target.Initialize(info);
        target.GetComponent <Button>().onClick.AddListener(() => { Add_Target(target); });
    }
Exemplo n.º 4
0
        public JsonResult Update_recordReal(User_Information userInformation)
        {
            _userRepo.UpdateUser(userInformation);
            string res = "Updated";

            return(Json(res, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 5
0
        public IHttpActionResult GetUserCreatedThread(int id)
        {
            try
            {
                using (var db = new UserDAL())
                {
                    Ws_User          wsUser          = db.GetUserById(id);
                    User_Information userInformation = db.GetUserInformation(id);
                    UserBasicInfoDTO user            = new UserBasicInfoDTO();
                    user.UserName     = wsUser.UserName;
                    user.AccountType  = wsUser.AccountType;
                    user.IsActive     = wsUser.IsActive;
                    user.FullName     = userInformation.FullName == null? wsUser.UserName: userInformation.FullName;
                    user.ProfileImage = userInformation.ProfileImage;
                    user.Email        = wsUser.Email;

                    return(Ok(new HTTPMessageDTO {
                        Status = WsConstant.HttpMessageType.SUCCESS, Data = user
                    }));
                }
            }
            catch (Exception)
            {
                return(Ok(new HTTPMessageDTO {
                    Status = WsConstant.HttpMessageType.ERROR
                }));
            }
        }
Exemplo n.º 6
0
        //
        // GET: /User/Details/5

        public ActionResult Details(int id = 0)
        {
            User_Information user_information = db.User_Information.Find(id);

            if (user_information == null)
            {
                return(HttpNotFound());
            }
            return(View(user_information));
        }
Exemplo n.º 7
0
        public ActionResult DeleteConfirmed(int id, string username)
        {
            User_Information user_information = db.User_Information.Find(id);
            User_Access      user_access      = db.User_Access.Find(username);

            db.User_Information.Remove(user_information);
            db.User_Access.Remove(user_access);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 8
0
        //public ActionResult Create(User_Information user_information)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        db.User_Information.Add(user_information);
        //        db.SaveChanges();
        //        return RedirectToAction("Index");
        //    }

        //    ViewBag.Username = new SelectList(db.User_Access, "Username", "Password", user_information.Username);
        //    return View(user_information);
        //}

        //
        // GET: /User/Edit/5

        public ActionResult Edit(int id, string username)
        {
            User_Information user_information = db.User_Information.Find(id);
            User_Access      user_access      = db.User_Access.Find(username);

            if (user_information == null)
            {
                return(HttpNotFound());
            }
            //ViewBag.Username = new SelectList(db.User_Access, "Username", "Password", user_information.Username);
            return(View(user_information));
        }
Exemplo n.º 9
0
        protected void RegisterButton_Click(object sender, EventArgs e)
        {
            using (chandureddyEntities db = new chandureddyEntities())
            {
                string userName = UserNameTextBox.Text;
                string password = PasswordTextBox.Text;
                string confPass = ConfirmPasswordTextBox.Text;

                //check user name exists in db

                var userNameCheck = (from UserInformation in db.User_Information
                                     where UserInformation.username == userName
                                     select UserInformation);

                if (userNameCheck.Any())
                {
                    ClientScript.RegisterStartupScript(GetType(), "validate", "alert('UserName already EXISTS.');", true);
                }
                else
                {
                    if (password == confPass)
                    {
                        if (password.Length > 5)
                        {
                            User_Information newUser = new User_Information();

                            newUser.username = userName;
                            newUser.password = password;
                            db.User_Information.Add(newUser);
                            db.SaveChanges();
                            Response.Redirect("Default.aspx");
                        }
                        else
                        {
                            ClientScript.RegisterStartupScript(GetType(), "validate", "alert('Password must be atleast 6 char long.');", true);
                            PasswordTextBox.Text = "";
                            PasswordTextBox.Focus();
                        }
                    }
                    else
                    {
                        ClientScript.RegisterStartupScript(GetType(), "validate", "alert('Passwords dont match.');", true);
                        ConfirmPasswordTextBox.Text = "";
                        ConfirmPasswordTextBox.Focus();
                    }
                }
            }
        }
Exemplo n.º 10
0
    public static void Handle_User_Data(string token)
    {
        User_Info = new User_Information {
            Username = ""
        };
        Users_Info = new List <User_Information>();

        string[] users = Utils.Split(token, '%');

        foreach (string user in users)
        {
            string[] data = Utils.Split(user, '#');

            for (int x = 0; x < data.Length; x++)
            {
                data[x] = Encryption.Decrypt(data[x]);
            }

            User_Information new_User = new User_Information();
            new_User.Id       = uint.Parse(data[0]);
            new_User.Username = data[1];
            new_User.Name     = data[2];
            new_User.Surname  = data[3];
            Enum.TryParse(data[4], out new_User.Role);
            new_User.Tel         = data[5];
            new_User.Email       = data[6];
            new_User.Polls_Data  = Vote_Data.Parse_Data(data[7]);
            new_User.Events_Data = Vote_Data.Parse_Data(data[8]);
            new_User.News_Data   = new List <uint>();

            if (!data[9].Contains("empty"))
            {
                foreach (string element in Utils.Split(data[9], '|'))
                {
                    new_User.News_Data.Add(uint.Parse(element));
                }
            }

            if (User_Info.Username == "")
            {
                User_Info = new_User;
            }
            else if (User_Info.Username != new_User.Username)
            {
                Users_Info.Add(new_User);
            }
        }
    }
Exemplo n.º 11
0
        public bool UpdateUser(User_Information userInformation)
        {
            var UserOld = _AngularAppCompanyEntities.User_Information.Where(a => a.Id == userInformation.Id).SingleOrDefault();

            UserOld.Id          = userInformation.Id;
            UserOld.AccountName = userInformation.AccountName;
            UserOld.DisplayName = userInformation.DisplayName;
            UserOld.Email       = userInformation.Email;
            UserOld.Designation = userInformation.Designation;
            UserOld.Active      = userInformation.Active;
            UserOld.Created     = UserOld.Created;
            UserOld.Modefied    = DateTime.Now;

            // _AngularAppCompanyEntities.Entry(userInformation).State = EntityState.Modified;
            return(Save());
        }
Exemplo n.º 12
0
        /// <summary>
        /// get user infomation using user id
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        public User_Information GetUserInformation(int userId)
        {
            User_Information currentUserInfo = new User_Information();

            try
            {
                using (var db = new Ws_DataContext())
                {
                    currentUserInfo = db.User_Information.FirstOrDefault(x => x.UserID == userId);
                }
            }
            catch (Exception)
            {
                //throw;
            }

            return(currentUserInfo);
        }
Exemplo n.º 13
0
        public long?Signup()
        {
            using (var db = new TESDataContext())
            {
                var user = new User_Information
                {
                    full_name       = this.FullName,
                    user_name       = this.Username,
                    user_email      = this.Email,
                    user_password   = this.Password,
                    user_contact_no = this.Contact,
                    user_gender     = this.Gender,
                    user_cnic_no    = this.CNIC
                };
                db.User_Informations.InsertOnSubmit(user);
                db.SubmitChanges();

                return((from u in db.User_Informations where u.user_name == this.Username select u.user_id).FirstOrDefault());
            }
        }
Exemplo n.º 14
0
        public ActionResult Edit(User_Information user_information, User_Access user_access)
        {
            if (ModelState.IsValid)
            {
                //db.Entry(user_access).State = EntityState.Modified;
                //db.Entry(user_information).State = EntityState.Modified;

                var userInfoQuery = from userInfo in db.User_Information
                                    where userInfo.Username == user_information.Username
                                    select userInfo;

                User_Information objUserInfo = userInfoQuery.FirstOrDefault();

                objUserInfo.Name           = user_information.Name;
                objUserInfo.Email          = user_information.Email;
                objUserInfo.Gender         = user_information.Gender;
                objUserInfo.Age            = user_information.Age;
                objUserInfo.Address        = user_information.Address;
                objUserInfo.Contact        = user_information.Contact;
                objUserInfo.Blood_Group    = user_information.Blood_Group;
                objUserInfo.Marital_Status = user_information.Marital_Status;
                objUserInfo.Salary         = user_information.Salary;


                var userAccessQuery = from userAccess in db.User_Access
                                      where userAccess.Username == user_access.Username
                                      select userAccess;

                User_Access objUserAccess = userAccessQuery.FirstOrDefault();

                objUserAccess.Password = user_access.Password;
                objUserAccess.Usertype = user_access.Usertype;


                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            ViewBag.Username = new SelectList(db.User_Access, "Username", "Password", user_information.Username);
            return(View(user_information));
        }
        public ActionResult Profile_Edit(User_Information user_information, User_Access user_access)
        {
            if (ModelState.IsValid)
            {
                //db.Entry(user_access).State = EntityState.Modified;
                //db.Entry(user_information).State = EntityState.Modified;

                var userInfoQuery = from userInfo in db.User_Information
                                    where userInfo.Username == user_information.Username
                                    select userInfo;

                User_Information objUserInfo = userInfoQuery.FirstOrDefault();

                objUserInfo.Name  = user_information.Name;
                objUserInfo.Email = user_information.Email;


                objUserInfo.Address = user_information.Address;
                objUserInfo.Contact = user_information.Contact;



                var userAccessQuery = from userAccess in db.User_Access
                                      where userAccess.Username == user_access.Username
                                      select userAccess;

                User_Access objUserAccess = userAccessQuery.FirstOrDefault();

                objUserAccess.Password = user_access.Password;



                db.SaveChanges();
                return(RedirectToAction("Profile_Index", new { objUserInfo.ID }));
            }
            ViewBag.Username = new SelectList(db.User_Access, "Username", "Password", user_information.Username);
            return(View(user_information));
        }
Exemplo n.º 16
0
        public ActionResult Create(UserViewModel model)
        {
            try
            {
                User_Access userAccess = new User_Access()
                {
                    Username = model.Username,
                    Password = model.Password,
                    Usertype = model.Usertype
                };

                User_Information userInfo = new User_Information();
                userInfo.Name           = model.Name;
                userInfo.Email          = model.Email;
                userInfo.Gender         = model.Gender;
                userInfo.Date_of_Birth  = model.Date_of_Birth;
                userInfo.Age            = model.Age;
                userInfo.Address        = model.Address;
                userInfo.Contact        = model.Contact;
                userInfo.Blood_Group    = model.Blood_Group;
                userInfo.Marital_Status = model.Marital_Status;
                userInfo.Join_Date      = model.Join_Date;
                userInfo.Salary         = model.Salary;
                userInfo.Username       = model.Username;
                userInfo.Name           = model.Name;
                userInfo.User_Access    = userAccess;

                db.User_Information.Add(userInfo);
                db.SaveChanges();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(RedirectToAction("Index", model));
            //return View(model);
        }
Exemplo n.º 17
0
        /// <summary>
        /// Get full information of User
        /// #Note: If you add new field to UserBasicInfoDTO model -
        ///        Please write code to set that information in this function
        /// </summary>
        /// <param name="userId"></param>
        /// <returns>UserBasicInfoDTO</returns>
        public UserBasicInfoDTO GetFullInforOfUserAsBasicUser(int userId)
        {
            UserBasicInfoDTO currentUser = new UserBasicInfoDTO();

            int     numberEventDonatedIn = 0;
            decimal totalMoneyDonatedIn  = 0;
            decimal lastDonateMoney      = 0;
            string  lastDonateDate       = "";

            int numberOfPost = 0;

            try
            {
                Ws_User          wsUser          = GetUserById(userId);
                User_Information userInformation = GetUserInformation(userId);

                //Get infomation about donation of this user
                using (var db = new DonationDAL())
                {
                    numberEventDonatedIn = db.GetNumberEventDonatedInByUsingUserId(userId);
                    totalMoneyDonatedIn  = db.GetTotalMoneyDonatedInByUsingUserId(userId);

                    Donation lastDonation = db.GetLastDonateInformation(userId);

                    if (lastDonation != null)
                    {
                        lastDonateMoney = lastDonation.DonatedMoney;
                        lastDonateDate  = lastDonation.DonatedDate.ToString("H:mm:ss dd/MM/yy");
                    }
                }

                //Get number of post for current user
                using (var db = new ThreadDAL())
                {
                    numberOfPost = db.GetNumberOfPostPerUser(userId);
                }
                using (var db = new OrganizationDAL())
                {
                    Organization org = db.GetOrganizationById(userId);
                    if (org != null)
                    {
                        currentUser.OrganazationName = org.OrganizationName;
                    }

                    if (currentUser.OrganazationName == "")
                    {
                        currentUser.OrganazationName = "Chưa có";
                    }
                }
                using (var db = new Ws_DataContext())
                {
                    currentUser.JoinedDate = db.Ws_User.Where(x => x.UserID == userId).SingleOrDefault().CreatedDate.ToString("dd/mm/yyyy");
                }

                //get ranking information
                WsRanking  ranking = new WsRanking();
                RankingDTO rank    = new RankingDTO();


                //Set information for user which want to get
                currentUser.UserId      = userId;
                currentUser.UserName    = wsUser.UserName;
                currentUser.AccountType = wsUser.AccountType;
                currentUser.IsActive    = wsUser.IsActive;
                currentUser.IsVerify    = wsUser.IsVerify;

                currentUser.Email = wsUser.Email;
                if (userInformation != null)
                {
                    rank = ranking.RankingWithPoint(userInformation.Point);
                    currentUser.FacebookUri   = userInformation.FacebookUrl;
                    currentUser.FullName      = userInformation.FullName;
                    currentUser.ProfileImage  = userInformation.ProfileImage;
                    currentUser.Gender        = userInformation.Gender;
                    currentUser.Phone         = userInformation.Phone;
                    currentUser.Address       = userInformation.UserAddress;
                    currentUser.UserSignature = userInformation.UserSignature;

                    if (userInformation.DoB != null)
                    {
                        currentUser.DOB = userInformation.DoB.Value.ToString("dd/MM/yyyy");
                    }

                    currentUser.Country     = userInformation.Country;
                    currentUser.FacebookUri = userInformation.FacebookUrl;
                    currentUser.CreateDate  = wsUser.CreatedDate.ToString("dd/MM/yyyy");
                    currentUser.Point       = userInformation.Point;
                }

                currentUser.NumberOfPost = numberOfPost;

                if (rank.CurrentRank == 0)
                {
                    currentUser.CurrentRank = "Mới";
                }
                else if (rank.CurrentRank == 200)
                {
                    currentUser.CurrentRank = "Đồng";
                }
                else if (rank.CurrentRank == 500)
                {
                    currentUser.CurrentRank = "Bạc";
                }
                else if (rank.CurrentRank == 2000)
                {
                    currentUser.CurrentRank = "Vàng";
                }
                else if (rank.CurrentRank == 5000)
                {
                    currentUser.CurrentRank = "Bạch Kim";
                }
                else if (rank.CurrentRank == 10000)
                {
                    currentUser.CurrentRank = "Kim Cương";
                }

                currentUser.RankPercent          = rank.RankPercent;
                currentUser.NumberEventDonatedIn = numberEventDonatedIn;
                currentUser.TotalMoneyDonatedIn  = totalMoneyDonatedIn;
                currentUser.LastDonateMoney      = lastDonateMoney;
                currentUser.LastDonateDate       = lastDonateDate;
            }
            catch (Exception)
            {
                //throw;
            }

            return(currentUser);
        }
Exemplo n.º 18
0
 public bool CreateUser(User_Information userInformation)
 {
     userInformation.Created = DateTime.Now;
     _AngularAppCompanyEntities.User_Information.Add(userInformation);
     return(Save());
 }
 public void Initialize(User_Information info)
 {
     User             = info;
     target_name.text = info.Name + " (" + info.Username + ")";
 }