public seller Get(int id)
        {
            seller _seller = new seller();

            //using (VendedoresEntities vendedoresentities = new VendedoresEntities())
            //{
            //    var resVend = vendedoresentities.VENDEDORs.FirstOrDefault(e => e.CODIGO == id);



            //    var resCiudad = vendedoresentities.CIUDADs.FirstOrDefault(x => x.CODIGO == resVend.CODIGO_CIUDAD);

            //    resVend.CODIGO_CIUDAD = resCiudad.CODIGO;


            //    return resVend;
            //}



            var res = dbContext.VENDEDORs.Where(p => p.CODIGO == id);

            _seller.CODIGO_CIUDAD = res.Select(x => x.CODIGO_CIUDAD).FirstOrDefault();

            foreach (var x in res)
            {
                _seller.CODIGO   = x.CODIGO;
                _seller.NOMBRE   = x.NOMBRE;
                _seller.APELLIDO = x.APELLIDO;
                _seller.NUMERO_IDENTIFICACION = x.NUMERO_IDENTIFICACION;
            }

            return(_seller);
        }
Esempio n. 2
0
        public async Task <IActionResult> Edit(int id, [Bind("seller_id,seller_name,seller_email,seller_password,seller_confirm_password,seller_mobile_no,seller_shop_address,seller_image")] seller seller)
        {
            if (id != seller.seller_id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(seller);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!sellerExists(seller.seller_id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(seller));
        }
Esempio n. 3
0
        public ActionResult Create(RevendeurModel collection, HttpPostedFileBase File)
        {
            seller s1 = new seller
            {
                name        = collection.Name,
                phoneNumber = collection.tel,
                email       = collection.Email,
                latitude    = collection.Latitude,
                longitude   = collection.Longitude,
                ImageName   = collection.ImageName
            };



            if (File.ContentLength > 0)
            {
                string _FileName = Path.GetFileName(new Random().Next().ToString() + File.FileName);
                var    path      = Path.Combine(Server.MapPath("~/Content/Upload"), _FileName);

                File.SaveAs(path);
                s1.ImageName = _FileName;
            }


            rvs.Add(s1);
            rvs.Commit();

            return(RedirectToAction("Index"));
        }
Esempio n. 4
0
        public bool UserLogin()
        {
            try
            {
                RealEntities db   = new RealEntities();
                user         user = db.users.Where(u => u.user_name == UserName && u.password == Password).FirstOrDefault();
                if (null == user)
                {
                    return(false);
                }
                UserId = user.user_id;
                seller seller = db.sellers.Where(s => s.user_id == user.user_id).FirstOrDefault();
                buyer  buyer  = db.buyers.Where(b => b.user_id == user.user_id).FirstOrDefault();

                if (null != buyer && null != seller)
                {
                    Type = UserType.Both;
                }
                else if (null != buyer)
                {
                    Type = UserType.Buyer;
                }
                else if (null != seller)
                {
                    Type = UserType.Seller;
                }
                return(true);
            }
            catch (Exception ex)
            {
            }
            return(false);
        }
Esempio n. 5
0
        public async Task <IActionResult> Create([Bind("seller_id,seller_name,seller_email,seller_password,seller_confirm_password,seller_mobile_no,seller_shop_address,seller_image")] seller_view_model seller)
        {
            if (ModelState.IsValid)
            {
                string uniqe_filename = null;
                if (seller.seller_image != null)
                {
                    string uplodefolder = Path.Combine(hostingEnvironment.WebRootPath, "seller_image");
                    uniqe_filename = Guid.NewGuid().ToString() + "_" + seller.seller_image.FileName;
                    String filePath = Path.Combine(uplodefolder, uniqe_filename);

                    seller.seller_image.CopyTo(new FileStream(filePath, FileMode.Create));
                }
                ;
                var user = new customer_identity
                {
                    seller_email        = seller.seller_email,
                    seller_name         = seller.seller_name,
                    seller_shop_address = seller.seller_shop_address,
                    seller_mobile_no    = seller.seller_mobile_no,
                    UserName            = seller.seller_email,
                    account_type        = "seller",
                };
                seller new_seller = new seller
                {
                    seller_email            = seller.seller_email,
                    seller_name             = seller.seller_name,
                    seller_shop_address     = seller.seller_shop_address,
                    seller_mobile_no        = seller.seller_mobile_no,
                    seller_password         = seller.seller_password,
                    seller_image            = uniqe_filename,
                    seller_confirm_password = seller.seller_confirm_password,
                };
                var result = await userManager.CreateAsync(user, seller.seller_password);

                if (result.Succeeded)
                {
                    _context.Add(new_seller);
                    await _context.SaveChangesAsync();

                    await signInManager.SignInAsync(user, isPersistent : false);

                    int id = await getuserAsync(seller.seller_email);

                    HttpContext.Session.SetInt32("seller_id", id);
                    CookieOptions cookie = new CookieOptions();
                    cookie.Expires = DateTime.Now.AddDays(365);
                    Response.Cookies.Append("seller_id", id.ToString());
                    Response.Cookies.Append("roll", "seller");

                    return(RedirectToAction("Homepage", "sellers"));
                }
                foreach (var error in result.Errors)
                {
                    ModelState.AddModelError(string.Empty, error.Description);
                }
            }
            return(View(seller));
        }
Esempio n. 6
0
        public ActionResult DeleteConfirmed(int id)
        {
            seller seller = db.seller.Find(id);

            db.seller.Remove(seller);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Esempio n. 7
0
 public ActionResult Edit([Bind(Include = "id,latitude,longitude,email,name,phoneNumber,ImageName")] seller seller)
 {
     if (ModelState.IsValid)
     {
         db.Entry(seller).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(seller));
 }
Esempio n. 8
0
        //public string Search()
        //{
        //    seller s = Is.GetSeller("007");
        //    return s.Name1 + "\n" + s.Id1 + "\n" + s.Address1 + "\n" + s.Moblie1 + "\n" + s.Company1;
        //}
        public IActionResult Search(int?id)
        {
            int Id = (int)((id == null) ? 1 : id);

            seller se = sellerbo.GetSeller(Id);

            //if(se!=null)
            //{
            //    return Content(se.Name1+"\n"+se.Id1+"\n"+se.Address1+"\n"+se.Moblie1+"\n"+se.Company1);

            //}
            return(View(se));
        }
Esempio n. 9
0
 protected void lstSeller_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(lstSellers.SelectedValue))
     {
         int    sellerID   = int.Parse(lstSellers.SelectedValue);
         seller sellerThis = seller.Cache.First(b => b.id == sellerID);
         txtSellerName.Text  = sellerThis.fullName;
         txtSellerLogin.Text = sellerThis.login;
         txtSellerPass.Text  = sellerThis.password;
         chkIsActive.Checked = sellerThis.isActive.GetValueOrDefault();
         chkIsAdmin.Checked  = sellerThis.isAdmin.GetValueOrDefault();
     }
 }
