private void BindProductbyproid()
    {
        DataTable dt = new DataTable();

        dt = objProduct.GetProduct(Convert.ToInt32(Request.QueryString["proid"]));
        reponeitemdetails.DataSource = dt;
        reponeitemdetails.DataBind();

        dt = objaccess.GetDatatable("select * from tblProduct where ProductID='" + Request.QueryString["id"] + "' ");
        if (dt.Rows.Count > 0)
        {
            labelDescription.Text = dt.Rows[0]["Description"].ToString();
        }
    }
    public void AddOrder()
    {
        if (cityid != 0 && Cusid != 0 && orderid != "" && orderid != null && deliverycharge != "")
        {
            double    amountMain = 0;
            DataTable dtvalue    = objaccess.GetDatatable("select * from CartMaster where CustomerID=" + Cusid + " ");
            #region Addorder
            if (dtvalue.Rows.Count > 0)
            {
                DataTable dtaddress = objaccess.GetDatatable("Select * from tblAddressMaster where Customer_ID='" + Cusid + "' and Isactive='true' ");
                if (dtaddress.Rows.Count > 0)
                {
                    name              = dtaddress.Rows[0]["Name"].ToString();
                    mobile            = dtaddress.Rows[0]["Mobile_No"].ToString();
                    address           = dtaddress.Rows[0]["Address"].ToString();
                    Country           = dtaddress.Rows[0]["Country"].ToString();
                    state             = dtaddress.Rows[0]["State"].ToString();
                    city              = dtaddress.Rows[0]["City"].ToString();
                    zip               = dtaddress.Rows[0]["Zip"].ToString();
                    landmark          = dtaddress.Rows[0]["Landmark"].ToString();
                    locality          = dtaddress.Rows[0]["Locality"].ToString();
                    Alternatemobileno = dtaddress.Rows[0]["Alternate_MobileNo"].ToString();
                }

                foreach (DataRow row in dtvalue.Rows)
                {
                    amountMain = amountMain + Convert.ToDouble(row["Totalamount"].ToString());
                }
                int orderID = objorder.AddEditOrder(0, Convert.ToInt32(Cusid), "Pending", Convert.ToBoolean(0), "Cash On Devilary", cityid, deliverycharge, orderid, amountMain.ToString(), System.DateTime.Now.ToString(), name, mobile, address, Country, state, city, zip, locality, landmark, Alternatemobileno);
                if (orderID > 0)
                {
                    foreach (DataRow row in dtvalue.Rows)
                    {
                        string cartID    = row["AddCart_Id"].ToString();
                        string productID = row["ProductID"].ToString();
                        string qty       = row["Quantity"].ToString();
                        string amount    = row["Totalamount"].ToString();

                        DataTable dtproduct = objproduct.GetProduct(Convert.ToInt32(productID));
                        if (dtproduct.Rows.Count > 0)
                        {
                            string  productname    = dtproduct.Rows[0]["title"].ToString();
                            string  weight         = dtproduct.Rows[0]["weight"].ToString();
                            decimal price          = Convert.ToDecimal(dtproduct.Rows[0]["Price"]);
                            decimal Discount       = Convert.ToDecimal(dtproduct.Rows[0]["Discount"]);
                            decimal Afterdiscount  = Convert.ToDecimal(dtproduct.Rows[0]["AfterDiscount"]);
                            decimal taxrate        = Convert.ToDecimal(dtproduct.Rows[0]["TaxRate"]);
                            decimal totalamount    = Convert.ToDecimal(dtproduct.Rows[0]["Total_Amount"]);
                            string  DeliveryCharge = dtproduct.Rows[0]["DeliveryCharge"].ToString();
                            string  productImage   = dtproduct.Rows[0]["ImageUrl"].ToString();

                            string sourcePath      = @"C:\inetpub\wwwroot\gartak.codunite.com\images\Product\actual\" + productImage;
                            string destinationPath = @"C:\inetpub\wwwroot\gartak.codunite.com\images\PurchaseProductImage\" + productImage;

                            //string sourcePath = @"C:\inetpub\wwwroot\gartak.codunite.com\images\Product\actual";
                            //string destinationPath = @"C:\inetpub\wwwroot\gartak.codunite.com\images\PurchaseProductImage";
                            File.Copy(sourcePath, destinationPath, true);

                            objorderdetails.AddEditOrderDetail(0, Cusid, Convert.ToInt32(productID), orderID, Convert.ToInt32(qty), amount, System.DateTime.Now.ToString("yyyyMMdd"),
                                                               orderid, productname, weight, price, Discount, Afterdiscount, taxrate, totalamount, DeliveryCharge, productImage);
                            objaccess.ExecuteQuery("delete from CartMaster where CustomerID=" + Cusid + " and AddCart_Id=" + cartID);
                            //return value
                        }
                        else
                        {
                            DataTable dts = MasterMassage("Status", "false", "Message", "Some issue with find Profuct.");
                            HttpContext.Current.Response.Write(JsonConvert.SerializeObject(dts, Newtonsoft.Json.Formatting.Indented));
                        }
                    }
                    string    querygetDetails = "select Convert(nvarchar, OrderDetailID) as OrderDetailID, Convert(nvarchar, CustomerID) as CustomerID, Convert(nvarchar, ProductID) as ProductID,Convert(nvarchar, ID) as OrderID, DevilaryAddress,'true' as Status,'Success' as Message from tblOrderDetail where orderno=" + orderid + " ";
                    DataTable dt = objaccess.GetDatatable(querygetDetails);
                    HttpContext.Current.Response.Write(JsonConvert.SerializeObject(dt, Newtonsoft.Json.Formatting.Indented));
                }
            }
            else
            {
                dt = MasterMassage("Status", "false", "Message", "Your Cart Is Empty.");
                HttpContext.Current.Response.Write(JsonConvert.SerializeObject(dt, Newtonsoft.Json.Formatting.Indented));
            }
            #endregion
        }
        else
        {
            dt = MasterMassage("Status", "false", "Message", "CityId CustomerID and Delivery Charge Is required");
            HttpContext.Current.Response.Write(JsonConvert.SerializeObject(dt, Newtonsoft.Json.Formatting.Indented));
        }
    }
