Пример #1
0
        public DataSet GetEmailIDbyUserID(LoginSchema objLoginSchmema)
        {
            try
            {
                login_conn = new SqlConnection();
                login_conn = HelperCls.OpenConnection();
                objTran    = login_conn.BeginTransaction();
                string user_names = " Select UM.EmailId as EmailId,UM.MobileNo as MobileNo,UM.UserID as UserID,UM.UsertypeID as UsertypeID, " +
                                    " UM.Username as UserName,UM.Password as UPassword,PasswordChanged,IsActive,IsLoggedin from UserMaster UM inner join EmployeeMaster EM on UM.UserID=EM.UserID " +

                                    " where UM.EmailId='" + objLoginSchmema.EmailId1 + "' ";
                ds = HelperCls.ExecuteDataset(login_conn, objTran, CommandType.Text, user_names);

                return(ds);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                objTran.Commit();
                HelperCls.CloseConnection(login_conn);
                ds = null;
            }
        }
Пример #2
0
 public DataSet GetUrl(LoginSchema objLoginSchema)
 {
     try
     {
         login_conn = new SqlConnection();
         login_conn = HelperCls.OpenConnection();
         string user_names = "select UserTypeUrl from UserType,UserMaster where UserType.UsertypeID=UserMaster.UserTypeID and UserMaster.UserID='" + objLoginSchema.UserID + "'";
         ds = HelperCls.ExecuteDataset(login_conn, null, CommandType.Text, user_names);
         return(ds);
     }
     catch (Exception e)
     {
         return(null);
     }
     finally
     {
         HelperCls.CloseConnection(login_conn);
         ds = null;
     }
 }
Пример #3
0
 public DataSet CheckUsernameforchangepassword(LoginSchema objLoginSchema)
 {
     try
     {
         login_conn = new SqlConnection();
         login_conn = HelperCls.OpenConnection();
         string user_names = "select UserID,PasswordChanged,Password,Attempt from UserMaster where userId='" + objLoginSchema.UserID.ToString() + "' and IsActive='1'";
         ds = HelperCls.ExecuteDataset(login_conn, null, CommandType.Text, user_names);
         return(ds);
     }
     catch (Exception e)
     {
         return(null);
     }
     finally
     {
         HelperCls.CloseConnection(login_conn);
         ds = null;
     }
 }
Пример #4
0
        public DataSet CheckForgotPwdToken(LoginSchema objLoginSchmema)
        {
            try
            {
                ds         = new DataSet();
                login_conn = new SqlConnection();
                login_conn = HelperCls.OpenConnection();
                StringBuilder  var1   = new StringBuilder();
                SqlParameter[] _param = new SqlParameter[4];
                _param[0]       = new SqlParameter("@EmailID", SqlDbType.VarChar);
                _param[0].Value = objLoginSchmema.EmailId1;

                _param[1]       = new SqlParameter("@UserID", SqlDbType.VarChar);
                _param[1].Value = objLoginSchmema.UserID;

                _param[2]       = new SqlParameter("@QueryNo", SqlDbType.Int);
                _param[2].Value = 3;

                _param[3]       = new SqlParameter("@ForgetPasswordToken", SqlDbType.VarChar);
                _param[3].Value = "ForgetPAsswordToken";


                SqlCommand command = new SqlCommand();

                command.CommandText    = "sp_GetUserDetailsForForgotPassword";
                command.CommandTimeout = 5000;
                command.CommandType    = CommandType.StoredProcedure;
                ds = HelperCls.ExecuteDataset(login_conn, null, command.CommandType, command.CommandText, _param);

                return(ds);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                HelperCls.CloseConnection(login_conn);
                ds = null;
            }
        }
Пример #5
0
        public string SetForgotPassword(LoginSchema objLoginSchema)
        {
            try
            {
                ds         = new DataSet();
                login_conn = new SqlConnection();
                login_conn = HelperCls.OpenConnection();
                StringBuilder  var1   = new StringBuilder();
                SqlParameter[] _param = new SqlParameter[4];
                _param[0]       = new SqlParameter("@EmailID", SqlDbType.VarChar);
                _param[0].Value = objLoginSchema.EmailId1;

                _param[1]       = new SqlParameter("@UserID", SqlDbType.UniqueIdentifier);
                _param[1].Value = new Guid(objLoginSchema.UserID);

                _param[2]       = new SqlParameter("@QueryNo", SqlDbType.Int);
                _param[2].Value = 2;

                _param[3]       = new SqlParameter("@ForgetPasswordToken", SqlDbType.VarChar);
                _param[3].Value = "ForgetPAsswordToken";

                SqlCommand command = new SqlCommand();

                command.CommandText    = "sp_GetUserDetailsForForgotPassword";
                command.CommandTimeout = 5000;
                command.CommandType    = CommandType.StoredProcedure;
                ds = HelperCls.ExecuteDataset(login_conn, null, CommandType.StoredProcedure, command.CommandText, _param);
                string result = ds.Tables[0].Rows[0][0].ToString();
                return(result);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                HelperCls.CloseConnection(login_conn);

                // login_conn.Dispose();
            }
        }
Пример #6
0
        public int insertSession(LoginSchema objLoginSchema)
        {
            try
            {
                login_conn = new SqlConnection();
                login_conn = HelperCls.OpenConnection();
                objTran    = login_conn.BeginTransaction();
                string user_names = "insert into UserSession ([UserID],[SessionID],[LoggedInAt],[LoggedFrom]) values(CAST('" + objLoginSchema.UserID + "'as uniqueidentifier),'" + objLoginSchema.SessionID + "',GetDate(),'" + objLoginSchema.IPAddress + "')";
                returnval = HelperCls.ExecuteNonQuery(login_conn, objTran, CommandType.Text, user_names);

                return(returnval);
            }
            catch (Exception e)
            {
                return(0);
            }
            finally
            {
                objTran.Commit();
                HelperCls.CloseConnection(login_conn);
                returnval = 0;
            }
        }
Пример #7
0
        public int ForceChangePasswordDAL(LoginSchema objLoginSchmema)
        {
            try
            {
                login_conn = new SqlConnection();
                login_conn = HelperCls.OpenConnection();
                objTran    = login_conn.BeginTransaction();
                string user_names = "update UserMaster set Password='******',PasswordChanged='1' where UserID='" + objLoginSchmema.UserID + "'  COLLATE SQL_Latin1_General_CP1_CS_AS";
                returnval = HelperCls.ExecuteNonQuery(login_conn, objTran, CommandType.Text, user_names);

                return(returnval);
            }
            catch (Exception e)
            {
                return(0);
            }
            finally
            {
                objTran.Commit();
                HelperCls.CloseConnection(login_conn);
                returnval = 0;
            }
        }
Пример #8
0
        public int LogoutSession(string str)
        {
            try
            {
                login_conn = new SqlConnection();
                login_conn = HelperCls.OpenConnection();
                objTran    = login_conn.BeginTransaction();
                string user_names = "update UserSession set LoggedOutAt=GetDate() where SessionID='" + str + "'";
                returnval = HelperCls.ExecuteNonQuery(login_conn, objTran, CommandType.Text, user_names);

                return(returnval);
            }
            catch (Exception e)
            {
                return(0);
            }
            finally
            {
                objTran.Commit();
                HelperCls.CloseConnection(login_conn);
                returnval = 0;
            }
        }