Esempio n. 10
0
        // GET: Revendeur/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            seller seller = db.seller.Find(id);

            if (seller == null)
            {
                return(HttpNotFound());
            }
            return(View(seller));
        }
        public ActionResult Create([Bind(Include = "user_id,user_email,user_role,user_password")] user user)
        {
            if (ModelState.IsValid)
            {
                var count = db.users.Count(u => u.user_email == user.user_email);
                if (count == 0)
                {
                    db.users.Add(user);
                    if (user.user_role == "seller")
                    {
                        seller seller = new seller
                        {
                            seller_email = (string)Session["email"],
                            seller_name  = (string)Session["name"],
                            seller_phone = (string)Session["phone"],
                            seller_state = (string)Session["state"]
                        };
                        db.sellers.Add(seller);
                    }
                    else
                    {
                        customer customer = new customer
                        {
                            customer_email = (string)Session["email"],
                            customer_name  = (string)Session["name"],
                            customer_phone = (string)Session["phone"],
                            customer_state = (string)Session["state"]
                        };
                        db.customers.Add(customer);
                        string body      = "Welcome To Online HouseRentManagementSystem";
                        string sendemail = ConfigurationManager.AppSettings["SendEmail"];
                        if (sendemail.ToLower() == "true")
                        {
                            SendEmail.Send(customer.customer_email, body);
                        }
                    }
                    db.SaveChanges();
                    Session["message"] = "";
                    return(RedirectToAction("SignupLogin", "Home"));
                }
                else
                {
                    Session["message"] = "User email already exist..!";
                    return(RedirectToAction("SignupLogin", "Home"));
                }
            }

            return(View(user));
        }
Esempio n. 12
0
        public static int GetSeller()
        {
            int    sellerid = 0;
            Object user     = System.Web.HttpContext.Current.Session["UserId"];

            if (null != user)
            {
                long userid = (long)user;
                using (RealEntities db = new RealEntities())
                {
                    seller seller = db.sellers.Where(s => s.user_id == userid).FirstOrDefault();
                    sellerid = seller.seller_id;
                }
            }
            return(sellerid);
        }
Esempio n. 13
0
 // GET: Sellers/Edit/5
 public ActionResult Edit(int?id, string saved = null)
 {
     if (Session["user_role"] != null)
     {
         if (id == null)
         {
             return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
         }
         seller seller = db.sellers.Find(id);
         if (seller == null)
         {
             return(HttpNotFound());
         }
         ViewData["saved"] = saved;
         return(View(seller));
     }
     return(RedirectToAction("Index", "Home"));
 }
Esempio n. 14
0
        protected void btnSellerAdd_Click(object sender, EventArgs e)
        {
            string sellerName = "Продавец";
            var    db         = new ssmDataContext();
            seller seller     = new seller {
                isActive = false, fullName = sellerName, isAdmin = false, password = "******", login = "******"
            };

            db.sellers.InsertOnSubmit(seller);
            db.SubmitChanges();
            seller.Refresh();
            lstsellersFill();

            if (lstSellers.Items.FindByText(sellerName) != null)
            {
                lstSellers.SelectedIndex = lstSellers.Items.IndexOf(lstSellers.Items.FindByText(sellerName));
                lstSeller_SelectedIndexChanged(new object(), new EventArgs());
            }
        }
        public ActionResult Register(UserDetail U)
        {
            db.UserDetails.Add(U);
            db.SaveChanges();
            var user = db.UserDetails.Single(u => u.UserName == U.UserName);

            if (user.Role == "Seller")
            {
                seller seller = new seller(user.Name, user.UserName, user.Email, user.Password);
                db.sellers.Add(seller);
                db.SaveChanges();
            }
            if (user.Role == "Customer")
            {
                Customer customer = new Customer(user.Name, user.UserName, user.Email, user.Password);
                db.Customers.Add(customer);
                db.SaveChanges();
            }
            return(View());
        }
