예제 #1
0
파일: DAL.cs 프로젝트: MaKeBits/AxRest
        public void deleteAddress(Address address)
        {
            try
            {

                AxLogon();

                using (axRecord = ax.CreateAxaptaRecord(tableName))
                {
                    // Execute a query to retrieve an editable record
                    // where the name is MyStateUpdated.
                    string stmt = "select forupdate * from %1 where %1.RecId == " + address.recId + "";
                    axRecord.ExecuteStmt(stmt);

                    deleteAxRecord();
                }
                ax.Logoff();
            }
            catch (Exception e)
            {
                throw (e);
            }
            finally
            {
                ax.Logoff();
            }
        }
예제 #2
0
        public void deleteAddress(Address address)
        {
            try
            {
                AxLogon();

                using (axRecord = ax.CreateAxaptaRecord(tableName))
                {
                    // Execute a query to retrieve an editable record
                    // where the name is MyStateUpdated.
                    string stmt = "select forupdate * from %1 where %1.RecId == " + address.recId + "";
                    axRecord.ExecuteStmt(stmt);

                    deleteAxRecord();
                }
                ax.Logoff();
            }
            catch (Exception e)
            {
                throw (e);
            }
            finally
            {
                ax.Logoff();
            }
        }
        public List <IntershopWebService.SizeStock> getItemDims(string itemId, string company)
        {
            List <IntershopWebService.SizeStock> sizeStockList = new List <IntershopWebService.SizeStock>();
            Axapta axapta = (Axapta)null;

            try
            {
                axapta = this.axLogon(company);
                string       str          = "select * from %1 where %1.ItemId == '" + itemId + "'";
                AxaptaRecord axaptaRecord = axapta.CreateAxaptaRecord("InventSize");
                axaptaRecord.ExecuteStmt(str);
                while (axaptaRecord.Found)
                {
                    IntershopWebService.SizeStock sizeStock = new IntershopWebService.SizeStock();
                    if (Convert.ToBoolean(axaptaRecord.get_Field("Color")))
                    {
                        sizeStock.color = Convert.ToString(axaptaRecord.get_Field("InventSizeId"));
                    }
                    else
                    {
                        sizeStock.size = Convert.ToString(axaptaRecord.get_Field("InventSizeId"));
                    }
                    sizeStockList.Add(sizeStock);
                    axaptaRecord.Next();
                }
                return(sizeStockList);
            }
            catch (Exception ex)
            {
                MessageLogger.info(string.Format("getItemDims(itemId={0}, company={1} -> error: {2})", itemId, company, ex.Message));
                return((List <IntershopWebService.SizeStock>)null);
            }
            finally
            {
                axapta.Logoff();
            }
        }
예제 #4
0
파일: DAL.cs 프로젝트: MaKeBits/AxRest
        public List<Address> getListOfAdresses()
        {
            Addresses addresses = new Addresses();

            // The AddressState field names for calls to
            // the AxRecord.get_field method.
            string strNameField = "NAME";
            string strStateIdField = "STATEID";
            string strRecIdField = "RecId";

            // The output variables for calls to the
            // AxRecord.get_Field method.
            string fieldName, fieldStateId, recId;

            try
            {
                AxLogon();

                // Create a query using the AxaptaRecord class
                // for the StateAddress table.
                using (axRecord = ax.CreateAxaptaRecord(tableName))
                {
                    // Execute the query on the table.
                    string stmt = "select * from %1";
                    axRecord.ExecuteStmt(stmt);

                    // Loop through the set of retrieved records.
                    while (axRecord.Found)
                    {
                        // Retrieve the record data for the specified fields.
                        fieldName = (String)axRecord.get_Field(strNameField);
                        fieldStateId = (String)axRecord.get_Field(strStateIdField);
                        recId = axRecord.get_Field(strRecIdField).ToString();

                        if (!String.IsNullOrEmpty(fieldName) && !String.IsNullOrEmpty(fieldStateId) && !String.IsNullOrEmpty(recId))
                        {
                            Address address = new Address();
                            address.Name = fieldName;
                            address.StateId = fieldStateId;
                            address.recId = recId;
                            addresses.Add(address);
                        }

                        // Advance to the next row.
                        axRecord.Next();
                    }
                }
                ax.Logoff();
            }

            catch (Exception e)
            {
                throw (e);
            }
            finally
            {
                ax.Logoff();
            }

            return addresses;
        }
예제 #5
0
        public List <Address> getListOfAdresses()
        {
            Addresses addresses = new Addresses();

            // The AddressState field names for calls to
            // the AxRecord.get_field method.
            string strNameField    = "NAME";
            string strStateIdField = "STATEID";
            string strRecIdField   = "RecId";

            // The output variables for calls to the
            // AxRecord.get_Field method.
            string fieldName, fieldStateId, recId;

            try
            {
                AxLogon();

                // Create a query using the AxaptaRecord class
                // for the StateAddress table.
                using (axRecord = ax.CreateAxaptaRecord(tableName))
                {
                    // Execute the query on the table.
                    string stmt = "select * from %1";
                    axRecord.ExecuteStmt(stmt);

                    // Loop through the set of retrieved records.
                    while (axRecord.Found)
                    {
                        // Retrieve the record data for the specified fields.
                        fieldName    = (String)axRecord.get_Field(strNameField);
                        fieldStateId = (String)axRecord.get_Field(strStateIdField);
                        recId        = axRecord.get_Field(strRecIdField).ToString();

                        if (!String.IsNullOrEmpty(fieldName) && !String.IsNullOrEmpty(fieldStateId) && !String.IsNullOrEmpty(recId))
                        {
                            Address address = new Address();
                            address.Name    = fieldName;
                            address.StateId = fieldStateId;
                            address.recId   = recId;
                            addresses.Add(address);
                        }

                        // Advance to the next row.
                        axRecord.Next();
                    }
                }
                ax.Logoff();
            }

            catch (Exception e)
            {
                throw (e);
            }
            finally
            {
                ax.Logoff();
            }

            return(addresses);
        }