Exemplo n.º 1
0
        private AuditDuplicateRes confirmtrntofixedasset(AuditPostReq dataReq, AuditDuplicateRes res, string conStr = null)
        {
            try
            {
                //Update to AuditTRN
                AUDITPOSTMSTReq req = new AUDITPOSTMSTReq()
                {
                    SQNO    = dataReq.SQNO,
                    COMPANY = dataReq.COMPANY,
                    ASSETNO = dataReq.ASSETNO,
                    INPID   = dataReq.INPID,
                    MEMO1   = dataReq.MEMO1 + " " + dataReq.STFLAGNM,
                    UCODE   = dataReq.UCODE,
                    MODE    = "updateTRN_TMP"
                };

                var updateSNDST = ASSETKKF_ADO.Mssql.Audit.AUDITPOSTTRNAdo.GetInstant().SP_AUDITPOSTTRNPHONE(req, null, null, conStr);

                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);
        }
Exemplo n.º 2
0
        /// <summary>
        /// SP_AUDITPOSTMST
        /// </summary>
        /// <param name="d"></param>
        /// <param name="transac"></param>
        /// <returns></returns>
        public int saveAUDITPOSTMST(AUDITPOSTMSTReq d, SqlTransaction transac = null, string conStr = null)
        {
            DynamicParameters param = new DynamicParameters();

            sql  = " EXEC [dbo].[SP_AUDITPOSTMST]  ";
            sql += " @SQNO  = '" + d.SQNO + "'";
            sql += " ,@COMPANY = '" + d.COMPANY + "'";
            sql += " ,@ASSETNO = '" + d.ASSETNO + "'";
            sql += " ,@FINDY = '" + d.FINDY + "'";
            sql += " ,@PCODE= '" + d.PCODE + "'";
            sql += " ,@PNAME= '" + d.PNAME + "'";
            sql += " ,@LEADERCODE = '" + d.LEADERCODE + "'";
            sql += " ,@LEADERNAME = '" + d.LEADERNAME + "'";
            sql += " ,@AREANAME = '" + d.AREANAME + "'";
            sql += " ,@AREACODE = '" + d.AREACODE + "'";
            sql += " ,@MEMO1 = '" + d.MEMO1 + "'";
            sql += " ,@USERID = '" + d.UCODE + "'";
            sql += " ,@DEPCODEOL = '" + d.DEPCODEOL + "'";
            sql += " ,@MODE = '" + d.MODE + "'";
            sql += " ,@PFLAG = '" + d.PFLAG + "'";


            var res = ExecuteNonQuery(sql, param, conStr);

            return(res);
        }
Exemplo n.º 3
0
        private AuditDuplicateRes confirmtmptofixedasset(AuditPostReq dataReq, AuditDuplicateRes res, string conStr = null)
        {
            try
            {
                //Save to AuditTMP
                AUDITPOSTMSTReq req1 = new AUDITPOSTMSTReq()
                {
                    MODE    = "update",
                    SQNO    = dataReq.SQNO,
                    COMPANY = dataReq.COMPANY,
                    ASSETNO = dataReq.ASSETNO,
                    UCODE   = dataReq.UCODE,
                    FINDY   = dataReq.FINDY,
                    PCODE   = dataReq.PCODE,
                    PNAME   = dataReq.PNAME,
                    MEMO1   = dataReq.MEMO1 + " " + dataReq.STFLAGNM,
                };
                ASSETKKF_ADO.Mssql.Audit.AUDITPOSTMSTTOTEMPAdo.GetInstant().SP_AUDITPOSTMSTTOTEMP(req1, null, null, conStr);



                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);
        }
Exemplo n.º 4
0
        private AuditDuplicateRes confirmDuplicateTOTEMP(AuditPostReq dataReq, AuditDuplicateRes res, string conStr = null)
        {
            try
            {
                AUDITPOSTMSTReq req = new AUDITPOSTMSTReq()
                {
                    SQNO    = dataReq.SQNO,
                    COMPANY = dataReq.COMPANY,
                    ASSETNO = dataReq.ASSETNO,
                    UCODE   = dataReq.UCODE,
                    MODE    = "updateSNDST_Y_ASSETNO_INPID"
                };
                var updateSNDST = ASSETKKF_ADO.Mssql.Audit.AUDITPOSTMSTTOTEMPAdo.GetInstant().SP_AUDITPOSTMSTTOTEMP(req, null, null, conStr);

                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);
        }
Exemplo n.º 5
0
        private AuditDepRes depimgtrn(AuditPostReq dataReq, AuditDepRes 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    = "",
                    IMGPATH = dataReq.IMGPATH,
                    MODE    = "update_IMG"
                };

                var updateSTY = ASSETKKF_ADO.Mssql.Audit.AUDITPOSTTRNAdo.GetInstant().SP_AUDITPOSTTRNPHONE(req, null, null, conStr);


                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";
            }
            finally
            {
                AuditPostReq req = new AuditPostReq()
                {
                    SQNO    = dataReq.SQNO,
                    COMPANY = dataReq.COMPANY,
                    filter  = dataReq.filter
                };
                var lst = ASSETKKF_ADO.Mssql.Audit.AUDITPOSTMSTTODEPAdo.GetInstant().getDataToClear(req, null, null, conStr);
                res.AUDITPOSTMSTTODEPLST = lst;

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


            return(res);
        }
Exemplo n.º 6
0
 private void updatePOSTMST_SNDST_Y(AuditPostReq dataReq, string conStr = null)
 {
     AUDITPOSTMSTReq req = new AUDITPOSTMSTReq()
     {
         SQNO    = dataReq.SQNO,
         COMPANY = dataReq.COMPANY,
         ASSETNO = dataReq.ASSETNO,
         UCODE   = dataReq.UCODE,
         MODE    = "updateSNDST_Y"
     };
     var updateSNDST = ASSETKKF_ADO.Mssql.Audit.AUDITPOSTMSTAdo.GetInstant().saveAUDITPOSTMST(req, null, conStr);
 }
Exemplo n.º 7
0
        private void addPOSTTEMP_NotExists(AuditPostReq dataReq, string conStr = null)
        {
            AUDITPOSTMSTReq req1 = new AUDITPOSTMSTReq()
            {
                MODE    = "addNotExists",
                SQNO    = dataReq.SQNO,
                COMPANY = dataReq.COMPANY,
                UCODE   = dataReq.UCODE
            };

            ASSETKKF_ADO.Mssql.Audit.AUDITPOSTMSTTOTEMPAdo.GetInstant().SP_AUDITPOSTMSTTOTEMP(req1, null, null, conStr);
        }
