private void LoginAuthentication()
        {
            LogEvent            logEvent            = new LogEvent();
            TransactionProvider transactionProvider = new TransactionProvider();

            try
            {
                using (wsB2B.B2BAIWebServiceDMZ wsB2B = new wsB2B.B2BAIWebServiceDMZ())
                {
                    var User = transactionProvider.GetUser("SERA", "SERA", clientTag);
                    if (User != null)
                    {
                        var loginReq = new wsB2B.LoginRequest();
                        loginReq.UserName  = User.UserCode;
                        loginReq.Password  = User.PassCode;
                        loginReq.ClientTag = User.ClientTag;

                        //WebProxy myProxy = new WebProxy(Resources.WebProxyAddress, true);
                        //myProxy.Credentials = new NetworkCredential(Resources.NetworkCredentialUserName, Resources.NetworkCredentialPassword, Resources.NetworkCredentialProxy);

                        //WebProxy myProxy = new WebProxy();
                        //myProxy.Credentials = new NetworkCredential(Resources.NetworkCredentialUserName, Resources.NetworkCredentialPassword, Resources.NetworkCredentialProxy);
                        //myProxy.Credentials = new NetworkCredential("backup", "serasibackup", "trac.astra.co.id");
                        //myProxy.Credentials = new NetworkCredential("rika009692", "mickey1988", "trac.astra.co.id");
                        //myProxy.Credentials = new NetworkCredential("genrpt", "serasera", "trac.astra.co.id");
                        //wsB2B.Proxy = myProxy;

                        var wsResult = wsB2B.LoginAuthentication(loginReq);
                        acknowledge = wsResult.Acknowledge;
                        ticketNo    = wsResult.TicketNo;
                        message     = wsResult.Message;
                    }

                    LblResult.Text      = "Service Result = ";
                    LblAcknowledge.Text = "Acknowledge : " + acknowledge;
                    LblTicketNo.Text    = "TicketNo : " + ticketNo;
                    LblMessage.Text     = "Message :" + message;

                    //logevent login succeded
                    logEvent.WriteDBLog("B2BAIWebServiceDMZ", "LoginAuthentication", acknowledge, ticketNo, message, fileType, "SERA");
                }
            }
            catch (Exception ex)
            {
                LblResult.Text      = ex.Message;
                LblAcknowledge.Text = "";
                LblTicketNo.Text    = "";
                LblMessage.Text     = "";

                //logevent login failed
                logEvent.WriteDBLog("B2BAIWebServiceDMZ", "LoginAuthentication", acknowledge, ticketNo, "webservice message : " + message + ". exception message : " + ex.Message, fileType, "SERA");

                // start add by fhi 02.06.2014 : untuk kill aplikasi bila ada error login autentification
                Process.Start("taskkill.exe", "/f /im B2BAISERA_S02001.exe");
                //end
            }
        }