Esempio n. 16
0
        public ActionResult Create([Bind(Include = "seller_id,seller_name,seller_email,seller_phone,seller_photo,seller_state")] seller seller)
        {
            if (ModelState.IsValid)
            {
                Session["name"]      = seller.seller_name.ToLower();
                Session["phone"]     = seller.seller_phone;
                Session["state"]     = seller.seller_state.ToLower();
                Session["email"]     = seller.seller_email;
                Session["user_role"] = "seller";
                int con = db.users.Count(s => s.user_email == seller.seller_email);
                if (con == 0)
                {
                    return(RedirectToAction("Create", "Users"));
                }
                else
                {
                    Session["message"] = "User email already exist..!";
                    return(RedirectToAction("SignupLogin", "Home"));
                }
            }

            return(View("/Views/Home/SignupLogin.cshtml"));
        }
Esempio n. 17
0
        protected void btnSellerUpdate_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(lstSellers.SelectedValue))
            {
                string sellerName = txtSellerName.Text;

                int    sellerID = int.Parse(lstSellers.SelectedValue);
                var    db       = new ssmDataContext();
                seller seller   = db.sellers.First(b => b.id == sellerID);
                seller.fullName = txtSellerName.Text;
                seller.login    = txtSellerLogin.Text;
                seller.password = txtSellerPass.Text;
                seller.isActive = chkIsActive.Checked;
                seller.isAdmin  = chkIsAdmin.Checked;
                db.SubmitChanges();
                seller.Refresh();
                lstsellersFill();
                if (lstSellers.Items.FindByText(sellerName) != null)
                {
                    lstSellers.SelectedIndex = lstSellers.Items.IndexOf(lstSellers.Items.FindByText(sellerName));
                    lstSeller_SelectedIndexChanged(new object(), new EventArgs());
                }
            }
        }
Esempio n. 18
0
 public ActionResult Edit([Bind(Exclude = "seller_photo", Include = "seller_id,seller_name,seller_email,seller_phone,seller_state")] seller seller, HttpPostedFileBase seller_photo)
 {
     if (ModelState.IsValid)
     {
         ViewData.Clear();
         if (seller_photo != null && seller_photo.ContentLength > 0)
         {
             BinaryReader binaryReader = new BinaryReader(seller_photo.InputStream);
             seller.seller_photo = binaryReader.ReadBytes((int)seller_photo.ContentLength);
         }
         else
         {
             var ts = db.sellers.AsNoTracking().FirstOrDefault(s => s.seller_id == seller.seller_id);
             seller.seller_photo = ts.seller_photo;
         }
         seller.seller_name     = seller.seller_name.ToLower();
         seller.seller_state    = seller.seller_state.ToLower();
         db.Entry(seller).State = EntityState.Modified;
         db.SaveChanges();
         ViewData["saved"] = "yes";
         return(RedirectToAction("Edit", "Sellers", new { id = seller.seller_id, saved = "true" }));
     }
     return(View(seller));
 }
