Esempio n. 1
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     if (Page.IsValid)
     {
         ProductLotBL objProductLotBL = new ProductLotBL();
         ProductLotEL objProductLotEL = new ProductLotEL();
         string       Responsetxt     = string.Empty;
         string       productimages   = Request["hdnimagefiles"];
         objProductLotEL.ProductUsed = ItemUsed.SelectedItem.ToString();
         if (!categotyLevel2.Visible)
         {
             objProductLotEL.CategoryId = Convert.ToInt32(categotyLevel1.SelectedValue);
         }
         else
         {
             if (categotyLevel3.Visible)
             {
                 objProductLotEL.CategoryId = Convert.ToInt32(categotyLevel3.SelectedValue);
             }
             else
             {
                 objProductLotEL.CategoryId = Convert.ToInt32(categotyLevel2.SelectedValue);
             }
         }
         objProductLotEL.AuctionId           = Convert.ToInt32(auction.SelectedValue);
         objProductLotEL.IsBranded           = rdbYes.Checked;
         objProductLotEL.Title               = txtTitle.Text;
         objProductLotEL.SKU                 = txtSKU.Text;
         objProductLotEL.Description         = txtDesc.Text;
         objProductLotEL.Question            = txtQuestion.Text;
         objProductLotEL.Quantity            = Convert.ToInt32(txtQuantity.Text);
         objProductLotEL.CostBasis           = txtCost.Text;
         objProductLotEL.RetailPrice         = txtRetail.Text;
         objProductLotEL.BuyPrice            = txtBuy.Text;
         objProductLotEL.StartingBid         = txtStartBid.Text;
         objProductLotEL.ShipCountry         = ddlCountry.Text;
         objProductLotEL.ShipWithin          = ddlShipWithin.Text;
         objProductLotEL.DeliveryTime        = ddlTimeTake.Text;
         objProductLotEL.IsFreeShipping      = chkFreeShipping.Checked;
         objProductLotEL.ShippingPrice       = ddlPrice.Text;
         objProductLotEL.IsShippedEverywhere = chkShip.Checked;
         objProductLotEL.LowEstimatePrice    = lowEstimatePrice.Text;
         objProductLotEL.HighEstimatePrice   = highEstimatePrice.Text;
         objProductLotEL.LiveAuctionPassed   = "0";
         objProductLotEL.FairWarning         = false;
         objProductLotEL.IsSold              = false;
         objProductLotEL.images              = productimages;
         if (objProductLotBL.Save(objProductLotEL, out Responsetxt))
         {
             ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "ScriptRegistration", "alert('" + Responsetxt + "');", true);
         }
         else
         {
             ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "ScriptRegistration", "alert('" + Responsetxt + "');", true);
         }
     }
 }
Esempio n. 2
0
        private void PopulateAuction()
        {
            ProductLotBL objProductLotBL = new ProductLotBL();
            DataTable    dtAuction       = objProductLotBL.GetAuction(Convert.ToString(Session["UserType"]), Convert.ToInt32(Session["UserId"]));

            auction.DataSource     = dtAuction;
            auction.DataTextField  = "AuctionName";
            auction.DataValueField = "AuctionId";
            auction.DataBind();
        }
Esempio n. 3
0
        private void PopulateCategoryLevel1()
        {
            ProductLotBL objProductLotBL  = new ProductLotBL();
            DataTable    dtCategoryLevel1 = objProductLotBL.GetProductCategoryLevel1();

            categotyLevel1.DataSource     = dtCategoryLevel1;
            categotyLevel1.DataTextField  = "CategoryName";
            categotyLevel1.DataValueField = "CategoryId";
            categotyLevel1.DataBind();
            PopulateCategoryLevel2(Convert.ToInt32(categotyLevel1.SelectedValue));
        }
Esempio n. 4
0
        private void PopulateCategoryLevel3(int parentCategoryIdLevel2)
        {
            ProductLotBL objProductLotBL  = new ProductLotBL();
            DataTable    dtCategoryLevel3 = objProductLotBL.GetProductCategoryLevel3(parentCategoryIdLevel2);

            categotyLevel3.DataSource     = dtCategoryLevel3;
            categotyLevel3.DataTextField  = "CategoryName";
            categotyLevel3.DataValueField = "CategoryId";
            categotyLevel3.DataBind();
            if (dtCategoryLevel3.Rows.Count > 0)
            {
                categotyLevel3.Visible = true;
            }
            else
            {
                categotyLevel3.Visible = false;
            }
        }
Esempio n. 5
0
        private void PopulateCategoryLevel2(int parentCategoryIdLevel1)
        {
            ProductLotBL objProductLotBL  = new ProductLotBL();
            DataTable    dtCategoryLevel2 = objProductLotBL.GetProductCategoryLevel2(parentCategoryIdLevel1);

            categotyLevel2.DataSource     = dtCategoryLevel2;
            categotyLevel2.DataTextField  = "CategoryName";
            categotyLevel2.DataValueField = "CategoryId";
            categotyLevel2.DataBind();
            if (dtCategoryLevel2.Rows.Count > 0)
            {
                categotyLevel2.Visible = true;
                PopulateCategoryLevel3(Convert.ToInt32(categotyLevel2.SelectedValue));
            }
            else
            {
                categotyLevel2.Visible = false;
                categotyLevel3.Visible = false;
            }
        }
