Esempio n. 1
0
 public HttpResponseMessage GetCount(SearchCondition sc)
 {
     int count = 0;
     switch (sc.pattern)
     {
         case "0":
             TXLDal.SearchCondition tsc = new TXLDal.SearchCondition();
             tsc.keyword = sc.keyword;
             tsc.size = sc.size;
             tsc.start = sc.start;
             tsc.status = sc.status;
             tsc.d = sc.d;
             tsc.dm = sc.dm;
             tsc.e = sc.e;
             tsc.i = sc.i;
             tsc.p = sc.p;
             tsc.r = sc.r;
             tsc.eid = sc.eid;
             tsc.pn = sc.pn;
             tsc.depid = sc.depid;
             count = _dal.GetCount(tsc);
             break;
         //case "1":
         //    count = _dal.GetCount(sc.id);
         //    break;
         default:
             count = _dal.GetCount(sc.keyword, sc.field, sc.start, sc.size) ;
             break;
     }
     HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(count.ToString(), Encoding.GetEncoding("UTF-8"), "application/json") };
     return result;
 }
Esempio n. 2
0
 public HttpResponseMessage Get(SearchCondition sc)
 {
     string json = "[]";
     switch (sc.pattern)
     {
         case "0":
             TXLDal.SearchCondition tsc = new TXLDal.SearchCondition();
             tsc.keyword = sc.keyword;
             tsc.size = sc.size;
             tsc.start = sc.start;
             tsc.status = sc.status;
             tsc.d = sc.d;
             tsc.e = sc.e;
             tsc.dm = sc.dm;
             tsc.i = sc.i;
             tsc.p = sc.p;
             tsc.r = sc.r;
             tsc.eid = sc.eid;
             tsc.pn = sc.pn;
             tsc.depid = sc.depid;
             json = _dal.Get(tsc).Replace("\r", string.Empty).Replace("\n", string.Empty);
             break;
         //case "1":
         //    json = _dal.Get(sc.id).Replace("\r", string.Empty).Replace("\n", string.Empty);
         //    break;
         default:
             json = _dal.Get(sc.keyword, sc.field, sc.start, sc.size).Replace("\r", string.Empty).Replace("\n", string.Empty);
             break;
     }
     HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(json, Encoding.GetEncoding("UTF-8"), "application/json") };
     return result;
 }