예제 #1
0
        private filters addFilter(filters filtresIn, string key, string op, string value)
        {
            filters filtres = filtresIn;

            if (filtres == null)
            {
                filtres = new filters();
            }

            complexFilter compfiltres = new complexFilter();

            compfiltres.key = key;
            associativeEntity ass = new associativeEntity();

            ass.key           = op;
            ass.value         = value;
            compfiltres.value = ass;

            List <complexFilter> tmpLst;

            if (filtres.complex_filter != null)
            {
                tmpLst = filtres.complex_filter.ToList();
            }
            else
            {
                tmpLst = new List <complexFilter>();
            }

            tmpLst.Add(compfiltres);

            filtres.complex_filter = tmpLst.ToArray();

            return(filtres);
        }
예제 #2
0
파일: mage.cs 프로젝트: chisan0501/ic_ef
        public salesOrderListEntity[] get_open_orders()
        {
            MagentoService mservice = new MagentoService();
            String         mlogin   = mservice.login("admin", "Interconnection123!");

            filters mf = new filters();

            complexFilter[] cpf  = new complexFilter[1];
            complexFilter   mcpf = new complexFilter();

            mcpf.key = "status";
            associativeEntity mas = new associativeEntity();

            mas.key    = "in";
            mas.value  = "pending,processing,approved_clearsale,analysing_clearsale,pending_clearsale";
            mcpf.value = mas;
            cpf[0]     = mcpf;
            //mcpf = new complexFilter();
            //mcpf.key = "status";
            //mas = new associativeEntity();

            //mas.key = "eq";
            //mas.value = "processing";
            //mcpf.value = mas;
            //cpf[1] = mcpf;
            //mcpf = new complexFilter();
            //mcpf.key = "status";
            //mas = new associativeEntity();

            //mas.key = "eq";
            //mas.value = "approved_clearsale";
            //mcpf.value = mas;
            //cpf[2] = mcpf;
            //mcpf = new complexFilter();
            //mcpf.key = "status";
            //mas = new associativeEntity();

            //mas.key = "eq";
            //mas.value = "analysing_clearsale";
            //mcpf.value = mas;
            //cpf[3] = mcpf;
            //mcpf = new complexFilter();
            //mcpf.key = "status";
            //mas = new associativeEntity();

            //mas.key = "eq";
            //mas.value = "pending_clearsale";
            //mcpf.value = mas;
            //cpf[4] = mcpf;
            mf.complex_filter = cpf;
            var soe = mservice.salesOrderList(mlogin, mf);

            return(soe);
        }
예제 #3
0
파일: mage.cs 프로젝트: chisan0501/ic_ef
        //use for retail picklist
        public int retail_quick_import(Models.retail_quick_import retail)
        {
            MagentoService mservice = new MagentoService();
            String         mlogin   = mservice.login("admin", "Interconnection123!");

            catalogProductCreateEntity            create     = new catalogProductCreateEntity();
            catalogCategoryEntity                 add_cat    = new catalogCategoryEntity();
            catalogInventoryStockItemUpdateEntity stock_data = new catalogInventoryStockItemUpdateEntity();

            stock_data.qty                     = "1";
            stock_data.manage_stock            = 1;
            stock_data.use_config_manage_stock = 0;
            stock_data.is_in_stock             = 1;
            create.description                 = retail.desc;
            create.name              = retail.name;
            create.price             = retail.price;
            create.short_description = retail.short_desc;
            create.status            = retail.status;
            create.visibility        = retail.visible;
            create.weight            = retail.weight;
            create.website_ids       = retail.webistes;
            create.tax_class_id      = retail.tax_id;

            create.stock_data = stock_data;

            associativeEntity[] attributes = new associativeEntity[3];
            attributes[0]       = new associativeEntity();
            attributes[0].key   = "vendor_id";
            attributes[0].value = "11";
            attributes[1]       = new associativeEntity();
            attributes[1].key   = "approval";
            attributes[1].value = "2";
            attributes[2]       = new associativeEntity();
            attributes[2].key   = "vendor_sku";
            attributes[2].value = retail.sku + "_vendor";
            catalogProductAdditionalAttributesEntity additionalAttributes = new catalogProductAdditionalAttributesEntity();

            additionalAttributes.single_data = attributes;
            create.additional_attributes     = additionalAttributes;
            int p_id = mservice.catalogProductCreate(
                mlogin, retail.type, retail.attr, retail.sku, create, "5");

            mservice.catalogCategoryAssignProduct(mlogin, 2, retail.sku, "0", "SKU");



            return(p_id);
        }
