Пример #1
0
    protected void btnConfirm_Click(object sender, EventArgs e)
    {
        DataTable dt = new DataTable();

        dt = getStateCityOnPincode(Convert.ToInt64(txtPincodeS.Text));

        if (dt.Rows.Count <= 0)
        {
            MsgBox("Invalid Pincode in Shipping Address");
            return;
        }

        DataTable dt1 = new DataTable();

        dt1 = getStateCityOnPincode(Convert.ToInt64(txtPincodeB.Text));

        if (dt1.Rows.Count <= 0)
        {
            MsgBox("Invalid Pincode in Billing Address");
            return;
        }

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

        dtBill = clsBSD.BindBillShip();

        if (dtBill.Rows.Count > 0)
        {
            clsBSD.RemoveItem(0);
        }
        clsBSD.AddToBillShipTable(txtTIN.Text, txtCST.Text, txtCompanyB.Text, txtMobileB.Text, txtAddress1B.Text, txtAddress2B.Text, txtCityB.Text, txtStateB.Text, txtCountryB.Text, txtPincodeB.Text, txtNameS.Text, txtEmailS.Text, txtCompanyS.Text, txtMobileS.Text, txtAddress1S.Text, txtAddress2S.Text, txtCityS.Text, txtStateS.Text, txtCountryS.Text, txtPincodeS.Text);
        Response.Redirect("Checkout_Order.aspx");
    }
    //protected int checkCoupon(string CouponName)
    //{
    //    int flag = 1;


    //    int a, b, c;

    //    if (Session["MemberInfo"] != null)
    //    {
    //        a = 1;
    //        DataTable dtUser;
    //        dtUser = new DataTable();
    //        dtUser = (DataTable)Session["MemberInfo"];
    //        if (dtUser.Rows[0]["memberId"].ToString() == "0")
    //        {
    //            a = 2;
    //        }
    //    }
    //    else
    //    {
    //        a = 2;
    //    }

    //    clsBSD = new BillingShippingDetails();
    //    DataTable dtbilship1 = new DataTable();
    //    dtbilship1 = clsBSD.BindBillShip();

    //     if (cls.CheckExistField("CheckExistField", "InvoiceBillingShipping", "ColourName", txtcolourname.Text, "and IsActive = 1"))
    //        {
    //     }



    //    DataTable dt = new DataTable();
    //    dt = cls.ReturnDataTable("Select_CouponOnName", new SqlParameter("@CouponName", CouponName));

    //    if (dt.Rows.Count > 0)
    //    {

    //    }
    //    else
    //    {
    //        flag = 2; // coupon not exist
    //    }
    //    return flag;
    //}


    protected string ValidateCoupon(string CouponName)
    {
        string amount = "";
        int    memberid;
        double orderval;
        string email;
        string couponname;

        if (Session["MemberInfo"] != null)
        {
            DataTable dtUser;
            dtUser   = new DataTable();
            dtUser   = (DataTable)Session["MemberInfo"];
            memberid = Convert.ToInt32(dtUser.Rows[0]["memberId"].ToString()); // set memberid
        }
        else
        {
            memberid = 0;
        }

        clsCart  = new clsAddToCart();
        orderval = clsCart.TotalPriceWithoutDiscount(); // set ordervalue


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

        dtbilship1 = clsBSD.BindBillShip();

        email      = dtbilship1.Rows[0]["SEmail"].ToString(); // set email
        couponname = CouponName;                              // set couponname
        amount     = cls.ReturnScalerObject("GetDiscountOnCoupon", new SqlParameter("@CouponName", couponname), new SqlParameter("@MemberId", memberid), new SqlParameter("@Email", email), new SqlParameter("@OrderValue", orderval)).ToString();
        return(amount);
    }
Пример #3
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());
        }
    }
Пример #4
0
    protected void BindShippingInfo()
    {
        clsBSD = new BillingShippingDetails();

        DataTable dtbilship = new DataTable();

        dtbilship = clsBSD.BindBillShip();

        if (dtbilship.Rows.Count <= 0)
        {
            DataTable dtMember = new DataTable();
            dtMember = (DataTable)Session["MemberInfo"];

            foreach (DataRow dr in dtMember.Rows)
            {
                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());
            }
        }
        foreach (DataRow dr in dtbilship.Rows)
        {
            txtEmailS.Text    = dr["SEmail"].ToString();
            txtNameS.Text     = dr["SName"].ToString();
            txtCompanyS.Text  = dr["SCompany"].ToString();
            txtMobileS.Text   = dr["SContact"].ToString();
            txtAddress1S.Text = dr["SAddress1"].ToString();
            txtAddress2S.Text = dr["SAddress2"].ToString();
            txtCityS.Text     = dr["SCity"].ToString();
            txtStateS.Text    = dr["SState"].ToString();
            txtCountryS.Text  = dr["SCountry"].ToString();
            txtPincodeS.Text  = dr["SZipcode"].ToString();
            txtEmailS.Text    = dr["SEmail"].ToString();

            //if (Session["CameAgain"] != null)
            //{
            txtCompanyB.Text  = dr["Company"].ToString();
            txtMobileB.Text   = dr["Contact"].ToString();
            txtAddress1B.Text = dr["Address1"].ToString();
            txtAddress2B.Text = dr["Address2"].ToString();
            txtCityB.Text     = dr["City"].ToString();
            txtStateB.Text    = dr["State"].ToString();
            txtCountryB.Text  = dr["Country"].ToString();
            txtPincodeB.Text  = dr["Zipcode"].ToString();
            //}
            txtTIN.Text = dr["Name"].ToString();
            txtCST.Text = dr["Email"].ToString();
        }
    }
