示例#1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         string userName = Request.QueryString["userName"];
         string password = Request.QueryString["password"];
         string status = "0";
         if (string.IsNullOrEmpty(userName) || string.IsNullOrEmpty(password))
         {
             status = "0";
         }
         else
         {
             UserDAL u = new UserDAL();
             if (u.Login(userName, password))
             {
                 status = "1";
                 Session["User"] = userName;
             }
         }
         Response.Write(status);
     }
     catch
     {
         Response.Write("0");
     }
     HttpContext.Current.ApplicationInstance.CompleteRequest();
 }
示例#2
0
        //Отправляется письмо на введенный емейл
        protected void btnActivateAccount1_Click(object sender, EventArgs e)
        {
            if (SessionManager.UserID != 0)
            {
                string login = SessionManager.UserLogin;
                string pass = SessionManager.UserPass;
                string userName = SessionManager.UserName;

                RegisterDB registerAspxcs = new RegisterDB();
                string htmlTextMess = registerAspxcs.WriteEmailMessage(userName, login, AppCode.GetHashEncoding(pass), Request.Url.Authority);

                UserDAL userdal = new UserDAL();

                try
                {
                    if (userdal.UpdateUserMail(SessionManager.UserID, tbxEmail.Text)) //Сохранение емейла в БД
                    {
                        bool b = Mail.SendEmail(tbxEmail.Text, "MiniForum - Вы были зарегистрированы", htmlTextMess);
                        Panel2.Visible = true;
                        pnlActivateAccount1.Visible = false;
                        Session.Clear();
                    }
                    else
                    {
                        ErrorMessage.Text = "При сохранении емейла возникла ошибка.";
                    }
                }
                catch (Exception ex)
                {
                    ErrorMessage.Text = ex.Message;
                }
            }
        }
 public List<User> List_CN100(int page, int size)
 {
     List<User> result = new List<User>();
     using (IDb db = DbFactory.Instance.GetDb())
     {
         try
         {
             UserDAL ud = new UserDAL();
             ud.Db = db;
             foreach (UserBM bm in ud.GetUserList(10, 20))
             {
                 User item = new User();
                 item.Email = bm.Email;
                 item.MobilePhone = bm.MobilePhone;
                 item.Password = bm.Password;
                 item.RealName = bm.RealName;
                 item.UserID = bm.UserID;
                 item.UserName = bm.UserName;
                 item.LoginEnum = LoginEnum.Success;
                 result.Add(item);
             }
            
         }
         catch (Exception e_)
         {
             Console.WriteLine(e_.Message);
             Console.WriteLine(e_.StackTrace);
         }
     }
     return result;
 }
        public User ValidateLogin(string email, string password)
        {
            User user = new UserDAL().GetUserByEmail(email);

            if (user != null)
            {
                string passwordMD5 = CryptorMD5.MD5Hash(password);

                if (passwordMD5 == user.Password)
                    return user;
            }

            return null;
        }
示例#5
0
 // To pass 'User' data in UserDAL Data Access Layer to show Active and Inactive type records
 public DataTable LoadActiveUser(bool IsActive, int LoggedInUser, string Ret)
 {
     UserDAL UserDAL = new UserDAL();
     try
     {
         return UserDAL.LoadActiveUser(IsActive, LoggedInUser, Ret);
     }
     catch
     {
         throw;
     }
     finally
     {
         UserDAL = null;
     }
 }
示例#6
0
 // To pass 'User' data in UserDAL Data Access Layer to show Email of all User
 public DataTable LoadNameEmail(int LoggedInUser, string Ret)
 {
     UserDAL UserDAL = new UserDAL();
     try
     {
         return UserDAL.LoadNameEmail(LoggedInUser, Ret);
     }
     catch
     {
         throw;
     }
     finally
     {
         UserDAL = null;
     }
 }
 public ActionResult VerifyLogin(String Login,String Password)
 {
     UserDAL dal = new UserDAL();
     var flag = dal.VerifyLogin(Login, Password);
     if (flag == true)
     {
         Session["valid"] = 1;
         return RedirectToAction("Home", "BasicUser");
     }
     else
     {
         Session["valid"] = 0;
         TempData["Msg"] = "Invalid User ID/Password";
         return RedirectToAction("Login");
     }
 }
示例#8
0
 //  To pass 'User' data in UserDAL Data Access Layer for insertion
 public int InsertUser(string FirstName, string LastName, string EMail, string Remarks, bool IsAdmin, bool IsActive, string UserName, int LoginUser, string Ret)
 {
     UserDAL UserDAL = new UserDAL();
     try
     {
         return UserDAL.InsertUser(FirstName, LastName, EMail, Remarks, IsAdmin, IsActive, UserName, LoginUser, Ret);
     }
     catch
     {
         throw;
     }
     finally
     {
         UserDAL = null;
     }
 }
