protected void LoadAddress(int id)
        {
            DataTable dt = new DataTable();

            using (SqlConnection conn = new SqlConnection(cnnString))
            {
                conn.Open();
                List <SqlJacknife.ParmStruct> parms = new List <SqlJacknife.ParmStruct>();
                parms.Add(new SqlJacknife.ParmStruct("@ID_Cust", id, 0, System.Data.SqlDbType.Int, System.Data.ParameterDirection.Input));

                dt = SqlJacknife.GetDataTable("Address_By_IDCust", parms);
                if (dt.Rows.Count != 0)
                {
                    if (dt.Rows[0]["country"].ToString() == "United States" || dt.Rows[0]["country"].ToString() == "USA")
                    {
                        country.SelectedIndex = 0;
                    }
                    else if (dt.Rows[0]["country"].ToString() == "Canada")
                    {
                        country.SelectedIndex = 1;
                    }
                    else
                    {
                        country.SelectedIndex = 2;
                    }
                    zip.Text     = dt.Rows[0]["zip"].ToString();
                    sOrP.Text    = dt.Rows[0]["state"].ToString();
                    address.Text = dt.Rows[0]["street"].ToString();
                    city.Text    = dt.Rows[0]["city"].ToString();
                    changeRegex(null, null);
                }
            }
        }
        protected void loadCustomer(int id)
        {
            try
            {
                List <SqlJacknife.ParmStruct> parms = new List <SqlJacknife.ParmStruct>();
                parms.Add(new SqlJacknife.ParmStruct("@ID_Cust", id, 20, SqlDbType.Int, ParameterDirection.Input));

                DataTable dt = SqlJacknife.GetDataTable("Get_Customer", parms);

                lblId.Text      = "Id :" + dt.Rows[0]["ID_Cust"].ToString();
                fname.Text      = dt.Rows[0]["FName"].ToString();
                mname.Text      = dt.Rows[0]["MName"].ToString();
                lname.Text      = dt.Rows[0]["LName"].ToString();
                username.Text   = dt.Rows[0]["UserName"].ToString();
                birthDate.Value = dt.Rows[0]["DOB"].ToString().Split(' ')[0];
                phone.Text      = dt.Rows[0]["Phone"].ToString();
                email.Text      = dt.Rows[0]["Email"].ToString();
                address.Text    = dt.Rows[0]["Street"].ToString();
                city.Text       = dt.Rows[0]["City"].ToString();
                sOrP.Text       = dt.Rows[0]["State"].ToString();
                zip.Text        = dt.Rows[0]["ZIP"].ToString();
                country.Text    = dt.Rows[0]["Country"].ToString();
                password.Text   = dt.Rows[0]["Password"].ToString();
            }
            catch (Exception ex)
            {
                master.messageLoggedError(ex.Message);
                IdeaHeaderAndSide.logMessage("IdeaShop-Account Editor: Retrieving customer data", ex.Message);
            }
        }
        public void LoadUpAccount(int Id)
        {
            try
            {
                List <SqlJacknife.ParmStruct> parms = new List <SqlJacknife.ParmStruct>();
                parms.Add(new SqlJacknife.ParmStruct("@ID_Cust", Id, 0, SqlDbType.Int, ParameterDirection.Input));

                DataTable dt = SqlJacknife.GetDataTable("RetrieveAccountByID", parms);
                lblID.Text            = Id.ToString();
                username.Text         = dt.Rows[0]["username"].ToString();
                password.Text         = dt.Rows[0]["password"].ToString();
                fname.Text            = dt.Rows[0]["fname"].ToString();
                lname.Text            = dt.Rows[0]["lname"].ToString();
                birthDate.Value       = dt.Rows[0]["dob"].ToString().Split(' ')[0];
                mname.Text            = dt.Rows[0]["mname"].ToString();
                phone.Text            = dt.Rows[0]["phone"].ToString();
                email.Text            = dt.Rows[0]["email"].ToString();
                country.SelectedValue = dt.Rows[0]["country"].ToString();
                city.Text             = dt.Rows[0]["city"].ToString();
                sOrP.Text             = dt.Rows[0]["state"].ToString();
                address.Text          = dt.Rows[0]["street"].ToString();
                zip.Text = dt.Rows[0]["zip"].ToString();
            }
            catch (Exception x)
            {
                master.messageLoggedError(x.Message);
                IdeaHeaderAndSide.logMessage("AccountEditorInfoLoad", x.Message);
            }
        }
        /// <summary>
        /// Loads a single image
        /// </summary>
        /// <param name="ID_Img"></param>
        /// <returns>A (hopefully) one-row DataTable</returns>
        public DataTable Load_Image(int ID_Img)
        {
            List <SqlJacknife.ParmStruct> parms = new List <SqlJacknife.ParmStruct>();

            parms.Add(new SqlJacknife.ParmStruct("@ID_Img", ID_Img, 0, SqlDbType.Int, ParameterDirection.Input));

            return(SqlJacknife.GetDataTable("Load_Image", parms));
        }
