コード例 #1
0
 public ActionResult Create(SeniorDesign.Models.CreateExpenseModel expense, string action)
 {
     // TODO: Add insert logic here
     ServiceClient sc = Sas.GetAuthenticatedServiceClient(this, action);
     sc.CreateExpence(expense.Name, expense.Description, expense.Total, expense.DateOfExpense, expense.UserId, expense.ASEPSA, expense.GroupId, "", -1); //TODO: Add category and window input
     return RedirectToAction("Index");
 }
コード例 #2
0
        public ActionResult Delete(SeniorDesign.Models.FullPermissionInfo fpi, string action)
        {
            ServiceClient sc = Sas.GetAuthenticatedServiceClient(this, action);
            sc.Deny(fpi.UserID, fpi.GroupId, fpi.PermissionName);

            return RedirectToAction("Index", "Permission", new { id = fpi.UserID });
        }
コード例 #3
0
        public ActionResult ChangePassword(int id, SeniorDesign.Models.PasswordChangeData passwordData, string action)
        {
            ServiceClient sc = Sas.GetAuthenticatedServiceClient(this, action);
            if (ModelState.IsValid)
            {
                sc.UpdateUser(id, null, passwordData.Password, null, null, null);
            }

            return View(passwordData);
        }
コード例 #4
0
        public ActionResult Create(SeniorDesign.Models.CreateUserModel usrMod, string action)
        {
            try
            {
                ServiceClient sc = Sas.GetAuthenticatedServiceClient(this, action);
                sc.CreateUser(usrMod.Username, usrMod.Password, usrMod.FirstName, usrMod.LastName, 0, usrMod.GroupId);

                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }
コード例 #5
0
        public ActionResult Index(SeniorDesign.Models.UsernamePasswordCreds creds)
        {
            ServiceClient sc = Session["ServiceClient"] as ServiceClient;
            if (sc == null || sc.State == System.ServiceModel.CommunicationState.Faulted)
            {
                sc = new ServiceClient();
                Session["ServiceClient"] = sc;
            }

            if (sc.State != System.ServiceModel.CommunicationState.Opened)
            {
                sc.Open();
            }

            bool auth = sc.UsernamePasswordAuthenticate(creds.Username, creds.Password);

            if (auth)
            {
                Session["AuthStatus"] = true;
                var remoteUsr = sc.CurrentUser();
                Session["UserId"] = remoteUsr;
                creds.CredStatusFailed = false;
                FormsAuthentication.SetAuthCookie(remoteUsr.Username, false);
                if ((Session["LoginRedirectUrl"] != null))
                {
                    Response.Redirect(Session["LoginRedirectUrl"].ToString());
                }
                else
                {
                    RedirectToAction("Index", "Home");
                }
            }
            else
            {
                Session["AuthStatus"] = false;
                creds.CredStatusFailed = true;
            }

            return View(creds);
        }
コード例 #6
0
 public ActionResult Create(int id, SeniorDesign.Models.PermissionGrant pg, string action)
 {
     ServiceClient sc = Sas.GetAuthenticatedServiceClient(this, action);
     sc.Grant(id, pg.GroupID, pg.Permission);
     return RedirectToAction("Index", "Permission", new { id = id });
 }
コード例 #7
0
 public ActionResult LogOff(SeniorDesign.Models.LogOffVerify model)
 {
     FormsAuthentication.SignOut();
     this.Session.Clear();
     return RedirectToAction("Index");
 }