Esempio n. 19
0
        /// <summary>
        /// Default constructor of Allocator
        /// </summary>
        public Allocator()
        {
            this.TopBlock = new BufferBlock <IRecord>();

            this.LinkOptions = new DataflowLinkOptions {
                PropagateCompletion = true
            };

            #region NewInsertBlocks
            this.InsertBestSellersAction = new ActionBlock <best_sellers[]>(a =>
            {
                using (var context = new KeepaContext())
                {
                    //context.Configuration.AutoDetectChangesEnabled = false;
                    context.best_sellers.AddRange(a);
                    context.SaveChangesAsync();
                }
            });

            this.InsertCategoryAction = new ActionBlock <category[]>(a =>
            {
                using (var context = new KeepaContext())
                {
                    //context.Configuration.AutoDetectChangesEnabled = false;
                    context.categories.AddRange(a);
                    context.SaveChanges();
                }
            });

            this.InsertCategoryLookupAction = new ActionBlock <category_lookup[]>(a =>
            {
                using (var context = new KeepaContext())
                {
                    //context.Configuration.AutoDetectChangesEnabled = false;
                    context.category_lookup.AddRange(a);
                    context.SaveChanges();
                }
            });

            this.InsertCategoryTreeAction = new ActionBlock <category_tree[]>(a =>
            {
                using (var context = new KeepaContext())
                {
                    //context.Configuration.AutoDetectChangesEnabled = false;
                    context.category_tree.AddRange(a);
                    context.SaveChanges();
                }
            });

            this.InsertEanAction = new ActionBlock <ean[]>(a =>
            {
                using (var context = new KeepaContext())
                {
                    //context.Configuration.AutoDetectChangesEnabled = false;
                    context.eans.AddRange(a);
                    context.SaveChanges();
                }
            });

            this.InsertFbaFeesAction = new ActionBlock <fba_fees[]>(a =>
            {
                using (var context = new KeepaContext())
                {
                    //context.Configuration.AutoDetectChangesEnabled = false;
                    context.fba_fees.AddRange(a);
                    context.SaveChanges();
                }
            });

            this.InsertFeatureAction = new ActionBlock <feature[]>(a =>
            {
                using (var context = new KeepaContext())
                {
                    //context.Configuration.AutoDetectChangesEnabled = false;
                    context.features.AddRange(a);
                    context.SaveChanges();
                }
            });

            this.InsertFreqBoughtAction = new ActionBlock <freq_bought_together[]>(a =>
            {
                using (var context = new KeepaContext())
                {
                    //context.Configuration.AutoDetectChangesEnabled = false;
                    context.freq_bought_together.AddRange(a);
                    context.SaveChanges();
                }
            });

            this.InsertLanguageAction = new ActionBlock <language[]>(a =>
            {
                using (var context = new KeepaContext())
                {
                    Console.WriteLine("HIT - Language");

                    //context.Configuration.AutoDetectChangesEnabled = false;
                    context.languages.AddRange(a);
                    context.SaveChanges();
                }
            });

            this.InsertMostRatedSellersAction = new ActionBlock <most_rated_sellers[]>(a =>
            {
                using (var context = new KeepaContext())
                {
                    Console.WriteLine("HIT - MostRatedSellers");

                    //context.Configuration.AutoDetectChangesEnabled = false;
                    context.most_rated_sellers.AddRange(a);
                    context.SaveChanges();
                }
            });

            this.InsertPriceHistoryAction = new ActionBlock <price_history[]>(a =>
            {
                using (var context = new KeepaContext())
                {
                    Console.WriteLine("HIT - PriceHistory");

                    //context.Configuration.AutoDetectChangesEnabled = false;
                    context.price_history.AddRange(a);
                    context.SaveChanges();
                }
            });

            this.InsertProductAction = new ActionBlock <product[]>(a =>
            {
                using (var context = new KeepaContext())
                {
                    Console.WriteLine("HIT - Product");

                    //context.Configuration.AutoDetectChangesEnabled = false;
                    context.products.AddRange(a);
                    context.SaveChanges();
                }
            });

            this.InsertSellerAction = new ActionBlock <seller[]>(a =>
            {
                using (var context = new KeepaContext())
                {
                    Console.WriteLine("HIT - Seller");
                    //context.Configuration.AutoDetectChangesEnabled = false;
                    context.sellers.AddRange(a);
                    context.SaveChanges();
                }
            });

            this.InsertSellersListedItemsAction = new ActionBlock <sellers_listed_items[]>(a =>
            {
                using (var context = new KeepaContext())
                {
                    Console.WriteLine("HIT - SellersListedItems");
                    //context.Configuration.AutoDetectChangesEnabled = false;
                    context.sellers_listed_items.AddRange(a);
                    context.SaveChanges();
                }
            });

            this.InsertStatisticAction = new ActionBlock <statistic[]>(a =>
            {
                using (var context = new KeepaContext())
                {
                    Console.WriteLine("HIT - Statistic");
                    //context.Configuration.AutoDetectChangesEnabled = false;
                    context.statistics.AddRange(a);
                    context.SaveChanges();
                }
            });

            this.InsertUpcAction = new ActionBlock <upc[]>(a =>
            {
                using (var context = new KeepaContext())
                {
                    Console.WriteLine("HIT - Upc");
                    //context.Configuration.AutoDetectChangesEnabled = false;
                    context.upcs.AddRange(a);
                    context.SaveChanges();
                }
            });

            this.InsertVariationAction = new ActionBlock <variation[]>(a =>
            {
                using (var context = new KeepaContext())
                {
                    Console.WriteLine("HIT - Variation");
                    //context.Configuration.AutoDetectChangesEnabled = false;
                    context.variations.AddRange(a);
                    context.SaveChanges();
                }
            });
            #endregion

            #region NewBatchBlocks
            this.bestSellerBlock      = new BatchBlock <best_sellers>(BATCH_SIZE);
            this.categoryBlock        = new BatchBlock <category>(BATCH_SIZE);
            this.categoryLookupBlock  = new BatchBlock <category_lookup>(BATCH_SIZE);
            this.categoryTreeBlock    = new BatchBlock <category_tree>(BATCH_SIZE);
            this.eanBlock             = new BatchBlock <ean>(BATCH_SIZE);
            this.fbaFeesBlock         = new BatchBlock <fba_fees>(BATCH_SIZE);
            this.featuresBlock        = new BatchBlock <feature>(BATCH_SIZE);
            this.freqBoughtBlock      = new BatchBlock <freq_bought_together>(BATCH_SIZE);
            this.languagesBlock       = new BatchBlock <language>(BATCH_SIZE);
            this.mostRatedSellerBlock = new BatchBlock <most_rated_sellers>(BATCH_SIZE);
            this.priceHistoryBlock    = new BatchBlock <price_history>(BATCH_SIZE);
            this.productBlock         = new BatchBlock <product>(BATCH_SIZE);
            //this.promotionBlock = new BatchBlock<PromotionRecord>(BATCH_SIZE);
            this.sellerItemBlock = new BatchBlock <sellers_listed_items>(BATCH_SIZE);
            this.sellerBlock     = new BatchBlock <seller>(BATCH_SIZE);
            this.statisticsBlock = new BatchBlock <statistic>(BATCH_SIZE);
            //this.topSellerBlock = new BatchBlock<TopSellersRecord>(BATCH_SIZE);
            this.upcBlock       = new BatchBlock <upc>(BATCH_SIZE);
            this.variationBlock = new BatchBlock <variation>(BATCH_SIZE);
            #endregion

            #region NewTransformBlocks
            this.BestSellerTBlock = new TransformBlock <IRecord, best_sellers>(x => {
                var dobj = (BestSellerRecord)x;
                var val  = new best_sellers(dobj.DomainId, dobj.LastUpdate, dobj.CategoryId, dobj.Asin, dobj.TimeStamp);
                return(val);
            });
            this.CategoryLookupTBlock = new TransformBlock <IRecord, category_lookup>(x =>
            {
                var dobj = (CategoryLookupRecord)x;
                var val  = new category_lookup(dobj.domainId, dobj.catId, dobj.name, dobj.children, dobj.parent, dobj.highestRank, dobj.productCount, dobj.TimeStamp);
                return(val);
            });
            this.CategoryTBlock = new TransformBlock <IRecord, category>(x => {
                var dobj = (CategoryRecord)x;
                var val  = new category(dobj.ProductId, dobj.AmznCategoryId, dobj.TimeStamp);
                return(val);
            });
            //this.CategoryTreeTBlock
            //this.DealTBlock
            this.EanTBlock = new TransformBlock <IRecord, ean>(x => {
                var dobj = (EanRecord)x;
                var val  = new ean(dobj.ProductId, dobj.EanNumber, dobj.TimeStamp);
                return(val);
            });
            this.FbaFeesTBlock = new TransformBlock <IRecord, fba_fees>(x => {
                var dobj = (FbaFeesRecord)x;
                var val  = new fba_fees(dobj.ProductId, dobj.PickPackFee, dobj.PickPackFeeTax, dobj.StorageFee, dobj.StorageFeeTax, dobj.TimeStamp);
                return(val);
            });
            this.FeatureTBlock = new TransformBlock <IRecord, feature>(x => {
                var dobj = (FeaturesRecord)x;
                var val  = new feature(dobj.ProductId, dobj.Features, dobj.TimeStamp);
                return(val);
            });
            this.FreqBoughtTBlock = new TransformBlock <IRecord, freq_bought_together>(x => {
                var dobj = (FreqBoughtTogetherRecord)x;
                var val  = new freq_bought_together(dobj.ProductId, dobj.AssociatedAsin, dobj.TimeStamp);
                return(val);
            });
            this.LanguageTBlock = new TransformBlock <IRecord, language>(x => {
                var dobj = (LanguagesRecord)x;
                var val  = new language(dobj.ProductId, dobj.LanguageName, dobj.LanguageType, dobj.AudioFormat, dobj.TimeStamp);
                return(val);
            });
            this.MostRatedSellersTBlock = new TransformBlock <IRecord, most_rated_sellers>(x => {
                var dobj = (MostRatedSellersRecord)x;
                var val  = new most_rated_sellers(dobj.AmznSellerIdentifier, dobj.TimeStamp);
                return(val);
            });
            this.PriceHistoryTBlock = new TransformBlock <IRecord, price_history>(x => {
                var dobj = (PriceHistoryRecord)x;
                var val  = new price_history(dobj.ProductId, dobj.obHistoryType, dobj.obDate, dobj.obPrice, dobj.obShipping, dobj.TimeStamp);
                return(val);
            });
            this.ProductTBlock = new TransformBlock <IRecord, product>(x =>
            {
                var dobj = (ProductRecord)x;
                var val  = new product(dobj.ProductId, dobj.productType.ToString(), dobj.asin, dobj.domainId, dobj.title, dobj.trackingSince, dobj.listedSince, dobj.lastUpdate,
                                       dobj.lastRatingUpdate, dobj.lastPriceChange, dobj.lastEbayUpdate, dobj.imagesCSV, dobj.rootCategory, dobj.parentAsin, dobj.variationCSV, dobj.mpn, dobj.hasReviews,
                                       dobj.type, dobj.manufacturer, dobj.brand, dobj.label, dobj.department, dobj.publisher, dobj.productGroup, dobj.partNumber, dobj.author, dobj.binding,
                                       dobj.numberOfItems, dobj.numberOfPages, dobj.publicationDate, dobj.releaseDate, dobj.studio, dobj.genre, dobj.model, dobj.color, dobj.size, dobj.edition,
                                       dobj.platform, dobj.format, dobj.description, dobj.hazardousMaterialType, dobj.packageHeight, dobj.packageLength, dobj.packageWidth, dobj.packageWeight, dobj.packageQuantity, dobj.availabilityAmazon,
                                       dobj.isAdultProduct, dobj.newPriceIsMAP, dobj.isEligibleForTradeIn, dobj.isEligibleForSuperSaverShipping, dobj.isRedirectASIN, dobj.isSNS, dobj.offersSuccessful, dobj.TimeStamp);
                return(val);
            });
            this.SellerTBlock = new TransformBlock <IRecord, seller>(x => {
                var dobj = (SellerRecord)x;
                var val  = new seller(dobj.SellerUid, dobj.DomainId, dobj.TrackingSince, dobj.LastUpdate, dobj.SellerId, dobj.SellerName, dobj.IsScammer, dobj.HasFba,
                                      dobj.TotalStoreFrontAsinRecTime, dobj.TotalStoreFrontAsins, dobj.Rating, dobj.RatingTime, dobj.RatingCount, dobj.RatingCountTime, dobj.TimeStamp);
                return(val);
            });
            this.SellerListedItemsTBlock = new TransformBlock <IRecord, sellers_listed_items>(x => {
                var dobj = (SellerItemRecord)x;
                var val  = new sellers_listed_items(dobj.AssociatedSeller, dobj.Asin, dobj.AsinLastSeen, dobj.TimeStamp);
                return(val);
            });
            this.StatisticsTBlock = new TransformBlock <IRecord, statistic>(x => {
                var dobj = (StatisticsRecord)x;
                var val  = new statistic(dobj.ProductId, dobj.StatType, dobj.Current, dobj.Avg, dobj.Avg30, dobj.Avg90, dobj.Avg180, dobj.AtIntervalStart, dobj.MinPriceType, dobj.MinPriceRecTime,
                                         dobj.MinPriceValue, dobj.MaxPriceType, dobj.MaxPriceRecTime, dobj.MaxPriceValue, dobj.IntervalMinPriceType, dobj.IntervalMinPriceRecTime, dobj.IntervalMinPriceValue,
                                         dobj.IntervalMaxPriceType, dobj.IntervalMaxPriceRecTime, dobj.IntervalMaxPriceValue, dobj.OutOfStockPercentageInInterval, dobj.OutOfStockPercentage30, dobj.OutOfStockPercentage90,
                                         dobj.LastOffersUpdate, dobj.TotalOffersCount, dobj.LightningDealInfo, dobj.RetrievedOfferCount, dobj.BuyBoxPrice, dobj.BuyBoxShipping, dobj.BuyBoxIsUnqualified,
                                         dobj.BuyBoxIsShippable, dobj.BuyBoxIsPreorder, dobj.BuyBoxIsFba, dobj.BuyBoxIsAmazon, dobj.BuyBoxIsMap, dobj.BuyBoxIsUsed, dobj.SellerIdsLowestFba, dobj.SellerIdsLowestFbm,
                                         dobj.OfferCountFba, dobj.OfferCountFbm, dobj.TimeStamp);
                return(val);
            });
            this.UpcTBlock = new TransformBlock <IRecord, upc>(x => {
                var dobj = (UpcRecord)x;
                var val  = new upc(dobj.ProductId, dobj.UpcNumber, dobj.TimeStamp);
                return(val);
            });
            this.VariationTBlock = new TransformBlock <IRecord, variation>(x => {
                var dobj = (VariationRecord)x;
                var val  = new variation(dobj.productId, dobj.Variation, dobj.vDimension, dobj.vValue, dobj.TimeStamp);
                return(val);
            });
            #endregion

            #region NewFilters
            this.CategoryLookupFilter     = (IRecord r) => { return(r.KeepaRecordType == KeepaRecordType.CategoryLookupRecord); };
            this.BestSellerFilter         = (IRecord r) => { return(r.KeepaRecordType == KeepaRecordType.BestSellerRecord); };
            this.CategoryFilter           = (IRecord r) => { return(r.KeepaRecordType == KeepaRecordType.CategoryRecord); };
            this.CategoryTreeFilter       = (IRecord r) => { return(r.KeepaRecordType == KeepaRecordType.CategoryTreeRecord); };
            this.DealFilter               = (IRecord r) => { return(r.KeepaRecordType == KeepaRecordType.DealRecord); };
            this.EanFilter                = (IRecord r) => { return(r.KeepaRecordType == KeepaRecordType.EanRecord); };
            this.FbaFeesFilter            = (IRecord r) => { return(r.KeepaRecordType == KeepaRecordType.FbaFeesRecord); };
            this.FeatureFilter            = (IRecord r) => { return(r.KeepaRecordType == KeepaRecordType.FeaturesRecord); };
            this.FreqBoughtTogetherFilter = (IRecord r) => { return(r.KeepaRecordType == KeepaRecordType.FrequentlyBoughtTogetherRecord); };
            this.LanguageFilter           = (IRecord r) => { return(r.KeepaRecordType == KeepaRecordType.LanguagesRecord); };
            this.MRSFilter                = (IRecord r) => { return(r.KeepaRecordType == KeepaRecordType.TopSellerRecord); };
            this.PriceHistoryFilter       = (IRecord r) => { return(r.KeepaRecordType == KeepaRecordType.PriceHistoryRecord); };
            this.ProductFilter            = (IRecord r) => { return(r.KeepaRecordType == KeepaRecordType.ProductRecord); };
            this.SellerFilter             = (IRecord r) => { return(r.KeepaRecordType == KeepaRecordType.SellerRecord); };
            this.SLIFilter                = (IRecord r) => { return(r.KeepaRecordType == KeepaRecordType.SellerItemRecord); };
            this.StatisticsFilter         = (IRecord r) => { return(r.KeepaRecordType == KeepaRecordType.StatisitcsRecord); };
            this.UpcFilter                = (IRecord r) => { return(r.KeepaRecordType == KeepaRecordType.UpcRecord); };
            this.VariationFilter          = (IRecord r) => { return(r.KeepaRecordType == KeepaRecordType.VariationsRecord); };
            #endregion

            //Dataflow Links
            #region Links
            //set up links using propogate oncompletion and appropriate filters
            #region TopToTransform
            this.TopBlock.LinkTo(this.BestSellerTBlock, this.LinkOptions, this.BestSellerFilter);
            this.TopBlock.LinkTo(this.CategoryTBlock, this.LinkOptions, this.CategoryFilter);
            this.TopBlock.LinkTo(this.CategoryLookupTBlock, this.LinkOptions, this.CategoryLookupFilter);
            this.TopBlock.LinkTo(this.EanTBlock, this.LinkOptions, this.EanFilter);
            this.TopBlock.LinkTo(this.FbaFeesTBlock, this.LinkOptions, this.FbaFeesFilter);
            this.TopBlock.LinkTo(this.FeatureTBlock, this.LinkOptions, this.FeatureFilter);
            this.TopBlock.LinkTo(this.FreqBoughtTBlock, this.LinkOptions, this.FreqBoughtTogetherFilter);
            this.TopBlock.LinkTo(this.LanguageTBlock, this.LinkOptions, this.LanguageFilter);
            this.TopBlock.LinkTo(this.MostRatedSellersTBlock, this.LinkOptions, this.MRSFilter);
            this.TopBlock.LinkTo(this.PriceHistoryTBlock, this.LinkOptions, this.PriceHistoryFilter);
            this.TopBlock.LinkTo(this.ProductTBlock, this.LinkOptions, this.ProductFilter);
            this.TopBlock.LinkTo(this.SellerTBlock, this.LinkOptions, this.SellerFilter);
            this.TopBlock.LinkTo(this.SellerListedItemsTBlock, this.LinkOptions, this.SLIFilter);
            this.TopBlock.LinkTo(this.StatisticsTBlock, this.LinkOptions, this.StatisticsFilter);
            this.TopBlock.LinkTo(this.UpcTBlock, this.LinkOptions, this.UpcFilter);
            this.TopBlock.LinkTo(this.VariationTBlock, this.LinkOptions, this.VariationFilter);
            #endregion
            //attach transforms to batch
            #region TransformToBatch
            this.BestSellerTBlock.LinkTo(this.bestSellerBlock, this.LinkOptions);
            this.CategoryTBlock.LinkTo(this.categoryBlock, this.LinkOptions);
            this.CategoryLookupTBlock.LinkTo(this.categoryLookupBlock, this.LinkOptions);
            this.EanTBlock.LinkTo(this.eanBlock, this.LinkOptions);
            this.FbaFeesTBlock.LinkTo(this.fbaFeesBlock, this.LinkOptions);
            this.FeatureTBlock.LinkTo(this.featuresBlock, this.LinkOptions);
            this.FreqBoughtTBlock.LinkTo(this.freqBoughtBlock, this.LinkOptions);
            this.LanguageTBlock.LinkTo(this.languagesBlock, this.LinkOptions);
            this.MostRatedSellersTBlock.LinkTo(this.mostRatedSellerBlock, this.LinkOptions);
            this.PriceHistoryTBlock.LinkTo(this.priceHistoryBlock, this.LinkOptions);
            this.ProductTBlock.LinkTo(this.productBlock, this.LinkOptions);
            this.SellerTBlock.LinkTo(this.sellerBlock, this.LinkOptions);
            this.SellerListedItemsTBlock.LinkTo(this.sellerItemBlock, this.LinkOptions);
            this.StatisticsTBlock.LinkTo(this.statisticsBlock, this.LinkOptions);
            this.UpcTBlock.LinkTo(this.upcBlock, this.LinkOptions);
            this.VariationTBlock.LinkTo(this.variationBlock, this.LinkOptions);
            #endregion
            //insert delegate for batches
            #region BatchToInsert
            this.bestSellerBlock.LinkTo(InsertBestSellersAction, this.LinkOptions);
            this.bestSellerBlock.Completion.ContinueWith(delegate
            {
                InsertBestSellersAction.Complete();
                InsertBestSellersAction.Completion.Wait();
            });

            this.categoryBlock.LinkTo(InsertCategoryAction, this.LinkOptions);
            this.categoryBlock.Completion.ContinueWith(delegate
            {
                InsertCategoryAction.Complete();
                InsertCategoryAction.Completion.Wait();
            });

            this.categoryLookupBlock.LinkTo(InsertCategoryLookupAction, this.LinkOptions);
            this.categoryLookupBlock.Completion.ContinueWith(delegate
            {
                InsertCategoryLookupAction.Complete();
                InsertCategoryLookupAction.Completion.Wait();
            });

            this.categoryTreeBlock.LinkTo(InsertCategoryTreeAction, this.LinkOptions);
            this.categoryTreeBlock.Completion.ContinueWith(delegate
            {
                InsertCategoryTreeAction.Complete();
                InsertCategoryTreeAction.Completion.Wait();
            });

            this.eanBlock.LinkTo(InsertEanAction, this.LinkOptions);
            this.eanBlock.Completion.ContinueWith(delegate
            {
                InsertEanAction.Complete();
                InsertEanAction.Completion.Wait();
            });

            this.fbaFeesBlock.LinkTo(InsertFbaFeesAction, this.LinkOptions);
            this.fbaFeesBlock.Completion.ContinueWith(delegate
            {
                InsertFbaFeesAction.Complete();
                InsertFbaFeesAction.Completion.Wait();
            });

            this.featuresBlock.LinkTo(InsertFeatureAction, this.LinkOptions);
            this.featuresBlock.Completion.ContinueWith(delegate
            {
                InsertFeatureAction.Complete();
                InsertFeatureAction.Completion.Wait();
            });

            this.freqBoughtBlock.LinkTo(InsertFreqBoughtAction, this.LinkOptions);
            this.freqBoughtBlock.Completion.ContinueWith(delegate
            {
                InsertFreqBoughtAction.Complete();
                InsertFreqBoughtAction.Completion.Wait();
            });

            this.languagesBlock.LinkTo(InsertLanguageAction, this.LinkOptions);
            this.languagesBlock.Completion.ContinueWith(delegate
            {
                InsertLanguageAction.Complete();
                InsertLanguageAction.Completion.Wait();
            });

            this.mostRatedSellerBlock.LinkTo(InsertMostRatedSellersAction, this.LinkOptions);
            this.mostRatedSellerBlock.Completion.ContinueWith(delegate
            {
                InsertMostRatedSellersAction.Complete();
                InsertMostRatedSellersAction.Completion.Wait();
            });

            this.priceHistoryBlock.LinkTo(InsertPriceHistoryAction, this.LinkOptions);
            this.priceHistoryBlock.Completion.ContinueWith(delegate
            {
                InsertPriceHistoryAction.Complete();
                InsertPriceHistoryAction.Completion.Wait();
            });

            this.productBlock.LinkTo(InsertProductAction, this.LinkOptions);
            this.productBlock.Completion.ContinueWith(delegate
            {
                InsertProductAction.Complete();
                InsertProductAction.Completion.Wait();
            });

            this.sellerItemBlock.LinkTo(InsertSellersListedItemsAction, this.LinkOptions);
            this.sellerItemBlock.Completion.ContinueWith(delegate
            {
                InsertSellersListedItemsAction.Complete();
                InsertSellersListedItemsAction.Completion.Wait();
            });

            this.sellerBlock.LinkTo(InsertSellerAction, this.LinkOptions);
            this.sellerBlock.Completion.ContinueWith(delegate
            {
                InsertSellerAction.Complete();
                InsertSellerAction.Completion.Wait();
            });

            this.statisticsBlock.LinkTo(InsertStatisticAction, this.LinkOptions);
            this.statisticsBlock.Completion.ContinueWith(delegate
            {
                InsertStatisticAction.Complete();
                InsertStatisticAction.Completion.Wait();
            });

            this.upcBlock.LinkTo(InsertUpcAction, this.LinkOptions);
            this.upcBlock.Completion.ContinueWith(delegate
            {
                InsertUpcAction.Complete();
                InsertUpcAction.Completion.Wait();
            });

            this.variationBlock.LinkTo(InsertVariationAction, this.LinkOptions);
            this.variationBlock.Completion.ContinueWith(delegate
            {
                InsertVariationAction.Complete();
                InsertVariationAction.Completion.Wait();
            });

            #endregion
            #endregion
        }
