Ejemplo n.º 1
0
        public ActionResult Logout()
        {
            var result = loginLogoutManager.AttemptLogout();

            if (!result.Success)
            {
                // TODO: #AG32 - Determine what failing to log out means and then deal with it accordingly.
                throw new NotSupportedException("Failure to log out is not supported.");
            }

            Session?.Abandon();
            return(RedirectToAction(nameof(LoginController.LoggedOut), this.GetName <LoginController>()));
        }
Ejemplo n.º 2
0
 public ActionResult LogOff()
 {
     FormsAuthentication.SignOut();
     Session.Abandon();
     return(Redirect("/"));
 }
Ejemplo n.º 3
0
 protected void btnLogout_Click(object sender, EventArgs e)
 {
     Session.Abandon();
     Response.Redirect("Default.aspx");
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["Email"] == null)
        {
            //logout2
            Session.Abandon();
            Response.Redirect("Login.aspx?m=Your+session+has+timed+out");
            Response.End();
        }
        if (Request.QueryString["action"] != null)
        {
            //timesheet popup modal action text
            lblAction.Text = "Timesheet Action";
            if (Request.QueryString["mess"] != null)
            {
                lblActionTimeSheet.Text = "Are you sure you want to " + Request.QueryString["action"] + " the timesheet for <br>" + Request.QueryString["mess"].ToString().Replace("(", "<br>(");
            }
            else
            {
                lblActionTimeSheet.Text = "Are you sure you want to " + Request.QueryString["action"] + " this timesheet";
            }
        }
        ////update timesheet status
        //if (Request.QueryString["action"] != null)
        //{
        //    //update status
        //    conn = new SqlConnection(WebConfigurationManager.ConnectionStrings["dbconn"].ConnectionString);
        //    try
        //    {
        //        if (conn.State == System.Data.ConnectionState.Closed)
        //        {
        //            conn.Open();
        //            string _TimeSheetID = "0";
        //            string sqlGetTimeSheetID = "";

        //            //start, end and weeks
        //            //get timesheetID + 7

        //                sqlGetTimeSheetID = " select timesheet_id " +
        //                                        " from ovms_timesheet " +
        //                                        " where day =  " + Request.QueryString["fromD"].ToString() + " " +
        //                                        " and month =  " + Request.QueryString["FromM"].ToString() + " " +
        //                                        " and year = " + Request.QueryString["FromY"].ToString() + " " +
        //                                        " and employee_id = " + Request.QueryString["TID"].ToString() + " " +
        //                                        " and active =  1";

        //            SqlCommand cmdGetTimeSheetID = new SqlCommand(sqlGetTimeSheetID, conn);
        //            SqlDataReader rsGetTimeSheetID = cmdGetTimeSheetID.ExecuteReader();
        //            if (rsGetTimeSheetID.HasRows == true)
        //            {
        //                while (rsGetTimeSheetID.Read())
        //                {
        //                    _TimeSheetID = rsGetTimeSheetID["timesheet_id"].ToString();
        //                }
        //            }
        //            //close
        //            rsGetTimeSheetID.Close();
        //            cmdGetTimeSheetID.Dispose();

        //            string sSQLUpdate = "";
        //            if (Request.QueryString["action"] == "Approve")
        //            {
        //                //update
        //                sSQLUpdate = " update ovms_timesheet_details " +
        //                                            " set timesheet_status_id = 1 " +
        //                                            " where timesheet_id between " + _TimeSheetID + " and " + (Convert.ToInt32(_TimeSheetID.ToString()) + +Convert.ToInt32("6")) + " " +
        //                                            " and active = 1";
        //            }
        //            if (Request.QueryString["action"] == "Reject")
        //            {
        //                //update
        //                sSQLUpdate = " update ovms_timesheet_details " +
        //                                            " set timesheet_status_id = 2 " +
        //                                            " where timesheet_id between " + _TimeSheetID + " and " + (Convert.ToInt32(_TimeSheetID.ToString()) + +Convert.ToInt32("6")) + " " +
        //                                            " and active = 1";

        //            }
        //            SqlCommand cmdUpdateTimeSheet1 = new SqlCommand(sSQLUpdate, conn);
        //            int iUpdate = cmdUpdateTimeSheet1.ExecuteNonQuery();
        //            cmdUpdateTimeSheet1.Dispose();

        //        }
        //    }
        //    catch (Exception ex)
        //    {
        //        //
        //    }
        //    finally
        //    {
        //        if (conn.State == System.Data.ConnectionState.Open)
        //            conn.Close();
        //    }

        //}
        //end of update timesheet status


        if (Request["TID"] != null)
        {
            GetListOfWorkers(Request.QueryString["TID"].ToString());
        }
        else
        {
            GetListOfWorkers("");
        }
    }
