Example #1
0
    protected void updateMemberInfoSession()
    {
        DataTable dtUser = new DataTable();

        dtUser = clscon.ReturnDataTable("Login_MembersLogin", new SqlParameter("@Email", txtEmailR.Text.Trim()), new SqlParameter("@Password", ViewState["Password"]));
        if (dtUser.Rows.Count > 0)
        {
            if (dtUser.Rows[0]["memberId"].ToString() == "0")
            {
                //MsgBox("Invalid EmailId or Password");
                //return;
            }
            else
            {
                Session["MemberInfo"] = dtUser;
                //Response.Redirect("MemberDashboard.aspx");
            }
        }
        //update billing info

        clsBSD = new BillingShippingDetails();
        DataTable dtBill = new DataTable();

        dtBill = clsBSD.BindBillShip();

        foreach (DataRow dr in dtUser.Rows)
        {
            if (dtBill.Rows.Count > 0)
            {
                clsBSD.RemoveItem(0);
            }
            clsBSD.AddToBillShipTable(dr["Tinno"].ToString(), dr["Cstno"].ToString(), dr["BCompany"].ToString(), dr["BContact"].ToString(), dr["BAddress1"].ToString(), dr["BAddress2"].ToString(), dr["BCity"].ToString(), dr["BState"].ToString(), dr["BCountry"].ToString(), dr["BZipcode"].ToString(), dr["Name"].ToString(), dr["Email"].ToString(), dr["Company"].ToString(), dr["Contact"].ToString(), dr["Address1"].ToString(), dr["Address2"].ToString(), dr["City"].ToString(), dr["State"].ToString(), dr["Country"].ToString(), dr["Zipcode"].ToString());
        }
    }
Example #2
0
    protected void BindOrder()
    {
        DataTable dt = new DataTable();

        dt = cls.ReturnDataTable("Select_InvoiceBillShipDetailsFromID", new SqlParameter("@InvoiceId", invoiceid));

        DataTable dt1 = new DataTable();

        dt1 = cls.ReturnDataTable("Select_InvoiceWiseOrderDetailsFromID", new SqlParameter("@InvoiceId", invoiceid),
                                  new SqlParameter("@InvoiceDispatchID", invoicedispatchid));
        rptOrderDetails.DataSource = dt1;
        rptOrderDetails.DataBind();

        rptBilling.DataSource = dt;
        rptBilling.DataBind();

        rptShipping.DataSource = dt;
        rptShipping.DataBind();

        rptrCutomerTin.DataSource = dt;
        rptrCutomerTin.DataBind();

        rptHeader.DataSource = dt;
        rptHeader.DataBind();
    }
Example #3
0
    protected void BindOrder()
    {
        DataTable dt = new DataTable();

        dt = cls.ReturnDataTable("Select_InvoiceBillShipDetailsFromID", new SqlParameter("@InvoiceId", invoiceid));


        DataTable dt1 = new DataTable();

        dt1 = cls.ReturnDataTable("Select_InvoiceWiseOrderDetailsFromID", new SqlParameter("@InvoiceId", invoiceid),
                                  new SqlParameter("@InvoiceDispatchID", invoicedispatchid));
        rptOrderDetails.DataSource = dt1;
        rptOrderDetails.DataBind();

        rptBilling.DataSource = dt;
        rptBilling.DataBind();

        rptShipping.DataSource = dt;
        rptShipping.DataBind();

        rptrCutomerTin.DataSource = dt;
        rptrCutomerTin.DataBind();

        if (dt1.Rows.Count > 0)
        {
            invoiceno = dt1.Rows[0]["InvoiceNumber"].ToString();
        }

        if (dt.Rows.Count > 0 && dt1.Rows.Count > 0)
        {
            lblOrderNo.Text = dt.Rows[0]["OrderID"].ToString() + " ( " + dt1.Rows[0]["InvoiceNumber"].ToString() + " ) ";
        }
    }
    protected void BindOrderDetails()
    {
        dt = cls.ReturnDataTable("Select_OrdersDetailsFromOrderId", new SqlParameter("@InvoiceId", invoiceid));
        rptOrder.DataSource = dt;
        rptOrder.DataBind();
        if (dt.Rows.Count > 0)
        {
            //txtTracking.Text = dt.Rows[0]["TrackingDetails"].ToString();
            //  ddlOrderStatus.SelectedValue = dt.Rows[0]["OrderStatus"].ToString();
            //if (dt.Rows[0]["PaymentMode"].ToString() == "Cash On Delivery")
            //{
            //    lblPaid.Visible = false;
            //    chkCOD.Visible = true;
            //    chkCOD.Checked = Convert.ToBoolean(dt.Rows[0]["IsPaid"]);
            //}
            //else
            //{
            //    lblPaid.Visible = true;
            //    chkCOD.Visible = false;
            //}
        }
        //if (ddlOrderStatus.SelectedValue.ToString() == "Dispatched" || ddlOrderStatus.SelectedValue.ToString() == "Delivered")
        //{
        //    BindDrpCourier();
        //    pnlShip.Visible = true;
        //   // txtTrackingNo.Text = dt.Rows[0]["TrackingNumber"].ToString();
        //    //drpCourier.SelectedValue = dt.Rows[0]["CourierName"].ToString();

        //    //drpCourier.Items.FindByText(dt.Rows[0]["CourierName"].ToString()).Selected=true;

        //   // drpCourier.Items.FindByText("UPS") = true;
        //}
    }
    protected void BindOrder()
    {
        DataTable dt = new DataTable();

        dt = cls.ReturnDataTable("Select_InvoiceBillShipDetailsFromID", new SqlParameter("@InvoiceId", invoiceid));

        if (dt.Rows.Count <= 0)
        {
            Response.Write("<script language='javascript'> { alert('Invalid OrderId') }</script>");
            Response.Write("<script language='javascript'> { self.close() }</script>");
        }
        else
        {
            rptOrderDetails.DataSource = dt;
            rptOrderDetails.DataBind();

            rptBilling.DataSource = dt;
            rptBilling.DataBind();

            rptShipping.DataSource = dt;
            rptShipping.DataBind();

            rptrCutomerTin.DataSource = dt;
            rptrCutomerTin.DataBind();
        }
    }
    protected void BindOrders()
    {
        DataTable dt = new DataTable();

        dt = cls.ReturnDataTable("Select_AllOrders");
        rptr.DataSource = dt;
        rptr.DataBind();
    }
    protected void BindDrpCourier()
    {
        DataTable dt = new DataTable();

        dt = cls.ReturnDataTable("Select_CourierMaster");
        drpCourier.DataSource     = dt;
        drpCourier.DataTextField  = "CourierName";
        drpCourier.DataValueField = "URL";
        drpCourier.DataBind();
    }
    protected void BindOrder()
    {
        DataTable dt = new DataTable();

        dt = cls.ReturnDataTable("Select_OrdersDetailsFromOrderId", new SqlParameter("@InvoiceId", invoiceid));
        if (dt.Rows.Count > 0)
        {
            lblOrderNo.Text = dt.Rows[0]["OrderId"].ToString();
        }
    }
    protected void BindNewsletter()
    {
        DataTable dt = new DataTable();

        dt = cls.ReturnDataTable("Select_Newsletter");
        drpNewsletter.DataSource     = dt;
        drpNewsletter.DataTextField  = "Title";
        drpNewsletter.DataValueField = "NewsletterID";
        drpNewsletter.DataBind();
    }
