Exemplo n.º 1
0
        public int InsertLogTransactionDownloadS02002(bool acknowledge, string ticketNo, string message, string transStatus, List <TransactionDataViewModel> listTransactionDataModel)
        {
            List <string> errorCatch2 = new List <string>();
            List <CUSTOM_DOWNLOAD_TRANSACTION>           listC1 = new List <CUSTOM_DOWNLOAD_TRANSACTION>();
            List <CUSTOM_DOWNLOAD_TRANSACTIONDATA>       listC2 = new List <CUSTOM_DOWNLOAD_TRANSACTIONDATA>();
            List <CUSTOM_DOWNLOAD_TRANSACTIONDATADETAIL> listC3 = new List <CUSTOM_DOWNLOAD_TRANSACTIONDATADETAIL>();
            List <CUSTOM_S02002> listC4 = new List <CUSTOM_S02002>();
            int result = 0;

            try
            {
                //insert into CUSTOM_DOWNLOAD_TRANSACTION
                CUSTOM_DOWNLOAD_TRANSACTION transaction = new CUSTOM_DOWNLOAD_TRANSACTION();
                transaction.Acknowledge = acknowledge;
                transaction.TicketNo    = ticketNo;
                transaction.Message     = message;
                EntityHelper.SetAuditForInsert(transaction, "SERA");
                entities.CUSTOM_DOWNLOAD_TRANSACTION.AddObject(transaction);
                listC1.Add(transaction);
                for (int i = 0; i < listTransactionDataModel.Count; i++)
                {
                    try
                    {
                        //insert into CUSTOM_DOWNLOAD_TRANSACTIONDATA
                        CUSTOM_DOWNLOAD_TRANSACTIONDATA transactionData = new CUSTOM_DOWNLOAD_TRANSACTIONDATA();
                        transactionData.CUSTOM_DOWNLOAD_TRANSACTION = transaction;
                        transactionData.AIID            = listTransactionDataModel[i].AIID;
                        transactionData.TransGUID       = listTransactionDataModel[i].TransGUID;
                        transactionData.DocumentNumber  = listTransactionDataModel[i].DocumentNumber;
                        transactionData.FileType        = listTransactionDataModel[i].FileType;
                        transactionData.IPAddress       = listTransactionDataModel[i].IPAddress;
                        transactionData.DestinationUser = listTransactionDataModel[i].DestinationUser;
                        transactionData.Key1            = listTransactionDataModel[i].Key1;
                        transactionData.Key2            = listTransactionDataModel[i].Key2;
                        transactionData.Key3            = listTransactionDataModel[i].Key3;
                        transactionData.DataLength      = listTransactionDataModel[i].DataLength;
                        transactionData.TransStatus     = transStatus;
                        EntityHelper.SetAuditForInsert(transactionData, "SERA");
                        entities.CUSTOM_DOWNLOAD_TRANSACTIONDATA.AddObject(transactionData);
                        listC2.Add(transactionData);

                        S02002ViewModel modelHSSO2002 = new S02002ViewModel();
                        S02002ViewModel modelISSO2002 = new S02002ViewModel();
                        for (int j = 0; j < listTransactionDataModel[i].Data.Length; j++)
                        {
                            //switch (j)
                            //{
                            //    case 0:
                            //        modelHSSO2002 = SplitStringHSS02002(listTransactionDataModel[i].Data[j]);
                            //        break;
                            //    case 1:
                            //        modelISSO2002 = SplitStringISS02002(listTransactionDataModel[i].Data[j]);
                            //        break;
                            //    default:
                            //        break;
                            //}
                            if (listTransactionDataModel[i].Data[j].Split('|')[0].Trim().Contains("HS"))
                            {
                                modelHSSO2002 = SplitStringHSS02002(listTransactionDataModel[i].Data[j]);
                            }
                            else if (listTransactionDataModel[i].Data[j].Split('|')[0].Trim().Contains("IS"))
                            {
                                modelISSO2002 = SplitStringISS02002(listTransactionDataModel[i].Data[j]);
                            }
                            //insert into CUSTOM_DOWNLOAD_TRANSACTIONDATADETAIL
                            CUSTOM_DOWNLOAD_TRANSACTIONDATADETAIL transactionDataDetail = new CUSTOM_DOWNLOAD_TRANSACTIONDATADETAIL();
                            transactionDataDetail.CUSTOM_DOWNLOAD_TRANSACTIONDATA = transactionData;
                            transactionDataDetail.Data = listTransactionDataModel[i].Data[j];
                            entities.CUSTOM_DOWNLOAD_TRANSACTIONDATADETAIL.AddObject(transactionDataDetail);
                            listC3.Add(transactionDataDetail);
                        }

                        //insert into CUSTOM_S02002 FOR HS
                        if (!string.IsNullOrEmpty(modelHSSO2002.PONumber))
                        {
                            CUSTOM_S02002 s02002 = new CUSTOM_S02002();
                            s02002.CUSTOM_DOWNLOAD_TRANSACTIONDATA = transactionData;
                            s02002.PONumber                = modelHSSO2002.PONumber;
                            s02002.VersionPOSERA           = modelHSSO2002.VersionPOSERA;
                            s02002.DataVersion             = modelHSSO2002.DataVersion;
                            s02002.StatusPOSERA            = modelHSSO2002.StatusPOSERA;
                            s02002.RejectRevisedPOSERA     = modelHSSO2002.RejectRevisedPOSERA;
                            s02002.DocumentNo              = modelHSSO2002.DocumentNo;
                            s02002.AIMaterialNumber        = modelHSSO2002.AIMaterialNumber;
                            s02002.SERAMaterialNumber      = modelHSSO2002.SERAMaterialNumber;
                            s02002.SERAMaterialDescription = modelHSSO2002.SERAMaterialDescription;
                            s02002.AIColor     = modelHSSO2002.AIColor;
                            s02002.SERAColor   = modelHSSO2002.SERAColor;
                            s02002.QuotationNo = modelHSSO2002.QuotationNo;
                            if (modelISSO2002 != null)
                            {
                                s02002.SalesOrderNo          = modelISSO2002.SalesOrderNo;
                                s02002.SalesOrderStatus      = modelISSO2002.SalesOrderStatus;
                                s02002.DPPByVendor           = modelISSO2002.DPPByVendor;
                                s02002.PPNByVendor           = modelISSO2002.PPNByVendor;
                                s02002.BBNPriceByVendor      = modelISSO2002.BBNPriceByVendor;
                                s02002.Currency              = modelISSO2002.Currency;
                                s02002.ChassisNumberByVendor = modelISSO2002.ChassisNumberByVendor;
                                s02002.MachineNumberByVendor = modelISSO2002.MachineNumberByVendor;
                                s02002.CBUCKD                 = modelISSO2002.CBUCKD;
                                s02002.Year                   = modelISSO2002.Year;
                                s02002.FactureDONumber        = modelISSO2002.FactureDONumber;
                                s02002.BillingStatus          = modelISSO2002.BillingStatus;
                                s02002.FactureDODate          = modelISSO2002.FactureDODate;
                                s02002.NoFakturKendaraan      = modelISSO2002.NoFakturKendaraan;
                                s02002.TanggalFakturKendaraan = modelISSO2002.TanggalFakturKendaraan;
                                s02002.CancellationReason     = modelISSO2002.CancellationReason;
                                s02002.ActualDateDeliveryUnit = modelISSO2002.ActualDateDeliveryUnit;
                                s02002.BSTKBNo                = modelISSO2002.BSTKBNo;
                                s02002.LicensePlateByVendor   = modelISSO2002.LicensePlateByVendor;
                                s02002.STNKDateByVendor       = modelISSO2002.STNKDateByVendor;
                                s02002.RevisiSTNK             = modelISSO2002.RevisiSTNK;
                                s02002.NoSertifikat           = modelISSO2002.NoSertifikat;
                                s02002.TglSertifikat          = modelISSO2002.TglSertifikat;
                                s02002.NoFormulirA            = modelISSO2002.NoFormulirA;
                                s02002.TglFormulirA           = modelISSO2002.TglFormulirA;
                                s02002.NoSertifikatRegUjiTipe = modelISSO2002.NoSertifikatRegUjiTipe;
                                s02002.ActualDeliveryBPKBDate = modelISSO2002.ActualDeliveryBPKBDate;
                                s02002.NamaPenerima           = modelISSO2002.NamaPenerima;
                                s02002.AlamatPenerima         = modelISSO2002.AlamatPenerima;
                                s02002.BPKBNumber             = modelISSO2002.BPKBNumber;
                                s02002.RemarksBPKB            = modelISSO2002.RemarksBPKB;
                                s02002.RevisiBPKB             = modelISSO2002.RevisiBPKB;
                            }
                            //start add by fhi 18.06.2014 : set owner
                            s02002.dibuatOleh    = "system";
                            s02002.dibuatTanggal = DateTime.Now;
                            s02002.diubahOleh    = "system";
                            s02002.diubahTanggal = DateTime.Now;
                            //end
                            entities.CUSTOM_S02002.AddObject(s02002);
                            listC4.Add(s02002);
                        }
                    }
                    catch (Exception ex)
                    {
                        errorCatch2.Add(i + " | " + listTransactionDataModel[i].DocumentNumber + " | " + ex.Message);
                    }
                }
                entities.CommandTimeout = 50000;
                entities.SaveChanges();
                result = 1;
            }
            catch (Exception ex)
            {
                result = 0;
                throw ex;
            }
            return(result);
        }
