Пример #1
0
    public static void Shop_AddProductVariant(string StoreName, string APIKey, string Password, long ProductID, string JsonString, out SqlInt64 VariantID)
    {
        ShopifyClient sp = new ShopifyClient(StoreName, APIKey, Password);
        VariantID = sp.AddProductVariant(ProductID, JsonString);

        if (!String.IsNullOrEmpty(sp.ErrMsg))
            RaiseErr(sp.ErrMsg);
    }
Пример #2
0
    public static void Shop_CalculateRefund(string StoreName, string APIKey, string Password, long OrderID, string JsonString)
    {
        ShopifyClient sp = new ShopifyClient(StoreName, APIKey, Password);
        SqlPipe p = SqlContext.Pipe;

        // Create a new record with the column metadata. The constructor is
        // able to accept a variable number of parameters.
        SqlDataRecord record = new SqlDataRecord(
            new SqlMetaData[] { new SqlMetaData("ShippingAmount", SqlDbType.NVarChar,18),
            new SqlMetaData("ShippingTax", SqlDbType.NVarChar,18),
            new SqlMetaData("MaximumRefundable", SqlDbType.NVarChar,18),
            new SqlMetaData("RefundLineItems", SqlDbType.Int,4),
            new SqlMetaData("Transactions", SqlDbType.Int,4)}
            );

        Refund r = sp.CalculateRefund(OrderID, JsonString);
        // Mark the begining of the result-set.
        SqlContext.Pipe.SendResultsStart(record);
        // Set the record fields.
        record.SetString(0,r.shipping.amount);
        record.SetString(1, r.shipping.tax);
        record.SetString(2, r.shipping.maximum_refundable);
        record.SetInt32(3, r.refund_line_items.Count);
        record.SetInt32(4, r.transactions.Count);

        //record.SetInt32(1, 42);
        //record.SetDateTime(2, DateTime.Now);

        // Send the row back to the client.
        SqlContext.Pipe.SendResultsRow(record);

        // Mark the end of the result-set.
        SqlContext.Pipe.SendResultsEnd();

        // Send the record to the calling program.
        SqlContext.Pipe.Send(record);
    }
Пример #3
0
 private void GetRefunds(long OrderID)
 {
     sp = new ShopifyClient(_storename, _apikey, _password);
     List<Refund> vars = sp.GetRefunds(OrderID);
     txtRawData_Copy.Clear();
     foreach (Refund r in vars)
     {
         txtRawData_Copy.Text += String.Format("ID: {0}| created at: {1}\n", r.id, r.created_at);
     }
 }
Пример #4
0
    public static IEnumerable Shop_GetVariantMetafields(string StoreName, string APIKey, string Password, long VariantID)
    {
        ShopifyClient sp = new ShopifyClient(StoreName, APIKey, Password);

        return sp.GetVariantMetafields(VariantID);
    }
Пример #5
0
    public static IEnumerable Shop_GetStoreMetafields(string StoreName, string APIKey, string Password)
    {
        ShopifyClient sp = new ShopifyClient(StoreName, APIKey, Password);

        return sp.GetStoreMetafields();
    }
Пример #6
0
    public static IEnumerable Shop_GetProducts(string StoreName, string APIKey, string Password, string PublishedStatus = null, string ProductType = null, int Page = 1)
    {
        ShopifyClient sp = new ShopifyClient(StoreName, APIKey, Password);
        ePublishedStatus _ps = ePublishedStatus.any;

        if (PublishedStatus != null)
        {
            if (Enum.TryParse(PublishedStatus, out _ps))
                _ps = (ePublishedStatus)Enum.Parse(typeof(ePublishedStatus), PublishedStatus);
        }

        string _pt = ProductType != null ? ProductType : "";
        ArrayList prods = new ArrayList();

        foreach(SIProduct pr in sp.GetProducts(_ps, _pt, Page))
        {
            SIOption op1 = pr.options[0];

            foreach(SIVariant vr in pr.variants)
            {
                ArrayList al = new ArrayList();
                al.Add(pr.id);
                al.Add(pr.title);
                al.Add(pr.product_type);
                al.Add(vr.price);
                al.Add(vr.compare_at_price);
                al.Add(vr.sku);
                al.Add(vr.inventory_quantity);
                al.Add(vr.id);
                al.Add(op1.id);
                al.Add(pr.tags);

                prods.Add(al);
            }
        }

        return prods;
    }
