Exemplo n.º 1
0
        protected override void ExecuteChild(AuditResultReq dataReq, ResponseAPI dataRes)
        {
            var res = new AuditCompRes();

            try
            {
                DBMode = dataReq.DBMode;
                res._result.ServerAddr = ConnectionString();
                res._result.DBMode     = DBMode;
                List <AuditComp> auditLst = new List <AuditComp>();

                var mode = String.IsNullOrEmpty(dataReq.MODE) ? dataReq.MODE : dataReq.MODE.ToLower();

                switch (mode)
                {
                default:
                    auditLst = AuditCompAdo.GetInstant().GetData(dataReq, null, conString);
                    break;
                }

                res.AuditCompLst = auditLst;

                if (auditLst == null)
                {
                    res._result._code    = "404";
                    res._result._message = "ไม่พบข้อมูล";
                    res._result._status  = "Bad Request";
                }
                else
                {
                    res._result._code    = "200";
                    res._result._message = "";
                    res._result._status  = "OK";
                }
            }
            catch (Exception ex)
            {
                res._result._code    = "500 ";
                res._result._message = ex.Message;
                res._result._status  = "Internal Server Error";
            }

            dataRes.data = res;
        }
Exemplo n.º 2
0
        private AuditCompRes checkacc(AuditPostReq dataReq, AuditCompRes res, string conStr = null)
        {
            try
            {
                var obj = AuditCompAdo.GetInstant().getAuditAcc(dataReq, null, conString).FirstOrDefault();
                if (obj != null)
                {
                    res.send_acc = obj.QTY_TOTAL;
                }

                res._result._code    = "200";
                res._result._message = "";
                res._result._status  = "OK";
            }
            catch (Exception ex)
            {
                res._result._code    = "500 ";
                res._result._message = ex.Message;
                res._result._status  = "Internal Server Error";
            }
            return(res);
        }