示例#9
0
 private void Confirmation(string login, string identityCode)
 {
     UserDAL userdal = new UserDAL();
     string pass = userdal.GetUserPass(login);
     if (pass != string.Empty )
     {
         string hashpass = AppCode.GetHashEncoding(pass);
         if ( hashpass.Trim() == identityCode )
         {
             userdal.UpdateUserConfirmRegistration(login, true);
             Label1.Visible = true;//запись активирована
         }
         else
             Label2.Visible = true;
     }
     else
         Label2.Visible = true; //Код активации неправильный
 }
示例#10
0
        protected void BntLogin_Click(object sender, EventArgs e)
        {
            Page.Validate();
            if (!Page.IsValid) return;

            UserDAL userdal = new UserDAL();
            Entities.User users = null;

            string login = txtbxLoginUser.Text.Trim();

            string pass = AppCode.GetHashEncoding(txtbxPassword.Text.Trim());//хеш пароля

            try
            {
                users = userdal.UserAuthenticationDB(login, pass);
                if ( users != null )
                {
                    if (users.ConfirmRegistration)  //Пользователь зарегистрирован, учетная запись активирована
                    {
                        FormsAuthentication.SetAuthCookie( users.ID.ToString(), false );//Добавление логина в куки
                        SessionManager.SessionAuthUser(users);//Добавление аутентификации пользователя в сессию
                        Response.Redirect(FormsAuthentication.GetRedirectUrl(login, false), false);
                    }
                    else//Пользователь зарегистрирован, но не активировал учетную запись
                    {
                        SessionManager.UserID = users.ID;
                        SessionManager.UserLogin = users.Login;
                        SessionManager.UserPass = users.Pass;
                        SessionManager.UserName = users.Name;
                        SessionManager.UserEmail = users.Email;

                        pnlRegistration.Visible = false;
                        pnlReactivate.Visible = true;
                        return;
                    }
                }
                else
                {
                    ErrorMassage.Text = "Invalid username or password!";
                }
            }
            catch (Exception ex)
            { ErrorMassage.Text = ex.Message; }
        }
示例#11
0
 public static IEnumerable <UserSearchViewData> GetUsersFor180dInactivity(int usrId)
 {
     return(Mapper.Map <IEnumerable <User>, IEnumerable <UserSearchViewData> >(UserDAL.GetUsersFor180dInactivity(usrId)));
 }
示例#12
0
 public static bool UpdateStateSuperDataEditor(int UserId, bool IsSuperDataEditor, int UpdatedBy)
 {
     return(UserDAL.UpdateStateSuperDataEditor(UserId, IsSuperDataEditor, UpdatedBy));
 }
示例#13
0
 /// <summary>
 /// Update a User's Profile. The User account part of the Profile can be included or excluded for updation.
 /// </summary>
 /// <param name="profileObj">UserProfile</param>
 /// <param name="UpdatedBy">int</param>
 /// <param name="UpdateAccountInfo">bool</param>
 /// <returns></returns>
 public static bool UpdateUserProfile(UserProfile profileObj, int UpdatedBy)
 {
     return(UserDAL.UpdateUserProfile(profileObj, UpdatedBy));
 }
示例#14
0
 /// <summary>
 /// Set User status to Active.
 /// </summary>
 /// <param name="UserId">int</param>
 /// <param name="UpdatedBy">int</param>
 /// <returns>bool</returns>
 public static bool ActivateUser(int UserId, int UpdatedBy)
 {
     return(UserDAL.SetUserAccountStatus(UserId, true, UpdatedBy));
 }
示例#15
0
        /// <summary>
        /// 用户注销
        /// </summary>
        /// <param name="username"></param>
        /// <param name="authkey"></param>
        /// <returns></returns>
        public static int Logout(string username, string authkey)
        {
            UserDAL dal = (UserDAL)DataAccess.CreateObject(DALClassName);

            return(dal.Logout(username, authkey));
        }
示例#16
0
 /// <summary>
 /// Returns UserProfile. The AccountInfo will be retreived if ReturnAccountInfo is set to true.
 /// Will throw an exception if all the required data cannot be retrieved.
 /// </summary>
 /// <param name="UserId">int</param>
 /// <param name="ReturnAccountInfo">bool</param>
 /// <returns>UserProfile</returns>
 public static UserProfile GetUserProfile(int UserId)
 {
     //Fill UserProfile here.
     return(UserDAL.GetUserProfile(UserId));
 }
