예제 #1
0
 /// <summary>
 /// Deprecated Method for adding a new object to the TblUsers EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToTblUsers(TblUser tblUser)
 {
     base.AddObject("TblUsers", tblUser);
 }
예제 #2
0
        public ActionResult Save(UserViewModel userViewModel)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    //add
                    if (userViewModel.UserId == 0 && userViewModel.ActionName == "Add")
                    {
                        var model = new TblUser()
                        {
                            LoginId = userViewModel.LoginId,
                            Password = userViewModel.Password,
                            UserName = userViewModel.UserName,
                            EmailAddress = userViewModel.EmailAddress,
                            Phone = userViewModel.Phone,
                            ChangePasswordAtFirstLogin = userViewModel.ChangePasswordAtFirstLogin,
                            Status = userViewModel.Status,

                            GroupId = userViewModel.GroupId,
                            ApplicationId = userViewModel.ApplicationId,
                            EmployeeId = userViewModel.EmployeeId
                        };

                        //_userRepository.Insert(model);
                    }
                    else if (userViewModel.ActionName == "Edit") //edit
                    {
                        TblUser user = _userRepository.GetById(userViewModel.UserId);

                        if (user != null)
                        {

                            user.UserId = userViewModel.UserId;
                            user.LoginId = userViewModel.LoginId;
                            user.Password = userViewModel.Password;
                            user.UserName = userViewModel.UserName;
                            user.EmailAddress = userViewModel.EmailAddress;
                            user.Phone = userViewModel.Phone;
                            user.ChangePasswordAtFirstLogin = userViewModel.ChangePasswordAtFirstLogin;
                            user.Status = userViewModel.Status;

                            user.ApplicationId = userViewModel.ApplicationId;
                            user.GroupId = userViewModel.GroupId;
                            user.EmployeeId = userViewModel.EmployeeId;

                            //_userRepository.Update(user);

                        }
                        else
                        {
                            return Content(KendoUiHelper.GetKendoUiWindowAjaxSuccessMethod(Boolean.FalseString, userViewModel.ActionName, MessageType.warning.ToString(), ExceptionHelper.ExceptionMessageForNullObject()));
                        }

                    }

                    //_userRepository.Save();

                    return Content(KendoUiHelper.GetKendoUiWindowAjaxSuccessMethod(Boolean.TrueString, userViewModel.ActionName, MessageType.success.ToString(), "Saved Successfully."));

                }

                return Content(KendoUiHelper.GetKendoUiWindowAjaxSuccessMethod(Boolean.FalseString, userViewModel.ActionName, MessageType.warning.ToString(), ExceptionHelper.ModelStateErrorFormat(ModelState)));
            }
            catch (Exception ex)
            {
                return Content(KendoUiHelper.GetKendoUiWindowAjaxSuccessMethod(Boolean.FalseString, userViewModel.ActionName, MessageType.warning.ToString(), ExceptionHelper.ExceptionMessageFormat(ex)));
            }
        }
예제 #3
0
 /// <summary>
 /// Create a new TblUser object.
 /// </summary>
 /// <param name="userId">Initial value of the UserId property.</param>
 /// <param name="userName">Initial value of the UserName property.</param>
 /// <param name="firstName">Initial value of the FirstName property.</param>
 /// <param name="lastName">Initial value of the LastName property.</param>
 /// <param name="loginId">Initial value of the LoginId property.</param>
 /// <param name="neverExperied">Initial value of the NeverExperied property.</param>
 /// <param name="createdBy">Initial value of the CreatedBy property.</param>
 /// <param name="createdDate">Initial value of the CreatedDate property.</param>
 /// <param name="groupId">Initial value of the GroupId property.</param>
 /// <param name="status">Initial value of the Status property.</param>
 /// <param name="isLockedOut">Initial value of the IsLockedOut property.</param>
 /// <param name="applicationId">Initial value of the ApplicationId property.</param>
 public static TblUser CreateTblUser(global::System.Int32 userId, global::System.String userName, global::System.String firstName, global::System.String lastName, global::System.String loginId, global::System.Boolean neverExperied, global::System.String createdBy, global::System.DateTime createdDate, global::System.Int32 groupId, global::System.Boolean status, global::System.Boolean isLockedOut, global::System.Int32 applicationId)
 {
     TblUser tblUser = new TblUser();
     tblUser.UserId = userId;
     tblUser.UserName = userName;
     tblUser.FirstName = firstName;
     tblUser.LastName = lastName;
     tblUser.LoginId = loginId;
     tblUser.NeverExperied = neverExperied;
     tblUser.CreatedBy = createdBy;
     tblUser.CreatedDate = createdDate;
     tblUser.GroupId = groupId;
     tblUser.Status = status;
     tblUser.IsLockedOut = isLockedOut;
     tblUser.ApplicationId = applicationId;
     return tblUser;
 }