Esempio n. 1
0
        public ActionResult Login(Client _client)
        {
            ModelState.Clear();
            User _user  = new User();
            var  client = (_clientService.GetClientByClientName(_client.EmailID));

            if (client != null)
            {
                if (_client.EmailID == client.EmailID && _encryptionService.VerifyHashedPassword(_client.Password, client.Password))
                {
                    client.Password = null;
                    client.EmailID  = null;
                    HCRGCLIENT      = Mapper.Map <Client>(client);
                    int orgID    = Int16.Parse(client.OrganizationID);
                    var _orgData = _clientService.GetOrganizationByID(orgID);
                    if (client.ClientTypeID == 2 && _orgData.MenuIDs != null)
                    {
                        var _menuIDS = _orgData.MenuIDs.Split(',');
                        HCRGCLIENT.ClientMenuIDS = _menuIDS.ToList();
                    }
                    _clientService.UpdateClientSessionIDByClientID(client.ClientID, this.Session.SessionID);
                    if (_orgData.LogoImage != null)
                    {
                        HCRGCLIENT.LogoPath = GlobalConst.FolderName.Storage + GlobalConst.ConstantChar.ForwardSlash + GlobalConst.FolderName.Org + orgID + GlobalConst.ConstantChar.ForwardSlash + GlobalConst.FolderName.LogoImage + GlobalConst.ConstantChar.ForwardSlash + _orgData.LogoImage;
                    }
                    return(RedirectToAction(GlobalConst.Actions.HomeContentController.Index, GlobalConst.Controllers.Home, new { area = "" }));
                }
            }
            TempData["Message"] = GlobalConst.Message.InvalidCredentials;
            return(RedirectToAction("Index"));
        }