예제 #1
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     PlaceHolder1.Visible = !PlaceHolder1.Visible;
     if (PlaceHolder1.Visible)
     {
         HourStart.Focus();
     }
 }
예제 #2
0
        private void Button_Aplicar(object sender, RoutedEventArgs e)
        {
            bool hourStart = Common.ValidateHour(mkbHoraInicio.Text);
            bool hourEnd   = Common.ValidateHour(mkbHoraFin.Text);


            if (!((CmbBranchOffice.SelectedIndex == 0) || (CmbWorkout.SelectedIndex == 0)))
            {
                if ((hourStart) && (hourEnd))
                {
                    if (TimeSpan.Parse(mkbHoraInicio.Text) < TimeSpan.Parse(mkbHoraFin.Text))
                    {
                        if (((TimeSpan.Parse(mkbHoraInicio.Text) >= HourStart) && (TimeSpan.Parse(mkbHoraFin.Text) <= HourEnd)))
                        {
                            int result = 0;
                            ClassScheduleModel _class = new ClassScheduleModel();
                            _class.IdBranchOffice = int.Parse(CmbBranchOffice.SelectedValue.ToString());
                            _class.IdWorkout      = int.Parse(CmbWorkout.SelectedValue.ToString());
                            _class.WeekDay        = int.Parse(CmbDia.SelectedValue.ToString());
                            _class.StarTime       = TimeSpan.Parse(mkbHoraInicio.Text);
                            _class.EndTime        = TimeSpan.Parse(mkbHoraFin.Text);
                            _class.IdTrainer      = int.Parse(CmbTrainer.SelectedValue.ToString());
                            _class.Active         = CmbActive.Text == "Activo";

                            if (LblId.Content == "0") //ADD
                            {
                                result = _services.Add(_class);
                            }
                            else //EDIT
                            {
                                int _id = int.Parse(LblId.Content.ToString());
                                _class.Id = _id;
                                var task = _services.Update(_class);
                                result = task ? _id : 0;
                            }


                            if (result > 0)
                            {
                                GRDialogConsultation _var = new GRDialogConsultation();
                                _var.Message = "Registro Guardado, desea crear otro Registro?";
                                if (_var.ShowDialog() == true)
                                {
                                    CleanControls();
                                }
                                else
                                {
                                    var window = new ClassScheduleList();
                                    this.Close();
                                    window.ShowDialog();
                                }
                            }
                            else
                            {
                                GRDialogError _err = new GRDialogError();
                                _err.Message = "Error guardando datos";
                                _err.ShowDialog();
                            }
                        }
                        else
                        {
                            var h0 = HourStart.ToString().Remove(HourStart.ToString().Length - 3);
                            var h1 = HourEnd.ToString().Remove(HourEnd.ToString().Length - 3);

                            GRDialogInformation _var0 = new GRDialogInformation();
                            _var0.Message = "Hora Sucursal fuera de Rango , Hora Apertura (" + h0 + ") Hora Cierre (" + h1 + ")";
                            _var0.ShowDialog();
                        }
                    }
                    else
                    {
                        GRDialogInformation _var1 = new GRDialogInformation();
                        _var1.Message = "La Hora de Inicio no puede ser mayor a la Hora Fin";
                        _var1.ShowDialog();
                    }
                }
                else
                {
                    GRDialogInformation _var2 = new GRDialogInformation();
                    _var2.Message = "Verificar campos Obligatorios / Formato de Horas";
                    _var2.ShowDialog();
                }
            }
            else
            {
                GRDialogInformation _var3 = new GRDialogInformation();
                _var3.Message = "Validar campos obligatorios";
                _var3.ShowDialog();
            }
        }
