示例#1
0
        public List <SupplierListOutModel> ext_GetSupplierList(SupplierListInModel paramIn)
        {
            List <SupplierListOutModel> suppliersLst = new List <SupplierListOutModel>();

            suppliersLst = null;
            var datacontext = new BillingAppEntities();

            SqlParameter[] procedureParameters = new SqlParameter[]
            {
                new SqlParameter {
                    ParameterName = "@shopID", Value = paramIn.ShopID == null? (object)DBNull.Value: paramIn.ShopID
                },
                new SqlParameter {
                    ParameterName = "@searchSupplierName", Value = string.IsNullOrEmpty(paramIn.SearchSupplierName) ? (Object)DBNull.Value : paramIn.SearchSupplierName
                },
                new SqlParameter {
                    ParameterName = "@pageNo", Value = paramIn.pagination.CurrentPage == null? (Object)DBNull.Value: paramIn.pagination.CurrentPage
                },
                new SqlParameter {
                    ParameterName = "@recordsPerPage", Value = paramIn.pagination.RecordsPerPage == null? (object)DBNull.Value: paramIn.pagination.RecordsPerPage
                },
                new SqlParameter {
                    ParameterName = "@purchaseDate", Value = paramIn.PurchaseDate == DateTime.MinValue || paramIn.PurchaseDate == null ? (object)DBNull.Value : paramIn.PurchaseDate
                },
                new SqlParameter {
                    ParameterName = "@purchaseAmount", Value = paramIn.purchaseAmount == null ? (Object)DBNull.Value : paramIn.purchaseAmount
                }
            };
            suppliersLst = datacontext.Database.SqlQuery <SupplierListOutModel>("exec usp_list_suppliers @shopID, @searchSupplierName, @pageNo, @recordsPerPage, @purchaseDate, @purchaseAmount",
                                                                                procedureParameters).ToList();
            if (suppliersLst != null)
            {
                return(suppliersLst);
            }
            return(null);
        }
示例#2
0
        //private GenericRepository<Token> _tokenRepository;
        #endregion

        public UnitOfWork()
        {
            _context = new BillingAppEntities();
        }
 /// <summary>
 /// Public Constructor,initializes privately declared local variables.
 /// </summary>
 /// <param name="context"></param>
 public GenericRepository(BillingAppEntities context)
 {
     this.Context = context;
     this.DbSet   = context.Set <TEntity>();
 }