コード例 #1
0
ファイル: frm_Cita.aspx.cs プロジェクト: juahidma/petnet-web
        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_Cita obj = new WSGestion.MOD_Cita();

                    obj.CIT_id_centro_atencion = Convert.ToInt32 (txt_cea_codigo.Value);
                    obj.CIT_id_mascota = codigo_mascota;
                    obj.CIT_fecha = Convert.ToDateTime(txt_fecha.Text).ToString("MM/dd/yyyy hh:mm:ss");
                    obj.CIT_estado = dl_estado.SelectedValue;

                    wsgest.CRE_Cita(obj);
                    Response.Redirect("frm_Grid_Cita.aspx");
                }

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

                    obj.CIT_id_centro_atencion =Convert.ToInt32(txt_cea_codigo.Value) ;
                    obj.CIT_id_mascota = codigo_mascota;
                    obj.CIT_fecha = Convert.ToDateTime(txt_fecha.Text).ToString("MM/dd/yyyy hh:mm:ss");
                    obj.CIT_estado = dl_estado.SelectedValue;
                    obj.CIT_id_cita = Convert.ToInt32(txt_codigo.Value);

                    wsgest.UPD_Cita(obj);
                    Response.Redirect("frm_Grid_Cita.aspx");
                }
            }

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