Exemplo n.º 8
0
        private void updatePOSTDEP_PCODE_PostMST_Dup(AuditPostReq dataReq, string conStr = null)
        {
            AUDITPOSTMSTReq req1 = new AUDITPOSTMSTReq()
            {
                MODE    = "updatePCODE_PostMST_Dup",
                SQNO    = dataReq.SQNO,
                COMPANY = dataReq.COMPANY,
                UCODE   = dataReq.UCODE
            };

            ASSETKKF_ADO.Mssql.Audit.AUDITPOSTMSTTODEPAdo.GetInstant().SP_AUDITPOSTMSTTODEP(req1, null, null, conStr);
        }
Exemplo n.º 9
0
        public List <ASAUDITPOSTMST> getASAUDITPOSTMSTPHONE(AUDITPOSTMSTReq d, string flag = null, SqlTransaction transac = null, string conStr = null)

        {
            DynamicParameters param = new DynamicParameters();

            sql  = " select * from   FT_ASAUDITPOSTMST_PHONE_COMPANY(" + QuoteStr(d.COMPANY) + ")  ";
            sql += " where SQNO = '" + d.SQNO + "'";
            sql += " and ASSETNO = '" + d.ASSETNO + "'";
            sql += " and INPID = '" + d.UCODE + "'";

            sql += " order by (case when INPID = '" + d.UCODE + "' then 1 else 0 end) desc";
            var res = Query <ASAUDITPOSTMST>(sql, param, conStr).ToList();

            return(res);
        }
Exemplo n.º 10
0
        private AuditDuplicateRes confirmtrntotmp(AuditPostReq dataReq, AuditDuplicateRes res, string conStr = null)
        {
            try
            {
                //Save to AuditTMP
                AUDITPOSTMSTReq req1 = new AUDITPOSTMSTReq()
                {
                    MODE    = "update",
                    SQNO    = dataReq.SQNO,
                    COMPANY = dataReq.COMPANY,
                    ASSETNO = dataReq.ASSETNO,
                    UCODE   = dataReq.UCODE,
                    FINDY   = dataReq.FINDY,
                    PCODE   = dataReq.PCODE,
                    PNAME   = dataReq.PNAME,
                    MEMO1   = dataReq.MEMO1,
                };
                ASSETKKF_ADO.Mssql.Audit.AUDITPOSTMSTTOTEMPAdo.GetInstant().SP_AUDITPOSTMSTTOTEMP(req1, null, null, conStr);


                //Update to AuditTRN
                AUDITPOSTMSTReq req = new AUDITPOSTMSTReq()
                {
                    SQNO    = dataReq.SQNO_TRN,
                    COMPANY = dataReq.COMPANY_TRN,
                    ASSETNO = dataReq.ASSETNO,
                    INPID   = dataReq.INPID_TRN,
                    MEMO1   = dataReq.MEMO_TRN,
                    UCODE   = dataReq.UCODE,
                    MODE    = "updateTRN_TMP"
                };

                var updateSNDST = ASSETKKF_ADO.Mssql.Audit.AUDITPOSTTRNAdo.GetInstant().SP_AUDITPOSTTRNPHONE(req, null, null, conStr);

                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);
        }
Exemplo n.º 11
0
        private void InSdataToTEMP(AuditPostReq dataReq, string conStr = null)
        {
            AUDITPOSTMSTReq req1 = new AUDITPOSTMSTReq()
            {
                MODE    = "add_PostMST_NoDup",
                SQNO    = dataReq.SQNO,
                COMPANY = dataReq.COMPANY,
                UCODE   = dataReq.UCODE
            };

            ASSETKKF_ADO.Mssql.Audit.AUDITPOSTMSTTOTEMPAdo.GetInstant().SP_AUDITPOSTMSTTOTEMP(req1, null, null, conString);

            var req2 = req1;

            req2.MODE = "add_PostMST_Dup";
            ASSETKKF_ADO.Mssql.Audit.AUDITPOSTMSTTOTEMPAdo.GetInstant().SP_AUDITPOSTMSTTOTEMP(req2, null, null, conString);
        }
Exemplo n.º 12
0
        private AuditDuplicateRes savebfsend(AuditPostReq dataReq, AuditDuplicateRes res, string conStr = null)
        {
            try
            {
                AUDITPOSTMSTReq req1 = new AUDITPOSTMSTReq()
                {
                    MODE    = "update",
                    SQNO    = dataReq.SQNO,
                    COMPANY = dataReq.COMPANY,
                    ASSETNO = dataReq.ASSETNO,
                    UCODE   = dataReq.UCODE,
                    FINDY   = dataReq.FINDY,
                    PCODE   = dataReq.PCODE,
                    PNAME   = dataReq.PNAME,
                    MEMO1   = dataReq.MEMO1,
                    poth    = dataReq.poth,
                    snnstdt = dataReq.snnstdt,
                    expstdt = dataReq.expstdt
                };
                ASSETKKF_ADO.Mssql.Audit.AUDITPOSTMSTTOTEMPAdo.GetInstant().SP_AUDITPOSTMSTTOTEMP(req1, null, null, conStr);

                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";
            }
            finally
            {
                var lstPostMSTToTEMP = ASSETKKF_ADO.Mssql.Audit.AUDITPOSTMSTTOTEMPAdo.GetInstant().getDataToSendDep(dataReq, null, null, conStr);
                res.AuditToTEMPLST = lstPostMSTToTEMP;

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

                var lstNoAudit = ASSETKKF_ADO.Mssql.Audit.AUDITCUTDATEAdo.GetInstant().getNoAudit(dataReq, null, null, conStr);
                //var lstNoAudit = lstPostMSTToTEMP.Where(p => String.IsNullOrEmpty(p.PCODE)).ToList();
                res.NoAuditLST = lstNoAudit;
            }
            return(res);
        }
Exemplo n.º 13
0
        private AuditDepRes confirminformedtrn(AuditPostReq dataReq, AuditDepRes 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    = "updateTRN_STY"
                };

                var updateSNDST = ASSETKKF_ADO.Mssql.Audit.AUDITPOSTTRNAdo.GetInstant().SP_AUDITPOSTTRNPHONE(req, null, null, conStr);


                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";
            }


            return(res);
        }
Exemplo n.º 14
0
        public int SP_AUDITPOSTTRNPHONE(AUDITPOSTMSTReq d, string flag = null, SqlTransaction transac = null, string conStr = null)
        {
            DynamicParameters param = new DynamicParameters();

            sql  = "  EXEC  SP_AUDITPOSTTRNPHONE";
            sql += " @SQNO  = '" + d.SQNO + "'";
            sql += " ,@COMPANY = '" + d.COMPANY + "'";
            sql += " ,@ASSETNO = '" + d.ASSETNO + "'";
            sql += " ,@INPID = '" + d.INPID + "'";
            sql += " ,@IMGPATH = '" + d.IMGPATH + "'";
            sql += " ,@USERID = '" + d.UCODE + "'";
            sql += " ,@FLAG = '" + d.FLAG + "'";
            sql += " ,@MEMO= '" + d.MEMO1 + "'";
            sql += " ,@MODE = '" + d.MODE + "'";

            var res = ExecuteNonQuery(sql, param, conStr);

            return(res);
        }
