Exemplo n.º 1
0
        public ActionResult Profiles()
        {
            ////////////////is implementing right here/////////////////
            // ViewBag.ID = id;
            try
            {
                int uid = (int)Session["UidInProfile"];
                // System.Diagnostics.Debug.Write("Uid in Profile is equal " + uid + " ");

                var dbContext = new MVCEntities();
                var profile = dbContext.Profiles.FirstOrDefault(u => u.UserId == uid);
                System.Diagnostics.Debug.Write("UIS is equal " + uid + " ");
                System.Diagnostics.Debug.Write("Pid is equal " + profile.ProId + " ");
                Session["ProfileId"] = profile.ProId;

                //   var profileDetail = dbContext.Profiles.FirstOrDefault(p => p.ProId == profile.ProId);

                try
                {
                    if (Session["UserType"].Equals("Freelancer          "))
                    {
                       // var profileDetail = dbContext.Profiles.FirstOrDefault(p => p.ProId == (int)Session["ProfileId"]);

                        var ProfileModel = new MyApplication.Profile();

                         System.Diagnostics.Debug.Write("TTTxx");
                         ProfileModel.Name = profile.Name;
                         System.Diagnostics.Debug.Write("TTT " + ProfileModel.Name + " " + profile.Name);

                        if (ProfileModel.Name == null)
                        {
                            ProfileModel.Name = " ";
                        }
                        else
                        {
                            ProfileModel.Name = profile.Name.TrimEnd();
                        }

                         ProfileModel.Telephone = profile.Telephone;

                        if (ProfileModel.Telephone == null)
                        {
                            ProfileModel.Telephone = " ";
                        }
                        else
                        {
                            ProfileModel.Telephone = profile.Telephone.TrimEnd();
                        }

                          ProfileModel.Status = profile.Status;

                        if (ProfileModel.Status == null)
                        {
                            ProfileModel.Status = " ";
                        }
                        else
                        {
                            ProfileModel.Status = profile.Status.TrimEnd();
                        }

                        ProfileModel.Fax = profile.Fax;

                        if (ProfileModel.Fax == null)
                        {
                            ProfileModel.Fax = " ";
                        }
                        else
                        {
                            ProfileModel.Fax = profile.Fax.TrimEnd();
                        }

                          ProfileModel.Address = profile.Address;

                        if (ProfileModel.Address == null)
                        {
                            ProfileModel.Address = " ";
                        }
                        else
                        {
                            ProfileModel.Address = profile.Address.TrimEnd();
                        }

                               ProfileModel.CompanyName = profile.CompanyName;

                        if (ProfileModel.CompanyName == null)
                        {
                            ProfileModel.CompanyName = " ";
                        }
                        else
                        {
                            ProfileModel.CompanyName = profile.CompanyName.TrimEnd();
                        }

                               ProfileModel.About_Yourself = profile.About_Yourself;

                        if (ProfileModel.About_Yourself == null)
                        {
                            ProfileModel.About_Yourself = " ";
                        }
                        else
                        {
                            ProfileModel.About_Yourself = profile.About_Yourself.TrimEnd();
                        }
                        ProfileModel.Android = profile.Android;
                        ProfileModel.ASP_NET = profile.ASP_NET;
                        ProfileModel.C = profile.C;
                        ProfileModel.Cplus = profile.Cplus;
                        ProfileModel.Csharp = profile.Csharp;
                        ProfileModel.Css = profile.Css;
                        ProfileModel.Html = profile.Html;
                             ProfileModel.Java = profile.Java;
                             ProfileModel.Javascript = profile.Javascript;
                             ProfileModel.Objective_C = profile.Objective_C;
                             ProfileModel.PHP = profile.PHP;
                             ProfileModel.Python = profile.Python;
                             ProfileModel.Ruby = profile.Ruby;
                             ProfileModel.SQL = profile.SQL;
                             ProfileModel.XML = profile.XML;

                             ProfileModel.Others = profile.Others;

                             if (ProfileModel.Others == null)
                             {
                                 ProfileModel.Others = " ";
                             }
                             else
                             {
                                 ProfileModel.Others = profile.Others.TrimEnd();
                             }

                             ProfileModel.WebDeveloper = profile.WebDeveloper;
                             ProfileModel.Tester = profile.Tester;
                             ProfileModel.MobileDeveloper = profile.MobileDeveloper;
                             ProfileModel.SystemDesign = profile.SystemDesign;
                             ProfileModel.SystemAnalyst = profile.SystemAnalyst;
                             ProfileModel.ProjectManager = profile.ProjectManager;
                             ProfileModel.GameDeveloper = profile.GameDeveloper;
                             ProfileModel.Marketing = profile.Marketing;
                             ProfileModel.OthersJob = profile.OthersJob;
                        return View(ProfileModel);
                    }
                    else if (Session["UserType"].Equals("Employer            "))
                    {
                        int PID = (int)Session["ProfileId"];
                        System.Diagnostics.Debug.Write("HAVE++1 " + PID);

                        var profileDetail = dbContext.Profiles.FirstOrDefault(p => p.ProId.Equals(PID));

                        System.Diagnostics.Debug.Write("HAVE++ " + profileDetail.Name);

                        var ProfileModel = new MyApplication.Profile();
                        ProfileModel.Name = profile.Name;

                        if (ProfileModel.Name == null)
                        {
                            ProfileModel.Name = " ";
                        }
                        else
                        {
                            ProfileModel.Name = profile.Name.TrimEnd();
                        }

                        ProfileModel.CompanyName = profile.CompanyName;
                        System.Diagnostics.Debug.Write("HAVE++2 " + ProfileModel.Name);
                        if (ProfileModel.CompanyName == null)
                        {
                            ProfileModel.CompanyName = " ";
                        }
                        else
                        {
                            ProfileModel.CompanyName = profile.CompanyName.TrimEnd();
                        }

                        ProfileModel.Address = profile.Address;
                        //   System.Diagnostics.Debug.Write("HAVE++2 " + ProfileModel.Name);
                        if (ProfileModel.Address == null)
                        {
                            ProfileModel.Address = " ";
                        }
                        else
                        {
                            ProfileModel.Address = profile.Address.TrimEnd();
                        }

                        ProfileModel.About_Yourself = profile.About_Yourself;
                        //   System.Diagnostics.Debug.Write("HAVE++2 " + ProfileModel.Name);
                        if (ProfileModel.About_Yourself == null)
                        {
                            ProfileModel.About_Yourself = " ";
                        }
                        else
                        {
                            ProfileModel.About_Yourself = profile.About_Yourself.TrimEnd();
                        }

                        ProfileModel.Telephone = profile.Telephone;
                        //   System.Diagnostics.Debug.Write("HAVE++2 " + ProfileModel.Name);
                        if (ProfileModel.Telephone == null)
                        {
                            ProfileModel.Telephone = " ";
                        }
                        else
                        {
                            ProfileModel.Telephone = profile.Telephone.TrimEnd();
                        }
                        ProfileModel.Fax = profile.Fax;
                        //   System.Diagnostics.Debug.Write("HAVE++2 " + ProfileModel.Name);
                        if (ProfileModel.Fax == null)
                        {
                            ProfileModel.Fax = " ";
                        }
                        else
                        {
                            ProfileModel.Fax = profile.Fax.TrimEnd();
                        }

                        System.Diagnostics.Debug.Write("Right here xxxx" + profile.Name);

                        return View(ProfileModel);
                    }
                }
                catch
                {

                }

                return View();
            }
            catch
            {
                return RedirectToAction("Index", "Home");
            }
        }