Ejemplo n.º 5
0
 protected void btnCancle_Click(object sender, EventArgs e)
 {
     Response.Redirect("~/Admin/Home");
     Session.Abandon();
     Session.Clear();
 }
 public ActionResult LogOut()
 {
     Session.Abandon();
     return(RedirectToAction("Index", "Login"));
 }
Ejemplo n.º 7
0
 protected void logout_Click(object sender, EventArgs e)
 {
     Session.Abandon();
     Session.Clear();
     Response.Redirect("~/login.aspx");
 }
Ejemplo n.º 8
0
 public ActionResult OutLogin()
 {
     Session.Abandon();
     Session.Clear();
     return(RedirectToAction("Login"));
 }
Ejemplo n.º 9
0
 protected void Page_Load(object sender, EventArgs e)
 {
     Session.Clear();
     Session.Abandon();
     Response.Redirect("Login.aspx");
 }
Ejemplo n.º 10
0
 public ActionResult Logout()
 {
     Session.Clear();
     Session.Abandon();
     return(View("Login"));
 }
Ejemplo n.º 11
0
        public ActionResult Reset()
        {
            Session.Abandon();

            return(RedirectToAction("Index"));
        }
Ejemplo n.º 12
0
        public ActionResult DoLogout()
        {
            Session.Abandon();

            return(RedirectToAction("Index", "Home"));
        }
Ejemplo n.º 13
0
		public async Task<ActionResult> LogOut(){
			Session.Abandon();
			return RedirectToAction("Forum", "Home");
		}
Ejemplo n.º 14
0
 public ActionResult Logout()
 {
     Session.Abandon();
     FormsAuthentication.SignOut();//hủy tất cả nhưng cookie
     return(RedirectToAction("Index", "Login"));
 }
Ejemplo n.º 15
0
        //
        // POST: /Account/LogOff

        public ActionResult LogOff()
        {
            Session.Abandon();
            return(RedirectToAction("Login", "Account"));
        }
Ejemplo n.º 16
0
 protected void Salir(object sender, EventArgs e)
 {
     Session.Abandon();
     Response.Redirect("~/View/Login/login.aspx");
 }
Ejemplo n.º 17
0
 protected void ls1_LoggedOut(object sender, EventArgs e)
 {
     Session.Abandon();
     FormsAuthentication.SignOut();
 }
Ejemplo n.º 18
0
 public ActionResult Logout()
 {
     Session.Abandon();
     return(RedirectToAction("Index", "User"));
 }
Ejemplo n.º 19
0
 public ActionResult CerrarSesion()
 {
     Session.Clear();
     Session.Abandon();
     return(RedirectToAction("Index", "Home"));
 }
Ejemplo n.º 20
0
 protected void Button_LogOut_Click(object sender, EventArgs e)
 {
     Session.Abandon();
     Response.Redirect("Login.aspx");
 }
Ejemplo n.º 21
0
 protected void Button2_Click(object sender, EventArgs e)//Logout button
 {
     Session.Abandon();
     Response.Redirect("Login.aspx");
 }
Ejemplo n.º 22
0
 public ActionResult Logout()
 {
     Session.Abandon();
     FormsAuthentication.SignOut();
     return(RedirectToAction("Login"));
 }
Ejemplo n.º 23
0
 protected void Page_Load(object sender, EventArgs e)
 {
     Session.Abandon();
     Response.Redirect("~/application/Login.aspx");
 }