示例#17
0
        /// <summary>
        /// 保存指定设备号的密钥信息
        /// </summary>
        /// <param name="MacAddr"></param>
        /// <param name="CryptKey"></param>
        /// <returns></returns>
        public static int AppCryptKey_SaveKey(string MacAddr, string CryptKey)
        {
            UserDAL dal = (UserDAL)DataAccess.CreateObject(DALClassName);

            return(dal.AppCryptKey_SaveKey(MacAddr, CryptKey));
        }
示例#18
0
        public static int LoginSuccess(string username, string authkey, string ipaddr, string MACAddr)
        {
            UserDAL dal = (UserDAL)DataAccess.CreateObject(DALClassName);

            return(dal.LoginSuccess(username, authkey, ipaddr, MACAddr));
        }
示例#19
0
 public User GetUserByUserName(string username)
 {
     return(UserDAL.GetUserByUsername(username));
 }
示例#20
0
 // To pass 'User' data in UserDAL Data Access Layer to show  all Users details
 public DataTable SelectUserdetails(string FName, string LName, bool IsActive, int LoggedInUser, string Ret)
 {
     UserDAL UserDAL = new UserDAL();
     try
     {
         return UserDAL.SelectUserdetails(FName, LName, IsActive, LoggedInUser, Ret);
     }
     catch
     {
         throw;
     }
     finally
     {
         UserDAL = null;
     }
 }
示例#21
0
 public UserBNL()
 {
     Connector = new UserDAL();
 }
示例#22
0
 private bool IsCurrentUser(string taskUser)
 {
     UserDAL u = new UserDAL();
     if ((taskUser == userID) || u.IsAdmin(userID))
         return true;
     return false;
     //return new UserDAL().IsCurrentUser(taskUser) || new UserDAL().IsAdmin(userID);
 }
示例#23
0
 // To pass 'User' data in UserDAL Data Access Layer to show Users permission wise
 public DataTable LoadUserPermission(int UserId,bool IsActive,int LoggedInUser, string Ret)
 {
     UserDAL UserDAL = new UserDAL();
     try
     {
         return UserDAL.LoadUserPermission(UserId, IsActive, LoggedInUser, Ret);
     }
     catch
     {
         throw;
     }
     finally
     {
         UserDAL = null;
     }
 }
示例#24
0
 // To pass 'User' data in UserDAL Data Access Layer to show selected UserName records
 public DataTable SelectUserName(string UserName, int LoggedInUser, string Ret)
 {
     UserDAL UserDAL = new UserDAL();
     try
     {
         return UserDAL.SelectUserName(UserName, LoggedInUser, Ret);
     }
     catch
     {
         throw;
     }
     finally
     {
         UserDAL = null;
     }
 }
示例#25
0
 //  To pass 'User' data in UserDAL Data Access Layer for updation
 public int UpdateUser(int UserId, string FirstName, string LastName, string EMail, string Remarks, bool IsAdmin, bool IsActive, int LoginUser, string Ret)
 {
     UserDAL UserDAL = new UserDAL();
     try
     {
         return UserDAL.UpdateUser(UserId, FirstName, LastName, EMail, Remarks, IsAdmin, IsActive, LoginUser, Ret);
     }
     catch
     {
         throw;
     }
     finally
     {
         UserDAL = null;
     }
 }
示例#26
0
 public User GetUserByID(int ID)
 {
     return(UserDAL.GetUserById(ID));
 }
示例#27
0
        public static int CheckAuthKey(string authkey, int activemodule, out string username, out int newmsgcount, out string UserInfo, out string CryptKey, out string ExtPropertys)
        {
            UserDAL dal = (UserDAL)DataAccess.CreateObject(DALClassName);

            return(dal.CheckAuthKey(authkey, activemodule, out username, out newmsgcount, out UserInfo, out CryptKey, out ExtPropertys));
        }
示例#28
0
        /// <summary>
        /// 通过AuthKey验证用户,并更新用户状态
        /// </summary>
        /// <param name="authkey"></param>
        /// <param name="activemodule"></param>
        /// <param name="username"></param>
        /// <param name="newmsgcount"></param>
        /// <returns></returns>
        public static int CheckAuthKey(string authkey, int activemodule, out string username, out int newmsgcount)
        {
            UserDAL dal = (UserDAL)DataAccess.CreateObject(DALClassName);

            return(dal.CheckAuthKey(authkey, activemodule, out username, out newmsgcount));
        }
示例#29
0
        public static int GetPromotorIDByUsername(string username)
        {
            UserDAL dal = (UserDAL)DataAccess.CreateObject(DALClassName);

            return(dal.GetPromotorIDByUsername(username));
        }
示例#30
0
        /// <summary>
        /// 查询在线用户名单
        /// </summary>
        /// <returns></returns>
        public static DataTable GetOnlineUserList()
        {
            UserDAL dal = (UserDAL)DataAccess.CreateObject(DALClassName);

            return(dal.GetOnlineUserList());
        }