Exemplo n.º 2
0
        public int InsertLogTransactionDownloadS02008(bool acknowledge, string ticketNo, string message, string transStatus, List <TransactionDataViewModel> listTransactionDataModel)
        {
            int result = 0;

            try
            {
                //insert into CUSTOM_DOWNLOAD_TRANSACTION
                CUSTOM_DOWNLOAD_TRANSACTION transaction = new CUSTOM_DOWNLOAD_TRANSACTION();
                transaction.Acknowledge = acknowledge;
                transaction.TicketNo    = ticketNo;
                transaction.Message     = message;
                EntityHelper.SetAuditForInsert(transaction, "SERA");
                entities.CUSTOM_DOWNLOAD_TRANSACTION.AddObject(transaction);

                for (int i = 0; i < listTransactionDataModel.Count; i++)
                {
                    //insert into CUSTOM_DOWNLOAD_TRANSACTIONDATA
                    CUSTOM_DOWNLOAD_TRANSACTIONDATA transactionData = new CUSTOM_DOWNLOAD_TRANSACTIONDATA();
                    transactionData.CUSTOM_DOWNLOAD_TRANSACTION = transaction;
                    transactionData.AIID            = listTransactionDataModel[i].AIID;
                    transactionData.TransGUID       = listTransactionDataModel[i].TransGUID;
                    transactionData.DocumentNumber  = listTransactionDataModel[i].DocumentNumber;
                    transactionData.FileType        = listTransactionDataModel[i].FileType;
                    transactionData.IPAddress       = listTransactionDataModel[i].IPAddress;
                    transactionData.DestinationUser = listTransactionDataModel[i].DestinationUser;
                    transactionData.Key1            = listTransactionDataModel[i].Key1;
                    transactionData.Key2            = listTransactionDataModel[i].Key2;
                    transactionData.Key3            = listTransactionDataModel[i].Key3;
                    transactionData.DataLength      = listTransactionDataModel[i].DataLength;
                    //transactionData.RowStatus = "";
                    EntityHelper.SetAuditForInsert(transactionData, "SERA");
                    entities.CUSTOM_DOWNLOAD_TRANSACTIONDATA.AddObject(transactionData);

                    for (int j = 0; j < listTransactionDataModel[i].Data.Length; j++)
                    {
                        //SPLITSTRING
                        S02008ViewModel modelSO2008 = SplitStringS02008(listTransactionDataModel[i].Data[j]);

                        if (modelSO2008 != null)
                        {
                            //insert into CUSTOM_S02008
                            CUSTOM_S02008 s02008 = new CUSTOM_S02008();
                            s02008.CUSTOM_DOWNLOAD_TRANSACTIONDATA = transactionData;
                            s02008.PONumber                        = modelSO2008.PONumber;
                            s02008.VersionPOSERA                   = modelSO2008.VersionPOSERA;
                            s02008.DataVersion                     = modelSO2008.DataVersion;
                            s02008.SalesOrderNo                    = modelSO2008.SalesOrderNo;
                            s02008.ChassisNumberByVendor           = modelSO2008.ChassisNumberByVendor;
                            s02008.DateEntryCarrosserieAccessories = modelSO2008.DateEntryCarrosserieAccessories;
                            //start add by fhi 18.06.2014 : set owner
                            s02008.dibuatOleh    = "system";
                            s02008.dibuatTanggal = DateTime.Now;
                            s02008.diubahOleh    = "system";
                            s02008.diubahTanggal = DateTime.Now;
                            //end
                            entities.CUSTOM_S02008.AddObject(s02008);
                        }

                        //insert into CUSTOM_DOWNLOAD_TRANSACTIONDATADETAIL
                        CUSTOM_DOWNLOAD_TRANSACTIONDATADETAIL transactionDataDetail = new CUSTOM_DOWNLOAD_TRANSACTIONDATADETAIL();
                        transactionDataDetail.CUSTOM_DOWNLOAD_TRANSACTIONDATA = transactionData;
                        transactionDataDetail.Data = listTransactionDataModel[i].Data[j];
                        entities.CUSTOM_DOWNLOAD_TRANSACTIONDATADETAIL.AddObject(transactionDataDetail);
                    }
                }
                entities.SaveChanges();
                result = 1;
            }
            catch (Exception ex)
            {
                result = 0;
                throw ex;
            }
            return(result);
        }
