Пример #1
0
        public bool Is_Exist_Local(DataLoad data)
        {
            bool result = true;
            Logs log    = new Logs();

            try
            {
                Query local = new Query();
                if (!local.Check_Exits_Product(data.Sku, data.CategoryId))
                {
                    Product product    = local.Insert_Product(data);
                    long    product_id = product.Id;
                    local.Insert_Product_Category(product.Id, data.CategoryId);
                    Pinterest pinterest = local.Insert_Pinterest(product_id, data);
                    local.Insert_Product_Link_Pinterest(product_id, pinterest.Id);
                    data.TypeName = local.Get_Product_Type_By_Id(data.Type).Name;
                    result        = false;
                }
            }
            catch (Exception ex)
            {
                log.IErrors("Logic - Is_Exist_Local: " + ex.Message);
            }
            return(result);
        }
Пример #2
0
        public bool Insert_Pin(DataLoad data)
        {
            bool result = false;

            try
            {
                MoneyDataContext db  = new MoneyDataContext();
                Pinterest        pin = new Pinterest
                {
                    Old_Id       = data.OldId,
                    Board        = data.Board,
                    Backlink     = data.Backlink,
                    Note         = data.Note,
                    Image_Url    = data.Image_Url,
                    Type         = data.Type,
                    Is_Pin       = 0,
                    Created_Date = DateTime.Now
                };
                db.Pinterests.InsertOnSubmit(pin);
                db.SubmitChanges();
                result = true;
            }
            catch (Exception ex) { }
            return(result);
        }
Пример #3
0
        public List <ShareResult> GetUrlsShares(string url, List <SocialNetworks> networks)
        {
            List <ShareResult> shareResults = new List <ShareResult>();
            ShareResult        sr;

            foreach (var item in networks)
            {
                sr = new ShareResult();
                switch (item)
                {
                case SocialNetworks.Facebook:
                    sr = Facebook.GetShares(url);
                    break;

                case SocialNetworks.Twitter:
                    sr = Twitter.GetShares(url);
                    break;

                case SocialNetworks.Vk:
                    sr = VKontakte.GetShares(url);
                    break;

                case SocialNetworks.Linkedin:
                    sr = Linkedin.GetShares(url);
                    break;

                case SocialNetworks.Mailru:
                    sr = Mailru.GetShares(url);
                    break;

                case SocialNetworks.Pinterest:
                    sr = Pinterest.GetShares(url);
                    break;

                case SocialNetworks.Odnoklassniki:
                    sr = Odnoklassniki.GetShares(url);
                    break;

                case SocialNetworks.Reddit:
                    sr = Reddit.GetShares(url);
                    break;

                case SocialNetworks.Stumbleupon:
                    sr = Stumbleupon.GetShares(url);
                    break;

                case SocialNetworks.Google:
                    sr = Google.GetShares(url);
                    break;
                }
                shareResults.Add(sr);
            }
            return(shareResults);
        }
Пример #4
0
        public DataLoad ImportDataToDataLoad(Pinterest pinterest, int type)
        {
            DataLoad data = new DataLoad();

            data.Id        = pinterest.Id;
            data.Backlink  = pinterest.Backlink;
            data.Board     = pinterest.Board;
            data.Image_Url = pinterest.Image_Url;
            data.Note      = pinterest.Note;
            data.Type      = type;
            return(data);
        }
Пример #5
0
 public void Update_Pin(int id, string pin_id)
 {
     try
     {
         MoneyDataContext db   = new MoneyDataContext();
         Pinterest        prod = (from p in db.Pinterests
                                  where p.Id == id
                                  select p).SingleOrDefault();
         prod.PinId       = pin_id;
         prod.Is_Pin      = 1;
         prod.Update_Date = DateTime.Now;
         db.SubmitChanges();
     }
     catch (Exception ex) { }
 }
Пример #6
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // Perform any additional setup after loading the view, typically from a nib.
            View.BackgroundColor = UIColor.White;
            Title = "Pmterest Pint It Demo";

            // Initialize a Pinterest instance with our client_id
            pinterest = new Pinterest("1234", "prod");

            // Setup a sample imageview for the image we want to pin
            var sampleImage = UIImage.LoadFromData(
                NSData.FromUrl(
                    NSUrl.FromString("http://placekitten.com/500/400")
                    )
                );

            sampleImageView = new UIImageView(sampleImage)
            {
                Frame = new RectangleF(0, 61, 320, 200)
            };

            View.AddSubview(sampleImageView);

            // Setup PinIt Button
            pinItButton       = Pinterest.GetPinItButton();
            pinItButton.Frame = new RectangleF(124, 281, 72, 32);

            // Add button handler
            pinItButton.TouchUpInside += (sender, e) => {
                // Check if we can pin or if we are using simulator
                if (!pinterest.CanPin)
                {
                    new UIAlertView("Error:", "Pinterest SDK can't pin if you are using simulator or you don't have Pinterest app :'(", null, "Ok", null).Show();
                }
                else
                {
                    pinterest.CreatePin(NSUrl.FromString("http://placekitten.com/500/400"),
                                        NSUrl.FromString("http://placekitten.com"),
                                        "Pinning from Pin It Demo"
                                        );
                }
            };

            View.AddSubview(pinItButton);
        }
Пример #7
0
        public List <ShareResult> GetAll(string url)
        {
            List <ShareResult> shareResults = new List <ShareResult>();

            shareResults.Add(Facebook.GetShares(url));
            shareResults.Add(Twitter.GetShares(url));
            shareResults.Add(VKontakte.GetShares(url));
            shareResults.Add(Linkedin.GetShares(url));
            shareResults.Add(Mailru.GetShares(url));
            shareResults.Add(Pinterest.GetShares(url));
            shareResults.Add(Odnoklassniki.GetShares(url));
            shareResults.Add(Reddit.GetShares(url));
            shareResults.Add(Stumbleupon.GetShares(url));
            shareResults.Add(Google.GetShares(url));


            return(shareResults);
        }
Пример #8
0
        // Insert Pinterest

        public Pinterest Insert_Pinterest(long product_id, DataLoad data)
        {
            MoneyDataContext db   = new MoneyDataContext();
            Pinterest        prod = new Pinterest
            {
                Board        = data.Tag,
                Backlink     = data.UrlName,
                Note         = data.Description,
                Image_Url    = data.Image,
                Type         = 1,
                Is_Pin       = 0,
                Created_Date = DateTime.Now
            };

            try
            {
                db.Pinterests.InsertOnSubmit(prod);
                db.SubmitChanges();
            }
            catch (Exception ex) { }
            return(prod);
        }