Esempio n. 20
0
 public static void SetSeller(seller Seller)
 {
     _Seller = Seller;
 }
Esempio n. 21
0
        public bool RegisterUser()
        {
            try
            {
                RealEntities db = new RealEntities();
                user         u  = new user();
                u.user_name  = UserName;
                u.password   = Password;
                u.first_name = FirstName;
                u.last_name  = LastName;
                u.address    = Address;
                u.pan_no     = PAN;
                u.mob_no     = Mob;
                u.email      = Email;
                u.status_id  = 1;
                db.users.Add(u);
                db.SaveChanges();
                UserId = u.user_id;
                switch (Type)
                {
                case UserType.Buyer:
                {
                    buyer b = new buyer();
                    b.user_id  = u.user_id;
                    b.max_area = MaxArea;
                    b.min_area = MinArea;
                    b.min_cost = MinCost;
                    b.max_cost = MaxCost;
                    db.buyers.Add(b);
                    break;
                }

                case UserType.Both:
                {
                    buyer b = new buyer();
                    b.user_id  = u.user_id;
                    b.max_area = MaxArea;
                    b.min_area = MinArea;
                    b.min_cost = MinCost;
                    b.max_cost = MaxCost;
                    db.buyers.Add(b);
                    seller s = new seller();
                    s.seller_type = 2;
                    s.user_id     = u.user_id;
                    db.sellers.Add(s);
                    break;
                }

                case UserType.Seller:
                {
                    seller s = new seller();
                    s.seller_type = 1;
                    s.user_id     = u.user_id;
                    db.sellers.Add(s);
                    break;
                }
                }
                db.SaveChanges();
                return(true);
            }
            catch (Exception ex)
            {
            }
            return(false);
        }