示例#1
0
        public QBResponceItem Inventoryadjustment(QBSessionManager sessionManager, IAccountRetList accountInfo, IPreferencesRet PreferencesRet, IItemInventoryRet inventoryItem)
        {
            QBResponceList qbResponceData  = null;
            QBSession      QBMgr           = null;
            QBResponceItem _qbResponceItem = null;

            try
            {
                QBMgr = new QBSession();
                if (sessionManager == null)
                {
                    QBMgr.CreateQBSession(out sessionManager);
                }

                if (sessionManager != null && inventoryItem != null && accountInfo != null)
                {
                    // Get the RequestMsgSet based on the correct QB Version
                    IMsgSetRequest requestSet = QBMgr.getLatestMsgSetRequest(sessionManager);

                    if (requestSet != null)
                    {
                        // Initialize the message set request object
                        requestSet.Attributes.OnError = ENRqOnError.roeStop;

                        BuildInventoryAdjustmentAddRq(requestSet, accountInfo, PreferencesRet, inventoryItem);

                        // Uncomment the following to view and save the request and response XML
                        //string requestXML = requestSet.ToXMLString();
                        //MessageBox.Show(requestXML);

                        // Do the request and get the response message set object
                        IMsgSetResponse responseSet = sessionManager.DoRequests(requestSet);

                        //string responseXML = responseSet.ToXMLString();
                        //MessageBox.Show(responseXML);

                        _qbResponceItem = WalkInventoryAdjustmentAddRs(responseSet);

                        //Close the session and connection with QuickBooks
                        //QBMgr.CloseQBConnection(sessionManager);
                    }
                }
            }
            catch (Exception ex)
            {
            }
            return(_qbResponceItem);
        }
示例#2
0
        private IAccountRetList GetQBAccountDetails()
        {
            IAccountRetList AccountList = null;

            try
            {
                if (sessionManager != null)
                {
                    QBAccount _qbAccount = new QBAccount();

                    IResponseList responseList = _qbAccount.GetQBAccountInfo(sessionManager);
                    if (responseList == null)
                    {
                        return(null);
                    }

                    //if we sent only one request, there is only one response.
                    for (int i = 0; i < responseList.Count; i++)
                    {
                        IResponse response = responseList.GetAt(i);
                        //check the status code of the response, 0=ok, >0 is warning
                        if (response.StatusCode >= 0)
                        {
                            //the request-specific response is in the details, make sure we have some
                            if (response.Detail != null)
                            {
                                //make sure the response is the type we're expecting
                                ENResponseType responseType = (ENResponseType)response.Type.GetValue();
                                if (responseType == ENResponseType.rtAccountQueryRs)
                                {
                                    //upcast to more specific type here, this is safe because we checked with response.Type check above
                                    AccountList = (IAccountRetList)response.Detail;
                                }
                            }
                        }
                        else
                        {
                            //*** Error Handling.
                        }
                    }
                }
            }
            catch (Exception e)
            {
            }
            return(AccountList);
        }
示例#3
0
    /// <summary>
    /// The GetQBAccounts.
    /// </summary>
    /// <param name="logsFile">The logsFile<see cref="StreamWriter"/>.</param>
    /// <returns>The <see cref="List{dynamic}"/>.</returns>
    public List <dynamic> GetQBAccounts(StreamWriter logsFile)
    {
        IMsgSetRequest requestSet = SessionManager.Instance.CreateMsgSetRequest();

        requestSet.Attributes.OnError = ENRqOnError.roeStop;
        requestSet.AppendAccountQueryRq();
        IMsgSetResponse responeSet     = SessionManager.Instance.DoRequests(requestSet, logsFile);
        IResponseList   responseList   = responeSet.ResponseList;
        List <dynamic>  accountsArray  = new List <dynamic>();
        var             account_number = "";

        try
        {
            for (int i = 0; i < responseList.Count; i++)
            {
                IResponse response = responseList.GetAt(i);

                if (response.StatusCode == 0)
                {
                    IAccountRetList AccountRet = (IAccountRetList)response.Detail;
                    Console.WriteLine("Number Of Records Being Fetched Are:\t" + AccountRet.Count + "\n");
                    for (int j = 0; j < AccountRet.Count; j++)
                    {
                        IAccountRet account = AccountRet.GetAt(j);
                        if (account.AccountNumber != null)
                        {
                            account_number = account.AccountNumber.GetValue();
                        }
                        else
                        {
                            account_number = "Account Number Not Defined...";
                        }
                        accountsArray.Add(new string[] { account.Name.GetValue().ToString(), account_number, account.AccountType.GetValue().ToString(), account.TotalBalance.GetValue().ToString() });
                    }
                }
            }
        }
        catch (Exception ex)
        {
            logsFile.WriteLine(DateTime.Now + "\tERROR\tError Message:\t" + ex.Message);
            logsFile.WriteLine();
            logsFile.WriteLine(DateTime.Now + "\tERROR\tError Message:\tStack Trace:\t" + ex.StackTrace);
            logsFile.WriteLine();
        }

        return(accountsArray);
    }
