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  = "";
        }
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        string fname    = Path.GetFileName(FileUpload1.FileName);
        string fileName = "~/offerimages/" + fname;

        //save the file to our local path
        FileUpload1.SaveAs(Server.MapPath(fileName));


        string      save = "insert into ItemMaster(iid,itemName,itemType,itemImage,price)values('" + txtid.Text + "','" + txtitemname.Text + "','" + DDL.Text + "','" + fileName + "','" + txtprice.Text + "')";
        foodfantacy ob   = new foodfantacy();

        ob.FoodI(save);
        ClientScript.RegisterStartupScript(GetType(), "alert", "alert('Item added succefully Sucessfully');", true);

        SqlDataSource1.SelectCommand = "select * from ItemMaster";
        //DetailsView1.DataSourceID = "SqlDataSource1";



        txtid.Text = "";

        txtitemname.Text = "";
        txtprice.Text    = "";

        return;
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        string      save = "insert into feedback(uloginname,feedback)values('" + TextBox1.Text + "','" + TextBox2.Text + "')";
        foodfantacy ob   = new foodfantacy();

        ob.FoodI(save);
        ClientScript.RegisterStartupScript(GetType(), "alert", "alert('Feedback posted Sucessfully');", true);
    }
Exemplo n.º 4
0
//protected void  Button1_Click1(object sender, EventArgs e)
//{


//    string fname = Path.GetFileName(FileUpload1.FileName);
//    create the path to save the file to
//    string fileName ="offerimages/"+FileUpload1.FileName;
//    save the file to our local path
//    FileUpload1.SaveAs(Server.MapPath(@"~/"+FileUpload1.FileName));
//    string fileName = "~/offerimages/" + fname;
//    save the file to our local path
//    FileUpload1.SaveAs(Server.MapPath(fileName));

//        string save = "insert into newoffer(pid,oitemname,image,price,date,discription)values('" + txtid.Text + "','" + txtname.Text + "','"+ fileName +"','" + txtprice.Text + "','" + txtdate.Text + "','" + txtdiscription.Text + "')";
//        foodfantacy ob = new foodfantacy();
//        ob.FoodI(save);
//        string msg1 = "<script>alert('item deleted!,');</script>";
//        ScriptManager.RegisterStartupScript(this, typeof(Control), "alertmsg", msg1, true);

//        SqlDataSource1.SelectCommand = "select * from newoffer";
//        DetailsView1.DataSourceID = "SqlDataSource1";
//}

    protected void Button1_Click(object sender, EventArgs e)
    {
        string fname = Path.GetFileName(FileUpload1.FileName);
        //create the path to save the file to
        //string fileName ="offerimages/"+FileUpload1.FileName;
        //save the file to our local path
        //FileUpload1.SaveAs(Server.MapPath(@"~/"+FileUpload1.FileName));
        string fileName = "~/offerimages/" + fname;

        //save the file to our local path
        FileUpload1.SaveAs(Server.MapPath(fileName));

        string      save = "insert into newoffer(pid,oitemname,image,price,date,discription)values('" + txtid.Text + "','" + txtname.Text + "','" + fileName + "','" + txtprice.Text + "','" + txtdate.Text + "','" + txtdiscription.Text + "')";
        foodfantacy ob   = new foodfantacy();

        ob.FoodI(save);
        ClientScript.RegisterStartupScript(GetType(), "alert", "alert('New Offer Added Sucessfully');", true);

        SqlDataSource1.SelectCommand = "select * from newoffer";
        //DetailsView1.DataSourceID = "SqlDataSource1";
    }
Exemplo n.º 5
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();
    }