示例#31
0
 public bool IsAdmin(string userID)
 {
     UserDAL u = new UserDAL(userID);
     return (u.EnumRole == RoleEnum.Admin);
 }
示例#32
0
        public static int GetNewMsgCount(string Username)
        {
            UserDAL dal = (UserDAL)DataAccess.CreateObject(DALClassName);

            return(dal.GetNewMsgCount(Username));
        }
示例#33
0
 //Активация аккаунта
 private void activateAccount()
 {
     if (SessionManager.UserID != 0)
     {
         pnlActivateAccount1.Visible = true;
         UserDAL userdal = new UserDAL();
         lblEmail1.Text = SessionManager.UserEmail.ToString();
     }
 }
示例#34
0
        /// <summary>
        /// 设置用户帐号对应的导购ID
        /// </summary>
        /// <param name="username"></param>
        /// <param name="promotor"></param>
        /// <returns></returns>
        public static int Membership_SetPromotorID(string username, int promotor)
        {
            UserDAL dal = (UserDAL)DataAccess.CreateObject(DALClassName);

            return(dal.Membership_SetPromotorID(ConfigHelper.GetConfigString("ApplicationName"), username, promotor));
        }
示例#35
0
文件: UserBLL.cs 项目: ssjylsg/crm
 public UserBLL()
 {
     dal = new UserDAL();
 }
示例#36
0
        public static int LoginSuccess(string username, string authkey, string ipaddr, string MACAddr, string UserInfo, string CryptKey, string ExtPropertys)
        {
            UserDAL dal = (UserDAL)DataAccess.CreateObject(DALClassName);

            return(dal.LoginSuccess(username, authkey, ipaddr, MACAddr, UserInfo, CryptKey, ExtPropertys));
        }
