コード例 #1
0
 public ResponseBBDetailtplListSearch BBDetailtplListSearch([FromBody] RequestBBDetailtplListSearch request)
 {
     try
     {
         ReportTplBLL bll = new ReportTplBLL();
         return(bll.BBDetailtplListSearch(request));
     }
     catch (Exception ex)
     {
         throw new HttpResponseException(
                   Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message));
     }
 }
コード例 #2
0
        public ResponseBBDetailtplListSearch BBDetailtplListSearch(RequestBBDetailtplListSearch request)
        {
            ResponseBBDetailtplListSearch response = new ResponseBBDetailtplListSearch();

            using (cnn = GetConnection())
            {
                var ts = cnn.BeginTransaction();
                try
                {
                    var user = this.UserInfoGetButAccount(request.Token, ts);
                    string where = string.Empty;


                    string sql = this.GetPageSql("A.* ",
                                                 @"  TKS_FAS_ReportDetailTPL A where parentId=@ParentId",
                                                 " A.seq  ",
                                                 request.PageSize,
                                                 request.PageIndex);

                    List <TKS_FAS_ReportDetailTPL> data = cnn.Query <TKS_FAS_ReportDetailTPL>(sql,
                                                                                              new
                    {
                        ParentId = request.Id
                    }, ts).ToList();

                    string countSql = @"select count(1) from TKS_FAS_ReportDetailTPL A where parentId=@ParentId
                      ";

                    int total = int.Parse(cnn.ExecuteScalar(countSql, new
                    {
                        ParentId = request.Id
                    }, ts).ToString());

                    ts.Commit();
                    response.IsSuccess = true;
                    response.Message   = "加载完毕";
                    response.PageIndex = request.PageIndex;
                    response.Data      = data;
                    response.Total     = total;
                    return(response);
                }
                catch (Exception ex)
                {
                    ts.Rollback();
                    return(this.DealException(response, ex) as ResponseBBDetailtplListSearch);
                }
            }
        }