Пример #1
0
 public Object[] isUserValid(String username,String password)
 {
     bool b = false;
     Object[] info = new Object[2]; String name="";
     password = new ProjectUtilities().hashFn(password);
     String q = "Select Email,Password,FirstName from SocialDB where Email=@a ";
     con = new SqlConnection(new ProjectUtilities().cons());
     SqlCommand c = new SqlCommand(q, con);
     con.Open();
     SqlDataReader r;
     try
     {
         c.Parameters.AddWithValue("@a", username);
         r = c.ExecuteReader();
         if (r != null && r[1] == password)
         {
             b = true;
             name = r[2].ToString();
         }
         else
         {
             b = false;
             name = "";
         }
     }
     catch (Exception exx) { b = false; }
     finally { con.Close(); }
     Boolean isval = new Boolean();
     isval = b;
     info[0] = isval;
     info[1] = name; 
     return info;
 }
Пример #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
         
            Button11.ServerClick += new EventHandler(this.fb_Click);
            RegularSubmit.Click += new EventHandler(this.RegularSubmit_Click);
            if (Session["User"] != null)
            {
                LoginName.Visible = true;
                LoginName.Text = "Welcome " + Session["User"].ToString();
            }
                
            //RegularSubmit
            //Button22.ServerClick += new EventHandler(this.gp_Click);
            //if (Session["user"] != null && String.IsNullOrEmpty(Session["user"].ToString()) == false)
            //    LoginName.Text = "Welcome " + Session["user"];
            if (!IsPostBack)
            {
                //NavBar.SkipLinkText = "";
                
                Button11.ServerClick += new EventHandler(this.fb_Click);
                //Button22.ServerClick += new EventHandler(this.fb_Click);
                DataTable table = new DataTable();
                string strCon;
                ProjectUtilities obj = new ProjectUtilities();
                strCon = obj.cons();
                SqlConnection conn = new SqlConnection(strCon);
                string sql = "select * from menuMaster";
                SqlCommand cmd = new SqlCommand(sql, conn);
                SqlDataAdapter da = new SqlDataAdapter(cmd);
                da.Fill(table);
                DataView view = new DataView(table);
                view.RowFilter = "menu_parent_id is NULL";
                foreach (DataRowView row in view)
                {
                    MenuItem menuItem = new MenuItem(row["menu_name"].ToString(),
                    row["menu_id"].ToString());
                    menuItem.NavigateUrl = row["menu_url"].ToString();
                    NavBar.Items.Add(menuItem);
                    AddChildItems(table, menuItem);
                }

                recordData();
                BrowsingData o = (BrowsingData)Session["BrowsingData"];
                if (o != null)
                    o.commit(o);
            }
        }
Пример #3
0
 public void Button1_Click(object sender, EventArgs e)
 {
     ProjectUtilities obj = new ProjectUtilities();
     try
     {
         SqlConnection con = new SqlConnection(obj.cons());
         String q = "Insert into SocialDB (Email,ContactNo,Address,FirstName,LastName,DOB,Gender,Location) Values (@email,@Cno,@address,@fname,@lname,@DOB,@Gender,@Location)";
         con.Open();
         SqlCommand com = new SqlCommand(q, con);
         com.CommandText = q;
         com.CommandType = CommandType.Text;
         com.Parameters.Add(new SqlParameter("@username", username));
         if(Address.Text!=null)
             com.Parameters.Add(new SqlParameter("@address", Address.Text));
         else
             com.Parameters.Add(new SqlParameter("@address", DBNull.Value));
         com.Parameters.Add(new SqlParameter("@email", email));
         com.Parameters.Add(new SqlParameter("@fname", firstname));
         com.Parameters.Add(new SqlParameter("@lname", lastname));
         if(ContactNo.Text!=null)
             com.Parameters.Add(new SqlParameter("@Cno", ContactNo.Text));
         else
             com.Parameters.Add(new SqlParameter("@Cno", DBNull.Value));
         if(DOB.Value!=null)
             com.Parameters.Add(new SqlParameter("@DOB", DOB.Value));
         else
             com.Parameters.Add(new SqlParameter("@DOB", DBNull.Value));
         com.Parameters.Add(new SqlParameter("@Gender", gender));
         com.Parameters.AddWithValue("@Location", location);
         //com.Parameters.Add(new SqlParameter("@Name", name));
         int v = com.ExecuteNonQuery();
         con.Close();
         Session["Logged"] = "True";
         Session["User"] = firstname;
         //Response.Redirect("Index.aspx",false);
     }
     catch (Exception ex)
     {
         new ProjectUtilities().sendError(ex);
     }
     finally
     {
         Response.Redirect("Index.aspx");
     }
 }
