Beispiel #1
0
        protected void loginControl_Login(object sender, EventArgs e)
        {
            RaiseEvent("Login.aspx#Login", sender, e);

            var args = e as LoginEventArgs;
            User user = null;
            bool allowLogin;

            using (var dataSource = NewDataSource())
            {
                using (var userAccountLogic = new UserAccountLogic(dataSource))
                {
                    userAccountLogic.UserNotFound += UserNotFound;
                    userAccountLogic.InvalidPassword += InvalidPassword;

                    allowLogin = userAccountLogic.AllowLogin(args.UserName, args.Password, ref user);
                }
            }

            if (allowLogin)
            {
                UserHandle.Current.CurrentUser = user;
                RaiseEvent("Login.aspx#LoginSuccessful", sender, e);
                if (!string.IsNullOrEmpty(ReturnUrl))
                    Response.Redirect(string.Format("{0}",ReturnUrl));
                Response.Redirect("UserHome.aspx");
            }
        }
Beispiel #2
0
        protected void AddSarfButton_Click(object sender, EventArgs e)
        {
            var dataSource = NewDataSource();
            //var systemSettings = new Sys
            var currentAccount = new UserAccountLogic(CurrentUser, dataSource);
            var user = currentAccount.GetUserByID(CurrentUser.UserID);
            SARF sarfObj = new SARF();

            //sarfObj.SARFCode
            sarfObj.DateFiled = SarfControl.dateFiledDatePicker.SelectedDate.Value;
            sarfObj.DateOfVisit = SarfControl.dateOfVisitDatePicker.SelectedDate.Value;
            sarfObj.FiledBy = user.ID;
            sarfObj.Purpose = SarfControl.purposeTextBox.Text;
            sarfObj.SourceIP =
                Request.ServerVariables["REMOTE_ADDR"] ?? Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
            sarfObj.Status = SarfControl.statusTextBox.Text;
            sarfObj.DateVisited = SarfControl.dateVisitedDatePicker.SelectedDate.Value;
            sarfObj.VisitVerifiedBy = 0;
            sarfObj.IsActive = true;
            sarfObj.UserCreated = user.ID;
            sarfObj.DateCreated = DateTime.Now;

            var sarfEntry = new SarfLogic(CurrentUser, dataSource);
            sarfEntry.AddSarf(sarfObj);
        }