Ejemplo n.º 24
0
        public async Task <ActionResult> Update(Profile model)
        {
            if (Session["ProfileId"] == null)
            {
                Session.Abandon();
                return(RedirectToRoute("FrontEndHomeIndex"));
            }
            long profileId = Convert.ToInt64(Session["ProfileId"].ToString());

            ViewBag.Nations              = new SelectList(_repository.GetRepository <Nation>().GetAll().OrderBy(o => o.Name).ToList(), "Id", "Name", model.NationId);
            ViewBag.Religions            = new SelectList(_repository.GetRepository <Religion>().GetAll().OrderBy(o => o.Name).ToList(), "Id", "Name", model.ReligionId);
            ViewBag.CurrentOrganizations = new SelectList(new Web.Controllers.SharedController().GetOrganizations(null).ToList(), "Id", "Name", model.CurrentOrganizationId);
            ViewBag.Positions            = new SelectList(_repository.GetRepository <Position>().GetAll().OrderBy(o => o.Name).ToList(), "Id", "Name", model.CurrentPositionId);
            ViewBag.Degrees              = new SelectList(_repository.GetRepository <Degree>().GetAll().OrderBy(o => o.Name).ToList(), "Id", "Name", model.CurrentDegreeId);
            ViewBag.Ranks         = new SelectList(_repository.GetRepository <Rank>().GetAll().OrderBy(o => o.Name).ToList(), "Id", "Name", model.CurrentRankId);
            ViewBag.Organizations = new SelectList(new Web.Controllers.SharedController().GetOrganizations(null, true).ToList(), "Id", "Name", string.Empty);
            ViewBag.Countries     = new SelectList(_repository.GetRepository <Country>().GetAll().OrderBy(o => o.Name).ToList(), "Id", "Name", model.CountryId);

            var provinces = _repository.GetRepository <Province>().GetAll().OrderBy(o => o.Name).ToList();

            ViewBag.NativeLandProvinces       = new SelectList(provinces, "Id", "Name", model.NativeLandProvinceId);
            ViewBag.NativeLandDistricts       = new SelectList(_repository.GetRepository <District>().GetAll(o => o.ProvinceId == model.NativeLandProvinceId).OrderBy(o => o.Name).ToList(), "Id", "Name", model.NativeLandDistrictId);
            ViewBag.CurrentResidenceProvinces = new SelectList(provinces, "Id", "Name", model.CurrentResidenceProvinceId);
            ViewBag.CurrentResidenceDistricts = new SelectList(_repository.GetRepository <District>().GetAll(o => o.ProvinceId == model.CurrentResidenceProvinceId).OrderBy(o => o.Name).ToList(), "Id", "Name", model.CurrentResidenceDistrictId);
            try
            {
                var profile = await _repository.GetRepository <Profile>().ReadAsync(profileId);

                string email = StringHelper.KillChars(Request.Form["Email"]);
                string name  = StringHelper.KillChars(Request.Form["Name"]);
                //Kiểm tra chưa nhập họ tên và email
                if (string.IsNullOrEmpty(email) || string.IsNullOrEmpty(name))
                {
                    return(View(model));
                }
                //Kiểm tra trùng email
                bool exists = await _repository.GetRepository <Account>().AnyAsync(o => o.Email == email && o.Profile.Id != profileId);

                bool exists2 = await _repository.GetRepository <Profile>().AnyAsync(o => o.Email == email && o.Id != profileId);

                if (exists || exists2)
                {
                    ModelState.AddModelError(string.Empty, "Địa chỉ email đã tồn tại!");
                    ModelState.AddModelError("Email", "Địa chỉ email này đã được sử dụng cho tài khoản khác!");
                    return(View(model));
                }
                //Kiểm tra chưa chọn trường
                string[] organizations = null;
                if (Request.Form["OrganizationId"] != null)
                {
                    organizations = Request.Form["OrganizationId"].Split(',');
                }
                if (organizations == null || organizations.Length == 0)
                {
                    ModelState.AddModelError(string.Empty, "Vui lòng chọn trường!");
                    return(View(model));
                }

                string dob              = StringHelper.KillChars(Request.Form["DateOfBirth"]);
                string sex              = StringHelper.KillChars(Request.Form["Sex"]);
                string cellphone        = StringHelper.KillChars(Request.Form["CellPhone"]);
                string profilepicture   = StringHelper.KillChars(Request.Form["ProfilePicture"]);
                string homephone        = StringHelper.KillChars(Request.Form["HomePhone"]);
                string officephone      = StringHelper.KillChars(Request.Form["OfficePhone"]);
                string nativeland       = StringHelper.KillChars(Request.Form["NativeLand"]);
                string currentresidence = StringHelper.KillChars(Request.Form["CurrentResidence"]);
                string extrainfomation  = StringHelper.KillChars(Request.Form["ExtraInfomation"]);

                long?nationId              = model.NationId;
                long?religionId            = model.ReligionId;
                long?currentOrganizationId = model.CurrentOrganizationId;
                long?currentPositionId     = model.CurrentPositionId;
                long?currentDegreeId       = model.CurrentDegreeId;
                long?currentRankId         = model.CurrentRankId;

                long?countryId                  = model.CountryId;
                long?nativeLandProvinceId       = model.NativeLandProvinceId;
                long?nativeLandDistrictId       = model.NativeLandDistrictId;
                long?currentResidenceProvinceId = model.CurrentResidenceProvinceId;
                long?currentResidenceDistrictId = model.CurrentResidenceDistrictId;

                profile.Name             = name;
                profile.Email            = email;
                profile.Sex              = string.IsNullOrEmpty(sex) ? false : Convert.ToBoolean(sex);
                profile.CellPhone        = cellphone;
                profile.ProfilePicture   = profilepicture;
                profile.NativeLand       = nativeland;
                profile.CurrentResidence = currentresidence;
                profile.ExtraInfomation  = extrainfomation;
                profile.HomePhone        = homephone;
                profile.OfficePhone      = officephone;

                profile.NationId              = nationId;
                profile.ReligionId            = religionId;
                profile.CurrentOrganizationId = currentOrganizationId;
                profile.CurrentPositionId     = currentPositionId;
                profile.CurrentDegreeId       = currentDegreeId;
                profile.CurrentRankId         = currentRankId;

                profile.CountryId                  = countryId;
                profile.NativeLandProvinceId       = nativeLandProvinceId;
                profile.NativeLandDistrictId       = nativeLandDistrictId;
                profile.CurrentResidenceProvinceId = currentResidenceProvinceId;
                profile.CurrentResidenceDistrictId = currentResidenceDistrictId;

                if (!string.IsNullOrEmpty(dob))
                {
                    try
                    {
                        DateTime date = DateTime.ParseExact(dob, "dd/MM/yyyy", null);
                        profile.DateOfBirth = date;
                    }
                    catch
                    {
                        profile.DateOfBirth = null;
                    }
                }
                int result = await _repository.GetRepository <Profile>().UpdateAsync(profile, profileId);

                if (result > 0)
                {
                    var         profileOrganizationsToAdd = new List <ProfileOrganization>();
                    List <long> poIds            = new List <long>();
                    List <long> poIdsNotToDelete = new List <long>();
                    var         po = profile.ProfileOrganizations.ToList();
                    if (po != null && po.Any())
                    {
                        poIds = po.Select(o => o.Id).ToList();
                    }

                    string[] startyears    = Request.Form.GetValues("StartYear");
                    string[] graduateyears = Request.Form.GetValues("GraduateYear");
                    string[] majorsids     = Request.Form.GetValues("MajorsId");
                    string[] courseids     = Request.Form.GetValues("CourseId");

                    string[] profileOrganizations = Request.Form.GetValues("ProfileOrganization");
                    if (profileOrganizations != null && profileOrganizations.Any())
                    {
                        for (int i = 0; i < profileOrganizations.Length; i++)
                        {
                            if (!string.IsNullOrEmpty(profileOrganizations[i]))
                            {
                                //Nếu chọn lần đầu
                                if (profileOrganizations[i] == "0")
                                {
                                    if (!string.IsNullOrEmpty(organizations[i]))
                                    {
                                        int? StartYear    = string.IsNullOrEmpty(startyears[i]) ? (int?)null : Convert.ToInt16(startyears[i]);
                                        int? GraduateYear = string.IsNullOrEmpty(graduateyears[i]) ? (int?)null : Convert.ToInt16(graduateyears[i]);
                                        long?MajorsId     = string.IsNullOrEmpty(majorsids[i]) ? (long?)null : Convert.ToInt64(majorsids[i]);
                                        long?CourseId     = string.IsNullOrEmpty(courseids[i]) ? (long?)null : Convert.ToInt64(courseids[i]);
                                        profileOrganizationsToAdd.Add(new ProfileOrganization()
                                        {
                                            ProfileId      = profile.Id,
                                            OrganizationId = Convert.ToInt64(organizations[i]),
                                            StartYear      = string.IsNullOrEmpty(startyears[i]) ? (int?)null : Convert.ToInt16(startyears[i]),
                                            GraduateYear   = string.IsNullOrEmpty(graduateyears[i]) ? (int?)null : Convert.ToInt16(graduateyears[i]),
                                            MajorsId       = string.IsNullOrEmpty(majorsids[i]) ? (long?)null : Convert.ToInt64(majorsids[i]),
                                            CourseId       = string.IsNullOrEmpty(courseids[i]) ? (long?)null : Convert.ToInt64(courseids[i])
                                        });
                                    }
                                }
                                else
                                {//Nếu đã chọn từ trước
                                    long poId = Convert.ToInt64(profileOrganizations[i]);
                                    //Nếu trường này đã chọn từ trước
                                    if (poIds.Contains(poId))
                                    {
                                        //Cập nhật ngành, khóa, năm
                                        ProfileOrganization profileOrganization = await _repository.GetRepository <ProfileOrganization>().ReadAsync(poId);

                                        profileOrganization.OrganizationId = Convert.ToInt64(organizations[i]);
                                        profileOrganization.StartYear      = string.IsNullOrEmpty(startyears[i]) ? (int?)null : Convert.ToInt16(startyears[i]);
                                        profileOrganization.GraduateYear   = string.IsNullOrEmpty(graduateyears[i]) ? (int?)null : Convert.ToInt16(graduateyears[i]);
                                        profileOrganization.MajorsId       = string.IsNullOrEmpty(majorsids[i]) ? (long?)null : Convert.ToInt64(majorsids[i]);
                                        profileOrganization.CourseId       = string.IsNullOrEmpty(courseids[i]) ? (long?)null : Convert.ToInt64(courseids[i]);
                                        await _repository.GetRepository <ProfileOrganization>().UpdateAsync(profileOrganization, profileId);

                                        //Đánh dấu là không bị xóa
                                        poIdsNotToDelete.Add(poId);
                                    }
                                }
                            }
                        }
                        if (poIdsNotToDelete != null && poIdsNotToDelete.Any())
                        {
                            int result2 = await _repository.GetRepository <ProfileOrganization>().DeleteAsync(o => o.ProfileId == profileId && (!poIdsNotToDelete.Contains(o.Id)), profileId);
                        }
                        if (profileOrganizationsToAdd != null && profileOrganizationsToAdd.Any())
                        {
                            int result3 = await _repository.GetRepository <ProfileOrganization>().CreateAsync(profileOrganizationsToAdd, profileId);
                        }
                    }

                    TempData["Success"] = "Đã cập nhật hồ sơ cựu sinh viên thành công!";
                    return(RedirectToRoute("FrontEndProfileDetail"));
                }
                else
                {
                    ModelState.AddModelError(string.Empty, "Vui lòng nhập chính xác các thông tin hồ sơ!");
                    return(View(model));
                }
            }
            catch (Exception ex)
            {
                ModelState.AddModelError(string.Empty, "Vui lòng nhập chính xác các thông tin hồ sơ!");
                return(View(model));
            }
        }
Ejemplo n.º 25
0
 protected void Back_Click(object sender, EventArgs e)
 {
     Response.Write("<script language=javascript>;window.location.replace('Login.aspx')</script>");
     Session.Abandon();
 }
Ejemplo n.º 26
0
 protected void cerrarSesionBtn_Click(object sender, EventArgs e)
 {
     Session.Clear();
     Session.Abandon();
     Response.Redirect("inicio.aspx");
 }
Ejemplo n.º 27
0
 protected void Page_Load(object sender, EventArgs e)
 {
     Session.Abandon();
     Response.Redirect("Default.aspx");
 }
Ejemplo n.º 28
0
 public ActionResult Logout()
 {
     FormsAuthentication.SignOut();
     Session.Abandon();
     return(RedirectToAction("Index", "Home"));
 }
 public ActionResult Logout()
 {
     Session.Abandon();
     return(RedirectToAction("SignIn", "Home"));
 }
Ejemplo n.º 30
0
 public void cancel(object sender, EventArgs args)
 {
     Session.Abandon();
     Response.Redirect("Default.aspx");
 }