Example #10
0
    protected void BindProduct()
    {
        DataTable dt = new DataTable();

        dt = cls.ReturnDataTable("Select_Product");
        drpProduct.DataSource     = dt;
        drpProduct.DataTextField  = "ProductName";
        drpProduct.DataValueField = "Id";
        drpProduct.DataBind();
    }
    protected void BindSize()
    {
        DataTable dt = new DataTable();

        dt = cls.ReturnDataTable("Select_ProductSize");
        cblSizeoption.DataSource     = dt;
        cblSizeoption.DataTextField  = "SizeName";
        cblSizeoption.DataValueField = "SizeID";
        cblSizeoption.DataBind();
    }
    protected void rptrProductDetail_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        Panel pnl;

        RadioButtonList rdbSize = (RadioButtonList)e.Item.FindControl("rdbSize");
        DataTable       dt      = new DataTable();

        dt = cls.ReturnDataTable("Select_AvailableSizeOnId", new SqlParameter("@pid", pid));

        rdbSize.DataSource     = dt;
        rdbSize.DataTextField  = "SizeName";
        rdbSize.DataValueField = "SizeId";
        rdbSize.DataBind();

        if (dt.Rows.Count > 0)
        {
            foreach (DataRow dr in dt.Rows)
            {
                if (dr["SizeName"].ToString() == "NA")
                {
                    pnl         = new Panel();
                    pnl         = (Panel)e.Item.FindControl("pnlSize");
                    pnl.Visible = false;
                    break;
                }
            }
        }

        RadioButtonList rdbColor = (RadioButtonList)e.Item.FindControl("rdbColor");
        DataTable       dt1      = new DataTable();

        dt1 = cls.ReturnDataTable("Select_AvailableColorOnId", new SqlParameter("@pid", pid));

        rdbColor.DataSource     = dt1;
        rdbColor.DataTextField  = "ColourName";
        rdbColor.DataValueField = "ColourID";
        rdbColor.DataBind();

        if (dt1.Rows.Count > 0)
        {
            foreach (DataRow dr in dt1.Rows)
            {
                if (dr["ColourName"].ToString() == "NA")
                {
                    pnl         = new Panel();
                    pnl         = (Panel)e.Item.FindControl("pnlColour");
                    pnl.Visible = false;
                    break;
                }
            }
        }
    }
Example #13
0
    protected void BindAdvDetail(string id)
    {
        DataTable dt = new DataTable();

        dt = cls.ReturnDataTable("Select_HomeAdvDetailOnId", new SqlParameter("@id", id));

        if (dt.Rows.Count > 0)
        {
            ViewState["ImageBanner"] = dt.Rows[0]["Image"];
        }
        else
        {
            Response.Redirect("SubCategory.aspx");
        }
    }
Example #14
0
    protected DataTable getStateCityOnPincode(float pincode)
    {
        DataTable dt = new DataTable();

        dt = cls.ReturnDataTable("Select_PinCodeCheckOnId", new SqlParameter("@pincode", pincode));
        return(dt);
    }
Example #15
0
    protected void BindNewsletter()
    {
        DataTable dt = new DataTable();

        dt = cls.ReturnDataTable("Select_Newsletter");
        rptr.DataSource = dt;
        rptr.DataBind();
    }
Example #16
0
    protected void BindData()
    {
        DataTable dt1 = new DataTable();

        dt1             = clscon.ReturnDataTable("Select_CourierMaster");
        rptr.DataSource = dt1;
        rptr.DataBind();
    }
Example #17
0
    protected void BindData()
    {
        DataTable dt = new DataTable();

        dt = cls.ReturnDataTable("Select_Coupon");
        rptr.DataSource = dt;
        rptr.DataBind();
    }
    protected void BindImageBanner(string sid)
    {
        DataTable dt = new DataTable();

        dt = cls.ReturnDataTable("Select_SubCategoryImageMap", new SqlParameter("@SubCategoryId", sid));
        if (dt.Rows.Count > 0)
        {
            mapAreas.ImageUrl = dt.Rows[0]["ImageBanner"].ToString();
            BindHotSpot(mapAreas);
        }
        else
        {
            mapAreas.Visible = false;
        }
        //rptrImageMap.DataSource = dt;
        //rptrImageMap.DataBind();
    }