예제 #3
0
 void FillLabels()
 {
     lPrinyalDate.Text = " с " + CalendarStart.SelectedDate.ToLongDateString() + " по " +
                         CalendarStartEnd.SelectedDate.ToLongDateString();
     if (HourStart.IsAllSelected())
     {
         lPHours.Text = " все";
     }
     else
     {
         List <int> sel = HourStart.GetSelectedTitles();
         lPHours.Text = string.Empty;
         foreach (int i in sel)
         {
             if (string.IsNullOrEmpty(lPHours.Text))
             {
                 lPHours.Text += i.ToString();
             }
             else
             {
                 lPHours.Text += ", " + i.ToString();
             }
         }
     }
     if (MinuteStart.IsAllSelected())
     {
         lPMinutes.Text = " все";
     }
     else
     {
         List <int> sel = MinuteStart.GetSelectedTitles();
         lPMinutes.Text = string.Empty;
         foreach (int i in sel)
         {
             if (string.IsNullOrEmpty(lPMinutes.Text))
             {
                 lPMinutes.Text += i.ToString();
             }
             else
             {
                 lPMinutes.Text += ", " + i.ToString();
             }
         }
     }
     if (_role != "Worker")
     {
         lVypolnilDate.Text = " с " + CalendarFinish.SelectedDate.ToLongDateString() + " по " +
                              CalendarFinishEnd.SelectedDate.ToLongDateString();
     }
     else
     {
         lVypolnilDate.Text = " в любое время";
     }
     if (HourFinish.IsAllSelected())
     {
         lVHours.Text = " все";
     }
     else
     {
         List <int> sel = HourFinish.GetSelectedTitles();
         lVHours.Text = string.Empty;
         foreach (int i in sel)
         {
             if (string.IsNullOrEmpty(lVHours.Text))
             {
                 lVHours.Text += i.ToString();
             }
             else
             {
                 lVHours.Text += ", " + i.ToString();
             }
         }
     }
     if (MinuteFinish.IsAllSelected())
     {
         lVMinutes.Text = " все";
     }
     else
     {
         List <int> sel = MinuteFinish.GetSelectedTitles();
         lVMinutes.Text = string.Empty;
         foreach (int i in sel)
         {
             if (string.IsNullOrEmpty(lVMinutes.Text))
             {
                 lVMinutes.Text += i.ToString();
             }
             else
             {
                 lVMinutes.Text += ", " + i.ToString();
             }
         }
     }
     if (IsAllSelected(IdU))
     {
         lU.Text = " любой";
     }
     else
     {
         lU.Text = GetSelected(IdU);
     }
     if (IsAllSelected(IdM))
     {
         lM.Text = " любой";
     }
     else
     {
         lM.Text = GetSelected(IdM);
     }
     if (IsAllSelected(IdL))
     {
         lL.Text = " любой";
     }
     else
     {
         lL.Text = GetSelected(IdL);
     }
     if (IsAllSelected(Address))
     {
         if (GetSelectedTitles(IdU).Count == 1 && GetSelectedTitles(IdM).Count == 1)
         {
             KOS.App_Code.Base db = new App_Code.Base(WebConfigurationManager.ConnectionStrings["DefaultConnection"].ToString());
             List <string>     ls = db.GetAddress(GetSelectedTitles(IdU)[0], GetSelectedTitles(IdM)[0]);
             lAddress.Text = string.Empty;
             foreach (string s in ls)
             {
                 if (!string.IsNullOrEmpty(lAddress.Text))
                 {
                     lAddress.Text += ", ";
                 }
                 lAddress.Text += s;
             }
         }
         else
         {
             lAddress.Text = " любой";
         }
     }
     else
     {
         lAddress.Text = GetSelected(Address);
     }
     if (IsAllSelected(Category))
     {
         lCategory.Text = " любая";
     }
     else
     {
         lCategory.Text = GetSelected(Category);
     }
     if (IsAllSelected(From))
     {
         lSource.Text = " любой";
     }
     else
     {
         lSource.Text = GetSelected(From);
     }
     if (IsAllSelected(Prinyal))
     {
         lPrinyal.Text = " любой";
     }
     else
     {
         lPrinyal.Text = GetSelected(Prinyal);
     }
     if (_role == "Worker")
     {
         App_Code.Base          db = new App_Code.Base(WebConfigurationManager.ConnectionStrings["DefaultConnection"].ToString());
         App_Code.Base.UserInfo ui = db.GetUserInfo(Page.User.Identity.Name);
         lWorker.Text = ui.Family + " " + ui.IO;
     }
     else if (IsAllSelected(Worker))
     {
         lWorker.Text = " любой";
     }
     else
     {
         lWorker.Text = GetSelected(Worker);
     }
 }