protected void Button1_Click(object sender, EventArgs e)
    {
        string un;

        un = TextBox1.Text;
        string pa;

        pa = TextBox2.Text;

        string selectquery = "select * from Reg_Table where ULoginName='" + un + "' and Password='******'";
        //foodfantacy ta3 = new foodfantacy();
        //ta3.FoodS(query);
        foodfantacy obj = new foodfantacy();
        //DataTable obj = new DataTable();
        DataTable ta1 = obj.FoodS(selectquery);

        if (ta1.Rows.Count >= 1)
        {
            Response.Redirect("chomepage.aspx");
        }
        else
        {
            string msg1 = "<script>alert('Enter Correct Username Or Password!,');</script>";
            ScriptManager.RegisterStartupScript(this, typeof(Control), "alertmsg", msg1, false);
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        string      selectquery = "select * from Reg_Table where UloginName='" + txtulname.Text + "'";
        foodfantacy obj         = new foodfantacy();
        //DataTable obj = new DataTable();
        DataTable ta1 = obj.FoodS(selectquery);

        if (ta1.Rows.Count >= 1)
        {
            string msg1 = "<script>alert('User Already Exist!,');</script>";
            ScriptManager.RegisterStartupScript(this, typeof(Control), "alertmsg", msg1, false);
        }
        else
        {
            string      save = "insert into Reg_Table(uname,uloginname,password,location,mobno,email)values('" + txtrname.Text + "','" + txtulname.Text + "','" + txtpass.Text + "','" + txtloca.Text + "','" + txtmobno.Text + "','" + txtemail.Text + "')";
            foodfantacy ob   = new foodfantacy();
            ob.FoodI(save);
            ClientScript.RegisterStartupScript(GetType(), "alert", "alert('Registred Sucessfully');", true);
            txtulname.Text = "";
            txtulname.Text = "";
            txtpass.Text   = "";
            txtloca.Text   = "";
            txtmobno.Text  = "";
            txtemail.Text  = "";
        }
    }
Exemplo n.º 3
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        string un;

        un = TextBox1.Text;
        string pa;

        pa = TextBox2.Text;
        string query;

        query = "select * from Admin_Table where Name='" + un + "' and password='******'";
        //foodfantacy ta3 = new foodfantacy();
        //ta3.FoodS(query);
        foodfantacy obj = new foodfantacy();
        //DataTable obj = new DataTable();
        DataTable ta1 = obj.FoodS(query);

        if (ta1.Rows.Count >= 1)
        {
            Response.Redirect("ahomepage.aspx");
        }
        else
        {
        }
    }
Exemplo n.º 4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        DataTable dt1     = new DataTable();
        string    querry2 = "SELECT DISTINCT onum, del_date, del_address FROM cancle_table";

        dt1 = obj.FoodS(querry2);
        GridView3.DataSource = dt1;
        GridView3.DataBind();
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        string query;

        query = "select * from order_Table where  onum='" + TextBox1.Text + "'";
        //foodfantacy ta3 = new foodfantacy();
        //ta3.FoodS(query);
        foodfantacy obj = new foodfantacy();
        //DataTable obj = new DataTable();
        DataTable ta1 = obj.FoodS(query);

        GridView2.DataSource = ta1;
        GridView2.DataBind();
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        //DataTable dt1 = new DataTable();
        //string querry2 = "select * from order_table";
        //dt1 = obj.FoodS(querry2);
        //GridView1.DataSource = dt1;
        //GridView1.DataBind();
        //SqlDataSource1.SelectCommand = "select * from ordernum";
        DataTable dt1     = new DataTable();
        string    querry2 = "SELECT DISTINCT onum, del_date, resturant FROM order_table";

        dt1 = obj.FoodS(querry2);
        GridView1.DataSource = dt1;
        GridView1.DataBind();
    }
