Пример #1
0
        /// <summary>
        /// Update User Password
        ///<param name="userID">userID</param>
        ///<param name="Pwd">Pwd</param>
        /// </summary>
        /// <returns>Affected rows</returns>
        public String UpdatePassword(String userID, String Pwd, Int32 Type)
        {
            String     msg = "";
            SqlCommand cmd = new SqlCommand();

            try
            {
                cmd.CommandText = "Sbsp_ResetPassword";
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add("@userID", SqlDbType.VarChar).Value      = userID;
                cmd.Parameters.Add("@Password", SqlDbType.Binary, 16).Value = MppUtility.EncryptPassword(Pwd);
                cmd.Parameters.Add("@Code", SqlDbType.VarChar).Value        = null;
                cmd.Parameters.Add("@Type", SqlDbType.Int).Value            = Type;
                cmd.Parameters.Add("@ModifiedOn", SqlDbType.DateTime).Value = DateTime.Now;
                DataAccess.ExecuteCommand(cmd);
            }
            catch (SqlException ex)
            {
                msg = ex.Message;
                LogFile.WriteLog(msg);
            }
            catch (Exception ex)
            {
                msg = ex.Message;
                LogFile.WriteLog(msg);
            }
            finally
            {
                if (cmd != null)
                {
                    cmd.Dispose();
                }
            }
            return(msg);
        }
Пример #2
0
        /// <summary>
        /// User Admin login vaildation
        ///<param name="UserID">AdminID</param>
        ///<param name="Password">Password</param>
        /// </summary>
        /// <returns></returns>
        public String CheckAdminUserLogin(Int32 AdminID, String Password)
        {
            String     res = "";
            SqlCommand cmd = new SqlCommand();

            try
            {
                cmd.CommandText = "Sbsp_VerifyAdminUserLogin";
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add("@AdminID", SqlDbType.VarChar, 50).Value = AdminID;
                cmd.Parameters.Add("@Password", SqlDbType.Binary, 16).Value = MppUtility.EncryptPassword(Password);
                DataAccess.ExecuteCommand(cmd);
            }
            catch (SqlException ex)
            {
                res = ex.Message;
                LogFile.WriteLog(res);
            }
            catch (Exception ex)
            {
                res = ex.Message;
                LogFile.WriteLog(res);
            }
            finally
            {
                if (cmd != null)
                {
                    cmd.Dispose();
                }
            }
            return(res);
        }
Пример #3
0
        /// <summary>
        /// User Activation code
        ///<param name="userID">userID</param>
        ///<param name="ActivationCode">ActivationCode</param>
        /// </summary>
        /// <returns>Affected rows</returns>
        public String UpdatePassword(Int32 userID, String oldPwd, String newPwd)
        {
            String     msg = "";
            SqlCommand cmd = new SqlCommand();

            try
            {
                cmd.CommandText = "Sbsp_UpdatePassword";
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add("@userID", SqlDbType.Int).Value             = userID;
                cmd.Parameters.Add("@oldPassword", SqlDbType.Binary, 16).Value = MppUtility.EncryptPassword(oldPwd);
                cmd.Parameters.Add("@newPassword", SqlDbType.Binary, 16).Value = MppUtility.EncryptPassword(newPwd);
                cmd.Parameters.Add("@date", SqlDbType.DateTime).Value          = DateTime.Now;
                msg = Convert.ToString(DataAccess.GetDataValue(cmd));
            }
            catch (SqlException ex)
            {
                msg = ex.Message;
                LogFile.WriteLog("Update Password - " + userID + ": " + msg);
            }
            catch (Exception ex)
            {
                msg = ex.Message;
                LogFile.WriteLog("Update Password - " + userID + ": " + msg);
            }
            finally
            {
                if (cmd != null)
                {
                    cmd.Dispose();
                }
            }
            return(msg);
        }
Пример #4
0
        /// <summary>
        /// User Registration
        ///<param name="firstName">firstName</param>
        /// </summary>
        /// <returns>ID</returns>
        public String InsertUpdateUser(String firstName, String lastName, String email, String password, String activecode)
        {
            String     res = "";
            SqlCommand cmd = new SqlCommand();

            try
            {
                cmd.CommandText = @"Sbsp_InsertUser";
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add("@Email", SqlDbType.VarChar, 150).Value         = email;
                cmd.Parameters.Add("@SbPassword", SqlDbType.Binary, 16).Value      = MppUtility.EncryptPassword(password);
                cmd.Parameters.Add("@FirstName", SqlDbType.VarChar).Value          = firstName;
                cmd.Parameters.Add("@LastName", SqlDbType.VarChar).Value           = lastName;
                cmd.Parameters.Add("@StartDate", SqlDbType.SmallDateTime).Value    = DateTime.Now.Date;
                cmd.Parameters.Add("@TrailEndDate", SqlDbType.SmallDateTime).Value = DateTime.Now.Date.AddDays(30);
                cmd.Parameters.Add("@ActivationCode", SqlDbType.VarChar).Value     = activecode;
                cmd.Parameters.Add("@CreatedOn", SqlDbType.DateTime).Value         = DateTime.Now;

                DataAccess.ExecuteCommand(cmd);
            }
            catch (SqlException ex)
            {
                res = ex.Message;
                LogFile.WriteLog(res);
            }
            catch (Exception ex)
            {
                res = ex.Message;
                LogFile.WriteLog(res);
            }
            finally
            {
                if (cmd != null)
                {
                    cmd.Dispose();
                }
            }
            return(res);
        }
Пример #5
0
        /// <summary>
        /// Admin User Registration
        ///<param name="firstName">firstName</param>
        /// </summary>
        /// <returns>ID</returns>
        public String AddUpdateAdminUser(String firstName, String lastName, String email, String password, String code, int type)
        {
            String     msg = "";
            SqlCommand cmd = new SqlCommand();

            try
            {
                cmd.CommandText = "Sbsp_InsertAdminUser";
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add("@Email", SqlDbType.VarChar, 500).Value  = email;
                cmd.Parameters.Add("@Password", SqlDbType.Binary, 16).Value = MppUtility.EncryptPassword(password);
                cmd.Parameters.Add("@FirstName", SqlDbType.VarChar).Value   = firstName;
                cmd.Parameters.Add("@LastName", SqlDbType.VarChar).Value    = lastName;
                cmd.Parameters.Add("@Code", SqlDbType.VarChar).Value        = code;
                cmd.Parameters.Add("@CreatedOn", SqlDbType.DateTime).Value  = DateTime.Now;
                cmd.Parameters.Add("@type", SqlDbType.Int).Value            = type;
                DataAccess.ExecuteCommand(cmd);
            }
            catch (SqlException ex)
            {
                msg = ex.Message;
                LogFile.WriteLog("Insert AdminUser : "******"Insert AdminUser : " + msg);
            }
            finally
            {
                if (cmd != null)
                {
                    cmd.Dispose();
                }
            }
            return(msg);
        }