Example #5
0
        private void LoadCart()
        {
            if (String.IsNullOrEmpty(Request.QueryString["ordered"]))
            {
                return;
            }


            DataTable dt;
            List <SqlJacknife.ParmStruct> parms = new List <SqlJacknife.ParmStruct>();

            int cartID = 0;

            cartID = Convert.ToInt32(Request.QueryString["ordered"]);

            parms.Add(new SqlJacknife.ParmStruct("@ID_Cart", cartID, 0, SqlDbType.Int, ParameterDirection.Input));
            dt = SqlJacknife.GetDS("spLoadOrderedItems", parms).Tables[0];
            if (dt.Rows.Count != 0)
            {
                grdCartItems.DataSource = dt;
                grdCartItems.DataBind();

                double subtotal = 0;
                foreach (GridViewRow row in grdCartItems.Rows)
                {
                    subtotal += Convert.ToDouble(row.Cells[4].Text.Substring(1));
                }
                lblSubtotal.Text = subtotal.ToString("c");

                double tax = subtotal * 0.15;

                double shipping = 0;

                if (subtotal <= 75 && subtotal >= 35)
                {
                    shipping = 12;
                }
                else if (subtotal < 35)
                {
                    shipping = 7;
                }

                lblSubtotal.Text = subtotal.ToString("c");
                lblTax.Text      = tax.ToString("c");
                lblShipping.Text = shipping.ToString("c");
                lblTotal.Text    = (subtotal + tax + shipping).ToString("c");
                //double subtotal = Convert.ToDouble(grdCartItems.Rows[0].Cells[4].Text.Replace("$",""));

                DataTable deets = SqlJacknife.GetDataTable("Get_OrderHistory_Details", parms);
                lblAddress.Text = deets.Rows[0]["ShippingAddress"].ToString();
                lblPayment.Text = deets.Rows[0]["PaymentType"].ToString();
            }
            else
            {
                master.messageNormal("You don't have any Item on order");
            }
        }
        /// <summary>
        /// Returns the unverified images that the current admin can verify
        /// </summary>
        /// <param name="ID_Adm"></param>
        /// <returns>A datatable images</returns>
        public DataTable Load_Unverified(int ID_Adm)
        {
            DataTable unverifiedImages          = new DataTable();
            List <SqlJacknife.ParmStruct> parms = new List <SqlJacknife.ParmStruct>();

            parms.Add(new SqlJacknife.ParmStruct("@ID_Adm", ID_Adm, 0, SqlDbType.Int, ParameterDirection.Input));

            unverifiedImages = SqlJacknife.GetDataTable("Load_Unverified", parms);
            return(unverifiedImages);
        }
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            List <SqlJacknife.ParmStruct> parms = new List <SqlJacknife.ParmStruct>();

            parms.Add(new SqlJacknife.ParmStruct("@SearchString", txtSearch.Text, 50, SqlDbType.VarChar, ParameterDirection.Input));


            // SqlCommand cmd = new SqlCommand("Customers_by_Keywords", new SqlConnection(cnnString));
            //cmd.CommandType = CommandType.StoredProcedure;

            // SqlDataAdapter da = new SqlDataAdapter(cmd);
            DataTable dt = SqlJacknife.GetDataTable("Customers_by_Keywords", parms);

            //da.Fill(dt);


            try
            {
                if (dt.Rows.Count != 0)
                {
                    customers.DataSource     = dt;
                    customers.DataTextField  = "username";
                    customers.DataValueField = "ID_Cust";
                    customers.DataBind();
                    customers.SelectedValue = Request.QueryString["IDCust"];
                }
                else
                {
                    master.messageError("Customers not found!");
                }
            }
            catch (Exception ex)
            {
                master.messageError(ex.Message);
            }
        }
 /// <summary>
 /// Loads all verified images
 /// </summary>
 /// <returns></returns>
 public DataTable Load_Verified()
 {
     return(SqlJacknife.GetDataTable("Load_Verified", new List <SqlJacknife.ParmStruct>()));
 }