コード例 #1
0
        protected void btn_guardar_ServerClick(object sender, EventArgs e)
        {
            try
            {
                if (FormAccion == "Agregar")
                {
                    WSGestion.WSGestion wsgest = new WSGestion.WSGestion();
                    wsgest.Url = ConfigurationManager.AppSettings.Get("dirWs");
                    WSGestion.MOD_Entrada_Inventario obj = new WSGestion.MOD_Entrada_Inventario();

                    obj.ENT_inv_id_centro_atencion = Convert.ToInt32(txt_cea_codigo.Value);
                    obj.ENT_inv_id_bodega = Convert.ToInt32(dl_id_bodega.SelectedValue);
                    obj.ENT_inv_id_sucursal = Convert.ToInt32(dl_id_sucursal.SelectedValue);
                    obj.ENT_inv_fecha = Convert.ToDateTime(txt_fecha.Text).ToString("dd/MM/yyyy hh:mm:ss");
                    obj.ENT_inv_aplicada = "N";
                    obj.ENT_inv_origen = "INVENTARIO";

                    wsgest.CRE_Entrada_Inventario(obj);
                    Response.Redirect("frm_Grid_Entrada_Inventario.aspx");
                }

                if (FormAccion == "Editar")
                {
                    WSGestion.WSGestion wsgest = new WSGestion.WSGestion();
                    wsgest.Url = ConfigurationManager.AppSettings.Get("dirWs");
                    WSGestion.MOD_Entrada_Inventario obj = new WSGestion.MOD_Entrada_Inventario();

                    obj.ENT_inv_id_entrada_inventario = Convert.ToInt32(txt_codigo.Value);
                    obj.ENT_inv_id_centro_atencion = Convert.ToInt32(txt_cea_codigo.Value);
                    obj.ENT_inv_id_bodega = Convert.ToInt32(dl_id_bodega.SelectedValue);
                    obj.ENT_inv_id_sucursal = Convert.ToInt32(dl_id_sucursal.SelectedValue);
                    obj.ENT_inv_fecha = Convert.ToDateTime(txt_fecha.Text).ToString("dd/MM/yyyy hh:mm:ss");
                    obj.ENT_inv_aplicada = dl_estado.SelectedValue;

                    wsgest.UPD_Entrada_Inventario(obj);
                    Response.Redirect("frm_Grid_Entrada_Inventario.aspx");
                }
            }

            catch (Exception exc)
            {
                Alert_Mensaje.Attributes["class"] = "alert alert-danger";
                mensaje_alerta = exc.ToString();
                titulo_mensaje_alerta = "Error: ";
                Alert_Mensaje.Visible = true;
            }
        }