示例#4
0
        void WalkAccountQueryRs(IMsgSetResponse responseMsgSet)
        {
            if (responseMsgSet == null)
            {
                return;
            }
            IResponseList responseList = responseMsgSet.ResponseList;

            if (responseList == null)
            {
                return;
            }
            //if we sent only one request, there is only one response, we'll walk the list for this sample
            for (int i = 0; i < responseList.Count; i++)
            {
                IResponse response = responseList.GetAt(i);
                //check the status code of the response, 0=ok, >0 is warning
                if (response.StatusCode >= 0)
                {
                    //the request-specific response is in the details, make sure we have some
                    if (response.Detail != null)
                    {
                        //make sure the response is the type we're expecting
                        ENResponseType responseType = (ENResponseType)response.Type.GetValue();
                        if (responseType == ENResponseType.rtAccountQueryRs)
                        {
                            // var vs = response.Detail.GetType();
                            //upcast to more specific type here, this is safe because we checked with response.Type check above
                            IAccountRetList AccountRet = (IAccountRetList)response.Detail;
                            for (int j = 0; j < AccountRet.Count; j++)
                            {
                                IAccountRet accountInfo = AccountRet.GetAt(j);
                                if (accountInfo != null)
                                {
                                    WalkAccountRet(accountInfo);
                                }
                            }
                        }
                    }
                }
            }
        }
示例#5
0
        private IList <ChartOfAccount> WalkChartOfAccount(IAccountRetList Account)
        {
            if (Account == null)
            {
                return(null);
            }
            ChartOfAccountList = new List <ChartOfAccount>();
            ChartOfAccount BankAccount;

            for (int a = 0; a < Account.Count; a++)
            {
                IAccountRet AccountRet = Account.GetAt(a);
                BankAccount = new ChartOfAccount();
                //BankAccount.Name = (string)AccountRet.Name.GetValue();
                BankAccount.FullName = (string)AccountRet.FullName.GetValue();
                BankAccount.ListID   = AccountRet.ListID.GetValue().ToString();
                ChartOfAccountList.Add(BankAccount);
            }
            return(ChartOfAccountList);
        }
示例#6
0
        private IList <ChartOfAccount> WalkChartOfAccountQuery(IMsgSetResponse responseMsgSet)
        {
            if (responseMsgSet == null)
            {
                return(null);
            }

            IResponseList responseList = responseMsgSet.ResponseList;

            if (responseList == null)
            {
                return(null);
            }

            int count = responseList.Count;

            //if we sent only one request, there is only one response, we'll walk the list for this sample
            for (int i = 0; i < count; i++)
            {
                IResponse response = responseList.GetAt(i);

                if (response.StatusCode == 0)
                {
                    if (response.Detail != null)
                    {
                        ENResponseType responseType = (ENResponseType)response.Type.GetValue();
                        if (responseType == ENResponseType.rtAccountQueryRs)
                        {
                            IAccountRetList CustomerRet = (IAccountRetList)response.Detail;
                            return(WalkChartOfAccount(CustomerRet));
                        }
                    }
                }
                else
                {
                    throw new QBException(response.StatusCode, response.StatusMessage, requestMsgSet.ToXMLString());
                }
            }

            return(null);
        }
