コード例 #1
0
 void SeleccionElemento()
 {
     salas = SalasController.GetSalaJuntas(Intent.GetStringExtra("sucursal_id"), fecha_seleccionada, hora_inicio_seleccionada, hora_fin_seleccionada);
     FillImagenes();
     lvSalasJuntas.Adapter = new SalasJuntasListAdapter(salas);
     sala_seleccionada     = null;
 }
コード例 #2
0
        private void EnviarMail(UsuarioModel usuario, SalaJuntasModel Sala, NSDate Fecha, SalaJuntasReservacionModel Reservas)
        {
            string Horarios = "";

            Horarios = Horarios + Reservas.Sala_Hora_Inicio + " - " + Reservas.Sala_Hora_Fin + " ";


            NSDateFormatter dateFormat = new NSDateFormatter();

            dateFormat.DateFormat = "dd";
            var DiaSeleccionado = dateFormat.ToString(Fecha);

            dateFormat.DateFormat = "dd/MM/yyyy";
            var fecha = dateFormat.ToString(Fecha);

            string correoInvitacion = System.IO.File.ReadAllText("HTML/SalaJuntasReserva.html");

            new Emails().SendMail(usuario.Usuario_Correo_Electronico, usuario.Usuario_Nombre + " " + usuario.Usuario_Apellidos,
                                  correoInvitacion.Replace("{{NOMBRE}}", usuario.Usuario_Nombre + " " + usuario.Usuario_Apellidos)
                                  .Replace("{{NOMBRESALA}}", Sala.Sala_Descripcion)
                                  .Replace("{{CAPACIDADSALA}}", Sala.Sala_Capacidad)
                                  .Replace("{{DIALETRA}}", fecha)
                                  .Replace("{{DIANUMERO}}", DiaSeleccionado)
                                  .Replace("{{HORARIO}}", Horarios),
                                  "Worklabs - Confirmación de sala de junta");
        }
コード例 #3
0
        public SalaJuntasModel GetSalaJuntasInfo(string sala_id)
        {
            SalaJuntasModel sala = new SalaJuntasModel();

            try
            {
                conn.Open();
                string query = "SELECT * FROM vw_cat_Salas_Juntas WHERE Sala_Id = @sala_id";
                command = CreateCommand(query);
                command.Parameters.AddWithValue("@sala_id", sala_id);
                reader = command.ExecuteReader();
                while (reader.Read())
                {
                    sala = new SalaJuntasModel
                    {
                        Sala_Descripcion = reader["Sala_Descripcion"].ToString(),
                        Sala_Nivel       = reader["Sala_Nivel"].ToString(),
                        Sala_Capacidad   = reader["Sala_Capacidad"].ToString()
                    };
                }
            }
            catch (Exception e)
            {
                SlackLogs.SendMessage(e.Message, GetType().Name, "GetSalaJuntas");
            }
            finally { conn.Close(); }

            return(sala);
        }
コード例 #4
0
 public void UpdateCell(SalaJuntasModel SalaJuntas)
 {
     this.lblPiso.Text       = "Piso: " + SalaJuntas.Sala_Nivel;
     this.lblCapacidad.Text  = SalaJuntas.Sala_Capacidad + " Personas";
     this.lblNombreSala.Text = SalaJuntas.Sala_Descripcion;
     if (SalaJuntas.Sala_Capacidad == "6")
     {
         imgSalaJuntas.Image = UIImage.FromBundle("Sala6");
     }
     else if (SalaJuntas.Sala_Capacidad == "10")
     {
         imgSalaJuntas.Image = UIImage.FromBundle("Sala10");
     }
 }