Пример #7
0
    public static IEnumerable Shop_GetOrders(string StoreName, string APIKey, string Password, string OrderStatus = null, string FulfillmentStatus = null, string FinancialStatus = null, int Page = 1)
    {
        ShopifyClient sp = new ShopifyClient(StoreName, APIKey, Password);
        eOrderStatus _os = eOrderStatus.any;
        eFulfillmentStatus _fus = eFulfillmentStatus.any;
        eOrderFinancialStatus _fis = eOrderFinancialStatus.any;

        if (OrderStatus != null)
        {
            if (Enum.TryParse(OrderStatus, out _os))
                _os = (eOrderStatus)Enum.Parse(typeof(eOrderStatus), OrderStatus);
        }

        if (FulfillmentStatus != null)
        {
            if (Enum.TryParse(FulfillmentStatus, out _fus))
                _fus = (eFulfillmentStatus)Enum.Parse(typeof(eFulfillmentStatus), FulfillmentStatus);
        }

        if (FinancialStatus != null)
        {
            if (Enum.TryParse(FinancialStatus, out _fis))
                _fis = (eOrderFinancialStatus)Enum.Parse(typeof(eOrderFinancialStatus), FinancialStatus);
        }

        return sp.GetOrders(_os, _fus, _fis, Page);
    }
Пример #8
0
    public static SqlInt32 Shop_UpdateStoreMetafield(string StoreName, string APIKey, string Password, long MetafieldID, string Value, string ValueType)
    {
        ShopifyClient sp = new ShopifyClient(StoreName, APIKey, Password);
        int success = sp.UpdateStoreMetafield(MetafieldID, Value, ValueType);

        if (!String.IsNullOrEmpty(sp.ErrMsg))
            RaiseErr(sp.ErrMsg);

        return success;
    }
Пример #9
0
 private void UpdatePrice(int VariantID)
 {
     sp = new ShopifyClient(_storename, _apikey, _password);
     int success = sp.UpdateVariant(VariantID, eSIVariantAttribute.price, 888);
     txtRawData_Copy.Text = success.ToString();
 }
Пример #10
0
 private void AddProduct()
 {
     sp = new ShopifyClient(_storename, _apikey, _password);
     long success = sp.AddProduct(txtRawData_Copy.Text);
     txtRawData_Copy.Text += "\n" + sp.RawData + "|| ProductID: " + success;
 }
Пример #11
0
 private void SP_UpdateProduct()
 {
     sp = new ShopifyClient(_storename, _apikey, _password);
     int success = sp.UpdateProduct(Convert.ToInt32(txtInput_Copy.Text), txtRawData_Copy.Text);
     txtRawData_Copy.Clear();
     txtRawData_Copy.Text += success.ToString();
 }
Пример #12
0
 private void PostFulfillment()
 {
     sp = new ShopifyClient(_storename, _apikey, _password);
     long fID = sp.PostFulfillment(Convert.ToInt64(txtInput_Copy.Text), txtRawData_Copy.Text);
     txtRawData_Copy.Clear();
     txtRawData_Copy.Text = fID.ToString();
 }
Пример #13
0
 private void GetVariantMetafields(int VariantID)
 {
     sp = new ShopifyClient(_storename, _apikey, _password);
     List<Metafield> vars = sp.GetVariantMetafields(VariantID);
     txtRawData_Copy.Clear();
     foreach (Metafield m in vars)
     {
         txtRawData_Copy.Text += String.Format("ID: {0}| Key: {1}| value: {2}| valuetype: {3}\n", m.id, m.key, m.value, m.value_type);
     }
 }
