コード例 #1
0
        public bool CargaProductoKit()
        {
            AxaptaRecord axRecord;

            var queryProductoKit = (from pdrel in db.tempProdKit
                                    select pdrel).ToList();

            System.Net.NetworkCredential jj = new System.Net.NetworkCredential("irojas", "italo123");
            DynAx.LogonAs("irojas", "yolito.cl", jj, "yod", "", "", "");
            if (deleteTempKit() == true)
            {
                using (axRecord = DynAx.CreateAxaptaRecord("InventConbinationItemKit"))
                {
                    axRecord.ExecuteStmt("select * from %1");
                    if (queryProductoKit.Count == 0)
                    {
                        int count = 0;
                        while (axRecord.Found)
                        {
                            tempProdKit tempProdKit = new tempProdKit
                            {
                                IdProd        = count++,
                                ItemId        = Convert.ToString(axRecord.get_Field("ItemId")),
                                ConfigId      = Convert.ToString(axRecord.get_Field("ConfigId")),
                                InventSizeId  = Convert.ToString(axRecord.get_Field("InventSizeId")),
                                InventColorId = Convert.ToString(axRecord.get_Field("InventColorId")),
                                RefRecId      = Convert.ToInt64(axRecord.get_Field("RefRecId")),
                            };
                            db.tempProdKit.Add(tempProdKit);

                            axRecord.Next();
                        }
                        db.SaveChanges();
                        DynAx.Logoff();
                        return(true);
                    }
                }
            }

            return(false);
        }
コード例 #2
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);
        }