Beispiel #3
0
    private void bindProduct()
    {
        if (Request.QueryString["fid"] != null)
        {
            Label1.Text = "Featured";
            dt          = objProduct.GetProductFeatured(0);
        }
        else if (Request.QueryString["pid"] != null)
        {
            Label1.Text = "Popular";
            dt          = objProduct.GetProductPopular(0);
        }
        else if (Request.QueryString["nid"] != null)
        {
            Label1.Text = "New";
            dt          = objProduct.GetProductLatest(0);
        }
        else if (Request.QueryString["sid"] != null)
        {
            Label1.Text = "Search";
            dt          = objProduct.GetProduct(Convert.ToInt32(Request.QueryString["sid"]));
        }
        else if (Request.QueryString["scid"] != null)
        {
            // Label1.Text = Convert.ToString(Request.QueryString["title"]);
            dt = objProduct.GetProductBySubCategoryID(Convert.ToInt32(Request.QueryString["scid"]), true);

            DataTable dt2 = new DataTable();
            dt2                 = objSubCategory.GetSubCategory(Convert.ToInt32(Request.QueryString["scid"]));
            Label1.Text         = Convert.ToString(dt2.Rows[0]["Title"]);
            ltrDescription.Text = Convert.ToString(dt2.Rows[0]["Description"]);
            if (dt2.Rows.Count > 0)
            {
                ((HtmlTitle)Master.FindControl("_metaTitle")).Text = dt2.Rows[0]["MetaTitle"].ToString();
                ((HtmlMeta)Master.FindControl("_metaKeywords")).Attributes.Add("Content", dt2.Rows[0]["MetaKeyword"].ToString());
                ((HtmlMeta)Master.FindControl("_metaDescription")).Attributes.Add("Content", dt2.Rows[0]["MetaDescription"].ToString());
            }
        }
        else if (Request.QueryString["cid"] != null)
        {
            // Label1.Text = Convert.ToString(Request.QueryString["title"]);
            dt = objProduct.GetProductByCategoryID(Convert.ToInt32(Request.QueryString["cid"]));

            DataTable dt2 = new DataTable();
            dt2                 = objCategory.GetCategory(Convert.ToInt32(Request.QueryString["cid"]));
            Label1.Text         = Convert.ToString(dt2.Rows[0]["Title"]);
            ltrDescription.Text = Convert.ToString(dt2.Rows[0]["Description"]);
            if (dt2.Rows.Count > 0)
            {
                ((HtmlTitle)Master.FindControl("_metaTitle")).Text = dt2.Rows[0]["MetaTitle"].ToString();
                ((HtmlMeta)Master.FindControl("_metaKeywords")).Attributes.Add("Content", dt2.Rows[0]["MetaKeyword"].ToString());
                ((HtmlMeta)Master.FindControl("_metaDescription")).Attributes.Add("Content", dt2.Rows[0]["MetaDescription"].ToString());
            }
        }
        else if (Request.QueryString["search"] != null)
        {
            Label1.Text = Convert.ToString(Request.QueryString["search"]);
            dt          = objProduct.GetProductByProductName((Request.QueryString["search"].ToString()));
        }
        else
        {
            Label1.Text = "Popular";
            dt          = objProduct.GetProductPopular(0);
        }


        if (dt.Rows.Count > 0)
        {
            _PagedDataSource.DataSource  = dt.DefaultView;
            _PagedDataSource.AllowPaging = true;
            _PagedDataSource.PageSize    = 8;
            if (currentPage >= 0)
            {
                _PagedDataSource.CurrentPageIndex = currentPage;
                ViewState["TotalPages"]           = _PagedDataSource.PageCount;
                this.btn_first.Enabled            = !_PagedDataSource.IsFirstPage;
                this.btn_last.Enabled             = !_PagedDataSource.IsFirstPage;
                this.btn_next.Enabled             = !_PagedDataSource.IsLastPage;
                this.btn_last.Enabled             = !_PagedDataSource.IsLastPage;

                repProducts.DataSource = _PagedDataSource;
                repProducts.DataBind();
                this.doPaging();
            }
        }
    }
