コード例 #1
0
        public ResponseFJListSearch FJListSearch(RequestFJListSearch request)
        {
            ResponseFJListSearch response = new ResponseFJListSearch();

            using (cnn = GetConnection())
            {
                var ts = cnn.BeginTransaction();
                try
                {
                    var user = this.UserInfoGet(request.Token, ts);



                    string sql = this.GetPageSql("*",
                                                 @" TKS_FAS_Attachment  where accountId=@AccountId and 
                        createUser=@CreateUser and docId=@DocId",
                                                 " createDate  desc ",
                                                 request.PageSize,
                                                 request.PageIndex);

                    List <TKS_FAS_Attachment> data = cnn.Query <TKS_FAS_Attachment>(sql,
                                                                                    new
                    {
                        AccountId  = user.AccountId,
                        CreateUser = user.User.UserName,
                        DocId      = request.DocId
                    }, ts).ToList();

                    string countSql = @"select count(1) from TKS_FAS_Attachment  where 
                    accountId=@AccountId and createUser=@CreateUser and docId=@DocId";

                    int total = int.Parse(cnn.ExecuteScalar(countSql, new
                    {
                        AccountId  = user.AccountId,
                        CreateUser = user.User.UserName,
                        DocId      = request.DocId
                    }, 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 ResponseFJListSearch);
                }
            }
        }
コード例 #2
0
ファイル: FJController.cs プロジェクト: ph3405/FAS-CSZJ-SAAS
 public ResponseFJListSearch FJListSearch([FromBody] RequestFJListSearch request)
 {
     try
     {
         FJBLL bll = new FJBLL();
         return(bll.FJListSearch(request));
     }
     catch (Exception ex)
     {
         throw new HttpResponseException(
                   Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message));
     }
 }