Exemplo n.º 7
0
 protected void RadioButtonList1_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (RadioButtonList1.SelectedIndex == 0)
     {
         string      retrive = "select * from ItemMaster where itemType='" + RadioButtonList1.SelectedItem.Text + "'";
         foodfantacy obj     = new foodfantacy();
         //DataTable obj = new DataTable();
         DataTable ta1 = obj.FoodS(retrive);
         GridView1.DataSource = ta1;
         GridView1.DataBind();
     }
     else if (RadioButtonList1.SelectedIndex == 1)
     {
         string      retrive = "select * from ItemMaster where itemType='" + RadioButtonList1.SelectedItem.Text + "'";
         foodfantacy obj     = new foodfantacy();
         //DataTable obj = new DataTable();
         DataTable ta1 = obj.FoodS(retrive);
         GridView1.DataSource = ta1;
         GridView1.DataBind();
     }
     else if (RadioButtonList1.SelectedIndex == 2)
     {
         string      retrive = "select * from ItemMaster where itemType='" + RadioButtonList1.SelectedItem.Text + "'";
         foodfantacy obj     = new foodfantacy();
         //DataTable obj = new DataTable();
         DataTable ta1 = obj.FoodS(retrive);
         GridView1.DataSource = ta1;
         GridView1.DataBind();
     }
     else if (RadioButtonList1.SelectedIndex == 3)
     {
         string      retrive = "select * from ItemMaster where itemType='" + RadioButtonList1.SelectedItem.Text + "'";
         foodfantacy obj     = new foodfantacy();
         //DataTable obj = new DataTable();
         DataTable ta1 = obj.FoodS(retrive);
         GridView1.DataSource = ta1;
         GridView1.DataBind();
     }
     else if (RadioButtonList1.SelectedIndex == 4)
     {
         string      retrive = "select * from ItemMaster where itemType='" + RadioButtonList1.SelectedItem.Text + "'";
         foodfantacy obj     = new foodfantacy();
         //DataTable obj = new DataTable();
         DataTable ta1 = obj.FoodS(retrive);
         GridView1.DataSource = ta1;
         GridView1.DataBind();
     }
     else if (RadioButtonList1.SelectedIndex == 5)
     {
         string      retrive = "select * from ItemMaster where itemType='" + RadioButtonList1.SelectedItem.Text + "'";
         foodfantacy obj     = new foodfantacy();
         //DataTable obj = new DataTable();
         DataTable ta1 = obj.FoodS(retrive);
         GridView1.DataSource = ta1;
         GridView1.DataBind();
     }
     else if (RadioButtonList1.SelectedIndex == 6)
     {
         string      retrive = "select * from ItemMaster where itemType='" + RadioButtonList1.SelectedItem.Text + "'";
         foodfantacy obj     = new foodfantacy();
         //DataTable obj = new DataTable();
         DataTable ta1 = obj.FoodS(retrive);
         GridView1.DataSource = ta1;
         GridView1.DataBind();
     }
 }
    protected void Button1_Click(object sender, EventArgs e)
    {
        // Label1.Visible = true;
        DateTime today = DateTime.Today;

        TimeSpan current_time = DateTime.Now.TimeOfDay;
        //TimeSpan m = TimeSpan.FromMinutes(30);
        //TimeSpan n = current_time.Add(m);
        //TimeSpan current_time = new TimeSpan(current);
        DateTime time         = DateTime.Today.Add(current_time);
        string   displayTime  = time.ToString("hh:mm tt");
        string   current_date = today.ToString("dd/MM/yyyy");
        //TimeSpan m = TimeSpan.FromMinutes(15);
        //TimeSpan n = tspan.Add(m);
        // txttime.Text = displayTime;
        DataTable dt1     = new DataTable();
        string    querry2 = "select * from order_table where onum='" + TextBox1.Text + "'";

        dt1 = obj.FoodS(querry2);
        if (dt1.Rows.Count > 0)
        {
            string date  = dt1.Rows[0]["del_date"].ToString();
            string time1 = dt1.Rows[0]["del_time"].ToString();

            TimeSpan tspan;

            tspan = DateTime.ParseExact(time1, "hh:mm tt", CultureInfo.InvariantCulture).TimeOfDay;



            //DateTime today = DateTime.Today;
            //string today1 = today.ToString("dd/MM/yyyy");
            TimeSpan m = TimeSpan.FromMinutes(30);
            TimeSpan n = tspan.Add(m);

            if (date == current_date)
            {
                if (n >= current_time && current_time >= tspan)
                {
                    //ClientScript.RegisterStartupScript(GetType(), "alert", "alert('Order Can't be cancelled');", true);
                    // return;
                    DataTable     dt2 = new DataTable();
                    SqlDataReader dr4;
                    SqlConnection con4 = new SqlConnection("Data Source=.\\SQLEXPRESS;AttachDbFilename=|DataDirectory|\\FoodFanctsy.mdf;Integrated Security=True;User Instance=True");
                    con4.Open();
                    SqlCommand com4 = new SqlCommand("select * from order_table where onum='" + TextBox1.Text + "'", con4);
                    dr4 = com4.ExecuteReader();
                    while (dr4.Read() == true)
                    {
                        //string querry3 = "select * from order_table where onum='" + TextBox1.Text + "'";
                        //dt2 = obj.FoodS(querry3);
                        // if (dt2.Rows.Count > 0)
                        //{
                        SqlConnection con1 = new SqlConnection("Data Source=.\\SQLEXPRESS;AttachDbFilename=|DataDirectory|\\FoodFanctsy.mdf;Integrated Security=True;User Instance=True");
                        SqlCommand    com1 = new SqlCommand("insert into cancle_table(onum,Product_id,Item_Name,date,Price,Quantity,Total,resturant,del_date,del_time,del_address) values ('" + dr4["onum"].ToString() + "','" + dr4["Product_id"].ToString() + "','" + dr4["Item_Name"].ToString() + "','" + dr4["date"].ToString() + "','" + dr4["Price"].ToString() + "','" + dr4["Quantity"].ToString() + "','" + dr4["Total"].ToString() + "','" + dr4["resturant"].ToString() + "','" + dr4["del_date"].ToString() + "','" + dr4["del_time"].ToString() + "','" + dr4["del_address"].ToString() + "')", con1);
                        con1.Open();

                        com1.ExecuteNonQuery();
                        con1.Close();
                    }
                    dr4.Close();
                    con4.Close();
                    SqlConnection con5 = new SqlConnection("Data Source=.\\SQLEXPRESS;AttachDbFilename=|DataDirectory|\\FoodFanctsy.mdf;Integrated Security=True;User Instance=True");
                    con5.Open();
                    SqlCommand com2 = new SqlCommand("delete from order_table where onum='" + TextBox1.Text + "'", con5);
                    com2.ExecuteNonQuery();
                    con5.Close();
                    ClientScript.RegisterStartupScript(GetType(), "alert", "alert('Order Cancelled Successfully');", true);
                    TextBox1.Text = "";
                }


                TextBox1.Text = "";
                return;
            }

            TextBox1.Text = "";
            return;
        }
    }