Пример #14
0
        private void GetSPPRoducts()
        {
            sp = new ShopifyClient(_storename, _apikey, _password);
            List<SIProduct> prods = sp.GetProducts(ePublishedStatus.unpublished);

            txtRawData_Copy.Clear();
            foreach(SIProduct sip in prods)
            {
                txtRawData_Copy.Text += String.Format("productID: {0}| sku: {1}| variantID: {2}| Qty: {3}| price: {4}\n", sip.id, sip.title, sip.variants[0].id, sip.variants[0].inventory_quantity, sip.variants[0].price);
            }
        }
Пример #15
0
        private void GetSPOrders()
        {
            sp = new ShopifyClient(_storename, _apikey, _password);
            List<SIOrder> prods = sp.GetOrders(eOrderStatus.cancelled, eFulfillmentStatus.any, eOrderFinancialStatus.any, 1);

            txtRawData_Copy.Clear();
            foreach (SIOrder sip in prods)
            {
                txtRawData_Copy.Text += String.Format("orderID: {0}| number: {1}| checkoutid: {2}\n", sip.id, sip.order_number, sip.checkout_id);
            }
        }
Пример #16
0
    public static void Shop_UpdateFulfillment(string StoreName, string APIKey, string Password, long OrderID, long FulfillmentID, string JsonString, out SqlString Status )
    {
        ShopifyClient sp = new ShopifyClient(StoreName, APIKey, Password);
        Status = sp.UpdateFulfillment(OrderID, FulfillmentID, JsonString);

        if (!String.IsNullOrEmpty(sp.ErrMsg))
            RaiseErr(sp.ErrMsg);
    }
Пример #17
0
    public static SqlInt32 Shop_UpdatePrice(string StoreName, string APIKey, string Password, long VariantID, double Price)
    {
        ShopifyClient sp = new ShopifyClient(StoreName, APIKey, Password);
        int success = sp.UpdateVariant(VariantID, eSIVariantAttribute.price, Price);

        if (!String.IsNullOrEmpty(sp.ErrMsg))
            RaiseErr(sp.ErrMsg);

        return success;
    }
Пример #18
0
 private void UpdateStoreMetafield(long MetafieldID)
 {
     sp = new ShopifyClient(_storename, _apikey, _password);
     int success = sp.UpdateStoreMetafield(MetafieldID, txtRawData_Copy.Text, "integer");
     txtRawData_Copy.Text += "\n" + sp.RawData + "\n" + success.ToString();
 }
Пример #19
0
    public static SqlInt32 Shop_UpdateVariant(string StoreName, string APIKey, string Password, long VariantID, string JsonString)
    {
        ShopifyClient sp = new ShopifyClient(StoreName, APIKey, Password);
        int success = sp.UpdateVariant(VariantID, JsonString);

        if (!String.IsNullOrEmpty(sp.ErrMsg))
            RaiseErr(sp.ErrMsg);

        return success;
    }
Пример #20
0
 private void UpdateVariant(int VariantID)
 {
     sp = new ShopifyClient(_storename, _apikey, _password);
     int success = sp.UpdateVariant(VariantID, txtRawData_Copy.Text);
     txtRawData_Copy.Text += success.ToString();
 }
Пример #21
0
 private void AddProductVariant()
 {
     sp = new ShopifyClient(_storename, _apikey, _password);
     long success = sp.AddProductVariant(Convert.ToInt64(txtInput_Copy.Text), txtRawData_Copy.Text);
     txtRawData_Copy.Text += "\n" + sp.RawData + "|| VariantID: " + success;
 }
Пример #22
0
    public static SqlInt32 Shop_DeleteProductVariant(string StoreName, string APIKey, string Password, long ProductID, long VariantID)
    {
        ShopifyClient sp = new ShopifyClient(StoreName, APIKey, Password);
        int success = sp.DeleteProductVariant(ProductID, VariantID);

        if (!String.IsNullOrEmpty(sp.ErrMsg))
            RaiseErr(sp.ErrMsg);

        return success;
    }
