protected void LoadAppointmentTypeCombo(AppointmentType apptype) { rdcAppointmentType.Items.Clear(); rdcAppointmentType.Items.Add(new RadComboBoxItem(apptype.Name, apptype.AppointmentTypeId.ToString())); rdcAppointmentType.SelectedValue = apptype.AppointmentTypeId.ToString(); }
public static void ImportAppointmentType(OleDbConnection con, AriClinicContext ctx) { //(1) Primero borrar citas y los tipos de cita anteriores //ctx.Delete(ctx.AppointmentInfos); //ctx.Delete(ctx.AppointmentTypes); //(2) Leer los tipos de OFT y darlos de alta en AriClinic string sql = "SELECT * FROM TiposCita"; cmd = new OleDbCommand(sql, con); da = new OleDbDataAdapter(cmd); DataSet ds = new DataSet(); da.Fill(ds, "ConTiposCita"); int nreg = ds.Tables["ConTiposCita"].Rows.Count; int reg = 0; foreach (DataRow dr in ds.Tables["ConTiposCita"].Rows) { reg++; Console.WriteLine("Formas de pago {0:#####0} de {1:#####0} {2}", reg, nreg, (string)dr["NomTipCit"]); int id = (int)dr["IdTipCit"]; DateTime durac = (DateTime)dr["Durac"]; AppointmentType apptype = (from apt in ctx.AppointmentTypes where apt.OftId == id select apt).FirstOrDefault<AppointmentType>(); if (apptype == null) { apptype = new AppointmentType(); ctx.Add(apptype); } apptype.Name = (string)dr["NomTipCit"]; apptype.Duration = durac.Minute; apptype.OftId = id; } ctx.SaveChanges(); }
protected void TimeCalculation(AppointmentType apptype) { if (apptype == null) return; txtDuration.Text = apptype.Duration.ToString(); DateTime start = (DateTime)rddtBeginDateTime.SelectedDate; rddtEndDateTime.SelectedDate = start.AddMinutes(apptype.Duration); }
public static void ImportAppointmentType(OleDbConnection con, AriClinicContext ctx) { //(1) Primero borrar citas y los tipos de cita anteriores ctx.Delete(ctx.AppointmentInfos); ctx.Delete(ctx.AppointmentTypes); //(2) Leer los tipos de OFT y darlos de alta en AriClinic string sql = "SELECT * FROM TiposCita"; cmd = new OleDbCommand(sql, con); da = new OleDbDataAdapter(cmd); DataSet ds = new DataSet(); da.Fill(ds, "ConTiposCita"); foreach (DataRow dr in ds.Tables["ConTiposCita"].Rows) { int id = (int)dr["IdTipCit"]; DateTime durac = (DateTime)dr["Durac"]; AppointmentType apptype = new AppointmentType(); apptype.Name = (string)dr["NomTipCit"]; apptype.Duration = durac.Minute; apptype.OftId = id; ctx.Add(apptype); } ctx.SaveChanges(); }