コード例 #5
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.SalasReunionConfirmarLayout);
            Toolbar toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);

            SetActionBar(toolbar);
            ActionBar.Title = Resources.GetString(Resource.String.str_meeting_room);
            ActionBar.SetDisplayHomeAsUpEnabled(true);
            sala_id = Intent.GetStringExtra("sala_id");

            sala = new SalasJuntasController().GetSalaJuntasInfo(sala_id);

            FindViewById <ImageView>(Resource.Id.ivSala).SetImageResource(Resources.GetIdentifier(string.Format("s{0}{1}", sala_id, sala.Sala_Nivel), "mipmap", PackageName));
            FindViewById <ImageView>(Resource.Id.ivSala1).SetImageResource(Resources.GetIdentifier(string.Format("n{0}{1}0", sala.Sala_Nivel, sala_id), "mipmap", PackageName));
            FindViewById <ImageView>(Resource.Id.ivSala2).SetImageResource(Resources.GetIdentifier(string.Format("n{0}{1}1", sala.Sala_Nivel, sala_id), "mipmap", PackageName));
            FindViewById <ImageView>(Resource.Id.ivSala3).SetImageResource(Resources.GetIdentifier(string.Format("n{0}{1}2", sala.Sala_Nivel, sala_id), "mipmap", PackageName));

            fecha_seleccionada = Intent.GetStringExtra("fecha_seleccionada");
            hora_inicio        = Intent.GetStringExtra("hora_inicio");
            hora_fin           = Intent.GetStringExtra("hora_fin");
            cantidad_personas  = Intent.GetStringExtra("cantidad_personas");
            cantidad_creditos  = Intent.GetStringExtra("cantidad_creditos");
            FillView();

            if (creditos_disponibles < Convert.ToInt32(cantidad_creditos))
            {
                FindViewById <TextView>(Resource.Id.lblCosto).SetTextColor(Color.DarkRed);
            }

            FindViewById <Button>(Resource.Id.btnAvanzar).Click += delegate
            {
                if (creditos_disponibles > Convert.ToInt32(cantidad_creditos))
                {
                    string correoInvitacion = new StreamReader(Assets.Open("SalaJuntasReserva.html")).ReadToEnd();
                    new Emails().SendMail(usuario.Usuario_Correo_Electronico, usuario.Usuario_Nombre + " " + usuario.Usuario_Apellidos,
                                          correoInvitacion.Replace("{{NOMBRE}}", usuario.Usuario_Nombre + " " + usuario.Usuario_Apellidos)
                                          .Replace("{{NOMBRESALA}}", sala.Sala_Descripcion)
                                          .Replace("{{CAPACIDADSALA}}", sala.Sala_Capacidad)
                                          .Replace("{{DIALETRA}}", new CultureInfo("es-MX").DateTimeFormat.GetDayName(DateTime.Parse(fecha_seleccionada).DayOfWeek).Substring(0, 3))
                                          .Replace("{{DIANUMERO}}", DateTime.Parse(fecha_seleccionada).Day.ToString())
                                          .Replace("{{HORARIO}}", hora_inicio + " - " + hora_fin),
                                          "Worklabs - Confirmación de sala de junta");
                    if (new SalasJuntasController().AsignarSalaJuntas("ALTA", sala.Sala_Id, storage.Get("Usuario_Id"),
                                                                      storage.Get("Usuario_Tipo"), DateTime.Parse(fecha_seleccionada), hora_inicio, hora_fin, cantidad_creditos, cantidad_personas) == -1)
                    {
                        SlackLogs.SendMessage("ERROR: Registro de sala de junta", GetType().Name, "ShowConfirmacion");
                        Toast.MakeText(this, "Existió un error en la reservación", ToastLength.Short).Show();
                    }
                    else
                    {
                        Intent intent = new Intent(this, typeof(ReservacionConfirmacionActivity));
                        intent.PutExtra("fecha_seleccionada", fecha_seleccionada);
                        intent.PutExtra("hora_inicio", hora_inicio);
                        intent.PutExtra("hora_fin", hora_fin);
                        intent.PutExtra("cantidad_personas", cantidad_personas);
                        intent.PutExtra("sala_id", sala.Sala_Id);
                        StartActivity(intent);
                        Finish();
                    }
                }
                else
                {
                    CreditosInsuficientes();
                }
            };

            FindViewById <Button>(Resource.Id.btnRetroceder).Click += delegate
            {
                OnBackPressed();
            };
        }
コード例 #6
0
 public void UpdateCell(SalaJuntasModel SalaJuntas)
 {
     this.lblSalaNivel.Text    = SalaJuntas.Sala_Nivel;
     this.lblSalaNombre.Text   = SalaJuntas.Sala_Descripcion;
     this.lblSalaCreditos.Text = "1.0";
 }