Exemplo n.º 15
0
        public int SP_AUDITPOSTMSTTODEP(AUDITPOSTMSTReq d, string flag = null, SqlTransaction transac = null, string conStr = null)
        {
            DynamicParameters param = new DynamicParameters();

            sql  = "  EXEC  SP_AUDITPOSTMSTTODEP";
            sql += " @SQNO  = '" + d.SQNO + "'";
            sql += " ,@COMPANY = '" + d.COMPANY + "'";
            sql += " ,@ASSETNO = '" + d.ASSETNO + "'";
            sql += " ,@USERID = '" + d.UCODE + "'";
            sql += " ,@MODE = '" + d.MODE + "'";
            sql += " ,@FINDY = '" + d.FINDY + "'";
            sql += " ,@PCODE= '" + d.PCODE + "'";
            sql += " ,@PNAME= '" + d.PNAME + "'";
            sql += " ,@MEMO= '" + d.MEMO1 + "'";

            var res = ExecuteNonQuery(sql, param, conStr);

            return(res);
        }
Exemplo n.º 16
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);
        }
Exemplo n.º 17
0
        public int UpdateAUDITPOSTMSTImage(AUDITPOSTMSTReq d, SqlTransaction transac = null, string conStr = null)
        {
            if (d == null && (d != null && (d.SQNO == null || d.ASSETNO == null)))
            {
                return(-1);
            }
            DynamicParameters param = new DynamicParameters();

            sql  = " EXEC [dbo].[SP_AUDITPOSTMSTIMG]  ";
            sql += " @SQNO  = '" + d.SQNO + "'";
            sql += " ,@COMPANY = '" + d.COMPANY + "'";
            sql += " ,@ASSETNO = '" + d.ASSETNO + "'";
            sql += " ,@IMGPATH = '" + d.IMGPATH + "'";
            sql += " ,@USERID = '" + d.UCODE + "'";;


            var res = ExecuteNonQuery(sql, param, conStr);

            return(res);
        }
Exemplo n.º 18
0
        private AuditCompRes depimgmst(AuditPostReq dataReq, AuditCompRes 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    = "",
                    IMGPATH = dataReq.IMGPATH,
                    MODE    = "update_ComIMG"
                };
                var updateSTY = ASSETKKF_ADO.Mssql.Audit.AUDITPOSTMSTTODEPAdo.GetInstant().SP_AUDITPOSTMSTTODEPPHONE(req, null, null, conStr);

                Thread.Sleep(1000);

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

                var updateSNDST = ASSETKKF_ADO.Mssql.Audit.AUDITPOSTTRNAdo.GetInstant().SP_AUDITPOSTTRNPHONE(req1, null, null, conStr);
                Thread.Sleep(1000);

                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";
            }
            finally
            {
                AuditPostReq req = new AuditPostReq()
                {
                    SQNO    = dataReq.SQNO,
                    COMPANY = dataReq.COMPANY,
                    filter  = dataReq.filter
                };
                var lst = ASSETKKF_ADO.Mssql.Audit.AUDITPOSTMSTTODEPAdo.GetInstant().getDataToCompEdit(req, null, null, conStr);
                res.AUDITPOSTMSTTODEPLST = lst;

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


            return(res);
        }