Пример #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                NavBar.SkipLinkText = "";
                //NavBar.Visible = false;

                // Button11.ServerClick += new EventHandler(this.fb_Click);
                // Button22.ServerClick += new EventHandler(this.fb_Click);
                DataTable table = new DataTable();
                string strCon;
                ProjectUtilities obj = new ProjectUtilities();
                strCon = obj.cons();
                SqlConnection conn = new SqlConnection(strCon);
                string sql = "select menu_id, menu_name, menu_parent_id, menu_url from menuMaster";
                conn.Open();
                SqlCommand cmd = new SqlCommand(sql, conn);
                SqlDataAdapter da = new SqlDataAdapter(cmd);
                da.Fill(table);
                DataView view = new DataView(table);
                view.RowFilter = "menu_parent_id is NULL";
                foreach (DataRowView row in view)
                {
                    MenuItem menuItem = new MenuItem(row["menu_name"].ToString(),
                    row["menu_id"].ToString());
                    menuItem.NavigateUrl = row["menu_url"].ToString();
                    NavBar.Items.Add(menuItem);
                    AddChildItems(table, menuItem);
                }
                conn.Close();
                displayItems();
                qr = Request.QueryString["q"];                
                if (!String.IsNullOrEmpty(q.Trim()))
                {
                    FilterList.Visible = false;
                    Page.Title = qr + " - Buy Best Products Online!";
                }
                else
                {
                    Response.Redirect("Index.aspx");
                }
            }
            else
            {
                if (Request.Form["__EVENTTARGET"] == "removeFilters1")
                {
                    string passedArgument = Request.Params.Get("__EVENTARGUMENT");
                    removeFilters1_click(passedArgument);
                }
                else if (Request.Form["__EVENTTARGET"] == "Button1")
                {
                    String[] s = Request.Params.Get("__EVENTARGUMENT").Split(',');
                    int s1 = Int32.Parse(s[0]);
                    int s2 = Int32.Parse(s[1]);
                    //filterPrice(s1, s2);
                    ll = s1;
                    ul = s2;
                    //q= createQuery();
                    query();
                }
                else if (Request.Form["__EVENTTARGET"] == "_Range")
                {
                    _Range_ValueChanged();
                }
                else if (Request.Form["__EVENTTARGET"] == "_Age")
                {
                    _Age_ValueChanged();
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            string workingKey = "9237F8E78FF96C00C023857A825C0056";//put in the 32bit alpha numeric key in the quotes provided here
            CCACrypto ccaCrypto = new CCACrypto();
            string encResponse = ccaCrypto.Decrypt(Request.Form["encResp"],workingKey);
            NameValueCollection Params = new NameValueCollection();
            string[] segments = encResponse.Split('&');
            String orderstatus = "";
            foreach (string seg in segments)
            {
                string[] parts = seg.Split('=');
                if (parts.Length > 0)
                {
                    string Key = parts[0].Trim();
                    string Value = parts[1].Trim();
                    if (Key == "order_status")
                        orderstatus = Key;
                    Params.Add(Key, Value);
                }
            }
            // order id tracking id failure msg payment mode  name on card
            // delivary add
            // billing add
            //

            if(orderstatus.ToLower() == "success")                      //              SUCCESSFUL ORDER 
            {

                String orderid = "", contactno = "", paymentmode = "", name = "", currency = "", amount = "", month, year, date;
                int tracker = -1; ;
                StringBuilder billingaddress, delivaryaddress, otherdetails;
                StringBuilder responseObj, items;
                responseObj = new StringBuilder();
                billingaddress = new StringBuilder();
                delivaryaddress = new StringBuilder();
                otherdetails = new StringBuilder();

                // Processing Response 
                month = DateTime.Now.Month.ToString();
                date = DateTime.Now.Date.ToString();
                year = DateTime.Now.Year.ToString();
                for (int i = 0; i < Params.Count; i++)
                {
                    //Response.Write(Params.Keys[i] + " = " + Params[i] + "<br>");
                    responseObj.Append("[" + Params.Keys[i] + "]:[" + Params[i] + "]");
                    responseObj.Append(",");
                    if (Params.Keys[i].Contains("billing"))
                    {
                        if (Params.Keys[i].Contains("name"))
                            name = Params[i];
                        else if (Params.Keys[i].Contains("tel"))
                            contactno = Params[i];
                        else
                            billingaddress.Append(Params[i] + ",");
                    }
                    else if (Params.Keys[i].Contains("billing"))
                    {
                        billingaddress.Append(Params[i] + ",");
                    }
                    else
                    {
                        if (Params.Keys[i] == "order_id")
                            orderid = Params[i];
                        else if (Params.Keys[i] == "tracking_id")
                            tracker = int.Parse(Params[i]);
                        else if (Params.Keys[i] == "currency")
                            currency = Params[i];
                        else if (Params.Keys[i] == "amount")
                            amount = Params[i];
                        else if (Params.Keys[i] == "payment_mode")
                            paymentmode = Params[i];
                        else
                        {
                            otherdetails.Append(Params.Keys[i] + ":" + Params[i]);
                        }
                    }
                }

                DataTable itemsoncart = (DataTable)Session["CurrentCart"];
                // Processing items
                // name , qty , final-uc
                items = new StringBuilder();
                String q = "Insert into OrderedProductList (OrderId,ProductName,Quantity,UnitPrice) Values(@a,@b,@c,@d)";
                SqlConnection c = new SqlConnection(new ProjectUtilities().cons());
                SqlCommand com = new SqlCommand(q, c);
                com.Parameters.AddWithValue("@a", orderid);
                try
                {
                    c.Open();
                    foreach (DataRow r in itemsoncart.Rows)
                    {
                        String names = r.Field<String>(1);
                        items.Append(names);
                        items.Append(",");
                        com.Parameters.AddWithValue("@b", names);
                        names = r.Field<double>(2).ToString("N2");
                        com.Parameters.AddWithValue("@d", names);
                        names = r.Field<int>(3).ToString();
                        com.Parameters.AddWithValue("@c", names);
                        int b = com.ExecuteNonQuery();
                        if (b == 0)
                        {
                            // issue 
                            throw new Exception();
                        }
                    }
                }
                catch (Exception expc) { 
                    // sends email of the entire transaction as a proof 
                    ProjectUtilities o = new ProjectUtilities();
                    o.sendError(expc);
                    o.sendMail(encResponse);
                }
                finally { c.Close(); }

                // add to order table

                SqlCommand c2 = new SqlCommand(q, c);
                q = @"INSERT INTO Orders (OrderId,BillingAddress,DeliveryAddress,ContactNo,Payment_Mode,Name,Currency,Amount,Tracking_Id,Response,Month,Year,Items) VALUES (@a, @b, @c, @d, @e, @f, @g, @h ,@i, @j, @k, @l, @m)";
                c2.Parameters.AddWithValue("@a", orderid);
                c2.Parameters.AddWithValue("@b", billingaddress.ToString());
                c2.Parameters.AddWithValue("@c", delivaryaddress.ToString());
                c2.Parameters.AddWithValue("@d", contactno);
                c2.Parameters.AddWithValue("@e", paymentmode);
                c2.Parameters.AddWithValue("@f", name);
                c2.Parameters.AddWithValue("@g", currency);
                c2.Parameters.AddWithValue("@h", amount);
                c2.Parameters.AddWithValue("@i", tracker.ToString());
                c2.Parameters.AddWithValue("@j", encResponse);
                c2.Parameters.AddWithValue("@k", month);
                c2.Parameters.AddWithValue("@l", year);
                c2.Parameters.AddWithValue("@m", items.ToString());
                int added = c2.ExecuteNonQuery();
                if(added == 0)
                {
                    new ProjectUtilities().sendMail("Data Not recorderd ! "+encResponse);                   
                }                    
                else
                {
                    new ProjectUtilities().sendMail("New Order : "+encResponse);
                }
            }

            else if(orderstatus.ToLower() == "failure")
            {
                new ProjectUtilities().sendMail(encResponse);
                Response.Redirect("Failed.aspx");
            }
            else if(orderstatus.ToLower() == "aborted")
            {
                new ProjectUtilities().sendMail(encResponse);
                Response.Redirect("Index.aspx");
            }
            else
            {
                new ProjectUtilities().sendMail(encResponse);
                Response.Redirect("Index.aspx");
            }
         }
Пример #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //HtmlGenericControl nc = new HtmlGenericControl();
         try
         { 
            ProjectUtilities o = new ProjectUtilities();
            Panel q1;
            Database dobj = new Database();
            SqlDataReader r = dobj.getHotDeals();

            // Hot Deals
            if (r != null)
            {
                while (r.Read())
                {
                    Panel p = new Panel();
                    p.CssClass = "ProdList";
                    Image i = new Image();
                    i.ImageUrl = r["ImageLocation"].ToString();
                    //r["Image"].ToString();
                    var h3 = new HtmlGenericControl("h3");
                    // h3.Attributes.Add("class", "details");                  
                    h3.InnerHtml = r["Name"].ToString();
                    HyperLink a = new HyperLink();
                    a.Controls.Add(i);
                    a.Controls.Add(h3);
                    Panel cr = crPrice(r);
                    cr.Style.Add("margin-top", "5px");
                    cr.Style.Add("text-align", "center");
                    a.Controls.Add(cr);
                    a.NavigateUrl = "ViewProduct.aspx?pid=" + r["Id"].ToString();
                    //p.Controls.Add(i);
                    p.Controls.Add(a);
                    //p.Controls.Add(h4);
                    hd.Controls.Add(p);
                }
                q1 = new Panel();
                q1.CssClass = "clearf";
                HyperLink a1 = new HyperLink();
                a1.NavigateUrl = "HotDeals.aspx";
                a1.CssClass = "morebtn";
                hd.Controls.Add(a1);
                hd.Controls.Add(q1);
                //                <a href="HotDeals.aspx" style="height:100%;width:30px;float:right;margin-top:150px;">
                    //    <img src="images/rarrow.png" style="display:block;margin:auto" alt="" />
                    //</a> 
                r.Close();
            }
            else
                hd.Visible = false;

            // RETEIVE BEST SELLERS

           // r = new Database().bestSeller();
            r = null;
            if (r != null)
            {
                while (r.Read())
                {
                    Panel p = new Panel();
                    p.CssClass = "ProdList";
                    Image i = new Image();
                    i.ImageUrl = r["ImageLocation"].ToString();
                    //r["Image"].ToString();
                    var h3 = new HtmlGenericControl("h3");
                    h3.InnerHtml = r["Name"].ToString();
                    HyperLink a = new HyperLink();
                    a.Controls.Add(i);
                    a.Controls.Add(h3);
                    Panel cr = crPrice(r);
                    cr.Style.Add("margin-top", "5px");
                    cr.Style.Add("text-align", "center");
                    a.Controls.Add(cr);
                    a.NavigateUrl = "ViewProduct.aspx?pid=" + r["PId"].ToString();
                    //p.Controls.Add(i);
                    p.Controls.Add(a);
                    //p.Controls.Add(h4);
                    bs.Controls.Add(p);
                }
                q1 = new Panel();
                q1.CssClass = "clearf";
                HyperLink a1 = new HyperLink();
                a1.NavigateUrl = "HotDeals.aspx";
                a1.CssClass = "morebtn";
                bs.Controls.Add(a1);
                bs.Controls.Add(q1);
            }
            else
                //bs.Visible = false; 
                bs.Parent.Visible = false;

            // New Arrivals

            r = dobj.newArrivals();

            if (r != null)
            {
                while (r.Read())
                {
                    Panel p = new Panel();
                    p.CssClass = "ProdList";
                    Image i = new Image();
                    i.ImageUrl = r["ImageLocation"].ToString();
                    //r["Image"].ToString();
                    var h3 = new HtmlGenericControl("h3");
                    h3.InnerHtml = r["Name"].ToString();
                    HyperLink a = new HyperLink();
                    a.Controls.Add(i);
                    a.Controls.Add(h3);
                    Panel cr = crPrice(r);
                    cr.Style.Add("margin-top", "5px");
                    cr.Style.Add("text-align", "center");
                    a.Controls.Add(cr);
                    a.NavigateUrl = "ViewProduct.aspx?pid=" + r["Id"].ToString();
                    //p.Controls.Add(i);
                    p.Controls.Add(a);
                    //p.Controls.Add(h4);
                    na.Controls.Add(p);
                }
                q1 = new Panel();
                q1.CssClass = "clearf";
                //na.Controls.Add(q1);
                HyperLink a1 = new HyperLink();
                a1.NavigateUrl = "NewArrivals.aspx";
                a1.CssClass = "morebtn";
                na.Controls.Add(a1);
                na.Controls.Add(q1);
            }
            else
                na.Parent.Visible = false;


            

            // Brands on Sale
            r = dobj.brandsOnSale();
            if (r != null)
            {
                while (r.Read())
                {
                    Panel p = new Panel();
                    p.CssClass = "ProdList-brands";
                    Image i = new Image();
                    i.ImageUrl = r["Image_Location"].ToString();
                    //r["Image"].ToString();
                    //var h3 = new HtmlGenericControl("h3");
                    // var h4 = new HtmlGenericControl("h4");
                    // h4.InnerHtml = r["Cost"].ToString();
                    //h3.InnerHtml = r["Brand_Name"].ToString();
                    //HyperLink a = new HyperLink();
                    //a.Controls.Add(i);
                    //a.Controls.Add(h3);
                    //a.NavigateUrl = "ViewProduct.aspx?pid=" + r["Id"].ToString();
                    //p.Controls.Add(i);
                    p.Controls.Add(i);
                    //p.Controls.Add(h4);
                    bos.Controls.Add(p);
                }
                //q1 = new Panel();
                //q1.CssClass = "clearf";
               // bos.Controls.Add(q1);
            }
             else
                bos.Parent.Visible = false;


            // RETRIEVE COOKIES FOR RECENTLY VIEWED

            HttpCookie c = Request.Cookies["Viewed"];
            if (c == null )
                Div1.Visible = false;
            else
            {
                List<String> pid = new List<String>();
                foreach (String key in c.Values.Keys)
                {
                    pid.Add(key);
                }
                r = new Database().recentlyViewed(pid);
                if (r == null)
                    Div1.Visible = false;
                else
                {
                    try {
                        while (r.Read())
                        {
                            Panel p = new Panel();
                            p.CssClass = "ProdList";
                            Image i = new Image();
                            i.ImageUrl = r["ImageLocation"].ToString();
                            //r["Image"].ToString();
                            var h3 = new HtmlGenericControl("h3");
                            h3.InnerHtml = r["Name"].ToString();
                            HyperLink a = new HyperLink();
                            a.Controls.Add(i);
                            a.Controls.Add(h3);
                            Panel cr = crPrice(r);
                            cr.Style.Add("margin-top", "5px");
                            cr.Style.Add("text-align", "center");
                            a.Controls.Add(cr);
                            a.NavigateUrl = "ViewProduct.aspx?pid=" + r["Id"].ToString();
                            p.Controls.Add(a);
                            Div1.Controls.Add(p);
                        }
                        HyperLink a1 = new HyperLink();
                        a1.NavigateUrl = "HotDeals.aspx";
                        a1.CssClass = "morebtn";
                        Div1.Controls.Add(a1);
                    }
                    catch (SqlException se)
                    { }
                    finally
                    {
                        dobj.closeConnection();
                    }

                }
                }
            }
         catch (Exception ex)
         {
             Console.WriteLine(ex.ToString());
         }
        }
