예제 #1
0
        protected override void ExecuteChild(AuditResultReq dataReq, ResponseAPI dataRes)
        {
            var res = new AuditAccRes();

            try
            {
                DBMode = dataReq.DBMode;
                res._result.ServerAddr = ConnectionString();
                res._result.DBMode     = DBMode;

                List <AuditAcc> auditLst = new List <AuditAcc>();
                var             mode     = String.IsNullOrEmpty(dataReq.MODE) ? dataReq.MODE : dataReq.MODE.ToLower();
                switch (mode)
                {
                default:
                    auditLst = AuditAccAdo.GetInstant().GetData(dataReq, null, conString);
                    break;
                }

                res.AuditAccLst = 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 (SqlException ex)
            {
                res._result._code    = "500 ";
                res._result._message = ex.Message;
                res._result._status  = "Execute exception Error";
            }
            catch (InvalidOperationException ex)
            {
                res._result._code    = "500 ";
                res._result._message = ex.Message;
                res._result._status  = "Connection Exception Error";
            }
            catch (Exception ex)
            {
                res._result._code    = "500 ";
                res._result._message = ex.Message;
                res._result._status  = "Internal Server Error";
            }


            dataRes.data = res;
        }
예제 #2
0
        protected override void ExecuteChild(AuditPostReq dataReq, ResponseAPI dataRes)
        {
            var res = new AuditAccRes();

            try
            {
                DBMode = dataReq.DBMode;
                res._result.ServerAddr = ConnectionString();
                res._result.DBMode     = DBMode;

                var mode = !String.IsNullOrEmpty(dataReq.mode) ? dataReq.mode.Trim().ToLower() : dataReq.mode;
                switch (mode)
                {
                case "sendmst":
                    res = sendMst(dataReq, res, conString);
                    break;

                case "sendtrn":
                    res = sendTrn(dataReq, res, conString);
                    break;

                case "save":
                    res = save(dataReq, res, conString);
                    break;

                default:
                    res = getAuditResult(dataReq, res, conString);
                    break;
                }
            }
            catch (SqlException ex)
            {
                res._result._code    = "500 ";
                res._result._message = ex.Message;
                res._result._status  = "Execute exception Error";
            }
            catch (InvalidOperationException ex)
            {
                res._result._code    = "500 ";
                res._result._message = ex.Message;
                res._result._status  = "Connection Exception Error";
            }
            catch (Exception ex)
            {
                res._result._code    = "500 ";
                res._result._message = ex.Message;
                res._result._status  = "Internal Server Error";
            }
            dataRes.data = res;
        }
예제 #3
0
        private AuditAccRes getAuditResult(AuditPostReq dataReq, AuditAccRes res, string conStr = null)
        {
            try
            {
                AuditPostReq req = new AuditPostReq()
                {
                    SQNO    = dataReq.SQNO,
                    COMPANY = dataReq.COMPANY,
                    filter  = dataReq.filter
                };

                var lst = ASSETKKF_ADO.Mssql.Audit.AUDITPOSTMSTTODEPAdo.GetInstant().getDataToACCEdit(req, null, null, conStr);
                res.AUDITPOSTMSTTODEPLST = lst;

                var lstPostTRN = ASSETKKF_ADO.Mssql.Audit.AUDITPOSTTRNAdo.GetInstant().getPOSTTRNACC(req, null, null, conStr);
                res.POSTTRNDuplicateLST = lstPostTRN;


                var summaryAudit = AuditAccAdo.GetInstant().GetSummaryAudit(dataReq, null, conStr);
                res.AuditSummary = summaryAudit;

                var lstResult = AuditAccAdo.GetInstant().GetSummaryResult(dataReq, null, conStr);
                res.SummaryResultLst = lstResult;
            }
            catch (SqlException ex)
            {
                res._result._code    = "500 ";
                res._result._message = ex.Message;
                res._result._status  = "Execute exception Error";
            }
            catch (InvalidOperationException ex)
            {
                res._result._code    = "500 ";
                res._result._message = ex.Message;
                res._result._status  = "Connection Exception Error";
            }
            catch (Exception ex)
            {
                res._result._code    = "500 ";
                res._result._message = ex.Message;
                res._result._status  = "Internal Server Error";
            }


            return(res);
        }
예제 #4
0
        private AuditAccRes sendMst(AuditPostReq dataReq, AuditAccRes res, string conStr = null)
        {
            try
            {
                AUDITPOSTMSTReq req = new AUDITPOSTMSTReq()
                {
                    SQNO    = dataReq.SQNO,
                    COMPANY = dataReq.COMPANY,
                    ASSETNO = dataReq.ASSETNO,
                    INPID   = dataReq.INPID,
                    UCODE   = dataReq.UCODE,
                    FLAG    = dataReq.FLAG,
                    MODE    = "updateDep_SNDACC"
                };
                //var updateDep = ASSETKKF_ADO.Mssql.Audit.AUDITPOSTMSTTODEPAdo.GetInstant().SP_AUDITPOSTMSTTODEPPHONE(req);


                var task1 = System.Threading.Tasks.Task.Factory.StartNew(() => ASSETKKF_ADO.Mssql.Audit.AUDITPOSTMSTTODEPAdo.GetInstant().SP_AUDITPOSTMSTTODEPPHONE(req, null, null, conStr));
                task1.Wait();
            }
            catch (SqlException ex)
            {
                res._result._code    = "500 ";
                res._result._message = ex.Message;
                res._result._status  = "Execute exception Error";
            }
            catch (InvalidOperationException ex)
            {
                res._result._code    = "500 ";
                res._result._message = ex.Message;
                res._result._status  = "Connection Exception Error";
            }
            catch (Exception ex)
            {
                res._result._code    = "500 ";
                res._result._message = ex.Message;
                res._result._status  = "Internal Server Error";
            }


            return(res);
        }
예제 #5
0
        private AuditAccRes save(AuditPostReq dataReq, AuditAccRes res, string conStr = null)
        {
            try
            {
                AUDITPOSTMSTReq req = new AUDITPOSTMSTReq()
                {
                    SQNO    = dataReq.SQNO,
                    COMPANY = dataReq.COMPANY,
                    ASSETNO = dataReq.ASSETNO,
                    INPID   = dataReq.INPID,
                    UCODE   = dataReq.UCODE,
                    FLAG    = dataReq.FLAG,
                    MODE    = "updateDep_SNDACCDT"
                };
                //var updateDep = ASSETKKF_ADO.Mssql.Audit.AUDITPOSTMSTTODEPAdo.GetInstant().SP_AUDITPOSTMSTTODEPPHONE(req);


                var task1 = System.Threading.Tasks.Task.Factory.StartNew(() => ASSETKKF_ADO.Mssql.Audit.AUDITPOSTMSTTODEPAdo.GetInstant().SP_AUDITPOSTMSTTODEPPHONE(req, null, null, conStr));
                task1.Wait();

                AUDITPOSTMSTReq req1 = new AUDITPOSTMSTReq()
                {
                    SQNO    = dataReq.SQNO,
                    COMPANY = dataReq.COMPANY,
                    ASSETNO = dataReq.ASSETNO,
                    INPID   = dataReq.INPID,
                    UCODE   = dataReq.UCODE,
                    FLAG    = dataReq.FLAG,
                    MODE    = "updateTRN_SNDACCDT"
                };

                var task2 = System.Threading.Tasks.Task.Factory.StartNew(() => ASSETKKF_ADO.Mssql.Audit.AUDITPOSTMSTTODEPAdo.GetInstant().SP_AUDITPOSTMSTTODEPPHONE(req1, null, null, conStr));
                task2.Wait();
            }
            catch (SqlException ex)
            {
                res._result._code    = "500 ";
                res._result._message = ex.Message;
                res._result._status  = "Execute exception Error";
            }
            catch (InvalidOperationException ex)
            {
                res._result._code    = "500 ";
                res._result._message = ex.Message;
                res._result._status  = "Connection Exception Error";
            }
            catch (Exception ex)
            {
                res._result._code    = "500 ";
                res._result._message = ex.Message;
                res._result._status  = "Internal Server Error";
            }
            finally
            {
                AuditPostReq req = new AuditPostReq()
                {
                    SQNO    = dataReq.SQNO,
                    COMPANY = dataReq.COMPANY,
                    filter  = dataReq.filter
                };

                var lst = ASSETKKF_ADO.Mssql.Audit.AUDITPOSTMSTTODEPAdo.GetInstant().getDataToACCEdit(req, null, null, conStr);
                res.AUDITPOSTMSTTODEPLST = lst;

                var lstPostTRN = ASSETKKF_ADO.Mssql.Audit.AUDITPOSTTRNAdo.GetInstant().getPOSTTRNACC(req, null, null, conStr);
                res.POSTTRNDuplicateLST = lstPostTRN;


                var summaryAudit = AuditAccAdo.GetInstant().GetSummaryAudit(dataReq, null, conStr);
                res.AuditSummary = summaryAudit;

                var lstResult = AuditAccAdo.GetInstant().GetSummaryResult(dataReq, null, conStr);
                res.SummaryResultLst = lstResult;
            }


            return(res);
        }