Exemplo n.º 19
0
        protected override void ExecuteChild(AuditPostCheckReq dataReq, ResponseAPI dataRes)
        {
            var res = new AuditPostRes();

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


            var req1 = new ASSETKKF_MODEL.Request.Asset.AuditPostReq()
            {
                SQNO       = dataReq.SQNO,
                DEPCODEOL  = dataReq.DEPCODEOL,
                COMPANY    = dataReq.COMPANY,
                LEADERCODE = dataReq.LEADERCODE,
                AREACODE   = dataReq.AREACODE,
                UCODE      = dataReq.UCODE,
                isdept     = dataReq.isdept
            };

            try
            {
                List <ASAUDITPOSTMST> lst = new List <ASAUDITPOSTMST>();
                //var lst = ASSETKKF_ADO.Mssql.Asset.AuditCutADO.GetInstant().checkAUDITAssetNo(dataReq);
                var t1 = System.Threading.Tasks.Task.Factory.StartNew(() => lst = ASSETKKF_ADO.Mssql.Asset.AuditCutADO.GetInstant().checkAUDITAssetNo(dataReq, transac, conString));
                t1.Wait();


                if (lst == null || (lst != null && lst.Count == 0))
                {
                    res._result._code    = "404";
                    res._result._message = "ไม่พบข้อมูล";
                    res._result._status  = "Bad Request";

                    ASSETASSETNOReq req = new ASSETASSETNOReq()
                    {
                        ASSETNO = dataReq.ASSETNO
                    };
                    ASSETASSETNO obj = ASSETKKF_ADO.Mssql.Asset.AUDITPOSTTRNADO.GetInstant().checkASSETASSETNO(req, transac, conString);

                    res.ASSETASSETNO = obj;
                }
                else
                {
                    if (dataReq.MODE != null && dataReq.MODE.ToLower() == "check")
                    {
                        var obj = lst.Where(x => x.INPID == dataReq.UCODE).FirstOrDefault();
                        res.AUDITPOSTMST = obj;

                        res._result._code    = "200";
                        res._result._message = "พบข้อมูล";
                        res._result._status  = "OK";
                    }
                    else if (dataReq.MODE != null && dataReq.MODE.ToLower() == "detail")
                    {
                        res.AUDITPOSTMST = lst.FirstOrDefault();

                        res._result._code    = "200";
                        res._result._message = "พบข้อมูล";
                        res._result._status  = "OK";
                    }
                    else
                    {
                        var reqProblem = new STProblemReq
                        {
                            Company = dataReq.COMPANY
                        };
                        var lstProblem = ASSETKKF_ADO.Mssql.Asset.STProblemADO.GetInstant().Search(reqProblem, transac, conString);
                        var objProblem = lstProblem.FirstOrDefault();
                        var reqPostMst = new AUDITPOSTMSTReq
                        {
                            SQNO       = dataReq.SQNO,
                            DEPCODEOL  = dataReq.DEPCODEOL,
                            COMPANY    = dataReq.COMPANY,
                            LEADERCODE = dataReq.LEADERCODE,
                            LEADERNAME = dataReq.LEADERNAME,
                            AREACODE   = dataReq.AREACODE,
                            AREANAME   = dataReq.AREANAME,
                            ASSETNO    = dataReq.ASSETNO,
                            FINDY      = objProblem != null? objProblem.FINDY:null,
                            PCODE      = objProblem != null ? objProblem.Pcode : null,
                            PNAME      = objProblem != null ? objProblem.Pname : null,
                            UCODE      = dataReq.UCODE,
                            PFLAG      = objProblem != null ? objProblem.PFLAG : null,
                            isdept     = dataReq.isdept
                        };
                        var reqPostMstPhone = new AUDITPOSTMSTReq();
                        reqPostMstPhone = reqPostMst;

                        //เคยบันทึกแล้ว มาบันทึกซ้ำ
                        var objDuplicate = lst.Where(x => x.INPID == dataReq.UCODE && !String.IsNullOrEmpty(x.PCODE)).FirstOrDefault();
                        //บันทึกครั้งแรก เป็นคน Export
                        var objFirstEx = lst.Where(x => x.INPID == dataReq.UCODE && String.IsNullOrEmpty(x.PCODE)).FirstOrDefault();
                        //บันทึกครั้งแรก ไม่ได้เป็นผู้ Export
                        //var objFirst = lst.Where(x => x.INPID != dataReq.UCODE && String.IsNullOrEmpty(x.PCODE)).FirstOrDefault();
                        var objFirst = new ASAUDITPOSTMST();
                        //บันทึกครั้งแรก แต่มีคนมาบันทึกก่อนหน้าแล้ว
                        var objSecound = lst.Where(x => x.INPID != dataReq.UCODE && !String.IsNullOrEmpty(x.PCODE)).FirstOrDefault();

                        if (objDuplicate != null)
                        {
                            res._result._code     = "202";
                            res._result._message  = objDuplicate.INPID + "เคยบันทึกผลการตรวจสอบทรัพย์สิน " + objDuplicate.ASSETNO + " เป็น " + objDuplicate.PCODE + " : " + objDuplicate.PNAME;
                            res._result._message += " เมื่อ " + objDuplicate.INPDT;
                            res._result._status   = "Accepted ";
                            res.AUDITPOSTMST      = objDuplicate;
                        }
                        else if (objSecound != null)
                        {
                            if (!String.IsNullOrEmpty(dataReq.status))
                            {
                                reqPostMst.MODE = "";
                                //ASSETKKF_ADO.Mssql.Asset.AuditCutADO.GetInstant().updateAUDITPOSTMST(reqPostMst);
                                var task1 = System.Threading.Tasks.Task.Factory.StartNew(() => ASSETKKF_ADO.Mssql.Asset.AuditCutADO.GetInstant().updateAUDITPOSTMST(reqPostMst, transac, conString));
                                task1.Wait();


                                reqPostMstPhone.MODE = "Edit";
                                //ASSETKKF_ADO.Mssql.Asset.AuditCutADO.GetInstant().updateAUDITPOSTMSTPHONE(reqPostMstPhone);
                                var task2 = System.Threading.Tasks.Task.Factory.StartNew(() => ASSETKKF_ADO.Mssql.Asset.AuditCutADO.GetInstant().updateAUDITPOSTMSTPHONE(reqPostMstPhone, transac, conString));
                                task2.Wait();

                                res.AUDITPOSTMST = objSecound;


                                res._result._code    = "201";
                                res._result._message = objSecound.INPID + "บันทึกผลการตรวจสอบทรัพย์สิน " + objSecound.ASSETNO + " เรียบร้อยแล้ว";
                                res._result._status  = "Created";
                            }
                            else
                            {
                                res._result._code     = "208";
                                res._result._message  = objSecound.INPID + "บันทึกผลการตรวจสอบทรัพย์สิน " + objSecound.ASSETNO + " เป็น " + objSecound.PCODE + " : " + objSecound.PNAME;
                                res._result._message += " เมื่อ " + objSecound.INPDT;
                                res._result._status   = "Already Saved ";
                                res.AUDITPOSTMST      = objSecound;
                            }
                        }
                        else if (objFirstEx != null)
                        {
                            reqPostMst.MODE = "";
                            //ASSETKKF_ADO.Mssql.Asset.AuditCutADO.GetInstant().updateAUDITPOSTMST(reqPostMst);
                            var task1 = System.Threading.Tasks.Task.Factory.StartNew(() => ASSETKKF_ADO.Mssql.Asset.AuditCutADO.GetInstant().updateAUDITPOSTMST(reqPostMst, transac, conString));
                            task1.Wait();

                            reqPostMstPhone.MODE = "Edit";
                            //ASSETKKF_ADO.Mssql.Asset.AuditCutADO.GetInstant().updateAUDITPOSTMSTPHONE(reqPostMstPhone);
                            var task2 = System.Threading.Tasks.Task.Factory.StartNew(() => ASSETKKF_ADO.Mssql.Asset.AuditCutADO.GetInstant().updateAUDITPOSTMSTPHONE(reqPostMstPhone, transac, conString));
                            task2.Wait();

                            res.AUDITPOSTMST = objFirstEx;


                            res._result._code    = "201";
                            res._result._message = objFirstEx.INPID + "บันทึกผลการตรวจสอบทรัพย์สิน " + objFirstEx.ASSETNO + " เรียบร้อยแล้ว";
                            res._result._status  = "Created";
                        }
                        else if (objFirst != null)
                        {
                            reqPostMst.MODE = "ADD";
                            //ASSETKKF_ADO.Mssql.Asset.AuditCutADO.GetInstant().updateAUDITPOSTMST(reqPostMst);
                            var task1 = System.Threading.Tasks.Task.Factory.StartNew(() => ASSETKKF_ADO.Mssql.Asset.AuditCutADO.GetInstant().updateAUDITPOSTMST(reqPostMst, transac, conString));
                            task1.Wait();

                            res.AUDITPOSTMST = objFirst;

                            res._result._code    = "201";
                            res._result._message = objFirst.INPNAME + "บันทึกผลการตรวจสอบทรัพย์สิน " + objFirst.ASSETNO + " เรียบร้อยแล้ว";
                            res._result._status  = "Created";
                        }

                        else
                        {
                            var obj = lst.FirstOrDefault();
                            res._result._code    = "404";
                            res._result._message = "ไม่พบข้อมูลตามเงื่อนไข :: ผู้ตรวจสอบ " + obj.INPID + " ,ทรัพย์สิน " + obj.ASSETNO + " : " + obj.ASSETNAME + " " + obj.PCODE;
                            res._result._status  = "Bad Request";
                        }
                    }
                }
            }
            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
            {
                var lstAUDITCUTDATE = ASSETKKF_ADO.Mssql.Asset.AuditCutADO.GetInstant().getAUDITCUTDATE(req1, transac, conString);
                res.AUDITCUTDATELST = lstAUDITCUTDATE;

                var req = new ASSETKKF_MODEL.Request.Asset.AuditPostReq()
                {
                    SQNO       = dataReq.SQNO,
                    DEPCODEOL  = dataReq.DEPCODEOL,
                    COMPANY    = dataReq.COMPANY,
                    LEADERCODE = dataReq.LEADERCODE,
                    AREACODE   = dataReq.AREACODE,
                    UCODE      = dataReq.UCODE,
                    LEADERNAME = dataReq.LEADERNAME,
                    AREANAME   = dataReq.AREANAME,
                    IMGPATH    = dataReq.IMGPATH,
                    YEAR       = dataReq.YEAR,
                    MN         = dataReq.MN,
                    DEPMST     = dataReq.DEPMST,
                    cutdt      = dataReq.cutdt,
                    OFFICECODE = dataReq.OFFICECODE,
                    TYPECODE   = dataReq.TYPECODE,
                    GASTCODE   = dataReq.GASTCODE,
                    isdept     = dataReq.isdept
                };

                var lstAUDITPOSTMST = ASSETKKF_ADO.Mssql.Asset.AuditCutADO.GetInstant().getAUDITPOSTMST(req, null, null, conString);
                var lstAUDITPOSTTRN = ASSETKKF_ADO.Mssql.Asset.AuditCutADO.GetInstant().getAUDITPOSTTRN(req, null, conString);

                res.AUDITPOSTTRNLST = lstAUDITPOSTTRN;

                //var lstWait = lstAUDITPOSTMST.Where(p => String.IsNullOrEmpty(p.PCODE)).ToList();
                var lstChecked = lstAUDITPOSTMST.Where(p => !String.IsNullOrEmpty(p.PCODE)).ToList();
                var lstWait    = ASSETKKF_ADO.Mssql.Asset.AuditCutADO.GetInstant().getAUDITPOSTMST_WAIT(req, null, null, conString);
                res.AUDITPOSTMSTWAITLST      = lstWait;
                res.AUDITPOSTMSTCHECKEDLST   = lstChecked;
                res.AUDITPOSTMSTNOPROBLEMLST = lstChecked.Where(x => x.PFLAG != "Y").ToList();
                res.AUDITPOSTMSTPROBLEMLST   = lstChecked.Where(x => x.PFLAG == "Y").ToList();

                //res.AUDITPOSTMST = lstAUDITPOSTMST.Where(x => x.INPID == dataReq.UCODE && x.ASSETNO == dataReq.ASSETNO && x.SQNO == dataReq.SQNO).FirstOrDefault();
                AuditSummaryReq reqSum = new AuditSummaryReq()
                {
                    Company = dataReq.COMPANY,
                    year    = dataReq.YEAR,
                    mn      = dataReq.MN,
                    sqno    = dataReq.SQNO,
                    isdept  = dataReq.isdept
                };
                //var lstSum = ASSETKKF_ADO.Mssql.Asset.DashboardADO.GetInstant().getInspectionByDEPMST(reqSum,transac,conString);
                //res.DashboardInspectionLST = lstSum;
            }

            dataRes.data = res;
        }