Beispiel #4
0
    public void AddOrder()
    {
        if (cityid != 0 && Cusid != 0 && orderid != "" && orderid != null && productid != "" && productid != null && quantity != "" && quantity != null && Amount != "" && Amount != null && deliverycharge != "")
        {
            #region address
            DataTable dtaddress = objaccess.GetDatatable("Select * from tblAddressMaster where Customer_ID=" + Cusid + " and Isactive='true' ");
            if (dtaddress.Rows.Count > 0)
            {
                name              = dtaddress.Rows[0]["Name"].ToString();
                mobile            = dtaddress.Rows[0]["Mobile_No"].ToString();
                address           = dtaddress.Rows[0]["Address"].ToString();
                Country           = dtaddress.Rows[0]["Country"].ToString();
                state             = dtaddress.Rows[0]["State"].ToString();
                city              = dtaddress.Rows[0]["City"].ToString();
                zip               = dtaddress.Rows[0]["Zip"].ToString();
                landmark          = dtaddress.Rows[0]["Landmark"].ToString();
                locality          = dtaddress.Rows[0]["Locality"].ToString();
                Alternatemobileno = dtaddress.Rows[0]["Alternate_MobileNo"].ToString();
            }
            #endregion
            DataTable dtproduct = objproduct.GetProduct(Convert.ToInt32(productid));
            if (dtaddress.Rows.Count > 0)
            {
                string  productname    = dtproduct.Rows[0]["title"].ToString();
                string  weight         = dtproduct.Rows[0]["weight"].ToString();
                decimal price          = Convert.ToDecimal(dtproduct.Rows[0]["Price"]);
                decimal Discount       = Convert.ToDecimal(dtproduct.Rows[0]["Discount"]);
                decimal Afterdiscount  = Convert.ToDecimal(dtproduct.Rows[0]["AfterDiscount"]);
                decimal taxrate        = Convert.ToDecimal(dtproduct.Rows[0]["TaxRate"]);
                decimal totalamount    = Convert.ToDecimal(dtproduct.Rows[0]["Total_Amount"]);
                string  DeliveryCharge = dtproduct.Rows[0]["DeliveryCharge"].ToString();
                string  productImage   = dtproduct.Rows[0]["ImageUrl"].ToString();

                int orderID = objorder.AddEditOrder(0, Cusid, "Pending", Convert.ToBoolean(0), "Cash On Devilary", cityid, deliverycharge, orderid, Amount, DelivaryDate, name, mobile, address, Country, state, city, zip, locality, landmark, Alternatemobileno);
                if (orderID > 0)
                {
                    int OrderID = objaccess.ExecuteIntScalar("select ID From tblorder Where OrderID=" + orderid + " ");

                    string sourcePath      = @"C:\inetpub\wwwroot\gartak.codunite.com\images\Product\actual\" + productImage;
                    string destinationPath = @"C:\inetpub\wwwroot\gartak.codunite.com\images\PurchaseProductImage\" + productImage;
                    File.Copy(sourcePath, destinationPath, true);

                    objorderdetails.AddEditOrderDetail(0, Cusid, Convert.ToInt32(productid), OrderID, Convert.ToInt32(quantity), Amount, DelivaryDate, orderid,
                                                       productname, weight, price, Discount, Afterdiscount, taxrate, totalamount, DeliveryCharge, productImage);

                    dt = MasterMassage("Status", "true", "Message", "Thank you for Your Order Your Order Successfully Placed.");
                    HttpContext.Current.Response.Write(JsonConvert.SerializeObject(dt, Newtonsoft.Json.Formatting.Indented));
                }
                else
                {
                    dt = MasterMassage("Status", "false", "Message", "Some Issue With Add Order.");
                    HttpContext.Current.Response.Write(JsonConvert.SerializeObject(dt, Newtonsoft.Json.Formatting.Indented));
                }
            }
            else
            {
                dt = MasterMassage("Status", "false", "Message", "Some Issue With Product.");
                HttpContext.Current.Response.Write(JsonConvert.SerializeObject(dt, Newtonsoft.Json.Formatting.Indented));
            }
        }
        else
        {
            dt = MasterMassage("Status", "false", "Message", "CustomerID, ProductID, Amount,Delivery Charge & Quantity Is required");
            HttpContext.Current.Response.Write(JsonConvert.SerializeObject(dt, Newtonsoft.Json.Formatting.Indented));
        }
    }