private void UpdatedLst(List <Item> Lst_Items, WriteResponseList responseLst)
        {
            //Tuple to hold local order ids and its corresponding Netsuite ids
            List <Tuple <int, string> > iDs = new List <Tuple <int, string> >();

            //loop to fill tuple values
            //for (int counter = 0; counter < Lst_Items.Count; counter++)
            try
            {
                for (int counter = 0; counter < Lst_Items.Count; counter++)
                {
                    //ensure that order is added to netsuite
                    if (responseLst.writeResponse[counter].status.isSuccess)
                    {
                        RecordRef rf = (RecordRef)responseLst.writeResponse[counter].baseRef;
                        //update netsuiteId property
                        Lst_Items[counter].Netsuite_Id = Convert.ToInt32(rf.internalId.ToString());
                        //add item to the tuple
                        iDs.Add(new Tuple <int, string>(Convert.ToInt32(rf.internalId.ToString()), Lst_Items[counter].Foodics_Id));
                    }
                }
            }
            catch (Exception ex)
            {
                LogDAO.Integration_Exception(LogIntegrationType.Error, this.GetType().FullName + "." + System.Reflection.MethodBase.GetCurrentMethod().Name, "Error " + ex.Message);
            }
            GenericeDAO <Item> objDAO = new GenericeDAO <Item>();

            //updates local db
            objDAO.UpdateNetsuiteIDs(iDs, "Item", true);
        }
Exemplo n.º 2
0
        private void UpdatedLst(List <Item> Lst_Items, WriteResponseList responseLst)
        {
            //Tuple to hold local order ids and its corresponding Netsuite ids
            List <Tuple <int, string> > iDs = new List <Tuple <int, string> >();

            //loop to fill tuple values
            //for (int counter = 0; counter < Lst_Items.Count; counter++)
            try
            {
                for (int counter = 0; counter < Lst_Items.Count; counter++)
                {
                    //ensure that order is added to netsuite
                    if (responseLst.writeResponse[counter].status.isSuccess)
                    {
                        RecordRef rf = (RecordRef)responseLst.writeResponse[counter].baseRef;
                        //update netsuiteId property
                        Lst_Items[counter].Netsuite_Id = Convert.ToInt32(rf.internalId.ToString());
                        //add item to the tuple
                        iDs.Add(new Tuple <int, string>(Convert.ToInt32(rf.internalId.ToString()), Lst_Items[counter].Foodics_Id));
                    }
                }
            }
            catch (Exception ex)
            {
            }
            GenericeDAO <Item> objDAO = new GenericeDAO <Item>();

            //updates local db
            objDAO.UpdateNetsuiteIDs(iDs, "Item", true);
        }
 private void UpdatedInvoice(List <Foodics.NetSuite.Shared.Model.Invoice> InvoiceLst, WriteResponseList responseLst)
 {
     try
     {
         //Tuple to hold local invoice ids and its corresponding Netsuite ids
         List <Tuple <int, string> > iDs = new List <Tuple <int, string> >();
         //loop to fill tuple values
         for (int counter = 0; counter < InvoiceLst.Count; counter++)
         {
             //ensure that invoice is added to netsuite
             if (responseLst.writeResponse[counter].status.isSuccess)
             {
                 try
                 {
                     RecordRef rf = (RecordRef)responseLst.writeResponse[counter].baseRef;
                     iDs.Add(new Tuple <int, string>(Convert.ToInt32(rf.internalId.ToString()), InvoiceLst[counter].Foodics_Id));
                 }
                 catch (Exception ex)
                 {
                     LogDAO.Integration_Exception(LogIntegrationType.Error, this.GetType().FullName + "." + System.Reflection.MethodBase.GetCurrentMethod().Name, "Error " + ex.Message);
                 }
             }
         }
         GenericeDAO <Foodics.NetSuite.Shared.Model.Invoice> objDAO = new GenericeDAO <Foodics.NetSuite.Shared.Model.Invoice>();
         objDAO.UpdateNetsuiteIDs(iDs, "Invoice");
     }
     catch (Exception ex)
     {
         LogDAO.Integration_Exception(LogIntegrationType.Error, this.GetType().FullName + "." + System.Reflection.MethodBase.GetCurrentMethod().Name, "Error " + ex.Message);
     }
 }
        private void UpdatedInvoice(List <Foodics.NetSuite.Shared.Model.Invoice> InvoiceLst, WriteResponseList responseLst)
        {
            try
            {
                //Tuple to hold local invoice ids and its corresponding Netsuite ids
                List <Tuple <int, string> > iDs = new List <Tuple <int, string> >();
                //loop to fill tuple values
                for (int counter = 0; counter < InvoiceLst.Count; counter++)
                {
                    //ensure that invoice is added to netsuite
                    if (responseLst.writeResponse[counter].status.isSuccess)
                    {
                        try
                        {
                            RecordRef rf = (RecordRef)responseLst.writeResponse[counter].baseRef;
                            //update netsuiteId property
                            InvoiceLst[counter].Netsuite_Id = Convert.ToInt32(rf.internalId.ToString());
                            //add item to the tuple
                            iDs.Add(new Tuple <int, string>(Convert.ToInt32(rf.internalId.ToString()), InvoiceLst[counter].Foodics_Id));
                        }
                        catch (Exception ex)
                        {
                            //   LogDAO.Integration_Exception(LogIntegrationType.Error, TaskRunType.POST, "InvoiceTask UpdateDB Counter Error", "Error " + ex.Message + " Count = " + counter.ToString());
                        }
                    }
                }
                // NetsuiteDAO objDAO = new NetsuiteDAO();
                //updates local db
                // LogDAO.Integration_Exception(LogIntegrationType.Info, TaskRunType.POST, "InvoiceTask UpdateDB", "Updating " + iDs.Count().ToString() + " from " + InvoiceLst.Count().ToString());

                //objDAO.UpdateNetsuiteIDs(iDs, "Invoice");

                GenericeDAO <Foodics.NetSuite.Shared.Model.Invoice> objDAO = new GenericeDAO <Foodics.NetSuite.Shared.Model.Invoice>();
                objDAO.UpdateNetsuiteIDs(iDs, "Invoice");
            }
            catch (Exception ex) {
                // LogDAO.Integration_Exception(LogIntegrationType.Error, TaskRunType.POST, "InvoiceTask UpdateDB Error", "Error " + ex.Message);
            }
        }