Ejemplo n.º 1
0
    protected void Button2_Click(object sender, EventArgs e)
    {
        if (!Page.IsValid)
        {
            return;
        }

        string insert_qry = "INSERT INTO restaurants(restaurant_name, restaurant_cusine, restaurant_location) values(@resname, @rescuisine, @resloc)";

        try
        {
            SqlCommand cmd = new SqlCommand(insert_qry, con);
            cmd.Parameters.AddWithValue("@resname", ResNameBox.Text);
            cmd.Parameters.AddWithValue("@rescuisine", ResCuisineBox.Text);
            cmd.Parameters.AddWithValue("@resloc", ResLocBox.Text);
            con.Open();
            int ret = cmd.ExecuteNonQuery();
            if (ret != 0)
            {
                Label2.Text      = "Restaurant Added!";
                Label2.ForeColor = System.Drawing.Color.CornflowerBlue;
            }
            con.Close();
        }
        catch (Exception ex)
        {
            Response.Write(ex.Message);
        }

        ResNameBox.Text    = "";
        ResCuisineBox.Text = "";
        ResLocBox.Text     = "";

        ResView.DataBind();
    }
Ejemplo n.º 2
0
    protected void SearchButton_Click(object sender, EventArgs e)
    {
        string name     = SResName.Text ?? "";
        string cuisine  = SResCus.Text ?? "";
        string location = SResLoc.Text ?? "";
        string rate     = (SResRate.Text == "") ? "0" : SResRate.Text;

        string qry = "SELECT * FROM restaurants WHERE restaurant_name LIKE '%{0}%' AND restaurant_cusine LIKE '%{1}%' AND restaurant_location LIKE '%{2}%' AND restaurant_rating >= {3}";

        qry = string.Format(qry, name, cuisine, location, rate);


        ResData.SelectCommand = qry;
        if (!ResView.Visible)
        {
            ResView.Visible = true;
        }
        ResView.DataBind();
    }
Ejemplo n.º 3
0
        private void Save(ResView v)
        {
            try
            {
                var view = v.GetView();

                for (int l = 0; l < view.Loops.Count; l++)
                {
                    for (int c = 0; c < view.Loops[l].Cells.Count; c++)
                    {
                        var cell = view.Loops[l].Cells[c];
                        cell.GetImage().Save(Path.Combine(OutDir, $"{v.Number}.{l}.{c}.png"));
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine($"View {v.Number} {ex.Message}");
            }
        }
Ejemplo n.º 4
0
 public BResource(uint fnum,ResView.BResourceControl cntr)
 {
     this.fnum = fnum;
     this.cntr=cntr;
 }