Example #1
0
        public static List <GPSuserModel> GPSUser_Login(string US, string PWD, string pelayar, string sistemope, string ipAdd)
        {
            List <GPSuserModel> _Value = new List <GPSuserModel>();
            //SqlConnection _SQLConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["DentalAppConn"].ConnectionString);
            SqlConnection _SQLConnection = SQLConnectionString.BuildConnection();

            using (SqlConnection _DBConnection = _SQLConnection)
            {
                SqlCommand _SQLCommand = new SqlCommand();
                _SQLCommand.CommandType    = System.Data.CommandType.StoredProcedure;
                _SQLCommand.CommandTimeout = 0;
                using (_SQLCommand)
                {
                    try
                    {
                        _SQLCommand.Connection  = _DBConnection;
                        _SQLCommand.CommandText = "GPSUser_Login";
                        _SQLCommand.Parameters.AddWithValue("@UserName", US);
                        _SQLCommand.Parameters.AddWithValue("@Password", PWD);
                        _SQLCommand.Parameters.AddWithValue("@Browser", pelayar);
                        _SQLCommand.Parameters.AddWithValue("@OS", sistemope);
                        _SQLCommand.Parameters.AddWithValue("@IP", ipAdd);
                        //  _SQLCommand.Parameters.AddWithValue("@count", count);
                        _DBConnection.Open();
                        SqlDataReader _SQLDataReader = _SQLCommand.ExecuteReader();
                        GPSuserModel  _result;
                        while (_SQLDataReader.Read())
                        {
                            _result               = new GPSuserModel();
                            _result.ID            = Convert.ToInt32(_SQLDataReader["ID"].ToString());
                            _result.AccountNo     = _SQLDataReader["AccountNo"].ToString();
                            _result.UserName      = _SQLDataReader["UserName"].ToString();
                            _result.LastLoginDate = _SQLDataReader["LastLoginDate"].ToString();
                            _result.EmailReg      = _SQLDataReader["EmailReg"].ToString();

                            //SMSAlertMsg


                            _Value.Add(_result);
                        }
                    }
                    catch (Exception ex)
                    {
                        throw new Exception(ex.Message);
                    }

                    finally
                    {
                        _DBConnection.Close();
                    }
                }
            }
            return(_Value);
        }
Example #2
0
        public static List <GPSuserModel> Get_User(string US, string PWD, string pelayar, string sistemope, string ipAdd)
        {
            List <GPSuserModel> _Value = new List <GPSuserModel>();
            //SqlConnection _SQLConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["DentalAppConn"].ConnectionString);
            SqlConnection _SQLConnection = SQLConnectionString.BuildConnection();

            using (SqlConnection _DBConnection = _SQLConnection)
            {
                SqlCommand _SQLCommand = new SqlCommand();
                _SQLCommand.CommandType    = System.Data.CommandType.StoredProcedure;
                _SQLCommand.CommandTimeout = 0;
                using (_SQLCommand)
                {
                    try
                    {
                        _SQLCommand.Connection  = _DBConnection;
                        _SQLCommand.CommandText = "Get_Login";
                        _SQLCommand.Parameters.AddWithValue("@UserName", US);
                        _SQLCommand.Parameters.AddWithValue("@Password", PWD);
                        _SQLCommand.Parameters.AddWithValue("@Browser", pelayar);
                        _SQLCommand.Parameters.AddWithValue("@OS", sistemope);
                        _SQLCommand.Parameters.AddWithValue("@IP", ipAdd);
                        //  _SQLCommand.Parameters.AddWithValue("@count", count);
                        _DBConnection.Open();
                        SqlDataReader _SQLDataReader = _SQLCommand.ExecuteReader();
                        GPSuserModel  _result;
                        while (_SQLDataReader.Read())
                        {
                            _result                = new GPSuserModel();
                            _result.ID             = Convert.ToInt32(_SQLDataReader["ID"].ToString());
                            _result.UserName       = _SQLDataReader["UserName"].ToString();
                            _result.Password       = _SQLDataReader["Password"].ToString();
                            _result.Version        = _SQLDataReader["Version"].ToString();
                            _result.Status         = _SQLDataReader["Status"].ToString();
                            _result.AccountNo      = _SQLDataReader["AccountNo"].ToString();
                            _result.RegisterBy     = _SQLDataReader["RegisterBy"].ToString();
                            _result.UpdateBy       = _SQLDataReader["UpdateBy"].ToString();
                            _result.CreatedDate    = _SQLDataReader["CreatedDate"].ToString();
                            _result.ModifiedDate   = _SQLDataReader["ModifiedDate"].ToString();
                            _result.ExpiredDate    = _SQLDataReader["ExpiredDate"].ToString();
                            _result.LoginIP        = _SQLDataReader["LoginIP"].ToString();
                            _result.LoginType      = _SQLDataReader["LoginType"].ToString();
                            _result.LastLoginDate  = _SQLDataReader["LastLoginDate"].ToString();
                            _result.LoginCount     = _SQLDataReader["LoginCount"].ToString();
                            _result.LastLogOutDate = _SQLDataReader["LastLogOutDate"].ToString();
                            _result.Browser        = _SQLDataReader["Browser"].ToString();
                            _result.OS             = _SQLDataReader["OS"].ToString();
                            _result.EmailReg       = _SQLDataReader["EmailReg"].ToString();
                            ((RegisteredAccountModel)_result).AccID              = Convert.ToInt32(_SQLDataReader["AccID"].ToString());
                            ((RegisteredAccountModel)_result).AccountName        = _SQLDataReader["AccountName"].ToString();
                            ((RegisteredAccountModel)_result).AAddress           = _SQLDataReader["AAddress"].ToString();
                            ((RegisteredAccountModel)_result).AMobilePhone       = _SQLDataReader["AMobilePhone"].ToString();
                            ((RegisteredAccountModel)_result).AHousePhone        = _SQLDataReader["AHousePhone"].ToString();
                            ((RegisteredAccountModel)_result).AOfficePhone       = _SQLDataReader["AOfficePhone"].ToString();
                            ((RegisteredAccountModel)_result).AAlertPhone        = _SQLDataReader["AAlertPhone"].ToString();
                            ((RegisteredAccountModel)_result).AEmail             = _SQLDataReader["AEmail"].ToString();
                            ((RegisteredAccountModel)_result).AAlertEmail        = _SQLDataReader["AAlertEmail"].ToString();
                            ((RegisteredAccountModel)_result).AVersion           = _SQLDataReader["AVersion"].ToString();
                            ((RegisteredAccountModel)_result).ARegisteredDate    = _SQLDataReader["ARegisteredDate"].ToString();
                            ((RegisteredAccountModel)_result).AExpiredDate       = _SQLDataReader["AExpiredDate"].ToString();
                            ((RegisteredAccountModel)_result).ACreatedDate       = _SQLDataReader["ACreatedDate"].ToString();
                            ((RegisteredAccountModel)_result).AModifiedDate      = _SQLDataReader["AModifiedDate"].ToString();
                            ((RegisteredAccountModel)_result).ACreatedBy         = _SQLDataReader["ACreatedBy"].ToString();
                            ((RegisteredAccountModel)_result).AModifiedBy        = _SQLDataReader["AModifiedBy"].ToString();
                            ((RegisteredAccountModel)_result).AStatus            = _SQLDataReader["AStatus"].ToString();
                            ((RegisteredAccountModel)_result).AItemRegisterCount = _SQLDataReader["AItemRegisterCount"].ToString();
                            ((RegisteredAccountModel)_result).SMSAlertMsg        = _SQLDataReader["SMSAlertMsg"].ToString();
                            //SMSAlertMsg


                            _Value.Add(_result);
                        }
                    }
                    catch (Exception ex)
                    {
                        throw new Exception(ex.Message);
                    }

                    finally
                    {
                        _DBConnection.Close();
                    }
                }
            }
            return(_Value);
        }