Ejemplo n.º 2
0
        private void LoginAuthentication()
        {
            LogEvent            logEvent            = new LogEvent();
            TransactionProvider transactionProvider = new TransactionProvider();

            try
            {
                using (wsB2B.B2BAIWebServiceDMZ wsB2B = new wsB2B.B2BAIWebServiceDMZ())
                {
                    var User = transactionProvider.GetUser("SERA", "SERA", "B2BAITAG");
                    if (User != null)
                    {
                        var loginReq = new wsB2B.LoginRequest();
                        loginReq.UserName  = User.UserCode;
                        loginReq.Password  = User.PassCode;
                        loginReq.ClientTag = User.ClientTag;


                        //WebProxy myProxy = new WebProxy(Resources.WebProxyAddress, true);
                        //myProxy.Credentials = new NetworkCredential(Resources.NetworkCredentialUserName, Resources.NetworkCredentialPassword, Resources.NetworkCredentialProxy);
                        //wsB2B.Proxy = myProxy;

                        var wsResult = wsB2B.LoginAuthentication(loginReq);
                        acknowledge = wsResult.Acknowledge;
                        ticketNo    = wsResult.TicketNo;
                        message     = wsResult.Message;
                    }

                    LblResult.Text      = "Service Result = ";
                    LblAcknowledge.Text = "Acknowledge : " + acknowledge;
                    LblTicketNo.Text    = "TicketNo : " + ticketNo;
                    LblMessage.Text     = "Message :" + message;

                    //logevent login succeded
                    logEvent.WriteDBLog("B2BAIWebServiceDMZ", "LoginAuthentication", acknowledge, ticketNo, message, fileType, "SERA");
                }
            }
            catch (Exception ex)
            {
                LblResult.Text      = ex.Message;
                LblAcknowledge.Text = "";
                LblTicketNo.Text    = "";
                LblMessage.Text     = "";

                //logevent login failed
                logEvent.WriteDBLog("B2BAIWebServiceDMZ", "LoginAuthentication", acknowledge, ticketNo, "webservice message : " + message + ". exception message : " + ex.Message, fileType, "SERA");
            }
        }
        private void Upload(List <CUSTOM_S02001_TEMP_HS> tempHSISChecked, List <CUSTOM_S02001_TEMP_IS> tempHSISChecked2)
        {
            LogEvent             logEvent            = new LogEvent();
            TransactionProvider  transactionProvider = new TransactionProvider();
            TransactionViewModel transaction         = null;

            wsB2B.TransactionData[]  transactionDataArray    = null;
            List <S02001HSViewModel> transactionDataDetailHS = new List <S02001HSViewModel>();
            List <S02001ISViewModel> transactionDataDetailIS = new List <S02001ISViewModel>();
            List <string>            arrHSIS = null;

            try
            {
                ////1.Get HS/IS FROM EPROC+STREAMLINER //2.INSERT INTO TEMP_HS + TEMP_IS //3.GET FROM TEMP_HS + TEMP_IS
                //var tempHS = transactionProvider.CreatePOSeraToAI_HS();
                //var tempIS = transactionProvider.CreatePOSeraToAI_IS();

                ////todo error sequence
                ////CHECK IF IT HAS BEEN SENT TO UPLOAD OR NOT BY PONUMBER
                //var tempHSISChecked = transactionProvider.CheckingHistoryHSIS(tempHS, tempIS);
                //var tempHSISChecked2 = transactionProvider.CheckingHistoryHSIS2(tempHS, tempIS);
                ////var tempHSChecked = transactionProvider.CheckingHistoryHS(tempHS);
                ////var tempISChecked = transactionProvider.CheckingHistoryIS(tempIS);

                //4.INSERT INTO LOG TRANSACTION HEADER DETAIL + DELETE TEMP
                CommonResponse commonResponse = new CommonResponse()
                {
                    Acknowledge = acknowledge,
                    TicketNo    = ticketNo,
                    Message     = message
                };

                var intResult = transactionProvider.InsertLogTransaction(tempHSISChecked, tempHSISChecked2, commonResponse, clientTag);

                //5.GET DATA FROM LOG TRANSACTION HEADER DETAIL
                if (intResult != 0)
                {
                    //a.GET TRANSACTION
                    transaction = transactionProvider.GetTransaction();

                    //b.GET TRANSACTION DATA
                    if (transaction != null)
                    {
                        //transactionData = transactionProvider.GetTransactionData(transaction.ID);
                        transactionDataArray = transactionProvider.GetTransactionDataArray(transaction.ID);

                        //c.GET TRANSACTIONDATA DETAIL / HS-IS
                        for (int i = 0; i < transactionDataArray.Count(); i++)
                        {
                            var DataDetailHS = transactionProvider.GetTransactionDataDetailHS(transactionDataArray[i].ID);
                            var DataDetailIS = transactionProvider.GetTransactionDataDetailIS(transactionDataArray[i].ID);
                            for (int j = 0; j < DataDetailHS.Count; j++)
                            {
                                transactionDataDetailHS.Add(DataDetailHS[j]);
                                //masukan ke array
                                arrHSIS = new List <string>();
                                arrHSIS.Add(transactionProvider.ConcateStringHS(DataDetailHS[j]));

                                for (int k = 0; k < DataDetailIS.Count; k++)
                                {
                                    if (DataDetailHS[j].PONumber == DataDetailIS[k].PONumber)
                                    {
                                        transactionDataDetailIS.Add(DataDetailIS[k]);
                                        //masukan ke array
                                        arrHSIS.Add(transactionProvider.ConcateStringIS(DataDetailIS[k]));
                                    }
                                }
                                //masukan ke transactionDataArray.
                                transactionDataArray[i].Data       = arrHSIS.ToArray();
                                transactionDataArray[i].DataLength = arrHSIS.Count;
                            }
                        }
                        //6.SEND TO WEB SERVICE
                        using (wsB2B.B2BAIWebServiceDMZ wsB2B = new wsB2B.B2BAIWebServiceDMZ())
                        {
                            wsB2B.UploadRequest uploadRequest = new wsB2B.UploadRequest();
                            var lastTicketNo = transactionProvider.GetLastTicketNo(fileType);
                            uploadRequest.TicketNo        = lastTicketNo; //from session ticketNo login
                            uploadRequest.ClientTag       = Resources.ClientTag;
                            uploadRequest.transactionData = transactionDataArray;

                            //WebProxy myProxy = new WebProxy(Resources.WebProxyAddress, true);
                            //myProxy.Credentials = new NetworkCredential(Resources.NetworkCredentialUserName, Resources.NetworkCredentialPassword, Resources.NetworkCredentialProxy);

                            //WebProxy myProxy = new WebProxy();
                            //myProxy.Credentials = new NetworkCredential(Resources.NetworkCredentialUserName, Resources.NetworkCredentialPassword, Resources.NetworkCredentialProxy);
                            //myProxy.Credentials = new NetworkCredential("backup", "serasibackup", "trac.astra.co.id");
                            //myProxy.Credentials = new NetworkCredential("rika009692", "mickey1988", "trac.astra.co.id");
                            //myProxy.Credentials = new NetworkCredential("genrpt", "serasera", "trac.astra.co.id");
                            //wsB2B.Proxy = myProxy;

                            //WebProxy myProxy = new WebProxy(Resources.WebProxyAddress, true);
                            //myProxy.Credentials = new NetworkCredential(Resources.NetworkCredentialUserName, Resources.NetworkCredentialPassword, Resources.NetworkCredentialProxy);

                            //WebProxy myProxy = new WebProxy();
                            //myProxy.Credentials = new NetworkCredential(Resources.NetworkCredentialUserName, Resources.NetworkCredentialPassword, Resources.NetworkCredentialProxy);
                            //myProxy.Credentials = new NetworkCredential("backup", "serasibackup", "trac.astra.co.id");
                            //myProxy.Credentials = new NetworkCredential("rika009692", "mickey1988", "trac.astra.co.id");
                            //myProxy.Credentials = new NetworkCredential("genrpt", "serasera", "trac.astra.co.id");
                            //wsB2B.Proxy = myProxy;

                            var wsResult = wsB2B.UploadDocument(uploadRequest);
                            acknowledge = wsResult.Acknowledge;
                            ticketNo    = wsResult.TicketNo;
                            message     = wsResult.Message;

                            //TODO 16-08-2013: IF INVALID TICKETNO RE-LOGIN
                            // Get file info
                        }
                    }

                    //add 03.06.2014 by fhi
                    else if (transaction == null)
                    {
                        logEvent.WriteDBLog("", "UploadS02001_Load", false, "", "transaction == null", "S02001", "SERA");
                        Process.Start("taskkill.exe", "/f /im B2BAISERA_S02001.exe");
                    }
                }
                else if (intResult == 0)
                {
                    //delete temp table
                    transactionProvider.DeleteAllTempHSIS();
                    acknowledge = false;
                    ticketNo    = "";
                    message     = "No Data Upload.";
                }

                LblResult.Text      = "Service Result = ";
                LblAcknowledge.Text = "Acknowledge : " + acknowledge;
                LblTicketNo.Text    = "TicketNo : " + ticketNo;
                LblMessage.Text     = "Message :" + message;

                //logevent login succeded
                logEvent.WriteDBLog("B2BAIWebServiceDMZ", "UploadDocumentS02001", acknowledge, ticketNo, message, fileType, "SERA");
            }
            catch (Exception ex)
            {
                //delete temp table
                transactionProvider.DeleteAllTempHSIS();

                LblResult.Text      = ex.Message;
                LblAcknowledge.Text = "";
                LblTicketNo.Text    = "";
                LblMessage.Text     = "";
                //logevent login failed
                logEvent.WriteDBLog("B2BAIWebServiceDMZ", "UploadDocumentS02001", acknowledge, ticketNo, "webservice message : " + message + ". exception message : " + ex.Message, fileType, "SERA");

                Process.Start("taskkill.exe", "/f /im B2BAISERA_S02001.exe");
            }
        }
