示例#1
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        string emailid = Session["main_res"].ToString();
        string path = "C:\\Users\\pramod\\Desktop\\ase project\\FIRST INCREMENT\\eathub_webservice\\images\\" + emailid + "\\";

        if (FileUpload1.HasFile)
        {
            try
            {
                if (!Directory.Exists(path))
                {
                    Directory.CreateDirectory(path);
                    Label1.Text = "path created";

                }

                FileUpload1.SaveAs(path + FileUpload1.FileName);
                Label1.Visible = true;
                Label1.Text = "File uploaded";
                path = "http://localhost:51966/eathub_webservice/images/" + emailid + "/"+ FileUpload1.FileName;
                Label1.Text = path;

            }
            catch
            {
                Label1.Visible = true;
                Label1.Text = "Unable to save file";

            }
        }

        restaurantmenus.restaurant_menus r2 = new restaurantmenus.restaurant_menus();
        int status = r2.item_add(emailid, name.Text, price.Text, category.Text, cattype.Text, path, desc.Text);

           if (status == 1)
           {
           Label1.Visible = true;
          Label1.Text = "Item Added Successfully";

           }
           else
           {
           Label1.Text = "try again";
           }
    }
示例#2
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        string emailid = Session["main_res"].ToString();
        string path    = "C:\\Users\\pramod\\Desktop\\ase project\\FIRST INCREMENT\\eathub_webservice\\images\\" + emailid + "\\";


        if (FileUpload1.HasFile)
        {
            try
            {
                if (!Directory.Exists(path))
                {
                    Directory.CreateDirectory(path);
                    Label1.Text = "path created";
                }


                FileUpload1.SaveAs(path + FileUpload1.FileName);
                Label1.Visible = true;
                Label1.Text    = "File uploaded";
                path           = "http://localhost:51966/eathub_webservice/images/" + emailid + "/" + FileUpload1.FileName;
                Label1.Text    = path;
            }
            catch
            {
                Label1.Visible = true;
                Label1.Text    = "Unable to save file";
            }
        }

        restaurantmenus.restaurant_menus r2 = new restaurantmenus.restaurant_menus();
        int status = r2.item_add(emailid, name.Text, price.Text, category.Text, cattype.Text, path, desc.Text);

        if (status == 1)
        {
            Label1.Visible = true;
            Label1.Text    = "Item Added Successfully";
        }
        else
        {
            Label1.Text = "try again";
        }
    }