Example #3
0
        public static List <GPSuserModel> Get_UserbyAccNo(string AccountNo)
        {
            List <GPSuserModel> _Value = new List <GPSuserModel>();
            //SqlConnection _SQLConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["DentalAppConn"].ConnectionString);
            SqlConnection _SQLConnection = SQLConnectionString.BuildConnection();

            using (SqlConnection _DBConnection = _SQLConnection)
            {
                SqlCommand _SQLCommand = new SqlCommand();
                _SQLCommand.CommandType    = System.Data.CommandType.StoredProcedure;
                _SQLCommand.CommandTimeout = 0;
                using (_SQLCommand)
                {
                    try
                    {
                        _SQLCommand.Connection  = _DBConnection;
                        _SQLCommand.CommandText = "Get_UserByAccNo";
                        _SQLCommand.Parameters.AddWithValue("@AccountNo", AccountNo);

                        //  _SQLCommand.Parameters.AddWithValue("@count", count);
                        _DBConnection.Open();
                        SqlDataReader _SQLDataReader = _SQLCommand.ExecuteReader();
                        GPSuserModel  _result;
                        while (_SQLDataReader.Read())
                        {
                            _result                = new GPSuserModel();
                            _result.ID             = Convert.ToInt32(_SQLDataReader["ID"].ToString());
                            _result.UserName       = _SQLDataReader["UserName"].ToString();
                            _result.Password       = _SQLDataReader["Password"].ToString();
                            _result.Version        = _SQLDataReader["Version"].ToString();
                            _result.Status         = _SQLDataReader["Status"].ToString();
                            _result.AccountNo      = _SQLDataReader["AccountNo"].ToString();
                            _result.RegisterBy     = _SQLDataReader["RegisterBy"].ToString();
                            _result.UpdateBy       = _SQLDataReader["UpdateBy"].ToString();
                            _result.CreatedDate    = _SQLDataReader["CreatedDate"].ToString();
                            _result.ModifiedDate   = _SQLDataReader["ModifiedDate"].ToString();
                            _result.ExpiredDate    = _SQLDataReader["ExpiredDate"].ToString();
                            _result.LoginIP        = _SQLDataReader["LoginIP"].ToString();
                            _result.LoginType      = _SQLDataReader["LoginType"].ToString();
                            _result.LastLoginDate  = _SQLDataReader["LastLoginDate"].ToString();
                            _result.LoginCount     = _SQLDataReader["LoginCount"].ToString();
                            _result.LastLogOutDate = _SQLDataReader["LastLogOutDate"].ToString();
                            _result.Browser        = _SQLDataReader["Browser"].ToString();
                            _result.OS             = _SQLDataReader["OS"].ToString();
                            _result.EmailReg       = _SQLDataReader["EmailReg"].ToString();

                            _Value.Add(_result);
                        }
                    }
                    catch (Exception ex)
                    {
                        throw new Exception(ex.Message);
                    }

                    finally
                    {
                        _DBConnection.Close();
                    }
                }
            }
            return(_Value);
        }