Exemplo n.º 20
0
        private AuditDuplicateRes uploadfile(AuditPostReq dataReq, AuditDuplicateRes res, string conStr = null)
        {
            try
            {
                if (dataReq.FileToUpload != null)
                {
                    res.FILEPATH    = FilesUtilSvc.uploadAttachFile(dataReq.FileToUpload);
                    dataReq.IMGPATH = res.FILEPATH;
                }

                if (!String.IsNullOrEmpty(dataReq.IMGPATH))
                {
                    var attachedFile = "";
                    var task1        = System.Threading.Tasks.Task.Factory.StartNew(() => attachedFile = ASSETKKF_ADO.Mssql.Audit.AUDITPOSTMSTTODEPAdo.GetInstant().getAttachedFile(dataReq, null, null, conStr));
                    task1.Wait();

                    if (!String.IsNullOrEmpty(attachedFile))
                    {
                        FilesUtilSvc.deleteFile(attachedFile);
                    }

                    var mode = String.IsNullOrEmpty(attachedFile) ? "attach_FILE" : "update_FILE";


                    AUDITPOSTMSTReq req = new AUDITPOSTMSTReq()
                    {
                        SQNO    = dataReq.SQNO,
                        COMPANY = dataReq.COMPANY,
                        ASSETNO = dataReq.ASSETNO,
                        INPID   = dataReq.INPID,
                        UCODE   = dataReq.UCODE,
                        FLAG    = "",
                        IMGPATH = dataReq.IMGPATH,
                        MODE    = mode
                    };
                    //var updateFILE = ASSETKKF_ADO.Mssql.Audit.AUDITPOSTMSTTODEPAdo.GetInstant().SP_AUDITPOSTMSTTODEPPHONE(req);

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

                    res.FILEPATH = dataReq.IMGPATH;
                    res.FileSRC  = FilesUtilSvc.getFile(res.FILEPATH);
                }



                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";
            }
            finally
            {
                var lstPostMSTToTEMP = ASSETKKF_ADO.Mssql.Audit.AUDITPOSTMSTTOTEMPAdo.GetInstant().getDataToSendDep(dataReq, null, null, conStr);
                res.AuditToTEMPLST = lstPostMSTToTEMP;

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

                var lstNoAudit = ASSETKKF_ADO.Mssql.Audit.AUDITCUTDATEAdo.GetInstant().getNoAudit(dataReq, null, null, conStr);
                //var lstNoAudit = lstPostMSTToTEMP.Where(p => String.IsNullOrEmpty(p.PCODE)).ToList();
                res.NoAuditLST = lstNoAudit;
            }


            return(res);
        }