예제 #4
0
        protected void export_Click(object sender, EventArgs e)
        {
            MagentoService mservice = new MagentoService();
            String         mlogin   = mservice.login("admin", "Interconnection123");

            string[] arr1    = new string[] { "1218" };
            string   product = "1";
            catalogInventoryStockItemUpdateEntity update_item = new catalogInventoryStockItemUpdateEntity();

            update_item.qty         = "1";
            update_item.is_in_stock = 1;
            var update = mservice.catalogInventoryStockItemUpdate(mlogin, product, update_item);
            var item   = mservice.catalogInventoryStockItemList(mlogin, arr1);


            //working up_sell function
            //catalogProductLinkEntity assign = new catalogProductLinkEntity();
            //assign.position = "1";


            //mservice.catalogProductLinkUpdate(mlogin, "related", "1030", "1029", assign, "product_id");



            catalogProductCreateEntity create = new catalogProductCreateEntity();
            var inv = new catalogProductTierPriceEntity();

            create.name              = name.Text;
            create.price             = price_control.Text;
            create.description       = des.Text;
            create.short_description = short_des.Text;
            create.tax_class_id      = "2";
            create.meta_title        = meta_info.Text;
            create.visibility        = "4";
            create.weight            = "0";
            create.status            = "2";
            create.meta_description  = meta_description.Text;
            inv.qty = 0;

            associativeEntity[] attributes = new associativeEntity[18];
            attributes[0]       = new associativeEntity();
            attributes[0].key   = "asset_tag";
            attributes[0].value = asset_tag.Text;

            attributes[1]       = new associativeEntity();
            attributes[1].key   = "sku_family";
            attributes[1].value = sku_family.Text;

            attributes[2]       = new associativeEntity();
            attributes[2].key   = "cpu";
            attributes[2].value = cpu.Text;

            attributes[3]       = new associativeEntity();
            attributes[3].key   = "software_description";
            attributes[3].value = soft_des.Text;

            attributes[4]       = new associativeEntity();
            attributes[4].key   = "ram";
            attributes[4].value = ram.Text + " RAM";

            attributes[5]       = new associativeEntity();
            attributes[5].key   = "hdd";
            attributes[5].value = hdd.Text + " HDD";

            attributes[6]       = new associativeEntity();
            attributes[6].key   = "os";
            attributes[6].value = software.Text;

            attributes[7]       = new associativeEntity();
            attributes[7].key   = "creation_date";
            attributes[7].value = create_date.Text;

            attributes[8]       = new associativeEntity();
            attributes[8].key   = "wireless";
            attributes[8].value = wireless.SelectedItem.ToString();

            attributes[9]       = new associativeEntity();
            attributes[9].key   = "incl";
            attributes[9].value = includes.Text;

            attributes[10]       = new associativeEntity();
            attributes[10].key   = "brand";
            attributes[10].value = brand.Text;

            attributes[11]       = new associativeEntity();
            attributes[11].key   = "grade";
            attributes[11].value = grade.SelectedItem.Value;

            attributes[12]       = new associativeEntity();
            attributes[12].key   = "wcoa";
            attributes[12].value = wcoa.Text;

            attributes[13]       = new associativeEntity();
            attributes[13].key   = "ocoa";
            attributes[13].value = ocoa.Text;

            attributes[14]       = new associativeEntity();
            attributes[14].key   = "video";
            attributes[14].value = video_card.Text;

            attributes[15]       = new associativeEntity();
            attributes[15].key   = "display";
            attributes[15].value = screen.Text;

            attributes[16]       = new associativeEntity();
            attributes[16].key   = "computer";
            attributes[16].value = is_computer.SelectedValue;

            attributes[17]       = new associativeEntity();
            attributes[17].key   = "optical";
            attributes[17].value = optical.Text;

            catalogProductAdditionalAttributesEntity additionalAttributes = new catalogProductAdditionalAttributesEntity();

            additionalAttributes.single_data = attributes;
            create.additional_attributes     = additionalAttributes;

            mservice.catalogProductCreate(
                mlogin, "simple", "4", sku.Text, create, "1");

            mservice.Dispose();

            //update inventory
            catalogInventoryStockItemUpdateEntity qty_update = new catalogInventoryStockItemUpdateEntity();


            qty_update.qty         = qty.Text;
            qty_update.is_in_stock = int.Parse(stock_Availability.SelectedValue);

            mservice.catalogInventoryStockItemUpdate(
                mlogin, sku.Text, qty_update);



            get_magento_list(sku.Text);
            ClearTextBoxes(Page);
            //string content = "admin,,Default,simple,,,0,"+status.SelectedItem.ToString()+ ",No,\"Catalog, Search\",Yes,"+tax_class.SelectedItem.ToString()+ ",No,No,Yes,No,No,\"" + name.Text+ "\",,," + software.Text+ ","+cpu.Text+","+hdd.Text+",,"+ram.Text+ ",Use config,Use config,\"" + meta_info.Text+ "\",\"" + meta_description.Text+ "\",,,,,No layout updates,Block after Info Column,No,,,,,,"+brand.Text+ ",\"" + includes.Text+ "\"," + grade.SelectedItem.ToString()+",,,,,,,,,,,,,,,,,,"+wireless.SelectedItem.ToString()+ ",,,,,,,,,,,,,," + des.Text + ",\"" + short_des.Text+ "\",,,\"" + soft_des.Text+ "\",,,,,,,,,,,1,0,1,0,0,1,1,1,0,1,0,,,1,0,1,0,1,0,1,0,0,0,1,\"" + name.Text+ "\",0,simple,,,,,,,,,,," + asset_tag.Text+","+sku_family.Text+","+create_date.Text+"";
        }