示例#37
0
        private void ajaxRegister()
        {
            string _UserName = this.f("name");
            string _Password = this.f("pass");
            string _code     = this.f("code");
            string str1      = this.f("u");
            string _realcode = "";

            try
            {
                if (!ValidateCode.CheckValidateCode(_code, ref _realcode))
                {
                    this._response = this.JsonResult(0, "验证码错误");
                }
                else if (_UserName.Length > 0 && _Password.Length > 0)
                {
                    string decryptKey = ConfigurationManager.AppSettings["DesKey"].ToString();
                    string str2       = this.DecryptDES(str1.Replace("@", "+"), decryptKey);
                    string str3       = str2.Substring(0, str2.IndexOf('@'));
                    this.doh.Reset();
                    this.doh.ConditionExpress = "id=@id and Isdel=0";
                    this.doh.AddConditionParameter("@id", (object)str3);
                    if (this.doh.Count("N_User") < 1)
                    {
                        this._response = this.JsonResult(0, "对不起,该注册链接已失效!");
                    }
                    else
                    {
                        string str4 = str2.Substring(str2.IndexOf('@') + 1);
                        if (Convert.ToDecimal(str4) >= new Decimal(125))
                        {
                            this.doh.Reset();
                            this.doh.ConditionExpress = "UserId=@UserId and Point=@Point";
                            this.doh.AddConditionParameter("@UserId", (object)str3);
                            this.doh.AddConditionParameter("@Point", (object)Convert.ToDecimal(Convert.ToDecimal(str4) / new Decimal(10)).ToString("0.00"));
                            object[] fields = this.doh.GetFields("V_UserQuota", "ChildNums,useNums,useNums2");
                            if (fields == null)
                            {
                                this._response = this.JsonResult(0, "对不起,此链接的配额不足,请联系上级!");
                                return;
                            }
                            if (Convert.ToDecimal(fields[0]) - (Convert.ToDecimal(fields[1]) + Convert.ToDecimal(fields[2])) < new Decimal(1))
                            {
                                this._response = this.JsonResult(0, "对不起,此链接的配额不足,请联系上级!");
                                return;
                            }
                        }
                        int result;
                        if (int.TryParse(str3, out result))
                        {
                            this.GetRandomNumberString(64, false);
                            int num1 = new UserDAL().Register(str3, _UserName, _Password, Convert.ToDecimal(str4));
                            if (num1 > 0)
                            {
                                this.doh.Reset();
                                this.doh.ConditionExpress = "id=@id";
                                this.doh.AddConditionParameter("@id", (object)str3);
                                string str5 = this.doh.GetField("N_User", "UserCode").ToString() + Strings.PadLeft(num1.ToString());
                                this.doh.Reset();
                                this.doh.ConditionExpress = "id=" + (object)num1;
                                this.doh.AddFieldItem("UserCode", (object)str5);
                                this.doh.AddFieldItem("UserGroup", (object)"0");
                                if (this.doh.Update("N_User") > 0)
                                {
                                    this.doh.Reset();
                                    this.doh.SqlCmd = "select Id,Point from N_User with(nolock) where Id=" + (object)num1 + " and IsEnable=0 and IsDel=0";
                                    DataTable dataTable1 = this.doh.GetDataTable();
                                    for (int index1 = 0; index1 < dataTable1.Rows.Count; ++index1)
                                    {
                                        this.doh.Reset();
                                        this.doh.SqlCmd = "SELECT [Point] FROM [N_UserLevel] where Point>=125.00 and Point<=" + (object)Convert.ToDecimal(dataTable1.Rows[index1]["Point"]) + " order by [Point] desc";
                                        DataTable dataTable2 = this.doh.GetDataTable();
                                        for (int index2 = 0; index2 < dataTable2.Rows.Count; ++index2)
                                        {
                                            int    num2 = 0;
                                            string str6 = "0";
                                            this.doh.Reset();
                                            this.doh.SqlCmd = "select isnull(ChildNums-useNums-useNums2,0) as num from V_UserQuota with(nolock) where UserId=" + this.AdminId + " and point=" + (object)(Convert.ToDecimal(dataTable2.Rows[index2]["Point"]) / new Decimal(10));
                                            DataTable dataTable3 = this.doh.GetDataTable();
                                            if (dataTable3.Rows.Count > 0)
                                            {
                                                num2 = Convert.ToInt32(dataTable3.Rows[0]["num"]);
                                            }
                                            if (Convert.ToDecimal(dataTable2.Rows[index2]["Point"]) == Convert.ToDecimal(dataTable1.Rows[index1]["Point"]))
                                            {
                                                new UserQuotaDAL().SaveUserQuota(dataTable1.Rows[index1]["Id"].ToString(), Convert.ToDecimal(dataTable2.Rows[index2]["Point"]) / new Decimal(10), 0);
                                            }
                                            else
                                            {
                                                if (num2 <= 5)
                                                {
                                                    str6 = string.Concat((object)num2);
                                                }
                                                new UserQuotaDAL().SaveUserQuota(dataTable1.Rows[index1]["Id"].ToString(), Convert.ToDecimal(dataTable2.Rows[index2]["Point"]) / new Decimal(10), Convert.ToInt32(str6));
                                            }
                                        }
                                    }
                                }
                                new LogSysDAL().Save("会员管理", "Id为" + (object)num1 + "的会员注册成功!");
                                this._response = this.JsonResult(1, "会员注册成功");
                            }
                            else
                            {
                                this._response = this.JsonResult(0, "注册失败,请重新注册");
                            }
                        }
                        else
                        {
                            this._response = this.JsonResult(0, "链接地址错误!请重新打开");
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                this._response = this.JsonResult(0, "注册异常:" + (object)ex);
            }
        }
示例#38
0
        /// <summary>
        /// Called when an Admin needs to create a new User account for the persons Jurisdiction.
        /// </summary>
        /// <param name="profileObj">UserProfile</param>
        /// <param name="OldUserId">int?</param>
        /// <param name="IsRegistrationRequest">bool</param>
        /// <param name="RequestedAgencyId">int</param>
        /// <param name="CreatedBy">int?</param>
        /// <returns>bool</returns>
        /// <returns>out int? UserId</returns>
        //private static bool CreateUser(UserRegistration regObj, bool IsRegistrationRequest, int? CreatedBy, out int? UserId)
        //{
        //    regObj.Password = GetEncryptedPassword(regObj.Password);
        //    return UserDAL.CreateUser(regObj, IsRegistrationRequest, CreatedBy, out UserId);
        //}


        /// <summary>
        ///     Requests for ErrorMessage by both Old SHIPtalk Users who login with old accounts
        ///     as well as Anonymous requests for User account.
        /// </summary>
        /// <param name="profileObj">UserProfile</param>
        /// <param name="OldUserId">int?</param>
        /// <param name="RequestedAgencyId">int</param>
        /// <returns>bool</returns>
        /// <returns>out int? UserId</returns>
        public static bool RegisterUser(UserRegistration regObj, out int?UserId)
        {
            regObj.Password = GetEncryptedPassword(regObj.Password);
            return(UserDAL.CreateUser(regObj, out UserId));
        }
示例#39
0
 public UserController()
 {
     _userDAL = new UserDAL();
 }
示例#40
0
 /// <summary>
 /// Returns UserAccount information.
 /// </summary>
 /// <param name="UserId">int</param>
 /// <returns>UserAccount</returns>
 public static UserAccount GetUserAccount(int UserId)
 {
     return(UserDAL.GetUserAccount(UserId));
 }
示例#41
0
 public Form1()
 {
     InitializeComponent();
     userDal = new UserDAL(connectionString);
 }
示例#42
0
 /// <summary>
 /// Update a User's account.
 /// </summary>
 /// <param name="userAcctObj">UserAccount</param>
 /// <param name="UpdatedBy">int</param>
 /// <returns>bool</returns>
 public static bool UpdateUserAccount(UserAccount userAcctObj, int UpdatedBy)
 {
     return(UserDAL.UpdateUserAccount(userAcctObj, UpdatedBy));
 }
示例#43
0
        protected void ProceedToSuccessLoginProcess(UserBO objResponse, string UserName, string Password)
        {
            //HttpCookie myOldCookie = Request.Cookies["UserInfo"];
            //if (myOldCookie == null)
            //{
            //    HttpCookie myCookie = new HttpCookie("UserInfo");
            //    myCookie.Values.Add("userid", objResponse.UserID);
            //    myCookie.Expires = DateTime.Now.AddMonths(1);
            //    Response.Cookies.Add(myCookie);
            //}

            Response.Cookies["userid"].Value   = objResponse.UserID;
            Response.Cookies["userid"].Expires = DateTime.Now.AddMonths(1);


            //HttpCookie _userInfoCookies = new HttpCookie("UserInfo");
            //_userInfoCookies["UserId"] = objResponse.UserID;
            //_userInfoCookies.Expires = DateTime.Now.AddMonths(1);
            //Response.Cookies.Add(_userInfoCookies);
            //End

            //Login Log
            LoginLogout _loginLogout = new LoginLogout();

            _loginLogout.UserID     = objResponse.UserID;
            _loginLogout.CompID     = objResponse.CompId.ToString();
            _loginLogout.Type       = "login";
            _loginLogout.IP_Address = Utility.GetClientIPaddress();
            UserDAL.InsertLoginLogoutHistory(_loginLogout, "");
            //End Login Log

            GetAccessToken(UserName, Password);

            if (HttpContext.Current.Session["access_token"] == null)
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "script", "Swal.fire({text: '" + ConstantMessages.WebServiceLog.GenericErrorMsg + "',allowOutsideClick:false})", true);
                return;
            }
            else
            {
                // Call Login Business Layer Function to record message
                Utility.CreateUserSession(objResponse.UserID, objResponse.Role, objResponse.FirstName, objResponse.LastName, objResponse.CompId, objResponse.EmailID, objResponse.OrganizationName);

                List <ActiveUser> lstActiveUsers = new List <ActiveUser>();
                if (Cache["ActiveUsers"] != null)
                {
                    lstActiveUsers = (List <ActiveUser>)Cache["ActiveUsers"];
                }
                ActiveUsersCache cache = new ActiveUsersCache();
                cache.AddOrUpdate(lstActiveUsers, objResponse.UserID, objResponse.EmailID, objResponse.FirstName + " " + objResponse.LastName, Session.SessionID);
                Cache["ActiveUsers"] = lstActiveUsers;

                //For ProfilePic,CompanyProfilePic & Theme
                var UserDetails = UserDAL.GetUserDetailsByUserID(objResponse.UserID, "");
                if (UserDetails != null && !string.IsNullOrEmpty(UserDetails.ProfilePicFileID))
                {
                    HttpContext.Current.Session["ThemeColor"]  = UserDetails.ThemeColor;
                    HttpContext.Current.Session["ThemeColor2"] = UserDetails.ThemeColor2;
                    HttpContext.Current.Session["ThemeColor3"] = UserDetails.ThemeColor3;
                    HttpContext.Current.Session["ThemeColor4"] = UserDetails.ThemeColor4;
                    HttpContext.Current.Session["Favicon"]     = UserDetails.FaviconFileID;

                    Utility.CreateProfileAndThemeSession(UserDetails.ProfilePicFileID, UserDetails.CompanyProfilePicFileID, UserDetails.ThemeColor);
                }
                //End For ProfilePic,CompanyProfilePic & Theme

                if (objResponse.IsFirstLogin == "1" || objResponse.IsFirstPasswordNotChanged == "1")
                {
                    if (objResponse.IsFirstLogin == "1")
                    {
                        Utility.CreateFirstLoginSession(true);
                    }
                    if (objResponse.IsFirstPasswordNotChanged == "1")
                    {
                        Utility.CreateFirstPasswordNotChangedSession(true);
                    }
                    if (objResponse.IsFirstLogin == "1")
                    {
                        Response.Redirect("~/t/Settings.aspx", false);
                    }
                    else if (objResponse.IsFirstPasswordNotChanged == "1")
                    {
                        Response.Redirect("~/t/ChangePassword.aspx", false);
                    }
                }
                else
                {
                    Utility.CreateFirstLoginSession(false);

                    //Added on 04 Jun 20 to preview add course without login
                    if (Request.QueryString["url"] != null && !string.IsNullOrEmpty(Convert.ToString(Request.QueryString["url"])))
                    {
                        string requestedurl = Convert.ToString(Request.QueryString["url"]);
                        requestedurl = HttpUtility.UrlDecode(requestedurl);
                        Response.Redirect(requestedurl);
                    }

                    //if (HttpContext.Current.Session["requestedurlcourse"] != null)
                    //{
                    //    string requestedurl = Convert.ToString(HttpContext.Current.Session["requestedurlcourse"]);
                    //    HttpContext.Current.Session["requestedurlcourse"] = null;
                    //    Response.Redirect(requestedurl);
                    //}
                    //End

                    //This is used to redirect user on specific page where he requested .Purpose of this is to navigate already logged in user in same browser
                    HttpCookie myCookie = Request.Cookies["UserInfo"];
                    if (myCookie != null && HttpContext.Current.Session["requestedurl"] != null)
                    {
                        string requestedurl = Convert.ToString(HttpContext.Current.Session["requestedurl"]);
                        HttpContext.Current.Session["requestedurl"] = null;
                        Response.Redirect(requestedurl);
                    }
                    //End

                    if (objResponse.Role.ToLower() == "enduser")
                    {
                        Response.Redirect("~/t/default.aspx", false);
                    }
                    else if (objResponse.Role.ToLower() == "superadmin" || objResponse.Role.ToLower() == "companyadmin" || objResponse.Role.ToLower() == "subadmin")
                    {
                        Response.Redirect("~/t/dashboard.aspx", false);
                    }
                }
            }
        }
示例#44
0
 public static IEnumerable <UserSearchViewData> SearchUsersFor180dInactivity(UserSearchSimpleParams param)
 {
     return(Mapper.Map <IEnumerable <User>, IEnumerable <UserSearchViewData> >(UserDAL.SearchUsersFor180dInactivity(param)));
 }
示例#45
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                bool IsMDE = false;
                #region User and Company Info
                clsUser objEmp = new clsUser();
                objEmp = UserDAL.SelectUserById(Convert.ToInt32(Session["UserAuthId"].ToString()));

                #endregion

                #region Getting User Info
                // for side menu. if 3 hide. else show.
                if (objEmp != null)
                {
                    #region Getting UserRole Id to check if the user is Admin
                    List <clsUserRole> lstUserRoleIs = new List <clsUserRole>();
                    lstUserRoleIs = UserRoleDAL.SelectDynamicUserRole("AuthorizedUserId = " + objEmp.AuthorisedUserId + "", "UserRoleId");
                    if (lstUserRoleIs != null)
                    {
                        if (lstUserRoleIs.Count > 0)
                        {
                            for (int i = 0; i < lstUserRoleIs.Count; i++)
                            {
                                if (lstUserRoleIs[i].RoleId == 1)
                                {
                                    IsMDE = true;
                                }
                            }
                        }
                    }
                    #endregion

                    #region getting all the roles boxes.
                    int            counter   = 1;
                    StringBuilder  strAccess = new StringBuilder("");
                    List <clsRole> lstRole   = new List <clsRole>();
                    if (IsMDE)
                    {
                        lstRole = RoleDAL.SelectDynamicRole("IsActive = 1", "DisplayOrder");
                    }
                    else
                    {
                        lstRole = RoleDAL.SelectDynamicRole("(IsActive = 1) and (RoleId NOT IN (1))", "DisplayOrder");
                    }

                    if (lstRole != null)
                    {
                        if (lstRole.Count > 0)
                        {
                            StringBuilder strAllRole = new StringBuilder("");

                            for (int i = 0; i < lstRole.Count; i++)
                            {
                                if (counter < 5)
                                {
                                    if (counter == 1)
                                    {
                                        strAllRole.Append("<div class='Row'>");
                                    }
                                    strAllRole.Append("<div class='col-lg-3'>");
                                    strAllRole.Append("<div class='hpanel stats'>");
                                    strAllRole.Append("<div class='panel-body h-200'>");
                                    strAllRole.Append("<div class='stats-title pull-left'><div class='stats-icon pull-left'>");
                                    strAllRole.Append("<i class='" + lstRole[i].RoleIcon + " fa-3x'></i>");
                                    strAllRole.Append("</div><div class='clearfix'></div><h4 class='text-danger' style='font-size:17px'>");
                                    strAllRole.Append(lstRole[i].RoleDispName);
                                    strAllRole.Append("</h4></div><div class='clearfix'></div>");
                                    strAllRole.Append("<div class='flot-chart'>");
                                    if (GlobalMethods.ValueIsNull(lstRole[i].Notes) == "")
                                    {
                                        strAllRole.Append("<small>" + GlobalMethods.ValueIsNull(lstRole[i].Notes) + "</small>");
                                    }
                                    else
                                    {
                                        strAllRole.Append("<small>" + GlobalMethods.ValueIsNull(lstRole[i].Notes).Substring(0, 120) + " ..." + "</small>");
                                    }
                                    strAllRole.Append("</div></div><div class='panel-footer'>");
                                    strAllRole.Append(GettingRoleURL(lstRole[i].RoleId.ToString(), objEmp.AuthorisedUserId.HasValue ? objEmp.AuthorisedUserId.Value : 0, lstRole[i].RoleName, strAccess));
                                    strAllRole.Append("</div></div></div>");
                                    if (counter == 4)
                                    {
                                        strAllRole.Append("</div>");
                                    }
                                    counter++;
                                }
                                else
                                {
                                    counter = 1;
                                    if (counter == 1)
                                    {
                                        strAllRole.Append("<div class='Row'>");
                                    }
                                    strAllRole.Append("<div class='col-lg-3'>");
                                    strAllRole.Append("<div class='hpanel stats'>");
                                    strAllRole.Append("<div class='panel-body h-200'>");
                                    strAllRole.Append("<div class='stats-title pull-left'><div class='stats-icon pull-left'>");
                                    strAllRole.Append("<i class='" + lstRole[i].RoleIcon + " fa-3x'></i>");
                                    strAllRole.Append("</div><div class='clearfix'></div><h4 class='text-danger' style='font-size:17px'>");
                                    strAllRole.Append(lstRole[i].RoleDispName);
                                    strAllRole.Append("</h4></div><div class='clearfix'></div>");
                                    strAllRole.Append("<div class='flot-chart'>");
                                    if (GlobalMethods.ValueIsNull(lstRole[i].Notes) == "")
                                    {
                                        strAllRole.Append("<small>" + GlobalMethods.ValueIsNull(lstRole[i].Notes) + "</small>");
                                    }
                                    else
                                    {
                                        strAllRole.Append("<small>" + GlobalMethods.ValueIsNull(lstRole[i].Notes).Substring(0, 120) + " ..." + "</small>");
                                    }
                                    strAllRole.Append("</div></div><div class='panel-footer'>");
                                    strAllRole.Append(GettingRoleURL(lstRole[i].RoleId.ToString(), objEmp.AuthorisedUserId.HasValue ? objEmp.AuthorisedUserId.Value : 0, lstRole[i].RoleName, strAccess));
                                    strAllRole.Append("</div></div></div>");
                                    counter++;
                                }
                            }

                            if (lstRole.Count % 2 != 0)
                            {
                                strAllRole.Append("</div>");
                            }


                            pnlAllRole.Controls.Add(new LiteralControl(strAllRole.ToString()));
                        }
                    }
                    #endregion
                }
                #endregion
            }
        }
