示例#1
0
        public IHttpActionResult Get(string Username)
        {
            try // handle exogenous exceptions
            {
                try // log all exceptions
                {

                    Tbl_LoginBusinessModelLayers tbl_loginBusinessModelLayers = new Tbl_LoginBusinessModelLayers();
                    List<BusinessModelLayer.Tbl_LoginSingle> tbl_logins = tbl_loginBusinessModelLayers.GetAllTbl_Logins().FindAll(x => x.Username == Username);

                    //BusinessModelLayer.Tbl_LoginSingle tbl_logins = tbl_loginBusinessModelLayers.GetTbl_LoginData(Username);
                    return Ok(tbl_logins);
                }
                catch (Exception ex)
                {
                    BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging();
                    exlog.SendExcepToDB(ex);
                    throw;
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
示例#2
0
        public ActionResult Verify(string Username, string Password)
        {
            try     // handle exogenous exceptions
            {
                try // log all exceptions
                {
                    Tbl_LoginBusinessModelLayers tbl_loginBusinessModelLayers = new Tbl_LoginBusinessModelLayers();

                    BusinessModelLayer.Tbl_LoginSingle tbl_login = tbl_loginBusinessModelLayers.GetAllTbl_Logins().FirstOrDefault(x => x.Username == Username && x.Password == Password);

                    if (tbl_login != null)
                    {
                        UpdateModel <Tbl_LoginSingle>(tbl_login);
                        if (ModelState.IsValid)
                        {
                            FormsAuthentication.SetAuthCookie(tbl_login.Username, false);
                            return(RedirectToAction("List", "Orders"));
                        }
                    }
                    return(View("Error"));
                }
                catch (Exception ex)
                {
                    BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging();
                    exlog.SendExcepToDB(ex);
                    throw;
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
示例#3
0
        public ActionResult Edit_Post(string Username)
        {
            try     // handle exogenous exceptions
            {
                try // log all exceptions
                {
                    Tbl_LoginBusinessModelLayers tbl_loginBusinessModelLayers = new Tbl_LoginBusinessModelLayers();

                    BusinessModelLayer.Tbl_LoginSingle tbl_login = tbl_loginBusinessModelLayers.GetAllTbl_Logins().Single(x => x.Username == Username);


                    UpdateModel <Tbl_LoginSingle>(tbl_login);
                    if (ModelState.IsValid)
                    {
                        //mm
                        tbl_loginBusinessModelLayers.UpdateTbl_Login(tbl_login);
                        return(RedirectToAction("List"));
                    }

                    return(View(tbl_login));
                }
                catch (Exception ex)
                {
                    BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging();
                    exlog.SendExcepToDB(ex);
                    throw;
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
示例#4
0
        public override string[] GetRolesForUser(string username)
        {
            //using (EmployeeDBContext context = new EmployeeDBContext())
            //{
            //var userRoles = (from user in context.Users
            //                 join roleMapping in context.UserRolesMappings
            //                 on user.ID equals roleMapping.UserID
            //                 join role in context.RoleMasters
            //                 on roleMapping.RoleID equals role.ID
            //                 where user.UserName == username
            //                 select role.RollName).ToArray();
            Tbl_LoginBusinessModelLayers tbl_loginBusinessModelLayers = new Tbl_LoginBusinessModelLayers();

            BusinessModelLayer.Tbl_LoginSingle tbl_login = tbl_loginBusinessModelLayers.GetAllTbl_Logins().FirstOrDefault(x => x.Username == username);
            var userRoles = "User".Split(',').ToArray();

            if (tbl_login != null)
            {
                userRoles = tbl_login.Roles.Split(',').ToArray();
            }
            return(userRoles);
            //}
        }
示例#5
0
        public ActionResult Details(string Username)
        {
            try     // handle exogenous exceptions
            {
                try // log all exceptions
                {
                    Tbl_LoginBusinessModelLayers tbl_loginBusinessModelLayers = new Tbl_LoginBusinessModelLayers();

                    BusinessModelLayer.Tbl_LoginSingle tbl_login = tbl_loginBusinessModelLayers.GetAllTbl_Logins().FirstOrDefault(x => x.Username == Username);

                    return(View(tbl_login));
                }
                catch (Exception ex)
                {
                    BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging();
                    exlog.SendExcepToDB(ex);
                    throw;
                }
            }
            catch (Exception)
            {
                throw;
            }
        }