Пример #1
0
 //[ValidateAntiForgeryToken]
 public ActionResult AdditionalDataAnnotationAttributes(UserProfileEx userProfileEx)
 {
     if (ModelState.IsValid)
     {
         // DoSomethig(userProfileEx);
     }
     return(View("AdditionalDataAnnotationAttributes", userProfileEx));
 }
Пример #2
0
        public ActionResult AdditionalDataAnnotationAttributes()
        {
            var model = new UserProfileEx();

            model.StartDate = DateTime.Now.AddYears(-500);
            model.EndDate   = model.StartDate.AddDays(50);
            return(View("AdditionalDataAnnotationAttributes", model));
        }
Пример #3
0
        public static void LogInfo(LogAction action, String message)
        {
            var user = UserProfileEx.GetByUserSid(ConfigHelper.CurrentUserId);

            if (user != null)
            {
                LogInfo(String.Format("[{0}] [{1}] {2}", user.Alias, action.ToString("g").ToUpper().PadRight(7), message));
            }
        }
Пример #4
0
        /// <summary>
        /// Authes the logon.
        /// </summary>
        /// <returns></returns>
        private bool AuthLogon()
        {
            if (Verify())
            {
                var oUser = UserProfileEx.GetLoginUser(txtStaffNumber.Text.Trim().Replace("'", ""), txtPassword.Text.Trim().Replace("'", ""));
                if (oUser != null)
                {
                    var oStaff = StaffEx.GetByStaffId(oUser.UserSid);
                    if (oStaff != null)
                    {
                        if (oStaff.Status > Convert.ToInt32(EnumHelper.Status.Inactive.ToString("d")))
                        {
                            if (!oStaff.Retired)
                            {
                                this.Context.Session.IsLoggedOn = true;

                                ConfigHelper.CurrentUserId   = oStaff.StaffId;
                                ConfigHelper.CurrentZoneId   = new Guid(cboZone.SelectedValue.ToString());
                                ConfigHelper.CurrentUserType = oUser.UserType.Value;

                                // The below code will logout the loggedin user when idle for the time specified
                                if (ConfigurationManager.AppSettings["sessionTimeout"] != null)
                                {
                                    this.Context.HttpContext.Session.Timeout = Convert.ToInt32(ConfigurationManager.AppSettings["sessionTimeout"]);
                                }

                                RT2020.Controls.Log4net.LogInfo(RT2020.Controls.Log4net.LogAction.Login, this.ToString());
                            }
                            else
                            {
                                this.lblErrorMessage.Text       = RT2020.Controls.Utility.Dictionary.GetWord("msg_retired_staff");
                                this.Context.Session.IsLoggedOn = false;
                            }
                        }
                        else
                        {
                            this.lblErrorMessage.Text       = RT2020.Controls.Utility.Dictionary.GetWord("msg_inactive_staff");
                            this.Context.Session.IsLoggedOn = false;
                        }
                    }
                }
                else
                {
                    // When user inputs incorrect staff number or password, prompt user the error message.
                    // To Do: We can try to limited the times of attempt to 5 or less.
                    this.lblErrorMessage.Text       = RT2020.Controls.Utility.Dictionary.GetWord("err_incorrect_staff");
                    this.Context.Session.IsLoggedOn = false;
                }
            }
            else
            {
                this.Context.Session.IsLoggedOn = false;
            }

            return(this.Context.Session.IsLoggedOn);
        }
Пример #5
0
 public static Guid GetSuperUserId()
 {
     return(UserProfileEx.GetUserIdBySid(Staff.GetSuperStaffId()));
 }