Exemplo n.º 9
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        //DataTable dt1 = new DataTable();
        //string querry2 = "select onum from order_table where onum='" + order1 + "' and del_date='"+txtdate.Text+"' and del_time='" + txttime.Text + "'";
        ///dt1 = obj.FoodS(querry2);
        //if (dt1.Rows.Count > 0)
        //{
        //ClientScript.RegisterStartupScript(GetType(), "alert", "alert('Order Number Exists  ');", true);
        //return;
        // }
        // else
        foreach (GridViewRow g1 in GridView1.Rows)
        {
            string    prod     = g1.Cells[1].Text;
            int       prod_id  = Convert.ToInt32(prod);
            string    pr       = g1.Cells[4].Text;
            int       price    = Convert.ToInt32(pr);
            string    qty      = g1.Cells[5].Text;
            int       quantity = Convert.ToInt32(qty);
            string    tot      = g1.Cells[6].Text;
            int       total    = Convert.ToInt32(tot);
            DataTable dt1      = new DataTable();
            string    querry2  = "select * from order_table where del_date='" + txtdate.Text + "' and Product_id='" + prod_id + "' and Item_Name='" + g1.Cells[2].Text + "' and Price='" + price + "' and Quantity='" + quantity + "' and Total='" + total + "'";
            dt1 = obj.FoodS(querry2);
            if (dt1.Rows.Count > 0)
            {
                ClientScript.RegisterStartupScript(GetType(), "alert", "alert('Order Exists  ');", true);
                txt_ord_no.Text             = "";
                DropDownList1.SelectedIndex = -1;
                txtdate.Text    = "";
                txttime.Text    = "";
                txtaddress.Text = "";
                return;
            }
            //if(DateTime.Now.TimeOfDay >= System.TimeSpan.Parse("11:00:00"))
            //{
            //    ClientScript.RegisterStartupScript(GetType(), "alert", "alert('vvv ');", true);
            //    txt_ord_no.Text = "";
            //    DropDownList1.SelectedIndex = -1;
            //    txtdate.Text = "";
            //    txttime.Text = "";
            //    txtaddress.Text = "";
            //    return;

            //}
            //else
            //{

            //    if (System.DateTime.Now.Hour >= 10)
            //    {
            //        ClientScript.RegisterStartupScript(GetType(), "alert", "alert('can't');", true);
            //    }
            //}
            //else
            //{
//            else if(DateTime.Now.TimeOfDay == System.TimeSpan.Parse("00:09:00"))

//{

//    ClientScript.RegisterStartupScript(GetType(), "alert", "alert('can't  ');", true);

//}



            SqlConnection con = new SqlConnection("Data Source=.\\SQLEXPRESS;AttachDbFilename=|DataDirectory|\\FoodFanctsy.mdf;Integrated Security=True;User Instance=True");

            SqlCommand com = new SqlCommand("insert into order_table(onum,Product_id,Item_Name,date,Price,Quantity,Total,resturant,del_date,del_time,del_address,mobno) values (" + order1 + ",'" + prod_id + "','" + g1.Cells[2].Text + "','" + g1.Cells[3].Text + "','" + price + "','" + quantity + "','" + total + "','" + DropDownList1.SelectedItem.Text + "','" + txtdate.Text + "','" + txttime.Text + "','" + txtaddress.Text + "','" + TextBox1.Text + "')", con);

            con.Open();

            com.ExecuteNonQuery();

            con.Close();

            string      save = "insert into  temp_table(onum,Product_id,Item_Name,date,Price,Quantity,Total,resturant,del_date,del_time,del_address) values (" + order1 + ",'" + prod_id + "','" + g1.Cells[2].Text + "','" + g1.Cells[3].Text + "','" + price + "','" + quantity + "','" + total + "','" + DropDownList1.SelectedItem.Text + "','" + txtdate.Text + "','" + txttime.Text + "','" + txtaddress.Text + "')";
            foodfantacy ob   = new foodfantacy();
            ob.FoodI(save);
        }
        SqlConnection con1 = new SqlConnection("Data Source=.\\SQLEXPRESS;AttachDbFilename=|DataDirectory|\\FoodFanctsy.mdf;Integrated Security=True;User Instance=True");
        SqlCommand    com1 = new SqlCommand("insert into ordernum(onum) values (" + order1 + ")", con1);

        con1.Open();

        com1.ExecuteNonQuery();

        con1.Close();
        txt_ord_no.Text             = "";
        DropDownList1.SelectedIndex = -1;
        txtdate.Text    = "";
        txttime.Text    = "";
        txtaddress.Text = "";
        TextBox1.Text   = "";
        //GridView1.Dispose();
        //Session["cart"] = null;
        //GridView1.Rows.Clear();
        GridView1.Visible = false;



        ClientScript.RegisterStartupScript(GetType(), "alert", "alert('Order Placed Sucessfully');", true);

        sendsms();
    }