Пример #7
0
        //protected void Page_Init(object sender, EventArgs e)
        //{
        //    Button b = new Button();
        //    b.Click += new EventHandler(a2c_Click);            
        //}


        //protected void Page_Load(object sender, EventArgs e)

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                NavBar.SkipLinkText = "";
                //NavBar.Visible = false;

                // Button11.ServerClick += new EventHandler(this.fb_Click);
                // Button22.ServerClick += new EventHandler(this.fb_Click);
                DataTable table = new DataTable();
                string strCon;
                ProjectUtilities obj = new ProjectUtilities();
                strCon = obj.cons();
                SqlConnection conn = new SqlConnection(strCon);
                string sql = "select menu_id, menu_name, menu_parent_id, menu_url from menuMaster";
                conn.Open();
                SqlCommand cmd = new SqlCommand(sql, conn);
                SqlDataAdapter da = new SqlDataAdapter(cmd);
                da.Fill(table);
                DataView view = new DataView(table);
                view.RowFilter = "menu_parent_id is NULL";
                foreach (DataRowView row in view)
                {
                    MenuItem menuItem = new MenuItem(row["menu_name"].ToString(),
                    row["menu_id"].ToString());
                    menuItem.NavigateUrl = row["menu_url"].ToString();
                    NavBar.Items.Add(menuItem);
                    AddChildItems(table, menuItem);
                }
                conn.Close();
                displayItems();
                String cid = Request.QueryString["Cid"];
                int temp;
                if (!String.IsNullOrEmpty(cid) && int.TryParse(cid,out temp) && cid.Length<=8)
                {
                    String temp1 = new Database().getCatName(temp);
                    if (temp1 == "NA")
                        Response.Redirect("Index.aspx");
                    String[] catg = temp1.Split(',');
                    A1.InnerHtml = catg[0];
                    A1.HRef = catg[1];
                    Page.Title = A1.InnerHtml + " | GiftDezires.com";
                    Image banner = new Image();
                    banner.Style.Add("width", "100%");
                    if (!catg[2].Contains("false"))
                    {
                        banner.ImageUrl = "http://giftdezires.com/estore/images/Banner/" + catg[2];
                        bannerdiv.Controls.Clear();
                        bloc = banner.ImageUrl;
                        bannerdiv.Controls.Add(banner);
                    }
                    else
                        bannerdiv.Visible = false;
                }
                else
                {
                    Response.Redirect("Index.aspx");
                }
            }
            else
            {
                Image banner = new Image();
                banner.Style.Add("width", "100%");
                banner.ImageUrl = bloc;
                bannerdiv.Controls.Clear();
                bannerdiv.Controls.Add(banner);
               // if (filterl.Count != 0)
              //     FilterList.Visible = true;
                if (Request.Form["__EVENTTARGET"] == "removeFilters1")
                {
                    string passedArgument = Request.Params.Get("__EVENTARGUMENT");
                    removeFilters1_click(passedArgument);
                }
                else if (Request.Form["__EVENTTARGET"] == "Button1")
                {
                    String[] s = Request.Params.Get("__EVENTARGUMENT").Split(',');
                    int s1 = Int32.Parse(s[0]);
                    int s2 = Int32.Parse(s[1]);
                    //filterPrice(s1, s2);
                    ll = s1;
                    ul = s2;
                    //q= createQuery();
                    query();
                }
                else if (Request.Form["__EVENTTARGET"] == "_Range")
                    _Range_ValueChanged();
                else if (Request.Form["__EVENTTARGET"] == "_Age")
                    _Age_ValueChanged();
                else if (Request.Form["__EVENTTARGET"].ToString().Contains("a2c"))
                {
                    //Request.Form["__EVENTTARGET"].ToString()
                    a2c_Click(Request.Form["__EVENTTARGET"].ToString(), null);
                    //Response.Redirect(Request.Url.AbsoluteUri);
                }
               // else
                 //   Response.Redirect(Request.Url.AbsoluteUri); 
                //Request.Form["__EVENTTARGET"]

            }
        }