public List <DepartmentViewModel> GetDepartment_Pagination(int Skip)
        {
            var result = new List <DepartmentViewModel>();
            var obj    = new DepartmentViewModel();

            using (NpgsqlConnection connection =
                       new NpgsqlConnection(ConfigureSetting.GetConnectionString))
            {
                connection.Open();

                string sql = "sp_departmentpagination";


                using (NpgsqlCommand command =
                           new NpgsqlCommand(sql, connection))
                {
                    command.CommandType = System.Data.CommandType.StoredProcedure;
                    command.Parameters.AddWithValue("@skip", NpgsqlTypes.NpgsqlDbType.Integer, Skip);

                    using (var reader = command.ExecuteReader())
                    {
                        result = DataReaderMap.DataReaderMapToList <DepartmentViewModel>(reader);
                    }
                }
                connection.Close();
            }

            return(result);
        }
        public List <AssetOpnameTransactionViewModel> GetAssetLatestLocationByLocationID(int LocationID, DateTime Opnamedate)
        {
            List <AssetOpnameTransactionViewModel> result = new List <AssetOpnameTransactionViewModel>();

            using (NpgsqlConnection connection =
                       new NpgsqlConnection(ConfigureSetting.GetConnectionString))
            {
                connection.Open();

                string sql = "sp_assetlocationlatest";


                using (NpgsqlCommand command =
                           new NpgsqlCommand(sql, connection))
                {
                    command.CommandType = System.Data.CommandType.StoredProcedure;
                    command.Parameters.AddWithValue("@locationid", NpgsqlTypes.NpgsqlDbType.Integer, LocationID);
                    command.Parameters.AddWithValue("@opnamedate", NpgsqlTypes.NpgsqlDbType.Timestamp, Opnamedate);

                    using (var reader = command.ExecuteReader())
                    {
                        result = DataReaderMap.DataReaderMapToList <AssetOpnameTransactionViewModel>(reader);
                    }
                }
                connection.Close();
            }
            return(result);
        }
Пример #3
0
        public List <HistoryViewModel> AssetHistory_SP(int AssetID, int Skip)
        {
            var result = new List <HistoryViewModel>();



            using (NpgsqlConnection connection =
                       new NpgsqlConnection(ConfigureSetting.GetConnectionString))
            {
                connection.Open();

                string sql = "sp_assethistory_pagination";


                using (NpgsqlCommand command =
                           new NpgsqlCommand(sql, connection))
                {
                    command.CommandType = System.Data.CommandType.StoredProcedure;
                    command.Parameters.AddWithValue("@skip", NpgsqlTypes.NpgsqlDbType.Integer, Skip);
                    command.Parameters.AddWithValue("@assetid", NpgsqlTypes.NpgsqlDbType.Integer, AssetID);

                    using (var reader = command.ExecuteReader())
                    {
                        result = DataReaderMap.DataReaderMapToList <HistoryViewModel>(reader);
                    }
                }
                connection.Close();
            }

            return(result);
        }
Пример #4
0
        public List <MismatchReportViewModel> LostAssetReport_SP(int categorycode, bool?ismovable, string owner)
        {
            var result = new List <MismatchReportViewModel>();

            using (NpgsqlConnection connection =
                       new NpgsqlConnection(ConfigureSetting.GetConnectionString))
            {
                connection.Open();

                string sql = "sp_lostassetreport";


                using (NpgsqlCommand command =
                           new NpgsqlCommand(sql, connection))
                {
                    command.CommandType = System.Data.CommandType.StoredProcedure;
                    command.Parameters.AddWithValue("@categorycd", NpgsqlTypes.NpgsqlDbType.Integer, categorycode);
                    if (ismovable == null)
                    {
                        command.Parameters.AddWithValue("@ismovable", NpgsqlTypes.NpgsqlDbType.Boolean, DBNull.Value);
                    }
                    else
                    {
                        command.Parameters.AddWithValue("@ismovable", NpgsqlTypes.NpgsqlDbType.Boolean, ismovable);
                    }

                    if (owner == null)
                    {
                        command.Parameters.AddWithValue("@owner", NpgsqlTypes.NpgsqlDbType.Varchar, DBNull.Value);
                    }
                    else
                    {
                        command.Parameters.AddWithValue("@owner", NpgsqlTypes.NpgsqlDbType.Varchar, owner);
                    }


                    using (var reader = command.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            result = DataReaderMap.DataReaderMapToList <MismatchReportViewModel>(reader);
                        }
                    }
                }
                connection.Close();
            }



            return(result);
        }