Пример #1
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            DataTable dt = Session["SalidaDetalle"] as DataTable;

            salida = new SalidaAD();

            string fecha           = txtFecha.Text;
            int    idBodegaOrigen  = Convert.ToInt32(ddlBodegaOrigen.SelectedValue);
            int    idBodegaDestino = Convert.ToInt32(ddlBodegaDestino.SelectedValue);

            int id = salida.InsertSalida(fecha, idBodegaOrigen, idBodegaDestino);

            if (id > 0)
            {
                for (int i = 1; i < dt.Rows.Count; i++)
                {
                    int medicamento = Convert.ToInt32(dt.Rows[i]["Medicamento"]);
                    int cantidad    = Convert.ToInt32(dt.Rows[i]["Cantidad"]);

                    if (!salida.InsertSalidaDetalle(id, medicamento, cantidad))
                    {
                        Response.Write("<script>window.alert('Salida Detalle Fallida')</script>");
                    }
                }
                Response.Redirect(HttpContext.Current.Request.Url.AbsoluteUri);
            }
            else
            {
                Response.Write("<script>window.alert('Salida Fallida')</script>");
            }
        }
Пример #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            salida = new SalidaAD();

            if (!IsPostBack)
            {
                GridLoad();

                salida.DropBodega(ddlBodegaOrigen);
                salida.DropBodega(ddlBodegaDestino);
                salida.DropMedicamento((DropDownList)grdSalidaDetalle.FooterRow.FindControl("ddlInsertMedicamento"));
            }
        }