示例#1
0
        public bool AddUser(User user)
        {
            try
            {
                user.CreatedTime = DateTime.Now;

                user.State = ObjectState.Added;
                userRep.AddOperation(user);
                return true;
            }
            catch (Exception ex) {
                var rr = ex.Message;
                return false;
            }
        }
示例#2
0
        public ActionResult InvitationConfirm(int id, User user)
        {
            var tnc = Request.Params.Get("tnc");
            if (tnc != null && tnc == "on")
            {
                Encryptor encrypt = new Encryptor();
                user.Password = encrypt.GetMD5(user.Password);
                user.ConfirmPassword = encrypt.GetMD5(user.ConfirmPassword);
                if (uService.GetSingleUserByEmail(user.Email) == null)
                {

                    if (uService.AddUser(user))
                    {
                        var Invitation = inService.GetSingleInvitation(id);
                        var emp = new Employee();

                        var setObj = setService.GetAllByUserId(user.Id);
                        var logEntry = new CompanyViewLog();
                        logEntry.UserId = user.Id;
                        logEntry.CompanyId = Invitation.CompanyId; ;
                        logEntry.LoginTime = DateTime.Now;
                        //logEntry.IpAddress = "";
                        _companyViewLog.AddCompanyViewLog(logEntry);

                        emp.UserId = user.Id;
                        emp.CompanyId = Invitation.CompanyId;
                        emp.DesignationId = Invitation.DesignationId;
                        if (eService.CreateEmployee(emp))
                        {
                            var accountSetting = new Settings();
                            accountSetting.userId = user.Id;
                            accountSetting.lgdash = false;
                            accountSetting.lglast = false;
                            accountSetting.lgcompany = true;
                            accountSetting.CompanyId = Invitation.CompanyId;

                            if (sService.AddSettings(accountSetting))
                            {
                                var userInRole = new UserInRole();
                                userInRole.EmployeeId = emp.Id;
                                userInRole.RoleId = Invitation.RoleId;
                                userInRole.IsActive = true;
                                if (URSer.AddUserInRole(userInRole))
                                {
                                    CustomPrincipal.Login(user.Email, user.Password, false);
                                    return RedirectToAction("Create", "EmployeeProfile", new { area = "OrganizationManagement" });
                                }
                            }
                        }
                        else
                        {
                            return Content("Failed");
                        }
                    }
                }
                else
                {
                    ModelState.AddModelError("Msg", "Already Register");
                    //return Content("Already Register");
                    return View();

                }
            }

            return Content("You Must Agree with our terms and Condition");
        }
示例#3
0
        public ActionResult Registration(User user)
        {
            var tnc = Request.Params.Get("tnc");
            if (tnc != null && tnc == "on")
            {
                if (uService.GetSingleUserByEmail(user.Email) == null)
                {
                    Encryptor encrypt = new Encryptor();
                    user.Password = encrypt.GetMD5(user.Password);
                    user.ConfirmPassword = encrypt.GetMD5(user.ConfirmPassword);
                    if (uService.AddUser(user))
                    {
                        //return View("RegistrationSuccess");

                        CustomPrincipal.Login(user.Email, user.Password, false);
                        return RedirectToAction("MyMhasb", "Users", new { Area = "UserManagement" });
                    }
                    else
                    {
                        ModelState.AddModelError("Msg", "Registration Failed!!!");
                        // return Content("Already Register");
                        return View();
                    }
                }
                else
                {
                    ModelState.AddModelError("Msg", "Already Register");
                    // return Content("Already Register");
                    return View();
                }

            }

            else
            {
                ModelState.AddModelError("Msg", "You Must Agree with Terms and Condition....");
                // return Content("Already Register");
                return View();
            }
        }
示例#4
0
        public bool UpdateUser(User user)
        {
            try
            {

                user.State = ObjectState.Modified;
                userRep.UpdateOperation(user);
                return true;
            }
            catch (Exception ex)
            {
                var rr = ex.Message;
                return false;
            }
        }