Exemple #1
0
        protected void btngrabar_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtcodigocliente.Text == string.Empty)
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Mensaje", "alert('Debe realizar primero la busqueda de la cita.')", true);
                    return;
                }

                int     idcita = Utilidades.ToInt(txtcodigocita.Text);
                DataSet data   = AtencionPeluqueriaBuss.GetDatosCita(idcita);


                if (data.Tables[0].Rows.Count > 0)
                {
                    txtcodigocliente.Text  = data.Tables[0].Rows[0]["idcliente"].ToString();
                    txtnombrecliente.Text  = data.Tables[0].Rows[0]["NombreCliente"].ToString();
                    txtcodigomascota.Text  = data.Tables[0].Rows[0]["idMascota"].ToString();
                    txtnombremascota.Text  = data.Tables[0].Rows[0]["nombreMascota"].ToString();
                    txtespeciemascota.Text = data.Tables[0].Rows[0]["descripcionEspecie"].ToString();
                    txtedadmascota.Text    = data.Tables[0].Rows[0]["Edad"].ToString();
                    txtsexomascota.Text    = data.Tables[0].Rows[0]["DscSexoMascota"].ToString();
                    txttamañomascota.Text  = data.Tables[0].Rows[0]["tamaño"].ToString();

                    //detalle

                    this.grvresultado.DataSource = data.Tables[1];
                    this.grvresultado.DataBind();
                }
                else
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Mensaje", "alert('La cita para el código ingresado no existe, o no esta pendiente.')", true);
                    return;
                }

                HojaServicio hoja = new HojaServicio();
                hoja.idEmpleado      = 1;
                hoja.FechaEmision    = txtfecharegistro.Text;
                hoja.NumHojaServicio = 0;
                hoja.Canil           = cbojaula.SelectedValue;
                hoja.idCita          = Utilidades.ToInt(txtcodigocita.Text);
                hoja.Observaciones   = txtobservaciones.Text.ToUpper();
                AtencionPeluqueriaBuss.GrabarHojaServicio(hoja, null, 1);
                Response.Redirect("ActualizarHojaServicio.aspx");
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Mensaje", "$.growl.warning({ title: 'Mensaje Sistema', message: 'Error interno del sistema.'});", true);
            }
        }
Exemple #2
0
        protected void grvresultado_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            //EJECUTAR
            if (e.CommandName == "Ejecutar")
            {
                int idHoja = Utilidades.ToInt(e.CommandArgument.ToString());
                try
                {
                    DataSet data = AtencionPeluqueriaBuss.GetDatosHojaServicioEjecutar(idHoja);


                    if (data.Tables[0].Rows.Count > 0)
                    {
                        hfidHojaServicio.Value        = data.Tables[0].Rows[0]["idHojaServicio"].ToString();
                        txtfechaemisionalt.Text       = data.Tables[0].Rows[0]["fechaRegistro"].ToString();
                        txtobservacionesejecutar.Text = data.Tables[0].Rows[0]["Observaciones"].ToString();

                        //detalle

                        this.grvResultadoPopup.DataSource = data.Tables[1];
                        this.grvResultadoPopup.DataBind();


                        lblModalTitle.Text = "Ejecutar Hoja de servicio";
                        ScriptManager.RegisterStartupScript(Page, Page.GetType(), "myModal", "$('#myModal').modal();", true);
                        upModal.Update();
                    }
                    else
                    {
                        ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Mensaje", "alert('No existe servicios agregados en la Hoja de servicio')", true);
                    }
                }
                catch (Exception ex)
                {
                    //this.lblmsg.Text = ex.Message;
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Mensaje", "$.growl.warning({ title: 'Mensaje Sistema', message: 'Error interno del sistema.'});", true);
                }

                //EDITAR
            }

            else if (e.CommandName == "Anular")
            {
                try
                {
                    int         idHoja   = Utilidades.ToInt(e.CommandArgument.ToString());
                    GridViewRow gvr      = (GridViewRow)((ImageButton)e.CommandSource).NamingContainer;
                    int         RowIndex = gvr.RowIndex;

                    HojaServicio hoja = new HojaServicio()
                    {
                        idHojaServicio = idHoja
                    };
                    AtencionPeluqueriaBuss.GrabarHojaServicio(hoja, (new List <DetalleServicio>()), 3);
                    ListarHojas();
                }
                catch (Exception ex)
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Mensaje", "$.growl.warning({ title: 'Mensaje Sistema', message: 'Error interno del sistema.'});", true);
                }
            }
        }
Exemple #3
0
        protected void btngrabarejecutar_Click(object sender, EventArgs e)
        {
            try
            {
                //Validando campos obligatorios
                if (txtfechaemisionalt.Text == string.Empty)
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Mensaje", "$.growl.warning({ title: 'Mensaje Sistema', message: 'Ingrese la fecha de emisión.'});", true);
                    return;
                }
                //Guardando cabecera
                HojaServicio hoja = new HojaServicio();
                hoja.idHojaServicio = Utilidades.ToInt(hfidHojaServicio.Value);
                hoja.FechaEmision   = txtfechaemisionalt.Text;
                hoja.Observaciones  = txtobservacionesejecutar.Text;

                //Guardando detalles
                List <DetalleServicio> lista    = new List <DetalleServicio>();
                DropDownList           ddestado = default(DropDownList);
                DropDownList           empleado = default(DropDownList);
                TextBox txthorainicio           = default(TextBox);
                TextBox txthorafin = default(TextBox);

                DetalleServicio item = null;
                for (Int32 i = 0; i <= grvResultadoPopup.Rows.Count - 1; i++)
                {
                    item = new DetalleServicio();

                    item.iddetalleHojaServicio = Utilidades.ToInt(this.grvResultadoPopup.DataKeys[i].Values[0].ToString());
                    ddestado      = (DropDownList)grvResultadoPopup.Rows[i].FindControl("cboEstadoser");
                    empleado      = (DropDownList)grvResultadoPopup.Rows[i].FindControl("cboEmpleadoServ");
                    txthorainicio = (TextBox)grvResultadoPopup.Rows[i].FindControl("txtHorainicio");
                    txthorafin    = (TextBox)grvResultadoPopup.Rows[i].FindControl("txtHoraFin");

                    if (ddestado.SelectedValue == "002")
                    {
                        if (txthorainicio.Text == string.Empty)
                        {
                            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Mensaje", "$.growl.warning({ title: 'Mensaje Sistema', message: 'Ingrese la hora de inicio.'});", true);
                            return;
                        }

                        if (txthorafin.Text == string.Empty)
                        {
                            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Mensaje", "$.growl.warning({ title: 'Mensaje Sistema', message: 'Ingrese la hora de Fin.'});", true);
                            return;
                        }

                        if (empleado.SelectedValue == "0")
                        {
                            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Mensaje", "$.growl.warning({ title: 'Mensaje Sistema', message: 'Seleccione el empleado que ejecuto el servicio.'});", true);
                            return;
                        }
                    }

                    item.Estado     = ddestado.SelectedValue;
                    item.HoraInicio = txthorainicio.Text;
                    item.HoraFin    = txthorafin.Text;
                    lista.Add(item);
                }


                AtencionPeluqueriaBuss.GrabarHojaServicio(hoja, lista, 2);
                ListarHojas();
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "myModal", "$('#myModal').modal('hide');", true);
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "myModal2", "callbusqueda();", true);
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Mensaje", "$.growl.warning({ title: 'Mensaje Sistema', message: 'Error interno del sistema.'});", true);
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "myModal", "$('#myModal').modal('hide');", true);
                //this.lblmsg.Text = ex.Message;
            }
        }