예제 #5
0
        private void bbDownload_Click(object sender, EventArgs e)
        {
            if (cbLoja.SelectedItem == null)
            {
                MessageBox.Show("Obrigatório selecionar loja.", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information);
                cbLoja.Focus();
                return;
            }
            if (string.IsNullOrEmpty((cbLoja.SelectedItem as TRegistro_LojaVirtual).UserName))
            {
                MessageBox.Show("Não existe USERNAME cadastrado para loja.", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            if (string.IsNullOrEmpty((cbLoja.SelectedItem as TRegistro_LojaVirtual).ApiKey))
            {
                MessageBox.Show("Não existe APIKEY cadastrado para loja.", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            MagentoService api    = new MagentoService();
            string         sessao = string.Empty;

            try
            {
                sessao = api.login((cbLoja.SelectedItem as TRegistro_LojaVirtual).UserName, (cbLoja.SelectedItem as TRegistro_LojaVirtual).ApiKey);
                filters         mf  = new filters();
                complexFilter[] cpf = new complexFilter[0];
                if (cbStatus.SelectedIndex > 0)
                {
                    complexFilter mcpf = new complexFilter();
                    mcpf.key = "status";
                    associativeEntity mas = new associativeEntity();
                    mas.key    = "=";
                    mas.value  = cbStatus.SelectedValue.ToString();
                    mcpf.value = mas;
                    Array.Resize(ref cpf, cpf.Length + 1);
                    cpf[cpf.Length - 1] = mcpf;
                }
                if (!string.IsNullOrEmpty(dt_ini.Text.SoNumero()))
                {
                    complexFilter mcpf = new complexFilter();
                    mcpf.key = "created_at";
                    associativeEntity mas = new associativeEntity();
                    mas.key    = "from";
                    mas.value  = DateTime.Parse(dt_ini.Text).ToString("yyyy-MM-dd") + " 00:00:00";
                    mcpf.value = mas;
                    Array.Resize(ref cpf, cpf.Length + 1);
                    cpf[cpf.Length - 1] = mcpf;
                }
                mf.complex_filter = cpf;
                salesOrderListEntity[] lista = api.salesOrderList(sessao, mf);
                if (lista.Length > 0)
                {
                    TList_Pedido lPedido = new TList_Pedido();
                    lista.ToList().ForEach(p =>
                    {
                        object obj = new TCD_Pedido().BuscarEscalar(
                            new TpBusca[]
                        {
                            new TpBusca()
                            {
                                vNM_Campo = "a.Nr_PedidoOrigem",
                                vOperador = "=",
                                vVL_Busca = "'" + p.increment_id.Trim() + "'"
                            }
                        }, "a.nr_pedido");
                        lPedido.Add(new TRegistro_Pedido()
                        {
                            Nr_PedidoOrigem = p.increment_id,
                            Vl_totalpedido  = decimal.Divide(int.Parse(p.grand_total.SoNumero()), 10000),
                            StatusMagento   = p.status,
                            NM_Clifor       = p.firstname.Trim() + " " + p.lastname.Trim(),
                            Nr_pedido       = obj == null ? 0 : decimal.Parse(obj.ToString()),
                            DT_Pedido       = DateTime.Parse(p.created_at)
                        });
                    });
                    bsPedLoja.DataSource = lPedido;
                }
            }
            catch (Exception ex)
            { MessageBox.Show(ex.Message.Trim(), "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error); }
            finally
            {
                if (!string.IsNullOrWhiteSpace(sessao))
                {
                    api.endSession(sessao);
                }
            }
        }