コード例 #7
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.ReservacionSalaJuntasLayout);
            Toolbar toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);

            SetActionBar(toolbar);
            ActionBar.Title = Resources.GetString(Resource.String.str_meeting_room_reservation);
            ActionBar.SetDisplayHomeAsUpEnabled(true);

            FindViewById <TextView>(Resource.Id.txtSeleccionarFecha).Text      = fecha_seleccionada = DateTime.Now.ToString("yyyy-MM-dd");
            FindViewById <TextView>(Resource.Id.txtSeleccionarHoraInicio).Text = hora_inicio_seleccionada = CalendarHelper.RoundUp(DateTime.Now, TimeSpan.FromMinutes(30)).ToString("HH:mm");
            FindViewById <TextView>(Resource.Id.txtSeleccionarHoraFin).Text    = hora_fin_seleccionada = CalendarHelper.RoundUp(DateTime.Now.AddMinutes(30), TimeSpan.FromMinutes(30)).ToString("HH:mm");

            FindViewById <TextView>(Resource.Id.lblCreditosDisponibles).Text   = SalasController.GetCreditosDisponibles(storage.Get("Usuario_Id")).ToString();
            FindViewById <LinearLayout>(Resource.Id.llSeleccionarFecha).Click += (sender, e) =>
            {
                DatePickerMinFragment frag = DatePickerMinFragment.NewInstance(delegate(DateTime time)
                {
                    FindViewById <TextView>(Resource.Id.lblDiaFecha).Text         = time.DayOfWeek.ToString().Substring(0, 3);
                    FindViewById <TextView>(Resource.Id.lblDiaNumero).Text        = time.Day.ToString();
                    FindViewById <TextView>(Resource.Id.txtSeleccionarFecha).Text = fecha_seleccionada = time.ToString("yyyy-MM-dd");
                    SeleccionElemento();
                });
                frag.Show(FragmentManager, Resources.GetString(Resource.String.str_label_select_date));
            };

            FindViewById <LinearLayout>(Resource.Id.llSeleccionarHoraInicio).Click += (sender, e) =>
            {
                TimePickerIntervalFragment frag = TimePickerIntervalFragment.NewInstance(delegate(DateTime time)
                {
                    FindViewById <TextView>(Resource.Id.txtSeleccionarHoraInicio).Text = hora_inicio_seleccionada = time.ToString("HH:mm");
                    if (DateTime.Parse(hora_fin_seleccionada).Subtract(DateTime.Parse(hora_inicio_seleccionada)).TotalHours < 0)
                    {
                        FindViewById <TextView>(Resource.Id.txtSeleccionarHoraFin).Text = hora_fin_seleccionada = time.AddMinutes(30).ToString("HH:mm");
                    }
                    SeleccionElemento();
                    FindViewById <TextView>(Resource.Id.lblHorasTotal).Text     = DateTime.Parse(hora_fin_seleccionada).Subtract(DateTime.Parse(hora_inicio_seleccionada)).TotalHours.ToString();
                    FindViewById <TextView>(Resource.Id.lblCreditosUsados).Text = CalcularCreditos().ToString();
                });
                frag.Show(FragmentManager, Resources.GetString(Resource.String.str_label_select_hour_initial));
            };

            FindViewById <LinearLayout>(Resource.Id.llSeleccionarHoraFin).Click += (sender, e) =>
            {
                TimePickerIntervalFragment frag = TimePickerIntervalFragment.NewInstance(delegate(DateTime time)
                {
                    if (DateTime.Parse(hora_fin_seleccionada).Subtract(DateTime.Parse(hora_inicio_seleccionada)).TotalHours > 0)
                    {
                        FindViewById <TextView>(Resource.Id.txtSeleccionarHoraFin).Text = hora_fin_seleccionada = time.ToString("HH:mm");
                        SeleccionElemento();
                        FindViewById <TextView>(Resource.Id.lblHorasTotal).Text     = DateTime.Parse(hora_fin_seleccionada).Subtract(DateTime.Parse(hora_inicio_seleccionada)).TotalHours.ToString();
                        FindViewById <TextView>(Resource.Id.lblCreditosUsados).Text = CalcularCreditos().ToString();
                    }
                    else
                    {
                        Toast.MakeText(this, "Su hora de termino debe ser mayor a la hora de inicio", ToastLength.Short).Show();
                    }
                });
                frag.Show(FragmentManager, Resources.GetString(Resource.String.str_label_select_hour_final));
            };

            salas = SalasController.GetSalaJuntas(Intent.GetStringExtra("sucursal_id"), fecha_seleccionada, hora_inicio_seleccionada, hora_fin_seleccionada);
            FillImagenes();
            lvSalasJuntas = FindViewById <ListView>(Resource.Id.lvSalasJuntas);
            lvSalasJuntas.SetMinimumHeight(salas.Count * 200);
            lvSalasJuntas.Adapter    = new SalasJuntasListAdapter(salas);
            lvSalasJuntas.ItemClick += (sender, e) =>
            {
                sala_seleccionada = salas[e.Position];
            };


            FindViewById <RadioGroup>(Resource.Id.rgCapacidad).CheckedChange += (sender, e) =>
            {
                SeleccionElemento();
            };


            FindViewById <TextView>(Resource.Id.lblDiaFecha).Text       = DateTime.Parse(fecha_seleccionada).DayOfWeek.ToString().Substring(0, 3);
            FindViewById <TextView>(Resource.Id.lblDiaNumero).Text      = DateTime.Parse(fecha_seleccionada).Day.ToString();
            FindViewById <TextView>(Resource.Id.lblHorasTotal).Text     = DateTime.Parse(hora_fin_seleccionada).Subtract(DateTime.Parse(hora_inicio_seleccionada)).TotalHours.ToString();
            FindViewById <TextView>(Resource.Id.lblCreditosUsados).Text = CalcularCreditos().ToString();//DateTime.Parse(hora_fin_seleccionada).Subtract(DateTime.Parse(hora_inicio_seleccionada)).TotalHours.ToString();


            FindViewById <TextView>(Resource.Id.lblAgendar).Click += delegate
            {
                if (sala_seleccionada != null)
                {
                    ShowConfirmacion();
                }
                else
                {
                    Toast.MakeText(this, "Seleccione una sala de reunión", ToastLength.Short).Show();
                }
            };
        }