示例#46
0
 /// <summary>
 /// For only users of State/CMS Scope, the User table will be updated for the IsApproverDesignate status.
 /// For all other users, an exception will be raised at the database level.
 /// </summary>
 /// <param name="UserId"></param>
 /// <param name="IsApproverDesignate"></param>
 /// <param name="UpdatedBy"></param>
 /// <returns></returns>
 public static bool UpdateApproverDesignate(int UserId, bool IsApproverDesignate, int UpdatedBy)
 {
     return(UserDAL.UpdateApproverDesignate(UserId, IsApproverDesignate, UpdatedBy));
 }
 public static List <Group> GetUserGroup()
 {
     return(UserDAL.GetGroup());
 }
示例#48
0
 /// <summary>
 /// Gets list of accessible Users.
 /// Specify StateFIPS for CMS Users to filter results by that State.
 /// </summary>
 /// <param name="AdminUserId"></param>
 /// <param name="filterByStateFIPS"></param>
 /// <returns></returns>
 public static IEnumerable <UserSearchViewData> GetAllUsers(int RequestingUserId, string filterByStateFIPS)
 {
     return(Mapper.Map <IEnumerable <User>, IEnumerable <UserSearchViewData> >(UserDAL.GetAllUsers(RequestingUserId, filterByStateFIPS)));
 }
示例#49
0
 private bool IsCurrentUser(string taskUser)
 {
     UserDAL u = new UserDAL();
     if ((taskUser.Equals(userID,StringComparison.OrdinalIgnoreCase)) || u.IsAdmin(userID))
         return true;
     return false;
     //return new UserDAL().IsCurrentUser(taskUser) || new UserDAL().IsAdmin(userID);
 }