Exemplo n.º 2
0
        public ActionResult ConfirmRegister(Member member)
        {
            try
            {
                /* if (IsExistUsername(member.Username))
                   {*/
                member.Username = member.Email;

                MVCEntities db = new MVCEntities();
            //    System.Diagnostics.Debug.Write("TEST1 " + member.Username + " " + member.ConfirmRegisterCode);

                var userList_Id = db.Members.FirstOrDefault(u => u.Email == member.Email && u.ConfirmRegisterCode == member.ConfirmRegisterCode).UserId;
                var userList_Type = db.Members.FirstOrDefault(u => u.Email == member.Email && u.ConfirmRegisterCode == member.ConfirmRegisterCode).UserType;
              //   var AccountComfirmCode = db.Members.FirstOrDefault(u => u.UserId == userList_Id).ConfirmRegisterCode;

                //  var person = accountRepo.GetUsers().FirstOrDefault(u => u.UserId == userList_Id);
                var person = db.Members.FirstOrDefault(u => u.UserId == userList_Id);
                //for uid in profile

                if (person != null)
                {

                    System.Diagnostics.Debug.Write("OK");
                    person.Username = member.Username;
                 //   System.Diagnostics.Debug.Write("Pure " + member.ConfirmRegisterCode + " " + AccountComfirmCode);

                    //check confirm register code//
                /*    if (member.ConfirmRegisterCode.TrimEnd() != person.ConfirmRegisterCode.TrimEnd())
                    {
                        ModelState.AddModelError("", "The confirm register password is wrong!");

                    }
                    else
                    {*/
                        person.ConfirmRegisterCode = "";
                        person.Credit = 2;
                        System.Diagnostics.Debug.Write("OK2" + member.Username);

                        accountRepo.UpdateUser(person);
                        accountRepo.Save();
                        System.Diagnostics.Debug.Write("OK3");

                        ////////////////////////
                        Profile pro = new MyApplication.Profile();
                        pro.UserId = userList_Id;
                        pro.UserType = userList_Type;
                        System.Diagnostics.Debug.Write("pro.UserId " + pro.UserId + " and " + pro.UserType + " ");

                        profileRepo.InsertUser(pro);
                        profileRepo.Save();

                        System.Diagnostics.Debug.Write("OK4");
                  //  }

                    //////////////////////////////////

                    // delete editing information that com with the link by delete confirmRegisterCode

                    if (IsValid(member.Username, member.Password))
                    {
                        FormsAuthentication.SetAuthCookie(member.Username, false);
                        // Session["Username"] = member.Username;

                        //////////////// don't forget to Edit(u => u.UserId == 434);
                        var dbContext = new MVCEntities();
                        var usersListRegis = dbContext.Members.FirstOrDefault(u => u.Username == member.Username && u.Password == member.Password);
                        //to get profile_ID
                        var personRegis = profileRepo.GetUsers().FirstOrDefault(u => u.UserId == usersListRegis.UserId);
                        //   Session["Username"] = member.Username;
                        Session["Name"] = usersListRegis.Name;
                        System.Diagnostics.Debug.Write("member.Name " + usersListRegis.UserId + "x" + usersListRegis.UserType);

                        Session["PID"] = personRegis.ProId;
                        Session["Online"] = "Online";
                        Session["UidInProfile"] = usersListRegis.UserId;
                        Session["UserType"] = usersListRegis.UserType;
                        //    Session["Picture"] = personRegis.ImageData;
                        //  System.Diagnostics.Debug.Write("usersList " + Session["UidInProfile"] + "x");

                        //System.Diagnostics.Debug.Write("Usertype " + Session["UserType"] + "x");
                        return RedirectToAction("Index", "Home");
                    }
                    else
                    {
                        ModelState.AddModelError("", "Login Data is incorrect");

                    }

                    //   return RedirectToAction("Index", "Home");
                }
                else
                {
                    ModelState.AddModelError("", "ConfirmRegister code has used already!");
                    return View();
                }
                /* }
                 else
                 {
                     ModelState.AddModelError("", "this Username is exist");
                 }*/
            }
            catch { ModelState.AddModelError("", "ConfirmRegister code is wrongs or used to register before!");  return View(); }
            return View();
        }