Пример #5
0
    protected void BindBillingInfo()
    {
        clsBSD = new BillingShippingDetails();
        DataTable dtBill = new DataTable();

        dtBill = clsBSD.BindBillShip();

        DataTable dtMember = new DataTable();

        dtMember = (DataTable)Session["MemberInfo"];

        if (dtBill.Rows.Count > 0)
        {
            clsBSD.RemoveItem(0);
        }
        foreach (DataRow dr in dtMember.Rows)
        {
            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());
        }
    }
    protected void setValueForccAvenue()
    {
        // seting ordersummary

        clsCart = new clsAddToCart();

        order_id.Value = Session["PayOrderId"].ToString();
        amount.Value   = clsCart.TotalPrice().ToString();

        // seting bilingshiping info
        clsBSD = new BillingShippingDetails();
        DataTable dtBillingShipping = new DataTable();

        dtBillingShipping = clsBSD.BindBillShip();

        if (dtBillingShipping.Rows.Count > 0)
        {
            //billing_name.Value = dtBillingShipping.Rows[0]["Company"].ToString();
            billing_name.Value    = dtBillingShipping.Rows[0]["SName"].ToString();
            billing_address.Value = dtBillingShipping.Rows[0]["Address1"].ToString();
            billing_zip.Value     = dtBillingShipping.Rows[0]["Zipcode"].ToString();
            billing_city.Value    = dtBillingShipping.Rows[0]["City"].ToString();
            billing_state.Value   = dtBillingShipping.Rows[0]["State"].ToString();
            billing_country.Value = dtBillingShipping.Rows[0]["Country"].ToString();
            billing_tel.Value     = dtBillingShipping.Rows[0]["Contact"].ToString();
            billing_email.Value   = dtBillingShipping.Rows[0]["SEmail"].ToString();

            delivery_name.Value    = dtBillingShipping.Rows[0]["SName"].ToString();
            delivery_address.Value = dtBillingShipping.Rows[0]["SAddress1"].ToString();
            delivery_zip.Value     = dtBillingShipping.Rows[0]["SZipcode"].ToString();
            delivery_city.Value    = dtBillingShipping.Rows[0]["SCity"].ToString();
            delivery_state.Value   = dtBillingShipping.Rows[0]["SState"].ToString();
            delivery_country.Value = dtBillingShipping.Rows[0]["SCountry"].ToString();
            delivery_tel.Value     = dtBillingShipping.Rows[0]["SContact"].ToString();

            //merchant_param1.Value = dtBillingShipping.Rows[0]["Name"].ToString();
            //merchant_param2.Value = dtBillingShipping.Rows[0]["Email"].ToString();
            merchant_param1.Value = "";
            merchant_param2.Value = "";
        }
    }
Пример #7
0
    protected void RemoveSession()
    {
        clsCart = new clsAddToCart();
        clsCart.RemoveFromSession();

        clsBSD = new BillingShippingDetails();
        clsBSD.RemoveFromSession();

        Session.Remove("PayMode");
        Session.Remove("PaypalId");
        Session.Remove("PaySuccess");
        Session.Remove("PayOrderId");
        if (Session["CameFrom"] != null)
        {
            Session.Remove("CameFrom");
        }
        Session.Remove("CameAgain");
        if (Session["Discount"] != null)
        {
            Session.Remove("Discount");
            Session.Remove("CouponCode");
            Session.Remove("DiscountValue");
        }
        if (Session["captcha"] != null)
        {
            Session.Remove("captcha");
        }
        if (Session["captcha1"] != null)
        {
            Session.Remove("captcha1");
        }
        if (Session["captcha2"] != null)
        {
            Session.Remove("captcha2");
        }
        if (Session["RedirectTo"] != null)
        {
            Session.Remove("RedirectTo");
        }
        //Session.Remove("Msg");
    }
 protected void BindShippingSummary()
 {
     clsBSD = new BillingShippingDetails();
     rptShipping.DataSource = clsBSD.BindBillShip();
     rptShipping.DataBind();
 }
    //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());
    }