Exemplo n.º 21
0
        private AuditDuplicateRes sendaudit2dep(AuditPostReq dataReq, AuditDuplicateRes res, string conStr = null)
        {
            try
            {
                updateCUTDT(dataReq, conStr);

                updatePOSTMST_SNDST_Y(dataReq, conStr);
                addPOSTTEMP_NotExists_PCODE_SNDST_Y(dataReq, conStr);
                addPOSTTEMP_NotExists_PCODE(dataReq, conStr);
                addPOSTTEMP_NotExists(dataReq, conStr);
                updatePOSTTEMP_SNDST_Y(dataReq, conStr);
                updatePOSTTEMP_PCODE_PostMST(dataReq, conStr);
                updatePOSTDEP_PCODE_PostMST(dataReq, conStr);
                updatePOSTTEMP_PCODE_PostMST_Dup(dataReq, conStr);
                updatePOSTDEP_PCODE_PostMST_Dup(dataReq, conStr);

                var lstPostMSTToTEMP = ASSETKKF_ADO.Mssql.Audit.AUDITPOSTMSTTOTEMPAdo.GetInstant().getDataToSendDep(dataReq, null, null, conStr);
                if (lstPostMSTToTEMP == null || lstPostMSTToTEMP != null && lstPostMSTToTEMP.Count == 0)
                {
                    InSdataToTEMP(dataReq, conStr);
                }

                AUDITPOSTTRNReq req = new AUDITPOSTTRNReq()
                {
                    SQNO    = dataReq.SQNO,
                    COMPANY = dataReq.COMPANY,
                    ASSETNO = dataReq.ASSETNO,
                    UCODE   = dataReq.UCODE,
                    INPID   = dataReq.INPID,
                    MODE    = "update_senddep"
                };

                var updateSNDST = ASSETKKF_ADO.Mssql.Audit.AUDITPOSTTRNAdo.GetInstant().saveAUDITPOSTTRN(req, null, conStr);

                AUDITPOSTMSTReq req1 = new AUDITPOSTMSTReq()
                {
                    MODE    = "insert_PostTEMP",
                    SQNO    = dataReq.SQNO,
                    COMPANY = dataReq.COMPANY,
                    ASSETNO = dataReq.ASSETNO,
                    UCODE   = dataReq.UCODE,
                    FINDY   = dataReq.FINDY,
                    PCODE   = dataReq.PCODE,
                    PNAME   = dataReq.PNAME,
                    MEMO1   = dataReq.MEMO1,
                    poth    = dataReq.poth,
                    snnstdt = dataReq.snnstdt,
                    expstdt = dataReq.expstdt
                };
                ASSETKKF_ADO.Mssql.Audit.AUDITPOSTMSTTODEPAdo.GetInstant().SP_AUDITPOSTMSTTODEP(req1, null, null, conStr);



                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";
            }
            finally
            {
                var lstPostMSTToTEMP = ASSETKKF_ADO.Mssql.Audit.AUDITPOSTMSTTOTEMPAdo.GetInstant().getDataToSendDep(dataReq, null, null, conStr);
                res.AuditToTEMPLST = lstPostMSTToTEMP;

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

                var lstNoAudit = ASSETKKF_ADO.Mssql.Audit.AUDITCUTDATEAdo.GetInstant().getNoAudit(dataReq, null, null, conStr);
                //var lstNoAudit = lstPostMSTToTEMP.Where(p => String.IsNullOrEmpty(p.PCODE)).ToList();
                res.NoAuditLST = lstNoAudit;
            }
            return(res);
        }
Exemplo n.º 22
0
        private AuditCompRes depeditmst(AuditPostReq dataReq, AuditCompRes 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    = "",
                    MEMO1   = dataReq.MEMO1,
                    FINDY   = dataReq.FINDY,
                    PCODE   = dataReq.PCODE,
                    PNAME   = dataReq.PNAME,
                    MODE    = "updatePCODE_TODEP",
                    snnstdt = dataReq.snnstdt,
                    expstdt = dataReq.expstdt
                };
                /*var updateDep = ASSETKKF_ADO.Mssql.Audit.AUDITPOSTMSTTODEPAdo.GetInstant(conString).SP_AUDITPOSTMSTTODEP(req);*/
                ASSETKKF_ADO.Mssql.Audit.AUDITPOSTMSTTOTEMPAdo.GetInstant().SP_AUDITPOSTMSTTOTEMP(req, null, null, conStr);

                Thread.Sleep(1000);

                AUDITPOSTMSTReq req1 = new AUDITPOSTMSTReq()
                {
                    SQNO    = dataReq.SQNO,
                    COMPANY = dataReq.COMPANY,
                    ASSETNO = dataReq.ASSETNO,
                    INPID   = dataReq.INPID,
                    UCODE   = dataReq.UCODE,
                    FLAG    = "",
                    MODE    = "updateDEP_STY"
                };
                var updateSTCY = ASSETKKF_ADO.Mssql.Audit.AUDITPOSTMSTTODEPAdo.GetInstant().SP_AUDITPOSTMSTTODEPPHONE(req1, null, null, conStr);

                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";
            }
            finally
            {
                Thread.Sleep(1000);
                AuditPostReq req = new AuditPostReq()
                {
                    SQNO    = dataReq.SQNO,
                    COMPANY = dataReq.COMPANY,
                    filter  = dataReq.filter
                };

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

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


            return(res);
        }
Exemplo n.º 23
0
        private TrackOfflineRes auditPostMST(TrackOfflineReq dataReq, TrackOfflineRes res, string conStr = null)
        {
            try
            {
                string msg, flag, transy;
                flag   = "1";
                transy = "";
                msg    = "";

                ASAUDITPOSTMST objMst = new ASAUDITPOSTMST();
                if (String.IsNullOrEmpty(dataReq.sqno))
                {
                    msg = "เลขที่เอกสารไม่ถูกต้อง";
                    res._result._code    = "404";
                    res._result._message = msg;
                    res._result._status  = "Bad Request";
                }
                else
                {
                    objMst = GetASAUDITPOSTMST(dataReq, conStr);
                    if (objMst != null)
                    {
                        if (!String.IsNullOrEmpty(objMst.PCODE))
                        {
                            msg = "ไม่สามารถบันทึกผลการตรวจสอบได้ เนื่องจากรหัสทรัพย์สินนี้เคยถูกบันทึกผลเป็น" + objMst.PCODE + " : " + objMst.PNAME;
                            res._result._code    = "501";
                            res._result._message = msg;
                            res._result._status  = "Not Implemented";
                        }
                        else
                        {
                            transy               = "Y";
                            res._result._code    = "200";
                            res._result._message = msg;
                            res._result._status  = "OK";
                        }
                    }
                    else
                    {
                        msg = "ไม่พบข้อมูล";
                        res._result._code    = "404";
                        res._result._message = msg;
                        res._result._status  = "Bad Request";
                    }
                }

                dataReq.flag   = flag;
                dataReq.remark = msg;

                UpdateTransferTrackPostMST(dataReq, conStr);

                if (!String.IsNullOrEmpty(transy))
                {
                    var reqPostMst = new AUDITPOSTMSTReq
                    {
                        SQNO       = dataReq.sqno,
                        DEPCODEOL  = objMst != null? objMst.DEPCODEOL:null,
                        COMPANY    = dataReq.company,
                        LEADERCODE = objMst != null ? objMst.LEADERCODE:null,
                        LEADERNAME = objMst != null ? objMst.LEADERNAME:null,
                        AREACODE   = objMst != null ? objMst.AREACODE:null,
                        AREANAME   = null,
                        ASSETNO    = dataReq.assetno,
                        FINDY      = dataReq.findy,
                        PCODE      = dataReq.pcode,
                        PNAME      = dataReq.pname,
                        UCODE      = dataReq.inpid,
                        PFLAG      = dataReq.pflag,
                        MEMO1      = dataReq.memo1
                    };

                    if (!String.IsNullOrEmpty(dataReq.transy) && dataReq.transy.ToLower().Equals("y"))
                    {
                        var stSave = UpdateAuditPostMST(reqPostMst, conStr);
                        if (stSave.Result != 0)
                        {
                            flag = "2";
                            msg  = "บันทึกผลการตรวจสอบเรียบร้อยแล้ว";
                        }
                        else
                        {
                            msg = "พบข้อผิดพลาดจากการบันทึกผลการตรวจสอบ";
                        }
                    }
                    else
                    {
                        msg = "ไม่บันทึกผลการตรวจสอบ";
                    }

                    dataReq.remark = msg;
                    dataReq.flag   = flag;
                }
                dataReq.transy = !String.IsNullOrEmpty(dataReq.transy) ? dataReq.transy.ToUpper() : dataReq.transy;
                UpdateAuditTrackPostMST(dataReq, conStr);
            }
            catch (Exception ex)
            {
                res._result._code    = "500 ";
                res._result._message = ex.Message;
                res._result._status  = "Internal Server Error";
            }

            return(res);
        }