Example #19
0
    protected void BindOrders(int MemberId)
    {
        DataTable dt = new DataTable();

        dt = cls.ReturnDataTable("Select_AllInvoiceOnMemberId", new SqlParameter("@MemberId", MemberId));
        rptrCart.DataSource = dt;
        rptrCart.DataBind();
    }
    protected void BindImageBanner()
    {
        DataTable dt = new DataTable();

        dt = cls.ReturnDataTable("Select_HomeAddImageMap");
        if (dt.Rows.Count > 0)
        {
            mapAreas.ImageUrl = dt.Rows[0]["ImageBanner"].ToString();
            BindHotSpot1(mapAreas);
        }
        else
        {
            mapAreas.Visible = false;
        }
        //rptrImageMap.DataSource = dt;
        //rptrImageMap.DataBind();
    }
    protected void BindCurrentOpenings()
    {
        DataTable dt = new DataTable();

        dt = cls.ReturnDataTable("Select_AllCurrentOpenings");
        rptr.DataSource = dt;
        rptr.DataBind();
    }
    protected void btnCheckStatus_Click(object sender, EventArgs e)
    {
        DataTable dt = new DataTable();

        dt = cls.ReturnDataTable("Select_InvoiceBillShipDetailsFromIDForTracking", new SqlParameter("@ID", txtOrderNumber.Text), new SqlParameter("@EmailId", txtEmailId.Text));

        if (dt.Rows.Count > 0)
        {
            rptOrderDetails.DataSource = dt;
            rptOrderDetails.DataBind();


            rptBilling.DataSource = dt;
            rptBilling.DataBind();

            rptShipping.DataSource = dt;
            rptShipping.DataBind();

            rptrCutomerTin.DataSource = dt;
            rptrCutomerTin.DataBind();

            invoiceid = dt.Rows[0]["InvoiceId"].ToString();
            BindProduct(dt.Rows[0]["InvoiceId"].ToString());
            pnlTrack.Visible = true;

            if (!string.IsNullOrEmpty(Convert.ToString(dt.Rows[0]["CouponName"])))
            {
                lblCoupon.Text = "Using Voucher Code (" + dt.Rows[0]["CouponName"] + ")";
            }
            else
            {
                lblCoupon.Text = "";
            }
            lblDisPer.Text = "(" + dt.Rows[0]["DiscountPer"] + "%)";
            lblDisVal.Text = Math.Round(Convert.ToDouble(dt.Rows[0]["DiscountAmount"])).ToString();
        }
        else
        {
            rptOrderDetails.DataSource = null;
            rptOrderDetails.DataBind();
            pnlTrack.Visible = false;
            MsgBox("Enter valid number or Correct Email Id which used in Shipping Address");
        }
    }
Example #23
0
    public static void Login(string UserName, string Password)
    {
        Clsconnection cls    = new Clsconnection();
        DataTable     dtUser = new DataTable();

        dtUser = cls.ReturnDataTable("Login_UserLogin", new SqlParameter("@UserName", UserName), new SqlParameter("@Pwd", Password));
        UserObject usr = new UserObject((Guid)dtUser.Rows[0]["UserID"], dtUser.Rows[0]["UserName"].ToString());

        HttpContext.Current.Session["UserObject"] = usr;
    }
 protected void BindOrderDetails()
 {
     dt = cls.ReturnDataTable("Select_InvoiceWiseOrderDetailsFromID", new SqlParameter("@InvoiceId", invoiceid),
                              new SqlParameter("@InvoiceDispatchID", invoicedispatchid));
     rptOrder.DataSource = dt;
     rptOrder.DataBind();
     if (dt.Rows.Count > 0)
     {
         drpStatus.SelectedValue = dt.Rows[0]["OrderStatus"].ToString();
         orderno                  = dt.Rows[0]["OrderId"].ToString();
         lblInvoiceNo.Text        = dt.Rows[0]["InvoiceNumber"].ToString();
         txtDate.Text             = cls.FormatDate_US_Ind(dt.Rows[0]["InvoiceDate"].ToString());
         txtTrackingNo.Text       = dt.Rows[0]["TrackingNumber"].ToString();
         txtOtherDetails.Text     = dt.Rows[0]["OtherDetails"].ToString();
         drpCourier.SelectedValue = dt.Rows[0]["URL"].ToString();
         invno = dt.Rows[0]["InvoiceNo"].ToString();
         lblInvoiceNoMail.Text = "TSM_Invoice_" + orderno + "-" + invno;
     }
 }
