Beispiel #1
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            string url  = "";
            string name = "";

            try
            {
                if (upload.HasFile)
                {
                    name = clases.Tools.ImgName(upload.FileName, Server.MapPath("~/images/"));
                    url  = "/images/" + name;
                }
                client.sp_AgregarPlatillo((SQLTrans.LoginData)Session["userdata"], txtDname.Text, float.Parse(txtPrice.Text), txtDescripcion.Text, Convert.ToInt32(ddCategorias.SelectedValue), Convert.ToInt32(ddRestaurantes.SelectedValue), url);
                output.Text = "Transaccion completada!";
                if (upload.HasFile)
                {
                    upload.SaveAs(Path.Combine(Server.MapPath("~/images"), name));
                }
                txtDescripcion.Text = "";
                txtDname.Text       = "";
                txtPrice.Text       = "";
            }
            catch (Exception)
            {
                output.Text = "Ocurrio un error y no se completo la transaccion!";
            }
        }