Exemplo n.º 24
0
 public Task <int> UpdateAuditPostMST(AUDITPOSTMSTReq dataReq, string conStr = null)
 {
     return(Task.Run(() => ASSETKKF_ADO.Mssql.Audit.AUDITPOSTMSTAdo.GetInstant().saveAUDITPOSTMST(dataReq, null, conStr)));
 }
Exemplo n.º 25
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);
        }
Exemplo n.º 26
0
        private AuditDuplicateRes savemst2tmp(AuditPostReq dataReq, AuditDuplicateRes res, string conStr = null)
        {
            try
            {
                int action         = 0;
                var lstNoDuplicate = ASSETKKF_ADO.Mssql.Audit.AUDITPOSTMSTAdo.GetInstant().getNoDuplicateAll(dataReq, null, null, conStr);
                var lstDuplicate   = ASSETKKF_ADO.Mssql.Audit.AUDITPOSTMSTAdo.GetInstant().getDuplicateAll(dataReq, null, null, conStr);

                if (lstNoDuplicate != null && lstNoDuplicate.Count > 0)
                {
                    action += 1;
                    lstNoDuplicate.ForEach(c => {
                        AUDITPOSTMSTReq req1 = new AUDITPOSTMSTReq()
                        {
                            MODE    = "deleteByAssetno",
                            SQNO    = c.SQNO,
                            COMPANY = c.COMPANY,
                            ASSETNO = c.ASSETNO,
                            UCODE   = c.INPID,
                            FINDY   = c.FINDY,
                            PCODE   = c.PCODE,
                            PNAME   = c.PNAME
                        };
                        ASSETKKF_ADO.Mssql.Audit.AUDITPOSTMSTTOTEMPAdo.GetInstant().SP_AUDITPOSTMSTTOTEMP(req1, null, null, conStr);

                        var req2  = req1;
                        req2.MODE = "addByAssetnoInpid";
                        ASSETKKF_ADO.Mssql.Audit.AUDITPOSTMSTTOTEMPAdo.GetInstant().SP_AUDITPOSTMSTTOTEMP(req2, null, null, conStr);
                    });
                }

                if (lstDuplicate != null && lstDuplicate.Count > 0)
                {
                    action += 1;
                    lstDuplicate.ForEach(c => {
                        AUDITPOSTMSTReq req3 = new AUDITPOSTMSTReq()
                        {
                            MODE    = "deleteByAssetno",
                            SQNO    = c.SQNO,
                            COMPANY = c.COMPANY,
                            ASSETNO = c.ASSETNO,
                            UCODE   = c.INPID,
                            FINDY   = c.FINDY,
                            PCODE   = c.PCODE,
                            PNAME   = c.PNAME
                        };
                        ASSETKKF_ADO.Mssql.Audit.AUDITPOSTMSTTOTEMPAdo.GetInstant().SP_AUDITPOSTMSTTOTEMP(req3, null, null, conStr);

                        var req4  = req3;
                        req4.MODE = "addByAssetnoInpid";
                        ASSETKKF_ADO.Mssql.Audit.AUDITPOSTMSTTOTEMPAdo.GetInstant().SP_AUDITPOSTMSTTOTEMP(req4, null, null, conStr);
                    });
                }

                if (action > 0)
                {
                    AUDITPOSTMSTReq req5 = new AUDITPOSTMSTReq()
                    {
                        MODE    = "updateSNDST",
                        SQNO    = dataReq.SQNO,
                        COMPANY = dataReq.COMPANY,
                        UCODE   = dataReq.UCODE
                    };
                    ASSETKKF_ADO.Mssql.Audit.AUDITPOSTMSTTOTEMPAdo.GetInstant().SP_AUDITPOSTMSTTOTEMP(req5, null, null, conStr);
                }

                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";
            }
            finally
            {
                var lstPostMST = ASSETKKF_ADO.Mssql.Audit.AUDITPOSTMSTAdo.GetInstant().getPOSTMSTDuplicate(dataReq, null, null, conStr);
                res.POSTMSTDuplicateLST = lstPostMST;

                var lstPostTRN = ASSETKKF_ADO.Mssql.Audit.AUDITPOSTTRNAdo.GetInstant().getPOSTTRNDuplicate(dataReq, null, null, conStr);
                res.POSTTRNDuplicateLST = lstPostTRN;
            }


            return(res);
        }
