public void LoadDdlWaves() { BD_TreatmentsWaves waves = new BD_TreatmentsWaves(); waves.StrCon = axVarSes.Lee <string>("strCon"); waves.TreatmentId = Convert.ToInt32(ddlTreatment.SelectedValue); ddlWave.DataSource = waves.SeeByTreatment(); ddlWave.DataTextField = "name"; ddlWave.DataValueField = "wave_id"; ddlWave.DataBind(); }
protected void btncreateTreatment_Click(object sender, EventArgs e) { try { BD_Treatments treatment = new BD_Treatments(); treatment.StrCon = axVarSes.Lee <string>("strCon"); treatment.UpdatedBy = Convert.ToInt32(axVarSes.Lee <string>("strUserID")); treatment.Name = tbTreatmentName.Text; treatment.Description = tbDesc.Text; if (treatment.Insert()) { DataTable dt = treatment.SeeIdByParams(); if (dt.Rows.Count > 0) { DataRow dr = dt.Rows[0]; BD_TreatmentsWaves treatmentWaves = new BD_TreatmentsWaves(); treatmentWaves.StrCon = axVarSes.Lee <string>("strCon"); treatmentWaves.UpdatedBy = Convert.ToInt32(axVarSes.Lee <string>("strUserID")); treatmentWaves.TreatmentId = Convert.ToInt32(dr["treatment_id"].ToString()); treatmentWaves.WaveId = Convert.ToInt32(ddlwave.SelectedValue); treatmentWaves.TimeMinutes = Convert.ToInt32(tbTime.Text); if (treatmentWaves.Insert()) { lblOK.Text = "Datos actualizados satisfactoriamente."; pnOK.Visible = true; pnPrincipal.Visible = true; pnModifyTreatment.Visible = false; LoadGrid(); } else { pnError.Visible = true; lblError.Text = "No se pudieron insertar los datos. " + treatmentWaves.Message; } } } else { pnError.Visible = true; lblError.Text = "No se pudieron insertar los datos. " + treatment.Message; } } catch (Exception ex) { pnError.Visible = true; lblError.Text = "No se pudieron actualizar los datos. " + e.ToString(); } }