public string UpdateTeam(string userid, string teamid, string UserName)
        {
            Domain.Myfashion.Domain.Team team = new Domain.Myfashion.Domain.Team();
            TeamRepository teamrepo = new TeamRepository();
            try
            {
                string[] fnamelname = UserName.Split(' ');
                string fname = fnamelname[0];
                string lname = string.Empty;
                for (int i = 1; i < fnamelname.Length; i++)
                {
                    lname += fnamelname[i];
                }
               
                team.Id = Guid.Parse(teamid);
                team.UserId = Guid.Parse(userid);
                team.FirstName = fname;
                team.LastName = lname;
                team.StatusUpdateDate = DateTime.Now;
                team.InviteStatus = 1;
                teamrepo.updateTeam(team);
                User objUser = new Services.User();


            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
                return "Something Went Wrong";
            }
            return new JavaScriptSerializer().Serialize(team);

        }
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            HttpSessionStateBase session = filterContext.HttpContext.Session;

            Services.User user = (Services.User)session[Constants.SESSION_USER];
            if (user != null)
            {
                return;
            }

            String    urlFrom = String.Empty;
            UrlHelper url;

            //send them off to the login page
            url     = new UrlHelper(filterContext.RequestContext);
            urlFrom = filterContext.Controller.ControllerContext.RequestContext.HttpContext.Request.RawUrl;
            if (!String.IsNullOrEmpty(urlFrom))
            {
                urlFrom = String.Format("?{0}", urlFrom);
            }
            var loginUrl = url.Content(String.Format("~/LogIn{0}", urlFrom));

            session.RemoveAll();
            session.Clear();
            session.Abandon();

            filterContext.HttpContext.Response.StatusCode = 403;
            filterContext.HttpContext.Response.Redirect(loginUrl, false);
            filterContext.Result = new EmptyResult();
        }
Пример #3
0
        public string UpdateTeam(string userid, string teamid, string UserName)
        {
            Domain.Myfashion.Domain.Team team = new Domain.Myfashion.Domain.Team();
            TeamRepository teamrepo           = new TeamRepository();

            try
            {
                string[] fnamelname = UserName.Split(' ');
                string   fname      = fnamelname[0];
                string   lname      = string.Empty;
                for (int i = 1; i < fnamelname.Length; i++)
                {
                    lname += fnamelname[i];
                }

                team.Id               = Guid.Parse(teamid);
                team.UserId           = Guid.Parse(userid);
                team.FirstName        = fname;
                team.LastName         = lname;
                team.StatusUpdateDate = DateTime.Now;
                team.InviteStatus     = 1;
                teamrepo.updateTeam(team);
                User objUser = new Services.User();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
                return("Something Went Wrong");
            }
            return(new JavaScriptSerializer().Serialize(team));
        }
Пример #4
0
        public async Task <bool> AddUser(Services.User user)
        {
            bool Result = false;
            await Context.AddAsync(user);

            Result = await Context.SaveChangesAsync() > 0;

            return(Result);
        }
Пример #5
0
 public void Login(byte[] encryptedUser, byte[] iv)
 {
     Services.ConnectionInfo connectionInfo = Connections.FindConnection(Context.ConnectionId);
     if (connectionInfo != null && connectionInfo.Status == Services.ConnectionInfo.Statuses.Handshaked)
     {
         string        json     = connectionInfo.Aes.Decrypt(encryptedUser, iv);
         Services.User userInfo = Newtonsoft.Json.JsonConvert.DeserializeObject <Services.User>(json);
         Connections.Login(Context.ConnectionId, userInfo);
     }
 }