Exemplo n.º 27
0
        private AuditCompRes depedittrn(AuditPostReq dataReq, AuditCompRes res, string conStr = null)
        {
            try
            {
                AUDITPOSTTRNReq req = new AUDITPOSTTRNReq()
                {
                    SQNO       = dataReq.SQNO,
                    COMPANY    = dataReq.COMPANY,
                    ASSETNO    = dataReq.ASSETNO,
                    INPID      = dataReq.INPID,
                    UCODE      = dataReq.UCODE,
                    FLAG       = "",
                    MEMO1      = dataReq.MEMO1,
                    ASSETNAME  = dataReq.ASSETNAME,
                    OFFICECODE = dataReq.OFFICECODE,
                    OFNAME     = dataReq.OFNAME,
                    ASSETNONEW = dataReq.ASSETNONEW,
                    MODE       = "EDITNEW"
                };


                var updateAuditPost = ASSETKKF_ADO.Mssql.Asset.AUDITPOSTTRNADO.GetInstant().addAUDITPOSTTRN(req, null, conStr);

                Thread.Sleep(1000);

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

                var updateSNDST = ASSETKKF_ADO.Mssql.Audit.AUDITPOSTTRNAdo.GetInstant().SP_AUDITPOSTTRNPHONE(req1, null, null, conStr);
                Thread.Sleep(1000);


                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";
            }
            finally
            {
                AuditPostReq req = new AuditPostReq()
                {
                    SQNO    = dataReq.SQNO,
                    COMPANY = dataReq.COMPANY,
                    filter  = dataReq.filter
                };
                var lst = ASSETKKF_ADO.Mssql.Audit.AUDITPOSTMSTTODEPAdo.GetInstant().getDataToClear(req, null, null, conStr);
                res.AUDITPOSTMSTTODEPLST = lst;

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


            return(res);
        }
Exemplo n.º 28
0
        protected override void ExecuteChild(ASSETASSETNOReq dataReq, ResponseAPI dataRes)
        {
            var res = new ASSETKKF_MODEL.Response.Asset.ASSETASSETNORes();
            try
            {
                DBMode = dataReq.DBMode;
                res._result.ServerAddr = ConnectionString();
                res._result.DBMode = DBMode;

                var reqProblem = new STProblemReq
                {
                    Company = dataReq.COMPANY
                };
                var lstProblem = ASSETKKF_ADO.Mssql.Asset.STProblemADO.GetInstant().Search(reqProblem, null, conString);
                var objProblem = lstProblem.FirstOrDefault();

                var reqPostMst = new AUDITPOSTMSTReq
                {
                    SQNO = dataReq.SQNO,
                    DEPCODEOL = dataReq.DEPCODEOL,
                    COMPANY = dataReq.COMPANY,
                    LEADERCODE = dataReq.LEADERCODE,
                    LEADERNAME = dataReq.LEADERNAME,
                    AREACODE = dataReq.AREACODE,
                    AREANAME = dataReq.AREANAME,
                    ASSETNO = dataReq.ASSETNO,
                    FINDY = objProblem.FINDY,
                    PCODE = objProblem.Pcode,
                    PNAME = objProblem.Pname,
                    UCODE = dataReq.UCODE,
                    isdept = dataReq.isdept


                };

                var reqPostChk = new AuditPostCheckReq
                {
                    SQNO = dataReq.SQNO,
                    DEPCODEOL = dataReq.DEPCODEOL,
                    COMPANY = dataReq.COMPANY,
                    LEADERCODE = dataReq.LEADERCODE,
                    LEADERNAME = dataReq.LEADERNAME,
                    AREACODE = dataReq.AREACODE,
                    AREANAME = dataReq.AREANAME,
                    ASSETNO = dataReq.ASSETNO,
                    UCODE = dataReq.UCODE,
                    isdept = dataReq.isdept


                };

                var req1 = new ASSETKKF_MODEL.Request.Asset.AuditPostReq()
                {
                    SQNO = dataReq.SQNO,
                    DEPCODEOL = dataReq.DEPCODEOL,
                    COMPANY = dataReq.COMPANY,
                    LEADERCODE = dataReq.LEADERCODE,
                    AREACODE = dataReq.AREACODE,
                    UCODE = dataReq.UCODE,
                    isdept = dataReq.isdept
                };

                reqPostMst.MODE = "EDIT";
                //ASSETKKF_ADO.Mssql.Asset.AuditCutADO.GetInstant().updateAUDITPOSTMST(reqPostMst);
                var editAuditPost = System.Threading.Tasks.Task.Factory.StartNew(() => ASSETKKF_ADO.Mssql.Asset.AuditCutADO.GetInstant().updateAUDITPOSTMST(reqPostMst, null, conString));
                editAuditPost.Wait();

                //res.AUDITPOSTMSTWAITLST = ASSETKKF_ADO.Mssql.Asset.AuditCutADO.GetInstant().getAUDITPOSTMST(req1, "");
                //res.AUDITPOSTMSTCHECKEDLST = ASSETKKF_ADO.Mssql.Asset.AuditCutADO.GetInstant().getAUDITPOSTMST(req1, "Y");
                //res.AUDITPOSTTRNLST = ASSETKKF_ADO.Mssql.Asset.AuditCutADO.GetInstant().getAUDITPOSTTRN(req1);
                //var lstAUDITAssetNo = ASSETKKF_ADO.Mssql.Asset.AuditCutADO.GetInstant().checkAUDITAssetNo(reqPostChk);
                //res.AUDITPOSTMST = lstAUDITAssetNo.FirstOrDefault();

                var lstAUDITPOSTMST = ASSETKKF_ADO.Mssql.Asset.AuditCutADO.GetInstant().getAUDITPOSTMST(req1,null, null, conString);
                var lstAUDITPOSTTRN = ASSETKKF_ADO.Mssql.Asset.AuditCutADO.GetInstant().getAUDITPOSTTRN(req1, null, conString);

                res.AUDITPOSTTRNLST = lstAUDITPOSTTRN;
               // var lstWait = lstAUDITPOSTMST.Where(p => String.IsNullOrEmpty(p.PCODE)).ToList();
                var lstChecked = lstAUDITPOSTMST.Where(p => !String.IsNullOrEmpty(p.PCODE)).ToList();
                var lstWait = ASSETKKF_ADO.Mssql.Asset.AuditCutADO.GetInstant().getAUDITPOSTMST_WAIT(req1, null, null, conString);
                res.AUDITPOSTMSTWAITLST = lstWait;
                res.AUDITPOSTMSTCHECKEDLST = lstChecked;
                res.AUDITPOSTMSTNOPROBLEMLST = lstChecked.Where(x => x.PFLAG != "Y").ToList();
                res.AUDITPOSTMSTPROBLEMLST = lstChecked.Where(x => x.PFLAG == "Y").ToList();

                res.AUDITPOSTMST = lstAUDITPOSTMST.Where(x => x.INPID == dataReq.UCODE).FirstOrDefault();

                AuditSummaryReq reqSum = new AuditSummaryReq()
                {
                    Company = dataReq.COMPANY,
                    year = res.AUDITPOSTMST.YR.ToString(),
                    mn = res.AUDITPOSTMST.MN.ToString(),
                    sqno = dataReq.SQNO,
                    isdept = dataReq.isdept
                };
                //var lstSum = ASSETKKF_ADO.Mssql.Asset.DashboardADO.GetInstant().getInspectionByDEPMST(reqSum, null, conString);
                //res.DashboardInspectionLST = lstSum;


                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;
        }