Пример #1
0
    public List <PresentProduct> getPresentProductListData(string RstId)
    {
        List <PresentProduct> list = null;

        try
        {
            IParameterMapper ipmapper = new getPresentProductListDataParameterMapper();
            DataAccessor <PresentProduct> tableAccessor;
            string strSql = @" 
        select pp.ProductId, pp.ProductName,pp.Unit,pp.MinUnit,pp.RstId ,c.CodeTypeListName ,pp.ProductCount 
        from PresentProduct  pp,s_codelist c 
        where c.codetype='ProductUnit' and pp.unit=c.codetypelistvalue  and pp.Status=1 and pp.RstId=@RstId ";
            tableAccessor = db.CreateSqlStringAccessor(strSql, ipmapper, MapBuilder <PresentProduct> .MapAllProperties()
                                                       .Map(t => t.ProductId).ToColumn("ProductId")
                                                       .Map(t => t.MinUnit).ToColumn("MinUnit")
                                                       .Map(t => t.ProductName).ToColumn("ProductName")
                                                       .Map(t => t.RstId).ToColumn("RstId")
                                                       .Map(t => t.CodeTypeListName).ToColumn("CodeTypeListName")
                                                       .Map(t => t.Unit).ToColumn("Unit")
                                                       .Map(t => t.ProductCount).ToColumn("ProductCount")
                                                       .Build());
            list = tableAccessor.Execute(new string[] { RstId }).ToList();
            return(list);
        }
        catch (Exception ex)
        {
            Logger.Log(ex);
            return(null);
        }
    }
Пример #2
0
    public List<PresentProduct> getPresentProductListData(string RstId)
    {
        List<PresentProduct> list = null;
        try
        {
            IParameterMapper ipmapper = new getPresentProductListDataParameterMapper();
            DataAccessor<PresentProduct> tableAccessor;
            string strSql  = @"
        select pp.ProductId, pp.ProductName,pp.Unit,pp.MinUnit,pp.RstId ,c.CodeTypeListName ,pp.ProductCount
        from PresentProduct  pp,s_codelist c
        where c.codetype='ProductUnit' and pp.unit=c.codetypelistvalue  and pp.Status=1 and pp.RstId=@RstId ";
        tableAccessor = db.CreateSqlStringAccessor(strSql, ipmapper, MapBuilder<PresentProduct>.MapAllProperties()
                 .Map(t => t.ProductId).ToColumn("ProductId")
                 .Map(t => t.MinUnit).ToColumn("MinUnit")
                 .Map(t => t.ProductName).ToColumn("ProductName")
                 .Map(t => t.RstId).ToColumn("RstId")
                 .Map(t => t.CodeTypeListName).ToColumn("CodeTypeListName")
                 .Map(t => t.Unit).ToColumn("Unit")
                 .Map(t => t.ProductCount).ToColumn("ProductCount")
                .Build());
        list = tableAccessor.Execute(new string[] { RstId }).ToList();
            return list;

        }
        catch (Exception ex)
        {
            Logger.Log(ex);
            return null;
        }
    }