Example #25
0
    protected void Binduser(string mode)
    {
        DataTable dtUser = new DataTable();

        if (mode == "L")
        {
            dtUser = cls.ReturnDataTable("Login_MembersLogin", new SqlParameter("@Email", txtEmailL.Text.Trim()), new SqlParameter("@Password", txtPasswordL.Text.Trim()));
            Session["Memberid"] = dtUser.Rows[0]["MemberId"].ToString();
        }
        else
        {
            //dtUser = cls.ReturnDataTable("Login_MembersLogin", new SqlParameter("@Email", txtEmailR.Text.Trim()), new SqlParameter("@Password", txtPasswordR.Text.Trim()));
        }

        if (dtUser.Rows.Count > 0 && Convert.ToInt32(dtUser.Rows[0]["MemberId"]) != 0)
        {
            if (Convert.ToBoolean(dtUser.Rows[0]["IsApproved"]))
            {
                if (mode == "R")
                {
                    //MailAdminRegistration();
                    //MailUserRegistration();
                }
                Session["MemberInfo"] = dtUser;
                BindBillingInfo();
                Session["CameAgain"] = "1";

                BindWishList(Convert.ToInt32(dtUser.Rows[0]["MemberId"]));
                if (Session["CameFrom"] != null)
                {
                    if (Session["CameFrom"].ToString() == "CheckOut_Login")
                    {
                        Response.Redirect("Register.aspx");
                    }
                    else if (Session["CameFrom"].ToString() == "Wishlist")
                    {
                        Response.Redirect("WishList.aspx");
                    }
                }
                Response.Redirect("Default.aspx");
            }
            else
            {
                MsgBox("You are blocked...!!");
                return;
            }
        }
        else
        {
            MsgBox("Invalid Username or Password...!!");
            return;
        }
    }
    //Insert into DB functions
    protected string InsertIntoDB()
    {
        clsCart = new clsAddToCart();
        long orderid;

A:
        orderid = (long)cls.ReturnScaler("Select_MaxOrderID");

        if (cls.CheckExistField("CheckExistField", "InvoiceMaster", "OrderId", orderid.ToString(), " and IsActive=1"))
        {
            goto A;
        }

        long      Memberid = 0;
        DataTable dtMember = new DataTable();

        dtMember = (DataTable)Session["MemberInfo"];
        foreach (DataRow dr in dtMember.Rows)
        {
            Memberid = Convert.ToInt64(dr["MemberId"]);
        }

        bool IsPaid = false;
        bool IsCOD  = false;

        double discount      = 0;
        double discountValue = 0;

        if (Session["Discount"] != null)
        {
            discount      = (double)Session["Discount"];
            discountValue = (double)Session["DiscountValue"];
        }

        //Insert into invoice master
        Int32 invoiceid;

        invoiceid = (Int32)cls.ReturnScaler("Insert_InvoiceMasterForOnlinePay", new SqlParameter("MemberId", Memberid),
                                            new SqlParameter("@OrderId", orderid),
                                            new SqlParameter("@ShippingCharges", "0"),
                                            new SqlParameter("@OrderAmount", clsCart.TotalPrice()),
                                            new SqlParameter("@OrderQty", clsCart.TotalQty()),
                                            new SqlParameter("@PaypalId", ""),
                                            new SqlParameter("@IsPaid", IsPaid),
                                            new SqlParameter("@IsCOD", IsCOD),
                                            new SqlParameter("@PaymentMode", Session["PayMode"].ToString()),
                                            new SqlParameter("@DiscountPer", discount),
                                            new SqlParameter("@DiscountAmount", discountValue),
                                            new SqlParameter("@OriginalAmount", clsCart.TotalPriceWithoutDiscount()));


        //Insert into invoice coupon
        if (Session["CouponCode"] != null)
        {
            DataTable dtCoupon = new DataTable();
            dtCoupon = cls.ReturnDataTable("Select_CouponOnName", new SqlParameter("@CouponName", Session["CouponCode"].ToString()));

            if (dtCoupon.Rows.Count > 0)
            {
                cls.ExecuteDA("Insert_InvoiceCoupon", new SqlParameter("@InvoiceId", invoiceid),
                              new SqlParameter("@CouponName", dtCoupon.Rows[0]["CouponName"]),
                              new SqlParameter("@CriteriaAVal", dtCoupon.Rows[0]["CriteriaAVal"]),
                              new SqlParameter("@CriteriaBVal", dtCoupon.Rows[0]["CriteriaBVal"]),
                              new SqlParameter("@CriteriaCVal", dtCoupon.Rows[0]["CriteriaCVal"]));
            }
        }


        //insert into invoice product table

        DataTable dt = new DataTable();

        dt = clsCart.BindCart();
        foreach (DataRow dr in dt.Rows)
        {
            cls.ExecuteDA("Insert_InvoiceProduct", new SqlParameter("@InvoiceId", invoiceid),
                          new SqlParameter("@ProductId", Convert.ToInt32(dr["ProductId"])),
                          new SqlParameter("@CategoryName", dr["CategoryName"]),
                          new SqlParameter("@SubCategoryName", dr["SubCategoryName"]),
                          new SqlParameter("@ProductName", dr["ProductName"]),
                          new SqlParameter("@Productdescp", dr["Productdescp"]),
                          new SqlParameter("@BrandName", dr["BrandName"]),
                          new SqlParameter("@SupplierName", dr["SupplierName"]),
                          new SqlParameter("@Unit", dr["Unit"]),
                          new SqlParameter("@ColourName", dr["ColourName"]),
                          new SqlParameter("@SizeName", dr["SizeName"]),
                          new SqlParameter("@ProductCode", dr["ProductCode"]),
                          new SqlParameter("@SupplierProductCode", dr["SupplierProductCode"]),
                          new SqlParameter("@PackSize", dr["PackSize"]),
                          new SqlParameter("@ProductCost", dr["ProductCost"]),
                          new SqlParameter("@ProductWeight", dr["ProductWeight"]),
                          new SqlParameter("@Image", dr["Image"]),
                          new SqlParameter("@Certification", dr["Certification"]),
                          new SqlParameter("@Description", dr["Description"]),
                          new SqlParameter("@Margin", Convert.ToDouble(dr["Margin"])),
                          new SqlParameter("@SalePrice", Convert.ToDouble(dr["SalePrice"])),
                          new SqlParameter("@Tax", Convert.ToDouble(dr["Tax"])),
                          new SqlParameter("@SalesPrice_Incl", Convert.ToDouble(dr["SalesPrice_Incl"])),
                          new SqlParameter("@MRP", Convert.ToDouble(dr["MRP"])),
                          new SqlParameter("@Discount", Convert.ToDouble(dr["Discount"])),
                          new SqlParameter("@CalDiscount", Convert.ToDouble(dr["CalDiscount"])),
                          new SqlParameter("@ShippingCost", Convert.ToDouble(dr["ShippingCost"])),
                          new SqlParameter("@FinalSellingPrice", Convert.ToDouble(dr["FinalSellingPrice"])),
                          new SqlParameter("@TaxFinalPrice", Convert.ToDouble(dr["TaxFinalPrice"])),
                          new SqlParameter("@Quantity", Convert.ToDouble(dr["Qty"])),
                          new SqlParameter("@ShippingDays", dr["ShippingDays"]),
                          new SqlParameter("@IsCOD", Convert.ToBoolean(dr["IsCOD"])));
        }

        //inserting into billing and delivery details
        clsBSD = new BillingShippingDetails();
        DataTable dtbilship = new DataTable();

        dtbilship = clsBSD.BindBillShip();

        foreach (DataRow drow in dtbilship.Rows)
        {
            ViewState["ToMail"] = drow["SEmail"];
            cls.ExecuteDA("Insert_InvoiceBillingShipping", new SqlParameter("@InvoiceId", invoiceid),
                          new SqlParameter("@Name", drow["Name"]),
                          new SqlParameter("@Email", drow["Email"]),
                          new SqlParameter("@Company", drow["Company"]),
                          new SqlParameter("@Contact", drow["Contact"]),
                          new SqlParameter("@Address1", drow["Address1"]),
                          new SqlParameter("@Address2", drow["Address2"]),
                          new SqlParameter("@City", drow["City"]),
                          new SqlParameter("@State", drow["State"]),
                          new SqlParameter("@Country", drow["Country"]),
                          new SqlParameter("@Zipcode", drow["Zipcode"]),
                          new SqlParameter("@SName", drow["SName"]),
                          new SqlParameter("@SEmail", drow["SEmail"]),
                          new SqlParameter("@SCompany", drow["SCompany"]),
                          new SqlParameter("@SContact", drow["SContact"]),
                          new SqlParameter("@SAddress1", drow["SAddress1"]),
                          new SqlParameter("@SAddress2", drow["SAddress2"]),
                          new SqlParameter("@SCity", drow["SCity"]),
                          new SqlParameter("@SState", drow["SState"]),
                          new SqlParameter("@SCountry", drow["SCountry"]),
                          new SqlParameter("@SZipcode", drow["SZipcode"]));
        }

        //  Session["OrderId"] = orderid.ToString();
        //  lblOredrId.Text = orderid.ToString();
        setPdfandMail(invoiceid, orderid);
        return(orderid.ToString());
    }
    protected void BindSubCategory(string cid)
    {
        DataTable dt = new DataTable();

        dt = cls.ReturnDataTable("Select_SubCategoryOnCatId", new SqlParameter("@catid", cid));

        if (dt.Rows.Count > 0)
        {
            //binding breadcrumb
            DataTable dttile = new DataTable();
            dttile = dt.DefaultView.ToTable(true, "ProductCategoryId", "CategoryName");
            rptrBreadCrumb.DataSource = dttile;
            rptrBreadCrumb.DataBind();

            DataTable dt1 = new DataTable();

            dt1.Columns.Add("ProductCategoryId1", Type.GetType("System.String"));
            dt1.Columns.Add("id1", Type.GetType("System.String"));
            dt1.Columns.Add("SubCategoryName1", Type.GetType("System.String"));
            dt1.Columns.Add("Image1", Type.GetType("System.String"));

            dt1.Columns.Add("ProductCategoryId2", Type.GetType("System.String"));
            dt1.Columns.Add("id2", Type.GetType("System.String"));
            dt1.Columns.Add("SubCategoryName2", Type.GetType("System.String"));
            dt1.Columns.Add("Image2", Type.GetType("System.String"));

            dt1.Columns.Add("ProductCategoryId3", Type.GetType("System.String"));
            dt1.Columns.Add("id3", Type.GetType("System.String"));
            dt1.Columns.Add("SubCategoryName3", Type.GetType("System.String"));
            dt1.Columns.Add("Image3", Type.GetType("System.String"));

            dt1.Columns.Add("ProductCategoryId4", Type.GetType("System.String"));
            dt1.Columns.Add("id4", Type.GetType("System.String"));
            dt1.Columns.Add("SubCategoryName4", Type.GetType("System.String"));
            dt1.Columns.Add("Image4", Type.GetType("System.String"));

            dt1.Columns.Add("ProductCategoryId5", Type.GetType("System.String"));
            dt1.Columns.Add("id5", Type.GetType("System.String"));
            dt1.Columns.Add("SubCategoryName5", Type.GetType("System.String"));
            dt1.Columns.Add("Image5", Type.GetType("System.String"));

            dt1.Columns.Add("ProductCategoryId6", Type.GetType("System.String"));
            dt1.Columns.Add("id6", Type.GetType("System.String"));
            dt1.Columns.Add("SubCategoryName6", Type.GetType("System.String"));
            dt1.Columns.Add("Image6", Type.GetType("System.String"));


            for (int i = 0; i < dt.Rows.Count; i = i + 6)
            {
                if (i + 1 < dt.Rows.Count)
                {
                    if (i + 2 < dt.Rows.Count)
                    {
                        if (i + 3 < dt.Rows.Count)
                        {
                            if (i + 4 < dt.Rows.Count)
                            {
                                if (i + 5 < dt.Rows.Count)
                                {
                                    dt1.Rows.Add(dt.Rows[i]["ProductCategoryId"].ToString(), dt.Rows[i]["id"].ToString(), dt.Rows[i]["SubCategoryName"].ToString(), dt.Rows[i]["Image"].ToString(), dt.Rows[i + 1]["ProductCategoryId"].ToString(), dt.Rows[i + 1]["id"].ToString(), dt.Rows[i + 1]["SubCategoryName"].ToString(), dt.Rows[i + 1]["Image"].ToString(), dt.Rows[i + 2]["ProductCategoryId"].ToString(), dt.Rows[i + 2]["id"].ToString(), dt.Rows[i + 2]["SubCategoryName"].ToString(), dt.Rows[i + 2]["Image"].ToString(), dt.Rows[i + 3]["ProductCategoryId"].ToString(), dt.Rows[i + 3]["id"].ToString(), dt.Rows[i + 3]["SubCategoryName"].ToString(), dt.Rows[i + 3]["Image"].ToString(), dt.Rows[i + 4]["ProductCategoryId"].ToString(), dt.Rows[i + 4]["id"].ToString(), dt.Rows[i + 4]["SubCategoryName"].ToString(), dt.Rows[i + 4]["Image"].ToString(), dt.Rows[i + 5]["ProductCategoryId"].ToString(), dt.Rows[i + 5]["id"].ToString(), dt.Rows[i + 5]["SubCategoryName"].ToString(), dt.Rows[i + 5]["Image"].ToString());
                                }
                                else
                                {
                                    dt1.Rows.Add(dt.Rows[i]["ProductCategoryId"].ToString(), dt.Rows[i]["id"].ToString(), dt.Rows[i]["SubCategoryName"].ToString(), dt.Rows[i]["Image"].ToString(), dt.Rows[i + 1]["ProductCategoryId"].ToString(), dt.Rows[i + 1]["id"].ToString(), dt.Rows[i + 1]["SubCategoryName"].ToString(), dt.Rows[i + 1]["Image"].ToString(), dt.Rows[i + 2]["ProductCategoryId"].ToString(), dt.Rows[i + 2]["id"].ToString(), dt.Rows[i + 2]["SubCategoryName"].ToString(), dt.Rows[i + 2]["Image"].ToString(), dt.Rows[i + 3]["ProductCategoryId"].ToString(), dt.Rows[i + 3]["id"].ToString(), dt.Rows[i + 3]["SubCategoryName"].ToString(), dt.Rows[i + 3]["Image"].ToString(), dt.Rows[i + 4]["ProductCategoryId"].ToString(), dt.Rows[i + 4]["id"].ToString(), dt.Rows[i + 4]["SubCategoryName"].ToString(), dt.Rows[i + 4]["Image"].ToString(), "", "", "", "");
                                }
                            }
                            else
                            {
                                dt1.Rows.Add(dt.Rows[i]["ProductCategoryId"].ToString(), dt.Rows[i]["id"].ToString(), dt.Rows[i]["SubCategoryName"].ToString(), dt.Rows[i]["Image"].ToString(), dt.Rows[i + 1]["ProductCategoryId"].ToString(), dt.Rows[i + 1]["id"].ToString(), dt.Rows[i + 1]["SubCategoryName"].ToString(), dt.Rows[i + 1]["Image"].ToString(), dt.Rows[i + 2]["ProductCategoryId"].ToString(), dt.Rows[i + 2]["id"].ToString(), dt.Rows[i + 2]["SubCategoryName"].ToString(), dt.Rows[i + 2]["Image"].ToString(), dt.Rows[i + 3]["ProductCategoryId"].ToString(), dt.Rows[i + 3]["id"].ToString(), dt.Rows[i + 3]["SubCategoryName"].ToString(), dt.Rows[i + 3]["Image"].ToString(), "", "", "", "", "", "", "", "");
                            }
                        }
                        else
                        {
                            dt1.Rows.Add(dt.Rows[i]["ProductCategoryId"].ToString(), dt.Rows[i]["id"].ToString(), dt.Rows[i]["SubCategoryName"].ToString(), dt.Rows[i]["Image"].ToString(), dt.Rows[i + 1]["ProductCategoryId"].ToString(), dt.Rows[i + 1]["id"].ToString(), dt.Rows[i + 1]["SubCategoryName"].ToString(), dt.Rows[i + 1]["Image"].ToString(), dt.Rows[i + 2]["ProductCategoryId"].ToString(), dt.Rows[i + 2]["id"].ToString(), dt.Rows[i + 2]["SubCategoryName"].ToString(), dt.Rows[i + 2]["Image"].ToString(), "", "", "", "", "", "", "", "", "", "", "", "");
                        }
                    }
                    else
                    {
                        dt1.Rows.Add(dt.Rows[i]["ProductCategoryId"].ToString(), dt.Rows[i]["id"].ToString(), dt.Rows[i]["SubCategoryName"].ToString(), dt.Rows[i]["Image"].ToString(), dt.Rows[i + 1]["ProductCategoryId"].ToString(), dt.Rows[i + 1]["id"].ToString(), dt.Rows[i + 1]["SubCategoryName"].ToString(), dt.Rows[i + 1]["Image"].ToString(), "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "");
                    }
                }
                else
                {
                    dt1.Rows.Add(dt.Rows[i]["ProductCategoryId"].ToString(), dt.Rows[i]["id"].ToString(), dt.Rows[i]["SubCategoryName"].ToString(), dt.Rows[i]["Image"].ToString(), "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "");
                }
            }
            rptrSubCategory.DataSource = dt1;
            rptrSubCategory.DataBind();
        }
        else
        {
            Response.Redirect("Default.aspx");
        }
    }
Example #28
0
 protected void BindOrderDetails()
 {
     dt = cls.ReturnDataTable("Select_OrdersDetailsFromOrderId", new SqlParameter("@InvoiceId", invoiceid));
     rptOrder.DataSource = dt;
     rptOrder.DataBind();
 }
Example #29
0
    /// <summary>
    /// Build DataTable to bind Main Items List
    /// </summary>
    /// <returns>DataTable</returns>
    private DataTable GetDataTable()
    {
        DataTable dt  = new DataTable();
        DataTable dt1 = new DataTable();

        //for sorting if value =1 then sort price from low to high
        // if value =2 sort price from high to low
        //if value =3 sort name a to z asc
        //if value =4 sort name z to a desc

        dt = cls.ReturnDataTable("Select_SearchResult", new SqlParameter("@searchtext", srchtext), new SqlParameter("@Flag", Convert.ToInt32(drpSort.SelectedValue.ToString())));

        if (ViewState["Display"].ToString() == "Grid")
        {
            dt1.Columns.Add("id1", Type.GetType("System.String"));
            dt1.Columns.Add("ProductName1", Type.GetType("System.String"));
            dt1.Columns.Add("ProductName11", Type.GetType("System.String"));
            dt1.Columns.Add("Image1", Type.GetType("System.String"));
            dt1.Columns.Add("ProductCode1", Type.GetType("System.String"));
            dt1.Columns.Add("FinalSellingPrice1", Type.GetType("System.Double"));

            dt1.Columns.Add("id2", Type.GetType("System.String"));
            dt1.Columns.Add("ProductName2", Type.GetType("System.String"));
            dt1.Columns.Add("ProductName22", Type.GetType("System.String"));
            dt1.Columns.Add("Image2", Type.GetType("System.String"));
            dt1.Columns.Add("ProductCode2", Type.GetType("System.String"));
            dt1.Columns.Add("FinalSellingPrice2", Type.GetType("System.Double"));

            dt1.Columns.Add("id3", Type.GetType("System.String"));
            dt1.Columns.Add("ProductName3", Type.GetType("System.String"));
            dt1.Columns.Add("ProductName33", Type.GetType("System.String"));
            dt1.Columns.Add("Image3", Type.GetType("System.String"));
            dt1.Columns.Add("ProductCode3", Type.GetType("System.String"));
            dt1.Columns.Add("FinalSellingPrice3", Type.GetType("System.Double"));

            dt1.Columns.Add("id4", Type.GetType("System.String"));
            dt1.Columns.Add("ProductName4", Type.GetType("System.String"));
            dt1.Columns.Add("ProductName44", Type.GetType("System.String"));
            dt1.Columns.Add("Image4", Type.GetType("System.String"));
            dt1.Columns.Add("ProductCode4", Type.GetType("System.String"));
            dt1.Columns.Add("FinalSellingPrice4", Type.GetType("System.Double"));

            dt1.Columns.Add("id5", Type.GetType("System.String"));
            dt1.Columns.Add("ProductName5", Type.GetType("System.String"));
            dt1.Columns.Add("ProductName55", Type.GetType("System.String"));
            dt1.Columns.Add("Image5", Type.GetType("System.String"));
            dt1.Columns.Add("ProductCode5", Type.GetType("System.String"));
            dt1.Columns.Add("FinalSellingPrice5", Type.GetType("System.Double"));

            dt1.Columns.Add("id6", Type.GetType("System.String"));
            dt1.Columns.Add("ProductName6", Type.GetType("System.String"));
            dt1.Columns.Add("ProductName66", Type.GetType("System.String"));
            dt1.Columns.Add("Image6", Type.GetType("System.String"));
            dt1.Columns.Add("ProductCode6", Type.GetType("System.String"));
            dt1.Columns.Add("FinalSellingPrice6", Type.GetType("System.Double"));

            if (dt.Rows.Count > 0)
            {
                //binding breadcrumb
                //DataTable dttile = new DataTable();
                //dttile = dt.DefaultView.ToTable(true, "ProductCategoryId", "ProductSubCategoryId", "SubCategoryName", "CategoryName");
                //rptrBreadCrumb.DataSource = dttile;
                //rptrBreadCrumb.DataBind();


                for (int i = 0; i < dt.Rows.Count; i = i + 6)
                {
                    if (i + 1 < dt.Rows.Count)
                    {
                        if (i + 2 < dt.Rows.Count)
                        {
                            if (i + 3 < dt.Rows.Count)
                            {
                                if (i + 4 < dt.Rows.Count)
                                {
                                    if (i + 5 < dt.Rows.Count)
                                    {
                                        dt1.Rows.Add(dt.Rows[i]["id"].ToString(), dt.Rows[i]["pname"].ToString(), dt.Rows[i]["ProductName"].ToString(), dt.Rows[i]["Image"].ToString(), dt.Rows[i]["ProductCode"].ToString(), dt.Rows[i]["FinalSellingPrice"].ToString(), dt.Rows[i + 1]["id"].ToString(), dt.Rows[i + 1]["pname"].ToString(), dt.Rows[i + 1]["ProductName"].ToString(), dt.Rows[i + 1]["Image"].ToString(), dt.Rows[i + 1]["ProductCode"].ToString(), dt.Rows[i + 1]["FinalSellingPrice"].ToString(), dt.Rows[i + 2]["id"].ToString(), dt.Rows[i + 2]["pname"].ToString(), dt.Rows[i + 2]["ProductName"].ToString(), dt.Rows[i + 2]["Image"].ToString(), dt.Rows[i + 2]["ProductCode"].ToString(), dt.Rows[i + 2]["FinalSellingPrice"].ToString(), dt.Rows[i + 3]["id"].ToString(), dt.Rows[i + 3]["pname"].ToString(), dt.Rows[i + 3]["ProductName"].ToString(), dt.Rows[i + 3]["Image"].ToString(), dt.Rows[i + 3]["ProductCode"].ToString(), dt.Rows[i + 3]["FinalSellingPrice"].ToString(), dt.Rows[i + 4]["id"].ToString(), dt.Rows[i + 4]["pname"].ToString(), dt.Rows[i + 4]["ProductName"].ToString(), dt.Rows[i + 4]["Image"].ToString(), dt.Rows[i + 4]["ProductCode"].ToString(), dt.Rows[i + 4]["FinalSellingPrice"].ToString(), dt.Rows[i + 5]["id"].ToString(), dt.Rows[i + 5]["pname"].ToString(), dt.Rows[i + 5]["ProductName"].ToString(), dt.Rows[i + 5]["Image"].ToString(), dt.Rows[i + 5]["ProductCode"].ToString(), dt.Rows[i + 5]["FinalSellingPrice"].ToString());
                                    }
                                    else
                                    {
                                        dt1.Rows.Add(dt.Rows[i]["id"].ToString(), dt.Rows[i]["pname"].ToString(), dt.Rows[i]["ProductName"].ToString(), dt.Rows[i]["Image"].ToString(), dt.Rows[i]["ProductCode"].ToString(), dt.Rows[i]["FinalSellingPrice"].ToString(), dt.Rows[i + 1]["id"].ToString(), dt.Rows[i + 1]["pname"].ToString(), dt.Rows[i + 1]["ProductName"].ToString(), dt.Rows[i + 1]["Image"].ToString(), dt.Rows[i + 1]["ProductCode"].ToString(), dt.Rows[i + 1]["FinalSellingPrice"].ToString(), dt.Rows[i + 2]["id"].ToString(), dt.Rows[i + 2]["pname"].ToString(), dt.Rows[i + 2]["ProductName"].ToString(), dt.Rows[i + 2]["Image"].ToString(), dt.Rows[i + 2]["ProductCode"].ToString(), dt.Rows[i + 2]["FinalSellingPrice"].ToString(), dt.Rows[i + 3]["id"].ToString(), dt.Rows[i + 3]["pname"].ToString(), dt.Rows[i + 3]["ProductName"].ToString(), dt.Rows[i + 3]["Image"].ToString(), dt.Rows[i + 3]["ProductCode"].ToString(), dt.Rows[i + 3]["FinalSellingPrice"].ToString(), dt.Rows[i + 4]["id"].ToString(), dt.Rows[i + 4]["pname"].ToString(), dt.Rows[i + 4]["ProductName"].ToString(), dt.Rows[i + 4]["Image"].ToString(), dt.Rows[i + 4]["ProductCode"].ToString(), dt.Rows[i + 4]["FinalSellingPrice"].ToString(), "", "", "", "", "", 0);
                                        //  dt1.Rows.Add(dt.Rows[i]["id"].ToString(), dt.Rows[i]["pname"].ToString(), dt.Rows[i]["Image"].ToString(), dt.Rows[i]["ProductCode"].ToString(), dt.Rows[i]["FinalSellingPrice"].ToString(), dt.Rows[i + 1]["id"].ToString(), dt.Rows[i + 1]["pname"].ToString(), dt.Rows[i + 1]["Image"].ToString(), dt.Rows[i + 1]["ProductCode"].ToString(), dt.Rows[i + 1]["FinalSellingPrice"].ToString(), dt.Rows[i + 2]["id"].ToString(), dt.Rows[i + 2]["pname"].ToString(), dt.Rows[i + 2]["Image"].ToString(), dt.Rows[i + 2]["ProductCode"].ToString(), dt.Rows[i + 2]["FinalSellingPrice"].ToString(), dt.Rows[i + 3]["id"].ToString(), dt.Rows[i + 3]["pname"].ToString(), dt.Rows[i + 3]["Image"].ToString(), dt.Rows[i + 3]["ProductCode"].ToString(), dt.Rows[i + 3]["FinalSellingPrice"].ToString(), dt.Rows[i + 4]["id"].ToString(), dt.Rows[i + 4]["pname"].ToString(), dt.Rows[i + 4]["Image"].ToString(), dt.Rows[i + 4]["ProductCode"].ToString(), dt.Rows[i + 4]["FinalSellingPrice"].ToString(), "","", "", "", "", 0);
                                    }
                                }
                                else
                                {
                                    //  dt1.Rows.Add(dt.Rows[i]["id"].ToString(), dt.Rows[i]["pname"].ToString(), dt.Rows[i]["Image"].ToString(), dt.Rows[i]["ProductCode"].ToString(), dt.Rows[i]["FinalSellingPrice"].ToString(), dt.Rows[i + 1]["id"].ToString(), dt.Rows[i + 1]["pname"].ToString(), dt.Rows[i + 1]["Image"].ToString(), dt.Rows[i + 1]["ProductCode"].ToString(), dt.Rows[i + 1]["FinalSellingPrice"].ToString(), dt.Rows[i + 2]["id"].ToString(), dt.Rows[i + 2]["pname"].ToString(), dt.Rows[i + 2]["Image"].ToString(), dt.Rows[i + 2]["ProductCode"].ToString(), dt.Rows[i + 2]["FinalSellingPrice"].ToString(), dt.Rows[i + 3]["id"].ToString(), dt.Rows[i + 3]["pname"].ToString(), dt.Rows[i + 3]["Image"].ToString(), dt.Rows[i + 3]["ProductCode"].ToString(), dt.Rows[i + 3]["FinalSellingPrice"].ToString(), "", "", "", "", 0, "", "", "", "", 0);
                                    dt1.Rows.Add(dt.Rows[i]["id"].ToString(), dt.Rows[i]["pname"].ToString(), dt.Rows[i]["ProductName"].ToString(), dt.Rows[i]["Image"].ToString(), dt.Rows[i]["ProductCode"].ToString(), dt.Rows[i]["FinalSellingPrice"].ToString(), dt.Rows[i + 1]["id"].ToString(), dt.Rows[i + 1]["pname"].ToString(), dt.Rows[i + 1]["ProductName"].ToString(), dt.Rows[i + 1]["Image"].ToString(), dt.Rows[i + 1]["ProductCode"].ToString(), dt.Rows[i + 1]["FinalSellingPrice"].ToString(), dt.Rows[i + 2]["id"].ToString(), dt.Rows[i + 2]["pname"].ToString(), dt.Rows[i + 2]["ProductName"].ToString(), dt.Rows[i + 2]["Image"].ToString(), dt.Rows[i + 2]["ProductCode"].ToString(), dt.Rows[i + 2]["FinalSellingPrice"].ToString(), dt.Rows[i + 3]["id"].ToString(), dt.Rows[i + 3]["pname"].ToString(), dt.Rows[i + 3]["ProductName"].ToString(), dt.Rows[i + 3]["Image"].ToString(), dt.Rows[i + 3]["ProductCode"].ToString(), dt.Rows[i + 3]["FinalSellingPrice"].ToString(), "", "", "", "", "", 0, "", "", "", "", "", 0);
                                }
                            }
                            else
                            {
                                //  dt1.Rows.Add(dt.Rows[i]["id"].ToString(), dt.Rows[i]["pname"].ToString(), dt.Rows[i]["Image"].ToString(), dt.Rows[i]["ProductCode"].ToString(), dt.Rows[i]["FinalSellingPrice"].ToString(), dt.Rows[i + 1]["id"].ToString(), dt.Rows[i + 1]["pname"].ToString(), dt.Rows[i + 1]["Image"].ToString(), dt.Rows[i + 1]["ProductCode"].ToString(), dt.Rows[i + 1]["FinalSellingPrice"].ToString(), dt.Rows[i + 2]["id"].ToString(), dt.Rows[i + 2]["pname"].ToString(), dt.Rows[i + 2]["Image"].ToString(), dt.Rows[i + 2]["ProductCode"].ToString(), dt.Rows[i + 2]["FinalSellingPrice"].ToString(), "", "", "", "", 0, "", "", "", "", 0, "", "", "", "", 0);
                                dt1.Rows.Add(dt.Rows[i]["id"].ToString(), dt.Rows[i]["pname"].ToString(), dt.Rows[i]["ProductName"].ToString(), dt.Rows[i]["Image"].ToString(), dt.Rows[i]["ProductCode"].ToString(), dt.Rows[i]["FinalSellingPrice"].ToString(), dt.Rows[i + 1]["id"].ToString(), dt.Rows[i + 1]["pname"].ToString(), dt.Rows[i + 1]["ProductName"].ToString(), dt.Rows[i + 1]["Image"].ToString(), dt.Rows[i + 1]["ProductCode"].ToString(), dt.Rows[i + 1]["FinalSellingPrice"].ToString(), dt.Rows[i + 2]["id"].ToString(), dt.Rows[i + 2]["pname"].ToString(), dt.Rows[i + 2]["ProductName"].ToString(), dt.Rows[i + 2]["Image"].ToString(), dt.Rows[i + 2]["ProductCode"].ToString(), dt.Rows[i + 2]["FinalSellingPrice"].ToString(), "", "", "", "", "", 0, "", "", "", "", "", 0, "", "", "", "", "", 0);
                            }
                        }
                        else
                        {
                            dt1.Rows.Add(dt.Rows[i]["id"].ToString(), dt.Rows[i]["pname"].ToString(), dt.Rows[i]["ProductName"].ToString(), dt.Rows[i]["Image"].ToString(), dt.Rows[i]["ProductCode"].ToString(), dt.Rows[i]["FinalSellingPrice"].ToString(), dt.Rows[i + 1]["id"].ToString(), dt.Rows[i + 1]["pname"].ToString(), dt.Rows[i + 1]["ProductName"].ToString(), dt.Rows[i + 1]["Image"].ToString(), dt.Rows[i + 1]["ProductCode"].ToString(), dt.Rows[i + 1]["FinalSellingPrice"].ToString(), "", "", "", "", "", 0, "", "", "", "", "", 0, "", "", "", "", "", 0, "", "", "", "", "", 0);
                        }
                    }
                    else
                    {
                        dt1.Rows.Add(dt.Rows[i]["id"].ToString(), dt.Rows[i]["pname"].ToString(), dt.Rows[i]["ProductName"].ToString(), dt.Rows[i]["Image"].ToString(), dt.Rows[i]["ProductCode"].ToString(), dt.Rows[i]["FinalSellingPrice"].ToString(), "", "", "", "", "", 0, "", "", "", "", "", 0, "", "", "", "", "", 0, "", "", "", "", "", 0, "", "", "", "", "", 0);
                    }
                }
            }
        }
        else
        {
            dt1 = dt;
        }
        return(dt1);
    }