Exemplo n.º 1
0
        private void UpdatedLst(List <Foodics.NetSuite.Shared.Model.PaymentMethodEntity> 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].Id.ToString()));
                    }
                }
            }
            catch (Exception ex)
            {
                LogDAO.Integration_Exception(LogIntegrationType.Error, this.GetType().FullName + "." + System.Reflection.MethodBase.GetCurrentMethod().Name, "Error " + ex.Message);
            }
            GenericeDAO <PaymentMethodEntity> objDAO = new GenericeDAO <PaymentMethodEntity>();

            //updates local db
            objDAO.MainUpdateNetsuiteIDs(iDs, "PaymentMethodEntity");
        }
Exemplo n.º 2
0
        private void Updatedlst(List <Foodics.NetSuite.Shared.Model.UnitsOfMeasure> InvoiceLst, WriteResponseList responseLst)
        {
            try
            {
                string strids = "";
                //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].Id.ToString()));

                            strids += InvoiceLst[counter].Id.ToString();
                            if (counter + 1 < InvoiceLst.Count)
                            {
                                strids += ",";
                            }
                        }
                        catch (Exception ex)
                        {
                            LogDAO.Integration_Exception(LogIntegrationType.Error, this.GetType().FullName + "." + System.Reflection.MethodBase.GetCurrentMethod().Name, "Error " + ex.Message);
                        }
                    }
                }
                // 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.UnitsOfMeasure> objDAO = new GenericeDAO <Foodics.NetSuite.Shared.Model.UnitsOfMeasure>();
                objDAO.MainUpdateNetsuiteIDs(iDs, "UnitsOfMeasure");
                new CustomDAO().UpdateUnitsOfMeasureIngredient(strids);
            }

            catch (Exception ex)
            {
                LogDAO.Integration_Exception(LogIntegrationType.Error, this.GetType().FullName + "." + System.Reflection.MethodBase.GetCurrentMethod().Name, "Error " + ex.Message);
            }
        }