Esempio n. 6
0
        protected void Upload(object sender, EventArgs e)
        {
            #region UpLoadCSV
            //Upload and save the file
            if (CSVFileUpload.HasFile)
            {
                string filename = DateTime.Now.ToString("yyyy_MM_ddTHHmmss") + "_" + Path.GetFileName(CSVFileUpload.FileName);
                string csvPath  = Server.MapPath("~/fileupload/CSV/") + filename;
                CSVFileUpload.SaveAs(csvPath);

                DataTable dt = new DataTable();
                dt.Columns.AddRange(new DataColumn[5] {
                    new DataColumn("Number", typeof(string)),
                    new DataColumn("LotDesc", typeof(string)),
                    new DataColumn("LowEstimatePrice", typeof(string)),
                    new DataColumn("HighEstimatePrice", typeof(string)),
                    new DataColumn("SaleSection", typeof(string))
                });
                string csvData = File.ReadAllText(csvPath);
                foreach (string row in csvData.Split('\n'))
                {
                    try
                    {
                        if (!string.IsNullOrEmpty(row))
                        {
                            dt.Rows.Add();
                            int i = 0;
                            foreach (string cell in row.Split(','))
                            {
                                dt.Rows[dt.Rows.Count - 1][i] = cell;
                                i++;
                            }
                        }
                    }
                    catch (Exception)
                    {
                        Response.Write("<script type='text/javascript'>alert('There might be a problem in uploading the file.Please try again !');</script>");
                    }
                }
                /*--------- proc call ---------- */
                ProductLotBL objProductLotBL = new ProductLotBL();
                ProductLotEL objProductLotEL = new ProductLotEL();
                string       Responsetxt     = string.Empty;
                string       productimages   = Request["hdnimagefiles"];
                ArrayList    images          = new ArrayList();
                foreach (string image in productimages.Split(','))
                {
                    images.Add(image);
                }
                Response.Write(images.Count);
                /*--------- proc call end -------*/
                string connectionString = System.Configuration.ConfigurationSettings.AppSettings["ConnStr"];
                using (SqlConnection con = new SqlConnection(connectionString))
                {
                    try
                    {
                        for (int i = 1; i < dt.Rows.Count; i++)
                        {
                            var            category      = Convert.ToString(dt.Rows[i]["SaleSection"]).Trim();
                            string         CategoryQuery = "select * from ProductCategory where CategoryName like '" + category + "'";
                            SqlDataAdapter adapter       = new SqlDataAdapter(CategoryQuery, con);
                            DataTable      dtCategory    = new DataTable();
                            adapter.Fill(dtCategory);
                            objProductLotEL.ProductUsed         = "";
                            objProductLotEL.CategoryId          = Convert.ToInt32(dtCategory.Rows[0]["CategoryId"]);
                            objProductLotEL.AuctionId           = Convert.ToInt32(auction.SelectedValue);
                            objProductLotEL.IsBranded           = true;
                            objProductLotEL.Title               = "";
                            objProductLotEL.SKU                 = "";
                            objProductLotEL.Description         = Convert.ToString(dt.Rows[i]["LotDesc"]);
                            objProductLotEL.Question            = "";
                            objProductLotEL.Quantity            = 1;
                            objProductLotEL.CostBasis           = "";
                            objProductLotEL.RetailPrice         = "";
                            objProductLotEL.BuyPrice            = "";
                            objProductLotEL.StartingBid         = "";
                            objProductLotEL.ShipCountry         = "";
                            objProductLotEL.ShipWithin          = "";
                            objProductLotEL.DeliveryTime        = "";
                            objProductLotEL.IsFreeShipping      = true;
                            objProductLotEL.ShippingPrice       = "";
                            objProductLotEL.IsShippedEverywhere = true;
                            objProductLotEL.IsScheduled         = true;
                            objProductLotEL.images              = Convert.ToString(images[i - 1]);
                            objProductLotEL.LowEstimatePrice    = Convert.ToString(dt.Rows[i]["LowEstimatePrice"]);
                            objProductLotEL.HighEstimatePrice   = Convert.ToString(dt.Rows[i]["HighEstimatePrice"]);
                            if (objProductLotBL.Save(objProductLotEL, out Responsetxt))
                            {
                                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "ScriptRegistration", "alert('" + Responsetxt + "');", true);
                            }
                            else
                            {
                                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "ScriptRegistration", "alert('" + Responsetxt + "');", true);
                            }
                        }
                    }
                    catch (Exception)
                    {
                        Response.Write("<script type='text/javascript'>alert('There might be a problem in uploading the file.Please try again !');</script>");
                    }
                }
            }
            #endregion
        }