Пример #6
0
 public string UpdateTeambyteamid(string teamid)
 {
     try
     {
         teamrepo.updateTeambyteamid(Guid.Parse(teamid));
         User objUser = new Services.User();
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.StackTrace);
         return("Something Went Wrong");
     }
     return(new JavaScriptSerializer().Serialize(team));
 }
        private string GenerateResponse(HttpContext context)
        {
            string retVal = string.Empty;
            string path   = context.Request.Path;

            switch (path.ToLower())
            {
            case "/registration.api": { retVal = new Services.Registration(context).GetResponse(); break; }

            case "/create/account/login/user.api": { retVal = new Services.CreateAccountLoginUser(context).GetResponse(); break; }

            case "/login.api": { retVal = new Services.Login(context).GetResponse(); break; }

            //case "/validate_session.api": { retVal = new Services.ValidateSession(context).GetResponse(); break; }
            case "/logout.api": { retVal = new Services.Logout(context).GetResponse(); break; }

            case "/dashboard/menu.api": { retVal = new Services.Menu(context).GetResponse(); break; }

            case "/page/user.api": { retVal = new Services.User(context).GetResponse(); break; }

            case "/page/user_add.api": { retVal = new Services.UserAdd(context).GetResponse(); break; }

            case "/page/user_delete.api": { retVal = new Services.UserDelete(context).GetResponse(); break; }

            case "/page/user_change_password.api": { retVal = new Services.ChangePassword(context).GetResponse(); break; }

            //case "/get/user.api": { retVal = new Services.GetUserList(context).GetResponse(); break; }

            //Menu
            case "/menu/list.api": { retVal = new Services.MenuList(context).GetResponse(); break; }

            //Employee
            case "/get/employees/list.api": { retVal = new Services.GetEmployeesList(context).GetResponse(); break; }

            case "/employee/add.api": { retVal = new Services.EmployeeAdd(context).GetResponse(); break; }

            case "/employee/edit.api": { retVal = new Services.EmployeeEdit(context).GetResponse(); break; }

            case "/employee/delete.api": { retVal = new Services.EmployeeDelete(context).GetResponse(); break; }

            //Combo
            case "/combo/departments.api": { retVal = new Services.ComboDepartmentName(context).GetResponse(); break; }

            case "/combo/jobtitles.api": { retVal = new Services.ComboJobTitle(context).GetResponse(); break; }

            //User
            case "/userlist.api": { retVal = new Services.UserList(context).GetResponse(); break; }

            case "/useradd.api": { retVal = new Services.UserLoginAdd(context).GetResponse(); break; }

            //Master Loan Book
            case "/master/loan/book/list.api": { retVal = new Services.MasterLoanBookList(context).GetResponse(); break; }

            case "/master/loan/book/add.api": { retVal = new Services.MasterLoanBookAdd(context).GetResponse(); break; }

            //Transaction Loan Book
            case "/transaction/loan/book/list.api": { retVal = new Services.TransactionsLoanBookList(context).GetResponse(); break; }

            case "/transaction/loan/book/borrow.api": { retVal = new Services.TransactionLoanBookBorrow(context).GetResponse(); break; }

            case "/transaction/loan/book/return.api": { retVal = new Services.TransactionLoanBookReturn(context).GetResponse(); break; }

            //Report Loan Book
            case "/report/loan/book/list.api": { retVal = new Services.ReportLoanBookList(context).GetResponse(); break; }

            case "/combo/databook.api": { retVal = new Services.ComboDataBook(context).GetResponse(); break; }

            default: { retVal = DefaultResponse(); break; }
            }

            return(retVal);
        }
Пример #8
0
        public static Services.User ViewModelToUser(UserViewModel user)
        {
            Services.User User = new Services.User()
            {
                Id       = CryptoRandom.CreateUniqueId(format: CryptoRandom.OutputFormat.Hex),
                UserName = user.UserName,
                Password = new Secret(user.Password.Sha256()).Value,
                IsActive = true,
            };
            var UserClaims = new List <Services.UserClaim>()
            {
                new Services.UserClaim()
                {
                    UserId     = User.Id,
                    ClaimName  = "name",
                    ClaimValue = user.Name
                },
                new Services.UserClaim()
                {
                    UserId     = User.Id,
                    ClaimName  = "family_name",
                    ClaimValue = user.Name
                },
                new Services.UserClaim()
                {
                    UserId     = User.Id,
                    ClaimName  = "given_name",
                    ClaimValue = user.GivenName
                },
                new Services.UserClaim()
                {
                    UserId     = User.Id,
                    ClaimName  = "email",
                    ClaimValue = user.Email
                },
                new Services.UserClaim()
                {
                    UserId     = User.Id,
                    ClaimName  = "email_verified",
                    ClaimValue = "true"
                },
                new Services.UserClaim()
                {
                    UserId     = User.Id,
                    ClaimName  = "website",
                    ClaimValue = user.WebSite
                },
            };

            if (!string.IsNullOrEmpty(user.Country))
            {
                UserClaims.Add(new Services.UserClaim()
                {
                    UserId     = User.Id,
                    ClaimName  = "address",
                    ClaimValue = JsonSerializer.Serialize(new {
                        street_address = user.Street,
                        locality       = user.Locality,
                        postal_code    = user.PostalCode,
                        country        = user.Country
                    })
                });
            }
            if (user.Roles.Any())
            {
                foreach (var role in user.Roles)
                {
                    UserClaims.Add(new Services.UserClaim()
                    {
                        UserId     = User.Id,
                        ClaimName  = "role",
                        ClaimValue = role
                    });
                }
            }
            User.UserClaims = UserClaims;
            return(User);
        }
Пример #9
0
        public string UpdateTeambyteamid(string teamid)
        {
            try
            {
                teamrepo.updateTeambyteamid(Guid.Parse(teamid));
                User objUser = new Services.User();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
                return "Something Went Wrong";
            }
            return new JavaScriptSerializer().Serialize(team);

        }