示例#7
0
        /// <summary>
        /// Obtain a list of all QuickBooks accounts.
        /// </summary>
        /// <returns>a list of quickbooks accounts</returns>
        private List <QuickbooksAccount> getAccounts(ENAccountType type)
        {
            List <QuickbooksAccount> account    = new List <QuickbooksAccount>();
            IMsgSetRequest           msgRequest = qbMgr.CreateMsgSetRequest("US", 4, 0);

            msgRequest.Attributes.OnError = ENRqOnError.roeStop;
            IAccountQuery query = msgRequest.AppendAccountQueryRq();

            query.ORAccountListQuery.AccountListFilter.AccountTypeList.Add(type);
            IMsgSetResponse response   = qbMgr.DoRequests(msgRequest);
            IAccountRetList qbAccounts = (IAccountRetList)response.ResponseList.GetAt(0).Detail;


            for (int i = 0; qbAccounts != null && i < qbAccounts.Count; i++)
            {
                account.Add(new QuickbooksAccount()
                {
                    Name = qbAccounts.GetAt(i).FullName.GetValue()
                });
            }

            return(account);
        }
示例#8
0
        public void CreatInventoryItem(QBSessionManager sessionManager, IAccountRetList accountInfo, IPreferencesRet PreferencesRet, IItemInventoryRet inventoryItem)
        {
            IMsgSetRequest requestMsgSet = null;
            QBSession      QBMgr         = null;

            try
            {
                QBMgr = new QBSession();
                if (sessionManager == null)
                {
                    QBMgr.CreateQBSession(out sessionManager);
                }

                if (sessionManager != null)
                {
                    // Get the RequestMsgSet based on the correct QB Version
                    IMsgSetRequest requestSet = QBMgr.getLatestMsgSetRequest(sessionManager);

                    if (requestSet != null)
                    {
                        // Initialize the message set request object
                        requestSet.Attributes.OnError = ENRqOnError.roeStop;

                        BuildItemInventoryAddRq(requestSet, accountInfo, PreferencesRet, inventoryItem);

                        // Do the request and get the response message set object
                        IMsgSetResponse responseSet = sessionManager.DoRequests(requestSet);

                        //WalkItemInventoryAddRs(responseSet);
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }
示例#9
0
        public void Execute(IJobExecutionContext context)
        {
            IAccountRetList       AccountList          = null;
            IPreferencesRet       PreferencesRet       = null;
            IItemInventoryRetList itemInventoryRetList = null;
            int maxRecords = 0;

            try
            {
                //** 1. To Get TDS Data Using Entity Frame Work.
                //TDSService _tdsService = new TDSService();

                TDSItemInventoryList = GetMetrialData();

                //** 2. If TDS data is grater than zero. than need to creat QBD session.
                if (TDSItemInventoryList != null && TDSItemInventoryList.Any())
                {
                    qbRequestItemSet = new QBRequestItemSet();
                    qbRequestItemSet.QBRequestItemList = new List <QBRequestItem>();
                    var bSessionResult = CreateQBsession();
                    if (bSessionResult)
                    {
                        //** 3. Using the QBD session to get AccountInfo.
                        AccountList = GetQBAccountDetails();

                        if (AccountList != null && AccountList.Count > 0)
                        {
                            qbRequestItemSet.AccountList = AccountList;

                            //** 4. Using the QBD session to get GetPreferences.
                            PreferencesRet = GetQBPreferencesDetails();
                            if (PreferencesRet != null)
                            {
                                qbRequestItemSet.PreferencesRet = PreferencesRet;
                            }


                            //** 5. Using the QBD session to get qbd invertory item list.
                            itemInventoryRetList = GetItemInventoryRetList(maxRecords);
                            if (itemInventoryRetList != null && itemInventoryRetList.Count > 0)
                            {
                                //Parallel.ForEach(itemInventoryRetList,item=>)
                                for (int i = 0; i < itemInventoryRetList.Count; i++)
                                {
                                    var reqdata = itemInventoryRetList.GetAt(i);
                                    if (TDSItemInventoryList.Where(x => x.TRC_CODE.Trim() == reqdata.FullName.GetValue()).SingleOrDefault() != null)
                                    {
                                        var reqitem = TDSItemInventoryList.Where(x => x.TRC_CODE.Trim() == reqdata.FullName.GetValue()).SingleOrDefault();
                                        //var reqitem=itemInventoryRetList.GetAt(i);
                                        double hh = reqdata.QuantityOnHand.GetValue();
                                        if (reqitem.Quantity != reqdata.QuantityOnHand.GetValue())
                                        {
                                            QBRequestItem requestItem = new QBRequestItem();
                                            requestItem.Action = QBAction.Modify;
                                            reqdata.QuantityOnHand.SetValue(Convert.ToDouble(reqitem.Quantity));
                                            requestItem.ItemInventoryRet = reqdata;
                                            qbRequestItemSet.QBRequestItemList.Add(requestItem);
                                        }
                                    }
                                    else
                                    {
                                    }
                                }



                                //** 4. To compare TDS and QBD item list using TRC_CODE code to asume as Name/Number in QBD item inventory list.
                                //** 5. If TRC_CODE is not match in QBD. than need to add to QBD as a new inventory item.
                                //** 6. If TRC_CODE is match in QBD. than need to ajust the quantity in QBD.
                                //** 7. final status need to send to client using email.
                            }
                            else
                            {
                                //** 5. If TRC_CODE is not match in QBD. than need to add to QBD as a new inventory item.
                            }
                        }
                    }
                }
                else
                {
                    //ServiceLog.log.Fatal("TDS Data is empty " + DateTime.Now.ToLongDateString());
                }

                //ServiceLog.GetUserInfo();
                //Email("Execution Execution");
            }
            catch (Exception ex)
            {
                // ServiceLog.Email(ex.ToString());
            }
            finally
            {
                _QBSession.CloseQBConnection(sessionManager);
            }
        }
示例#10
0
        protected Dictionary <string, string> QuickBooksExcuet(IMsgSetRequest requestMsgSet, string externalId = null)
        {
            try
            {
                SessionManager.OpenConnection("QuickBooks Application", "QuickBooks Application");
                ConnectionOpen = true;

                SessionManager.BeginSession("", ENOpenMode.omDontCare);
                SessionBegun = true;

                IMsgSetResponse responseMsgSet = SessionManager.DoRequests(requestMsgSet);
                SessionManager.EndSession();
                SessionBegun = false;

                SessionManager.CloseConnection();
                ConnectionOpen = false;

                if (responseMsgSet != null)
                {
                    IResponseList responseList = responseMsgSet.ResponseList;
                    for (int i = 0; i < responseList.Count; i++)
                    {
                        IResponse response = responseList.GetAt(i);
                        //check the status code of the response, 0=ok, >0 is warning
                        if (response.StatusCode >= 0)
                        {
                            var result = new Dictionary <string, string>();
                            result.Add("StatusCode", response.StatusCode + "");
                            //the request-specific response is in the details, make sure we have some
                            if (response.Detail != null)
                            {
                                //make sure the response is the type we're expecting
                                ENResponseType responseType = (ENResponseType)response.Type.GetValue();
                                if (responseType == ENResponseType.rtCustomerAddRs)
                                {
                                    //upcast to more specific type here, this is safe because we checked with response.Type check above
                                    ICustomerRet customerRet = (ICustomerRet)response.Detail;
                                    if (customerRet != null)
                                    {
                                        string newId = customerRet.ListID.GetValue();
                                        result.Add("Message", "Customer has been Added successfully");
                                        result.Add("ListID", newId);
                                        return(result);
                                    }
                                }
                                if (responseType == ENResponseType.rtCustomerModRs)
                                {
                                    ICustomerRet ItemInventoryRet = (ICustomerRet)response.Detail;
                                    if (ItemInventoryRet != null)
                                    {
                                        string newId = ItemInventoryRet.ListID.GetValue();
                                        result.Add("Message", $"Customer with Id {newId} has been updated Successfully");
                                        return(result);
                                    }
                                }
                                if (responseType == ENResponseType.rtListDelRs)
                                {
                                    IQBENListDelTypeType ListDelType = (IQBENListDelTypeType)response.Detail;
                                    result.Add("Message", $"Customer with Id {externalId} has been deleted Successfully");
                                    return(result);
                                }
                                if (responseType == ENResponseType.rtAccountQueryRs)
                                {
                                    IAccountRetList AccountRet = (IAccountRetList)response.Detail;
                                    for (int j = 0; j < AccountRet.Count; j++)
                                    {
                                        var    acc      = AccountRet.GetAt(j);
                                        string FullName = (string)acc.FullName.GetValue();
                                        result.Add("Name", FullName);
                                    }
                                }
                            }
                            else
                            {
                                result.Add("Error", response.StatusMessage);
                                return(result);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                if (SessionBegun)
                {
                    SessionManager.EndSession();
                }
                if (ConnectionOpen)
                {
                    SessionManager.CloseConnection();
                }
                return(new Dictionary <string, string>()
                {
                    { "Error", ex.Message }
                });
            }

            return(new Dictionary <string, string>());
        }
示例#11
0
        ///<summary>Returns list of all active accounts.</summary>
        public static List <string> GetListOfAccounts()
        {
            List <string> accountList = new List <string>();

            try {
                OpenConnection(8, 0, PrefC.GetString(PrefName.QuickBooksCompanyFile));
                QueryListOfAccounts();
                DoRequests();
                CloseConnection();
            }
            catch (Exception e) {
                if (SessionBegun)
                {
                    SessionManager.EndSession();
                }
                if (ConnectionOpen)
                {
                    SessionManager.CloseConnection();
                }
                throw e;
            }
            if (ResponseMsgSet == null)
            {
                return(accountList);
            }
            IResponseList responseList = ResponseMsgSet.ResponseList;

            if (responseList == null)
            {
                return(accountList);
            }
            //Loop through the list to pick out the AccountQueryRs section.
            for (int i = 0; i < responseList.Count; i++)
            {
                IResponse response = responseList.GetAt(i);
                //Check the status code of the response, 0=ok, >0 is warning.
                if (response.StatusCode >= 0)
                {
                    //The request-specific response is in the details, make sure we have some.
                    if (response.Detail != null)
                    {
                        //Make sure the response is the type we're expecting.
                        ENResponseType responseType = (ENResponseType)response.Type.GetValue();
                        if (responseType == ENResponseType.rtAccountQueryRs)
                        {
                            //Upcast to more specific type here, this is safe because we checked with response.Type check above.
                            IAccountRetList AccountRetList = (IAccountRetList)response.Detail;
                            for (int j = 0; j < AccountRetList.Count; j++)
                            {
                                IAccountRet AccountRet = AccountRetList.GetAt(j);
                                if (AccountRet.FullName != null)
                                {
                                    accountList.Add(AccountRet.FullName.GetValue());
                                }
                            }
                        }
                    }
                }
            }
            return(accountList);
        }
示例#12
0
        private void BuildItemInventoryAddRq(IMsgSetRequest requestMsgSet, IAccountRetList accountInfo, IPreferencesRet PreferencesRet, IItemInventoryRet inventoryItem)
        {
            //IItemInventoryAdd[] AdditemList = new IItemInventoryAdd[2];
            IItemInventoryAdd ItemInventoryAddRq = requestMsgSet.AppendItemInventoryAddRq();

            //Set field value for Name
            ItemInventoryAddRq.Name.SetValue(inventoryItem.Name.GetValue()); //"venky01"

            //Set field value for BarCodeValue
            //ItemInventoryAddRq.BarCode.BarCodeValue.SetValue("ab");
            //Set field value for AssignEvenIfUsed
            //ItemInventoryAddRq.BarCode.AssignEvenIfUsed.SetValue(true);
            //Set field value for AllowOverride
            //ItemInventoryAddRq.BarCode.AllowOverride.SetValue(true);

            //Set field value for IsActive
            ItemInventoryAddRq.IsActive.SetValue(true);

            if (inventoryItem.ClassRef != null)
            {
                ////Set field value for ListID
                //ItemInventoryAddRq.ClassRef.ListID.SetValue("200000-1011023419");
                ////Set field value for FullName
                //ItemInventoryAddRq.ClassRef.FullName.SetValue("ab");
            }

            if (inventoryItem.ParentRef != null)
            {
                ////Set field value for ListID
                //ItemInventoryAddRq.ParentRef.ListID.SetValue("200000-1011023419");
                ////Set field value for FullName
                //ItemInventoryAddRq.ParentRef.FullName.SetValue("ab");
            }

            //Set field value for ManufacturerPartNumber
            ItemInventoryAddRq.ManufacturerPartNumber.SetValue(inventoryItem.ManufacturerPartNumber.GetValue());
            if (inventoryItem.UnitOfMeasureSetRef != null)
            {
                //Set field value for ListID
                // ItemInventoryAddRq.UnitOfMeasureSetRef.ListID.SetValue("200000-1011023419");
                //Set field value for FullName
                //ItemInventoryAddRq.UnitOfMeasureSetRef.FullName.SetValue("ab");
            }

            //Set field value for IsTaxIncluded
            //ItemInventoryAddRq.IsTaxIncluded.SetValue(true);

            if (inventoryItem.SalesTaxCodeRef != null)
            {
                //Set field value for ListID
                //ItemInventoryAddRq.SalesTaxCodeRef.ListID.SetValue("200000-1011023419");
                //Set field value for FullName
                // ItemInventoryAddRq.SalesTaxCodeRef.FullName.SetValue("ab");
            }

            //Set field value for SalesDesc
            ItemInventoryAddRq.SalesDesc.SetValue(inventoryItem.SalesDesc.GetValue());
            //Set field value for SalesPrice
            ItemInventoryAddRq.SalesPrice.SetValue(inventoryItem.SalesPrice.GetValue());

            if (inventoryItem.IncomeAccountRef != null)
            {
                //Set field value for ListID
                ItemInventoryAddRq.IncomeAccountRef.ListID.SetValue(inventoryItem.IncomeAccountRef.ListID.GetValue()); //"80000008-1552559357"
                                                                                                                       //Set field value for FullName
                ItemInventoryAddRq.IncomeAccountRef.FullName.SetValue(inventoryItem.IncomeAccountRef.FullName.GetValue());
            }

            //Set field value for PurchaseDesc
            ItemInventoryAddRq.PurchaseDesc.SetValue(inventoryItem.PurchaseDesc.GetValue());
            //Set field value for PurchaseCost
            ItemInventoryAddRq.PurchaseCost.SetValue(inventoryItem.PurchaseCost.GetValue());

            //Set field value for ListID
            // ItemInventoryAddRq.PurchaseTaxCodeRef.ListID.SetValue("200000-1011023419");
            //Set field value for FullName
            // ItemInventoryAddRq.PurchaseTaxCodeRef.FullName.SetValue("ab");

            if (inventoryItem.COGSAccountRef != null)
            {
                //Set field value for ListID
                ItemInventoryAddRq.COGSAccountRef.ListID.SetValue(inventoryItem.COGSAccountRef.ListID.GetValue());
                //Set field value for FullName
                ItemInventoryAddRq.COGSAccountRef.FullName.SetValue(inventoryItem.COGSAccountRef.FullName.GetValue());
            }

            if (inventoryItem.PrefVendorRef != null)
            {
                //Set field value for ListID
                ItemInventoryAddRq.PrefVendorRef.ListID.SetValue(inventoryItem.PrefVendorRef.ListID.GetValue());
                //Set field value for FullName
                ItemInventoryAddRq.PrefVendorRef.FullName.SetValue(inventoryItem.PrefVendorRef.FullName.GetValue());
            }

            if (inventoryItem.AssetAccountRef != null)
            {
                //Set field value for ListID
                ItemInventoryAddRq.AssetAccountRef.ListID.SetValue(inventoryItem.AssetAccountRef.ListID.GetValue());
                //Set field value for FullName
                ItemInventoryAddRq.AssetAccountRef.FullName.SetValue(inventoryItem.AssetAccountRef.FullName.GetValue());
            }

            //Set field value for ReorderPoint
            // ItemInventoryAddRq.ReorderPoint.SetValue(2);
            //Set field value for Max
            // ItemInventoryAddRq.Max.SetValue(2);
            //Set field value for QuantityOnHand
            ItemInventoryAddRq.QuantityOnHand.SetValue(inventoryItem.QuantityOnHand.GetValue());
            //Set field value for TotalValue
            //ItemInventoryAddRq.TotalValue.SetValue(1500);
            //Set field value for InventoryDate
            //ItemInventoryAddRq.InventoryDate.SetValue(DateTime.Now);
            //ItemInventoryAddRq.InventoryDate.SetValue(DateTime.Parse("19-03-2019"));

            //Set field value for ExternalGUID
            //ItemInventoryAddRq.ExternalGUID.SetValue(Guid.NewGuid().ToString());

            //Set field value for IncludeRetElementList
            //May create more than one of these if needed
            //ItemInventoryAddRq.IncludeRetElementList.Add("ab");
        }
示例#13
0
        private void BuildInventoryAdjustmentAddRq(IMsgSetRequest requestMsgSet, IAccountRetList accountInfo, IPreferencesRet PreferencesRet, IItemInventoryRet inventoryItem)
        {
            IInventoryAdjustmentAdd InventoryAdjustmentAddRq = requestMsgSet.AppendInventoryAdjustmentAddRq();

            //Set attributes
            //Set field value for defMacro
            InventoryAdjustmentAddRq.defMacro.SetValue("IQBStringType");
            //Set field value for ListID
            InventoryAdjustmentAddRq.AccountRef.ListID.SetValue(inventoryItem.AssetAccountRef.ListID.GetValue());;    //"80000022-1552565294"
            //Set field value for FullName
            InventoryAdjustmentAddRq.AccountRef.FullName.SetValue(inventoryItem.AssetAccountRef.FullName.GetValue()); //"Inventory Asset"

            //Set field value for TxnDate
            InventoryAdjustmentAddRq.TxnDate.SetValue(DateTime.Now); //"20-03-2019"

            //Set field value for RefNumber
            //InventoryAdjustmentAddRq.RefNumber.SetValue("ab");
            //Set field value for ListID
            //InventoryAdjustmentAddRq.InventorySiteRef.ListID.SetValue("200000-1011023419");
            //Set field value for FullName
            //InventoryAdjustmentAddRq.InventorySiteRef.FullName.SetValue("ab");
            //Set field value for ListID
            //InventoryAdjustmentAddRq.CustomerRef.ListID.SetValue("200000-1011023419");
            //Set field value for FullName
            //InventoryAdjustmentAddRq.CustomerRef.FullName.SetValue("ab");
            //Set field value for ListID
            // InventoryAdjustmentAddRq.ClassRef.ListID.SetValue("200000-1011023419");
            //Set field value for FullName
            //InventoryAdjustmentAddRq.ClassRef.FullName.SetValue("ab");
            //Set field value for Memo
            // InventoryAdjustmentAddRq.Memo.SetValue("ab");
            //Set field value for ExternalGUID
            //InventoryAdjustmentAddRq.ExternalGUID.SetValue(Guid.NewGuid().ToString());
            IInventoryAdjustmentLineAdd InventoryAdjustmentLineAdd10753 = InventoryAdjustmentAddRq.InventoryAdjustmentLineAddList.Append();

            //Set field value for ListID
            InventoryAdjustmentLineAdd10753.ItemRef.ListID.SetValue(inventoryItem.ListID.GetValue());     //"8000000B-1553066645" Item List Id
            //Set field value for FullName
            InventoryAdjustmentLineAdd10753.ItemRef.FullName.SetValue(inventoryItem.FullName.GetValue()); //"venky04" Item Name
            string ORTypeAdjustmentElementType10754 = "QuantityAdjustment";

            if (ORTypeAdjustmentElementType10754 == "QuantityAdjustment")
            {
                string ORQuantityAdjustmentElementType10755 = "NewQuantity";
                if (ORQuantityAdjustmentElementType10755 == "NewQuantity")
                {
                    //Set field value for NewQuantity
                    InventoryAdjustmentLineAdd10753.ORTypeAdjustment.QuantityAdjustment.ORQuantityAdjustment.NewQuantity.SetValue(inventoryItem.QuantityOnHand.GetValue());
                }
                //if (ORQuantityAdjustmentElementType10755 == "QuantityDifference")
                //{
                //    //Set field value for QuantityDifference
                //    InventoryAdjustmentLineAdd10753.ORTypeAdjustment.QuantityAdjustment.ORQuantityAdjustment.QuantityDifference.SetValue(10);
                //}

                //string ORSerialLotNumberElementType10756 = "SerialNumber";
                //if (ORSerialLotNumberElementType10756 == "SerialNumber")
                //{
                //    //Set field value for SerialNumber
                //    InventoryAdjustmentLineAdd10753.ORTypeAdjustment.QuantityAdjustment.ORSerialLotNumber.SerialNumber.SetValue("12345");
                //}
                //if (ORSerialLotNumberElementType10756 == "LotNumber")
                //{
                //    //Set field value for LotNumber
                //    InventoryAdjustmentLineAdd10753.ORTypeAdjustment.QuantityAdjustment.ORSerialLotNumber.LotNumber.SetValue("ab");
                //}

                ////Set field value for ListID
                //InventoryAdjustmentLineAdd10753.ORTypeAdjustment.QuantityAdjustment.InventorySiteLocationRef.ListID.SetValue("200000-1011023419");
                ////Set field value for FullName
                //InventoryAdjustmentLineAdd10753.ORTypeAdjustment.QuantityAdjustment.InventorySiteLocationRef.FullName.SetValue("ab");
            }
            if (ORTypeAdjustmentElementType10754 == "ValueAdjustment")
            {
                string ORQuantityAdjustmentElementType10757 = "NewQuantity";
                if (ORQuantityAdjustmentElementType10757 == "NewQuantity")
                {
                    //Set field value for NewQuantity
                    InventoryAdjustmentLineAdd10753.ORTypeAdjustment.ValueAdjustment.ORQuantityAdjustment.NewQuantity.SetValue(2);
                }
                if (ORQuantityAdjustmentElementType10757 == "QuantityDifference")
                {
                    //Set field value for QuantityDifference
                    InventoryAdjustmentLineAdd10753.ORTypeAdjustment.ValueAdjustment.ORQuantityAdjustment.QuantityDifference.SetValue(2);
                }
                string ORValueAdjustmentElementType10758 = "NewValue";
                if (ORValueAdjustmentElementType10758 == "NewValue")
                {
                    //Set field value for NewValue
                    InventoryAdjustmentLineAdd10753.ORTypeAdjustment.ValueAdjustment.ORValueAdjustment.NewValue.SetValue(10.01);
                }
                if (ORValueAdjustmentElementType10758 == "ValueDifference")
                {
                    //Set field value for ValueDifference
                    InventoryAdjustmentLineAdd10753.ORTypeAdjustment.ValueAdjustment.ORValueAdjustment.ValueDifference.SetValue(10.01);
                }
            }
            if (ORTypeAdjustmentElementType10754 == "SerialNumberAdjustment")
            {
                string ORSerialNumberAdjustmentElementType10759 = "AddSerialNumber";
                if (ORSerialNumberAdjustmentElementType10759 == "AddSerialNumber")
                {
                    //Set field value for AddSerialNumber
                    InventoryAdjustmentLineAdd10753.ORTypeAdjustment.SerialNumberAdjustment.ORSerialNumberAdjustment.AddSerialNumber.SetValue("ab");
                }
                if (ORSerialNumberAdjustmentElementType10759 == "RemoveSerialNumber")
                {
                    //Set field value for RemoveSerialNumber
                    InventoryAdjustmentLineAdd10753.ORTypeAdjustment.SerialNumberAdjustment.ORSerialNumberAdjustment.RemoveSerialNumber.SetValue("ab");
                }
                //Set field value for ListID
                InventoryAdjustmentLineAdd10753.ORTypeAdjustment.SerialNumberAdjustment.InventorySiteLocationRef.ListID.SetValue("200000-1011023419");
                //Set field value for FullName
                InventoryAdjustmentLineAdd10753.ORTypeAdjustment.SerialNumberAdjustment.InventorySiteLocationRef.FullName.SetValue("ab");
            }
            if (ORTypeAdjustmentElementType10754 == "LotNumberAdjustment")
            {
                //Set field value for LotNumber
                InventoryAdjustmentLineAdd10753.ORTypeAdjustment.LotNumberAdjustment.LotNumber.SetValue("ab");
                //Set field value for CountAdjustment
                InventoryAdjustmentLineAdd10753.ORTypeAdjustment.LotNumberAdjustment.CountAdjustment.SetValue(6);
                //Set field value for ListID
                InventoryAdjustmentLineAdd10753.ORTypeAdjustment.LotNumberAdjustment.InventorySiteLocationRef.ListID.SetValue("200000-1011023419");
                //Set field value for FullName
                InventoryAdjustmentLineAdd10753.ORTypeAdjustment.LotNumberAdjustment.InventorySiteLocationRef.FullName.SetValue("ab");
            }
            if (ORTypeAdjustmentElementType10754 == "")
            {
            }
            //Set field value for IncludeRetElementList
            //May create more than one of these if needed
            // InventoryAdjustmentAddRq.IncludeRetElementList.Add("ab");
        }