Пример #1
0
    protected void btnsubmit_Click(object sender, EventArgs e)
    {
        try
        {
            if (ff.CheckAllreadyExist("select menuid from menuwiseingredients where menuid='" + ddlmenu.SelectedItem.Text.Trim() + "'"))
            {
                ScriptManager.RegisterStartupScript(this, GetType(), "alert", "alert('This Item Ingredient is Already exist... !')", true);
            }
            else
            {
                foreach (RepeaterItem itm in rptdetails.Items)
                {
                    DropDownList ddlingre    = (DropDownList)itm.FindControl("ddlingre");
                    TextBox      txtquantity = (TextBox)itm.FindControl("txtquantity");
                    DropDownList ddlunits    = (DropDownList)itm.FindControl("ddlunits");

                    int max = ff.FetchMax("menuwiseingredients", "id");
                    data.Clear();
                    data.Add(max);
                    data.Add(ddlmenu.SelectedItem.Value.Trim());
                    data.Add(txtIngr.Text.Trim());
                    data.Add(ddlingre.SelectedItem.Text.Trim());
                    data.Add(txtquantity.Text.Trim() + " " + ddlunits.SelectedItem.Text.Trim());


                    if (ff.Insertion("menuwiseingredients", data))
                    {
                        value = 1;
                    }
                    else
                    {
                        value = 0;
                    }
                }
            }
        }
        catch (Exception)
        {
            value = 0;
        }
        if (value == 1)
        {
            Response.Redirect("Success.aspx?msg=Activity Completed Successfully.&home=MenuWiseIngredient.aspx", false);
        }
        else if (value == 0)
        {
            Response.Redirect("Failure.aspx?err=Operation Failed&home=MenuWiseIngredient.aspx", false);
        }
    }
Пример #2
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        try
        {
            if (ff.CheckAllreadyExist("select * from menucategory where ctg='" + txtCategory.Text.Trim() + "'"))
            {
                ScriptManager.RegisterStartupScript(this, GetType(), "alert", "alert('Category is Already Exists...!')", true);
            }
            else
            {
                int max = ff.FetchMax("menucategory", "ctgid");
                data.Clear();
                data.Add(max);
                data.Add(txtCategory.Text.Trim());

                if (ff.Insertion("menucategory", data))
                {
                    Response.Redirect("KitchenManager.aspx", false);
                }
            }
            txtCategory.Text = "";
        }
        catch (Exception) { }
    }