Exemplo n.º 3
0
        public ActionResult ShowProfiles(int pid)
        {
            // actually pid form parameter is UID kiki
            ////////////////is implementing right here/////////////////
            // ViewBag.ID = id;
            try
            {
                //  System.Diagnostics.Debug.Write("Uid in ShowProfile is equal " + pid + " ");

                var profile = profileRepo.GetUsers().FirstOrDefault(u => u.UserId == pid);
                //  System.Diagnostics.Debug.Write("XIS" + profile.ProId + " " + profile.Name);
                var usersProfile = new MyApplication.Profile()
                {

                    ProId = profile.ProId,
                    Name = profile.Name,
                    Telephone = profile.Telephone,
                    About_Yourself = profile.About_Yourself,
                    Address = profile.Address,
                    CompanyName = profile.CompanyName,
                    Fax = profile.Fax,
                    HideText = profile.HideText,

                        Android = profile.Android,
                        ASP_NET = profile.ASP_NET,
                        C = profile.C,
                        Cplus = profile.Cplus,
                        Csharp = profile.Csharp,
                        Css = profile.Css,

                        Html = profile.Html,
                        Java = profile.Java,
                        Javascript = profile.Javascript,
                        Objective_C = profile.Objective_C,
                        PHP = profile.PHP,
                        Python = profile.Python,
                        Ruby = profile.Ruby,
                        SQL = profile.SQL,
                        XML = profile.XML,
                        Others = profile.Others,

                        WebDeveloper = profile.WebDeveloper,
                        Tester = profile.Tester,
                        MobileDeveloper = profile.MobileDeveloper,
                        SystemDesign = profile.SystemDesign,
                        SystemAnalyst = profile.SystemAnalyst,
                        ProjectManager = profile.ProjectManager,
                        GameDeveloper = profile.GameDeveloper,
                        Marketing = profile.Marketing,
                        OthersJob = profile.OthersJob,

                };
                ViewBag.UserId = pid;

                return View(usersProfile);
            }
            catch
            {
                // return RedirectToAction("Index", "Home");
                return View();
            }
        }