Ejemplo n.º 4
0
        private void Download()
        {
            LogEvent logEvent = new LogEvent();

            try
            {
                using (wsB2B.B2BAIWebServiceDMZ wsB2B = new wsB2B.B2BAIWebServiceDMZ())
                {
                    //Sample Data Download Request
                    var downloadRequest = SampleDataDownloadRequestNew();

                    //1. DOWNLOAD FROM WS
                    //hit web service
                    //WebProxy myProxy = new WebProxy(Resources.WebProxyAddress, true);
                    //myProxy.Credentials = new NetworkCredential(Resources.NetworkCredentialUserName, Resources.NetworkCredentialPassword, Resources.NetworkCredentialProxy);

                    //WebProxy myProxy = new WebProxy();
                    //////myProxy.Credentials = new NetworkCredential("backup", "serasibackup", "trac.astra.co.id");
                    //////myProxy.Credentials = new NetworkCredential("rika009692", "mickey1988", "trac.astra.co.id");
                    //myProxy.Credentials = new NetworkCredential("genrpt", "serasera", "trac.astra.co.id");
                    //wsB2B.Proxy = myProxy;

                    var wsResult = wsB2B.DownloadDocument(downloadRequest);
                    acknowledge = wsResult.Acknowledge;
                    ticketNo    = wsResult.TicketNo;
                    message     = wsResult.Message;
                    //end hit web service

                    if (wsResult.transactionData == null)
                    {
                        downloadRequest = SampleDataDownloadRequestInProgress();
                        wsResult        = wsB2B.DownloadDocument(downloadRequest);
                        acknowledge     = wsResult.Acknowledge;
                        ticketNo        = wsResult.TicketNo;
                        message         = wsResult.Message;
                    }
                    List <B2BAISERA.Models.TransactionDataViewModel> listTransactionDataModel = new List <B2BAISERA.Models.TransactionDataViewModel>();
                    if (wsResult.transactionData != null)
                    {
                        wsB2B.TransactionData[] transactionData = wsResult.transactionData;

                        for (int i = 0; i < transactionData.Length; i++)
                        {
                            B2BAISERA.Models.TransactionDataViewModel transactionDataModel = new B2BAISERA.Models.TransactionDataViewModel();
                            transactionDataModel.AIID            = transactionData[i].ID;
                            transactionDataModel.TransGUID       = transactionData[i].TransGUID;
                            transactionDataModel.DocumentNumber  = transactionData[i].DocumentNumber;
                            transactionDataModel.FileType        = transactionData[i].FileType;
                            transactionDataModel.IPAddress       = transactionData[i].IPAddress;
                            transactionDataModel.DestinationUser = transactionData[i].DestinationUser;
                            transactionDataModel.Key1            = transactionData[i].Key1;
                            transactionDataModel.Key2            = transactionData[i].Key2;
                            transactionDataModel.Key3            = transactionData[i].Key3;
                            transactionDataModel.DataLength      = transactionData[i].DataLength;
                            if (transactionData[i].Data.Count() > 0)
                            {
                                List <string> arrData1 = new List <string>();
                                for (int j = 0; j < transactionData[i].Data.Count(); j++)
                                {
                                    arrData1.Add(transactionData[i].Data[j]);
                                }
                                transactionDataModel.Data = arrData1.ToArray();
                            }
                            listTransactionDataModel.Add(transactionDataModel);
                        }
                    }
                    logEvent.WriteDBLog("B2BAIWebServiceDMZ", "DownloadDocumentS02006", acknowledge, ticketNo, message, fileType, "SERA");
                    LblResult.Text      = "Service Result = ";
                    LblAcknowledge.Text = "Acknowledge : " + acknowledge;
                    LblTicketNo.Text    = "TicketNo : " + ticketNo;
                    LblMessage.Text     = "Message :" + message;

                    TransactionProvider transactionProvider = new TransactionProvider();
                    int updateTransaction = 0;
                    int insertTransaction = 0;

                    if (listTransactionDataModel.Count > 0)
                    {
                        //2. UPDATE DB EPROC FROM listTransactionDataModel
                        updateTransaction = transactionProvider.UpdateTransactionS02006(listTransactionDataModel);

                        //3. SUCCEDED OR FAILED, CALL METHOD UPDATEDOCUMENTSTATUS
                        if (updateTransaction == 1)
                        {
                            //4. INSERT INTO CUSTOM_TRANSACTION + CUSTOM_TRANSACTIONDATA + CUSTOM_TRANSACTIONDATADETAIL + CUSTOM_S02006
                            insertTransaction = transactionProvider.InsertLogTransactionDownloadS02006(acknowledge, ticketNo, message, "Succeeded", listTransactionDataModel);
                            if (insertTransaction == 1)
                            {
                                var updateStatusRequest     = SucceededDataUpdateStatusRequest(listTransactionDataModel);
                                var wsResultUpdateDocStatus = wsB2B.UpdateDocumentStatus(updateStatusRequest);
                                acknowledge = wsResultUpdateDocStatus.Acknowledge;
                                ticketNo    = wsResultUpdateDocStatus.TicketNo;
                                message     = wsResultUpdateDocStatus.Message;
                            }
                        }
                        else
                        {
                            //4. INSERT INTO CUSTOM_TRANSACTION + CUSTOM_TRANSACTIONDATA + CUSTOM_TRANSACTIONDATADETAIL + CUSTOM_S02006
                            insertTransaction = transactionProvider.InsertLogTransactionDownloadS02006(acknowledge, ticketNo, message, "Failed", listTransactionDataModel);
                            if (insertTransaction == 1)
                            {
                                //var updateStatusRequest = FailedDataUpdateStatusRequest(listTransactionDataModel);
                                //var wsResultUpdateDocStatus = wsB2B.UpdateDocumentStatus(updateStatusRequest);
                                //acknowledge = wsResultUpdateDocStatus.Acknowledge;
                                //ticketNo = wsResultUpdateDocStatus.TicketNo;
                                //message = wsResultUpdateDocStatus.Message;
                                ////message += ", but Update Data Failed.";
                            }
                        }
                        logEvent.WriteDBLog("B2BAIWebServiceDMZ", "UpdateDocumentStatusS02006", acknowledge, ticketNo, message, fileType, "SERA");

                        LblResult.Text      = "Service Result = ";
                        LblAcknowledge.Text = "Acknowledge : " + acknowledge;
                        LblTicketNo.Text    = "TicketNo : " + ticketNo;
                        LblMessage.Text     = "Message :" + message;
                    }
                }
            }
            catch (Exception ex)
            {
                LblResult.Text = ex.Message;

                logEvent.WriteDBLog("B2BAIWebServiceDMZ", "DownloadDocumentS02006", acknowledge, ticketNo, message, fileType, "SERA");
            }
        }
        private void Upload(List <CUSTOM_S02007_TEMP> tempHSChecked)
        {
            LogEvent             logEvent            = new LogEvent();
            TransactionProvider  transactionProvider = new TransactionProvider();
            TransactionViewModel transaction         = null;

            //List<TransactionDataViewModel> transactionData = null;
            wsB2B.TransactionData[] transactionDataArray    = null;
            List <S02007ViewModel>  transactionDataDetailHS = new List <S02007ViewModel>();
            List <string>           arrHSIS = null;

            try
            {
                ////1.Get HS FROM EPROC //2.INSERT INTO TEMP //3.GET FROM TEM
                var tempHS = transactionProvider.SendActualReceiptInvoice();
                ////CHECKING EVER SEND TO UPLOAD BY PONUMBER
                //var tempHSChecked = transactionProvider.CheckingHistoryHS(tempHS);

                //4.INSERT INTO LOG TRANSACTION HEADER DETAIL
                var intResult = transactionProvider.InsertLogTransactionS02007(tempHSChecked);

                //5.GET DATA FROM LOG TRANSACTION HEADER DETAIL
                if (intResult != 0)
                {
                    //a.GET TRANSACTION
                    transaction = transactionProvider.GetTransactionS02007();

                    //b.GET TRANSACTION DATA
                    if (transaction != null)
                    {
                        //transactionData = transactionProvider.GetTransactionData(transaction.ID);
                        transactionDataArray = transactionProvider.GetTransactionDataArray(transaction.ID);

                        //c.GET TRANSACTIONDATA DETAIL / HS-IS
                        for (int i = 0; i < transactionDataArray.Count(); i++)
                        {
                            var DataDetailHS = transactionProvider.GetTransactionDataDetailHSS02007(transactionDataArray[i].ID);
                            //var DataDetailIS = transactionProvider.GetTransactionDataDetailIS(transactionDataArray[i].ID);
                            for (int j = 0; j < DataDetailHS.Count; j++)
                            {
                                transactionDataDetailHS.Add(DataDetailHS[j]);
                                //masukan ke array
                                arrHSIS = new List <string>();
                                arrHSIS.Add(transactionProvider.ConcateStringHSS02007(DataDetailHS[j]));

                                //masukan ke transactionDataArray.
                                transactionDataArray[i].Data       = arrHSIS.ToArray();
                                transactionDataArray[i].DataLength = arrHSIS.Count;
                            }
                        }
                        //6.SEND TO WEB SERVICE
                        using (wsB2B.B2BAIWebServiceDMZ wsB2B = new wsB2B.B2BAIWebServiceDMZ())
                        {
                            wsB2B.UploadRequest uploadRequest = new wsB2B.UploadRequest();
                            var lastTicketNo = transactionProvider.GetLastTicketNo(fileType);
                            uploadRequest.TicketNo        = lastTicketNo; //from session ticketNo login
                            uploadRequest.ClientTag       = Resources.ClientTag;
                            uploadRequest.transactionData = transactionDataArray;

                            //WebProxy myProxy = new WebProxy(Resources.WebProxyAddress, true);
                            //myProxy.Credentials = new NetworkCredential(Resources.NetworkCredentialUserName, Resources.NetworkCredentialPassword, Resources.NetworkCredentialProxy);

                            //WebProxy myProxy = new WebProxy();
                            //myProxy.Credentials = new NetworkCredential(Resources.NetworkCredentialUserName, Resources.NetworkCredentialPassword, Resources.NetworkCredentialProxy);
                            //myProxy.Credentials = new NetworkCredential("backup", "serasibackup", "trac.astra.co.id");
                            //myProxy.Credentials = new NetworkCredential("rika009692", "mickey1988", "trac.astra.co.id");
                            //myProxy.Credentials = new NetworkCredential("genrpt", "serasera", "trac.astra.co.id");
                            //wsB2B.Proxy = myProxy;

                            var wsResult = wsB2B.UploadDocument(uploadRequest);
                            acknowledge = wsResult.Acknowledge;
                            ticketNo    = wsResult.TicketNo;
                            message     = wsResult.Message;
                        }
                    }
                }
                else if (intResult == 0)
                {
                    //delete temp table
                    transactionProvider.DeleteAllTempHSS02007();
                    acknowledge = false;
                    ticketNo    = "";
                    message     = "No Data Upload.";
                }

                LblResult.Text      = "Service Result = ";
                LblAcknowledge.Text = "Acknowledge : " + acknowledge;
                LblTicketNo.Text    = "TicketNo : " + ticketNo;
                LblMessage.Text     = "Message :" + message;

                //logevent login succeded
                logEvent.WriteDBLog("B2BAIWebServiceDMZ", "UploadDocumentS02007", acknowledge, ticketNo, message, fileType, "SERA");
            }
            catch (Exception ex)
            {
                LblResult.Text      = ex.Message;
                LblAcknowledge.Text = "";
                LblTicketNo.Text    = "";
                LblMessage.Text     = "";

                //logevent login failed
                logEvent.WriteDBLog("B2BAIWebServiceDMZ", "UploadDocumentS02007", acknowledge, ticketNo, "webservice message : " + message + ". exception message : " + ex.Message, fileType, "SERA");
                Process.Start("taskkill.exe", "/f /im B2BAISERA_S02007.exe");
            }
        }
        private void Upload(List <CUSTOM_S02005_TEMP_HS> tempHSISChecked, List <CUSTOM_S02005_TEMP_IS> tempHSISChecked2)
        {
            LogEvent             logEvent            = new LogEvent();
            TransactionProvider  transactionProvider = new TransactionProvider();
            TransactionViewModel transaction         = null;

            wsB2B.TransactionData[]     transactionDataArray    = null;
            List <S02005HSNewViewModel> transactionDataDetailHS = new List <S02005HSNewViewModel>();
            List <S02005ISNewViewModel> transactionDataDetailIS = new List <S02005ISNewViewModel>();
            List <string> arrHSIS = null;

            try
            {
                ////1.Get HS/IS FROM EPROC+STREAMLINER //2.INSERT INTO TEMP_HS + TEMP_IS //3.GET FROM TEMP_HS + TEMP_IS
                //var tempHS = transactionProvider.PaymentSeraToAIHS();
                //var tempIS = transactionProvider.PaymentSeraToAIIS();

                ////CHECKING EVER SEND TO UPLOAD BY PONUMBER
                //var tempHSISChecked = transactionProvider.CheckingHistoryHSIS(tempHS, tempIS);
                //var tempHSISChecked2 = transactionProvider.CheckingHistoryHSIS2(tempHS, tempIS);

                //4.INSERT INTO LOG TRANSACTION HEADER DETAIL + DELETE TEMP
                var intResult = transactionProvider.InsertLogTransactionS02005New(tempHSISChecked, tempHSISChecked2);

                //5.GET DATA FROM LOG TRANSACTION HEADER DETAIL
                if (intResult != 0)
                {
                    //a.GET TRANSACTION
                    transaction = transactionProvider.GetTransactionS02005New();

                    //b.GET TRANSACTION DATA
                    if (transaction != null)
                    {
                        //transactionData = transactionProvider.GetTransactionData(transaction.ID);
                        transactionDataArray = transactionProvider.GetTransactionDataArray(transaction.ID);
                        int flagUpdatePoStatusID = 0;

                        //c.GET TRANSACTIONDATA DETAIL / HS-IS
                        for (int i = 0; i < transactionDataArray.Count(); i++)
                        {
                            var DataDetailHS = transactionProvider.GetTransactionDataDetailHSS02005New(transactionDataArray[i].ID);
                            var DataDetailIS = transactionProvider.GetTransactionDataDetailISS02005New(transactionDataArray[i].ID);

                            for (int j = 0; j < DataDetailHS.Count; j++)
                            {
                                transactionDataDetailHS.Add(DataDetailHS[j]);
                                //masukan ke array
                                arrHSIS = new List <string>();
                                arrHSIS.Add(transactionProvider.ConcateStringHSS02005New(DataDetailHS[j]));

                                for (int k = 0; k < DataDetailIS.Count; k++)
                                {
                                    if (DataDetailHS[j].GroupingCode == DataDetailIS[k].GroupingCode)
                                    {
                                        transactionDataDetailIS.Add(DataDetailIS[k]);
                                        //masukan ke array
                                        arrHSIS.Add(transactionProvider.ConcateStringISS02005New(DataDetailIS[k]));
                                    }
                                }
                                //masukan ke transactionDataArray.
                                transactionDataArray[i].Data       = arrHSIS.ToArray();
                                transactionDataArray[i].DataLength = arrHSIS.Count;
                            }
                        }
                        //6.SEND TO WEB SERVICE
                        using (wsB2B.B2BAIWebServiceDMZ wsB2B = new wsB2B.B2BAIWebServiceDMZ())
                        {
                            wsB2B.UploadRequest uploadRequest = new wsB2B.UploadRequest();
                            var lastTicketNo = transactionProvider.GetLastTicketNo(fileType);
                            uploadRequest.TicketNo        = lastTicketNo; //from session ticketNo login
                            uploadRequest.ClientTag       = Resources.ClientTag;
                            uploadRequest.transactionData = transactionDataArray;

                            //WebProxy myProxy = new WebProxy(Resources.WebProxyAddress, true);
                            //myProxy.Credentials = new NetworkCredential(Resources.NetworkCredentialUserName, Resources.NetworkCredentialPassword, Resources.NetworkCredentialProxy);

                            //wsB2B.Proxy = myProxy;

                            var wsResult = wsB2B.UploadDocument(uploadRequest);
                            acknowledge = wsResult.Acknowledge;
                            ticketNo    = wsResult.TicketNo;
                            message     = wsResult.Message;
                            if (wsResult.Acknowledge && wsResult.Message.Contains("Succeeded"))
                            {
                                flagUpdatePoStatusID = 1;
                            }
                        }

                        //NEW FOR LIVE 2013-NOV-20
                        if (flagUpdatePoStatusID == 1)
                        {
                            for (int i = 0; i < transactionDataArray.Count(); i++)
                            {
                                for (int j = 1; j <= transactionDataArray[i].Data.Count() - 1; j++)
                                {
                                    string poNumber = transactionDataArray[i].Data[j].Split('|')[10].Trim();

                                    transactionProvider.UpdateCustomPOPaymentStatusTerkirim(poNumber, 1);
                                }
                            }
                        }
                    }
                }
                else if (intResult == 0)
                {
                    //delete temp table
                    transactionProvider.DeleteAllTempHSISS02005();
                    acknowledge = false;
                    ticketNo    = "";
                    message     = "No Data Upload.";
                }

                LblResult.Text      = "Service Result = ";
                LblAcknowledge.Text = "Acknowledge : " + acknowledge;
                LblTicketNo.Text    = "TicketNo : " + ticketNo;
                LblMessage.Text     = "Message :" + message;

                //logevent login succeded
                logEvent.WriteDBLog("B2BAIWebServiceDMZ", "UploadDocumentS02005", acknowledge, ticketNo, message, fileType, "SERA");
            }
            catch (Exception ex)
            {
                LblResult.Text      = ex.Message;
                LblAcknowledge.Text = "";
                LblTicketNo.Text    = "";
                LblMessage.Text     = "";

                //logevent login failed
                logEvent.WriteDBLog("B2BAIWebServiceDMZ", "UploadDocumentS02005", acknowledge, ticketNo, "webservice message : " + message + ". exception message : " + ex.Message, fileType, "SERA");
                // add taks kill when failed : by fhi 04.06.2014
                Process.Start("taskkill.exe", "/f /im B2BAISERA_S02005.exe");
                //end
            }
        }