Exemplo n.º 3
0
        public int InsertLogTransactionDownloadS02006(bool acknowledge, string ticketNo, string message, string transStatus, List <TransactionDataViewModel> listTransactionDataModel)
        {
            int result = 0;

            try
            {
                //insert into CUSTOM_DOWNLOAD_TRANSACTION
                CUSTOM_DOWNLOAD_TRANSACTION transaction = new CUSTOM_DOWNLOAD_TRANSACTION();
                transaction.Acknowledge = acknowledge;
                transaction.TicketNo    = ticketNo;
                transaction.Message     = message;
                EntityHelper.SetAuditForInsert(transaction, "SERA");
                entities.CUSTOM_DOWNLOAD_TRANSACTION.AddObject(transaction);

                for (int i = 0; i < listTransactionDataModel.Count; i++)
                {
                    //insert into CUSTOM_DOWNLOAD_TRANSACTIONDATA
                    CUSTOM_DOWNLOAD_TRANSACTIONDATA transactionData = new CUSTOM_DOWNLOAD_TRANSACTIONDATA();
                    transactionData.CUSTOM_DOWNLOAD_TRANSACTION = transaction;
                    transactionData.AIID            = listTransactionDataModel[i].AIID;
                    transactionData.TransGUID       = listTransactionDataModel[i].TransGUID;
                    transactionData.DocumentNumber  = listTransactionDataModel[i].DocumentNumber;
                    transactionData.FileType        = listTransactionDataModel[i].FileType;
                    transactionData.IPAddress       = listTransactionDataModel[i].IPAddress;
                    transactionData.DestinationUser = listTransactionDataModel[i].DestinationUser;
                    transactionData.Key1            = listTransactionDataModel[i].Key1;
                    transactionData.Key2            = listTransactionDataModel[i].Key2;
                    transactionData.Key3            = listTransactionDataModel[i].Key3;
                    transactionData.DataLength      = listTransactionDataModel[i].DataLength;
                    //transactionData.RowStatus = "";
                    EntityHelper.SetAuditForInsert(transactionData, "SERA");
                    entities.CUSTOM_DOWNLOAD_TRANSACTIONDATA.AddObject(transactionData);

                    for (int j = 0; j < listTransactionDataModel[i].Data.Length; j++)
                    {
                        //SPLITSTRING
                        S02006ViewModel modelSO2006 = SplitStringS02006(listTransactionDataModel[i].Data[j]);

                        if (modelSO2006 != null)
                        {
                            //insert into CUSTOM_S02006
                            CUSTOM_S02006 s02006 = new CUSTOM_S02006();
                            s02006.CUSTOM_DOWNLOAD_TRANSACTIONDATA = transactionData;
                            s02006.BillingNo        = modelSO2006.BillingNo;
                            s02006.KuitansiNo       = modelSO2006.KuitansiNo;
                            s02006.KuitansiDate     = modelSO2006.KuitansiDate;
                            s02006.CurrencyCode     = modelSO2006.CurrencyCode;
                            s02006.AmountKuitansiDC = modelSO2006.AmountKuitansiDC;
                            s02006.BusinessAreaCode = modelSO2006.BusinessAreaCode;
                            s02006.CustomerNo       = modelSO2006.CustomerNo;
                            s02006.NomorSpes        = modelSO2006.NomorSpes;
                            s02006.SalesOrderNo     = modelSO2006.SalesOrderNo;
                            s02006.SalesmanNumber   = modelSO2006.SalesmanNumber;
                            s02006.NomorFakturPajak = modelSO2006.NomorFakturPajak;
                            s02006.ChasisNumber     = modelSO2006.ChasisNumber;
                            s02006.PONumberSERA     = modelSO2006.PONumberSERA;
                            s02006.VersionPOSERA    = modelSO2006.VersionPOSERA;
                            s02006.KuitansiNoRef    = modelSO2006.KuitansiNoRef;
                            s02006.KuitansiDateRef  = modelSO2006.KuitansiDateRef;
                            s02006.DownloadDate     = modelSO2006.DownloadDate;
                            //start add by fhi 18.06.2014 : set owner
                            s02006.dibuatOleh    = "system";
                            s02006.dibuatTanggal = DateTime.Now;
                            s02006.diubahOleh    = "system";
                            s02006.diubahTanggal = DateTime.Now;
                            //end
                            entities.CUSTOM_S02006.AddObject(s02006);
                        }

                        //insert into CUSTOM_DOWNLOAD_TRANSACTIONDATADETAIL
                        CUSTOM_DOWNLOAD_TRANSACTIONDATADETAIL transactionDataDetail = new CUSTOM_DOWNLOAD_TRANSACTIONDATADETAIL();
                        transactionDataDetail.CUSTOM_DOWNLOAD_TRANSACTIONDATA = transactionData;
                        transactionDataDetail.Data = listTransactionDataModel[i].Data[j];
                        entities.CUSTOM_DOWNLOAD_TRANSACTIONDATADETAIL.AddObject(transactionDataDetail);
                    }
                }
                entities.SaveChanges();
                result = 1;
            }
            catch (Exception ex)
            {
                result = 0;
                throw ex;
            }
            return(result);
        }