Пример #23
0
    public static IEnumerable Shop_GetProduct(string StoreName, string APIKey, string Password, long ProductID)
    {
        ShopifyClient sp = new ShopifyClient(StoreName, APIKey, Password);
        List<SIProduct> prods = new List<SIProduct>();
        SIProduct p = sp.GetProduct(ProductID);
        prods.Add(p);

        return prods;
    }
Пример #24
0
    public static void Shop_GetOrderCount(string StoreName, string APIKey, string Password)
    {
        ShopifyClient sp = new ShopifyClient(StoreName, APIKey, Password);
        SqlPipe p = SqlContext.Pipe;

        // Create the record and specify the metadata for the columns.
        SqlDataRecord record = new SqlDataRecord(new SqlMetaData("OrderCount", SqlDbType.Int));

        // Mark the begining of the result-set.
        SqlContext.Pipe.SendResultsStart(record);
        record.SetInt32(0,sp.GetOrderCount());

        // Send the row back to the client.
        SqlContext.Pipe.SendResultsRow(record);

        // Mark the end of the result-set.
        SqlContext.Pipe.SendResultsEnd();
    }
Пример #25
0
    public static IEnumerable Shop_GetProductVariants(string StoreName, string APIKey, string Password, long ProductID)
    {
        ShopifyClient sp = new ShopifyClient(StoreName, APIKey, Password);

        return sp.GetProductVariants(ProductID);
    }
Пример #26
0
    public static void Shop_GetProductCount(string StoreName, string APIKey, string Password, string Vendor = null, string ProductType = null, string PublishedStatus = null)
    {
        ShopifyClient sp = new ShopifyClient(StoreName, APIKey, Password);
        SqlPipe p = SqlContext.Pipe;

        // Create the record and specify the metadata for the columns.
        SqlDataRecord record = new SqlDataRecord(new SqlMetaData("ProductCount", SqlDbType.Int));

        string _v = Vendor != null ? Vendor : "";
        string _pt = ProductType != null ? ProductType : "";
        string _ps = PublishedStatus != null ? PublishedStatus : "";
        // Mark the begining of the result-set.
        SqlContext.Pipe.SendResultsStart(record);
        record.SetInt32(0, sp.GetProductCount(_v, _pt, _ps));

        // Send the row back to the client.
        SqlContext.Pipe.SendResultsRow(record);

        // Mark the end of the result-set.
        SqlContext.Pipe.SendResultsEnd();
    }
Пример #27
0
 public static IEnumerable Shop_GetTransactions(string StoreName, string APIKey, string Password, long OrderID, long SinceID)
 {
     ShopifyClient sp = new ShopifyClient(StoreName, APIKey, Password);
     return sp.GetTransactions(OrderID, SinceID);
 }
Пример #28
0
    public static void Shop_PostTransaction(string StoreName, string APIKey, string Password, long OrderID, string JsonString, out SqlInt64 TransactionID)
    {
        ShopifyClient sp = new ShopifyClient(StoreName, APIKey, Password);
        TransactionID = sp.PostTransaction(OrderID, JsonString);

        if (TransactionID < 0 || !String.IsNullOrEmpty(sp.ErrMsg))
            RaiseErr(sp.ErrMsg);
    }
Пример #29
0
    public static IEnumerable Shop_GetOrderLineItems(string StoreName, string APIKey, string Password, long OrderID)
    {
        ShopifyClient sp = new ShopifyClient(StoreName, APIKey, Password);

        return sp.GetOrderLineItems(OrderID);
    }
Пример #30
0
        private void GetProductVariants(int ProductID)
        {
            sp = new ShopifyClient(_storename, _apikey, _password);

            List<SIVariant> vars = sp.GetProductVariants(ProductID);
            txtRawData_Copy.Clear();
            foreach(SIVariant v in vars)
            {
                txtRawData_Copy.Text = String.Format("ID: {0}| Price: {1:C}| Qty: {2}", v.id, v.price, v.inventory_quantity);
            }
        }