private void Button_Aplicar(object sender, RoutedEventArgs e) { int result = 0; StaffModel staff = new StaffModel(); staff.Name = TxtName.Text.Trim(); staff.Code = TxtCode.Text.Trim(); staff.Active = CmbActive.Text == "Activo"; staff.Huella1 = _huella1; staff.Huella2 = _huella2; if ((!string.IsNullOrEmpty(TxtName.Text.Trim())) || (!string.IsNullOrEmpty(TxtCode.Text.Trim()))) { if (LblId.Content == "0") //ADD { result = staffServices.Add(staff); //result = task0.Result; LblId.Content = result.ToString(); } else //EDIT { int _id = int.Parse(LblId.Content.ToString()); staff.Id = _id; var task = staffServices.Update(staff); result = task ? _id : 0; } if (result > 0) { GRDialogConsultation _var = new GRDialogConsultation(); _var.Message = "Registro Guardado, desea crear otro Registro?"; if (_var.ShowDialog() == true) { CleanControls(); TxtName.Focus(); } else { var window = new StaffList(); this.Close(); window.ShowDialog(); } } else { GRDialogError _error = new GRDialogError(); _error.Message = "Ocurrion un error al guardar el resgitro"; _error.ShowDialog(); } } else { GRDialogInformation _var = new GRDialogInformation(); _var.Message = "Verificar campos obligatorios"; _var.ShowDialog(); } }
private void ButtonAcept_Click(object sender, RoutedEventArgs e) { bool buser = false; bool bpassword = false; bool badmi = false; GRUser user = GreenRetail.Bridge.GreenRetailApplication.Instance.User; if (GreenRetail.Bridge.GreenRetailApplication.Instance.ExistByName(TextBoxUser.Text)) { GreenRetail.Bridge.GreenRetailApplication.Instance.OperatorID = TextBoxUser.Text; buser = true; } if (GreenRetail.Bridge.GreenRetailApplication.Instance.UserAuthenticate(GreenRetail.Bridge.GreenRetailApplication.Instance.OperatorID, passwordBox.Password)) { bpassword = true; } if (string.Equals(GreenRetail.Bridge.GreenRetailApplication.Instance.User.NameSufix.ToUpper().Trim(), "ADM")) { badmi = true; } if (!buser) { GRDialogError Var = new GRDialogError(); Var.Message = "Error: ID no Existe"; Var.ShowDialog(); } else if (!bpassword) { GRDialogError Var = new GRDialogError(); Var.Message = "Error: Clave Errada"; Var.ShowDialog(); } else if (!badmi) { GRDialogError Var = new GRDialogError(); Var.Message = "Error: El Usuario no tiene privilegios para salir de la aplicación.."; Var.ShowDialog(); } GreenRetail.Bridge.GreenRetailApplication.Instance.UserAuthenticateTrust(user.UserId);//Volvemos a la sesion anterior if (buser && bpassword && badmi) { this.DialogResult = true; } else { this.DialogResult = false; } }
private void Button_Cancel(object sender, RoutedEventArgs e) { GRDialogConsultation _var = new GRDialogConsultation(); _var.Message = "Desea Cancelar la clase?"; if (_var.ShowDialog() == true) { ClassScheduleReviewModel classScheduleReview = new ClassScheduleReviewModel(); if (!string.IsNullOrEmpty(TxtObservacion.Text.Trim())) { DateTime _date = DateTime.Now; int result = 0; // classScheduleReview.Id = int.Parse(LblId.Content.ToString()); classScheduleReview.IdClassSchedule = int.Parse(LblIdClass.Content.ToString()); classScheduleReview.Observation = TxtObservacion.Text; classScheduleReview.IdStaff = int.Parse(CmbStaf.SelectedValue.ToString()); classScheduleReview.IsTrainer = (LblIdTrainer.Content == CmbTrainer.SelectedValue); //if diferente Trainer then Susititute classScheduleReview.IdTrainer = int.Parse(CmbTrainer.SelectedValue.ToString()); classScheduleReview.Members = int.Parse(intMembers.Text); classScheduleReview.Start = new TimeSpan(_date.Hour, _date.Minute, _date.Second); classScheduleReview.End = new TimeSpan(_date.Hour, _date.Minute, _date.Second); classScheduleReview.Estatus = (int)Constants.StatusClass.CANCELED; result = services.Add(classScheduleReview); //result = task.Result; if (result > 0) { GRDialogInformation _msg = new GRDialogInformation(); _msg.Message = "Clase Cancelada"; _msg.ShowDialog(); this.Close(); } else { GRDialogError _err = new GRDialogError(); _err.Message = "Error guardando datos"; _err.ShowDialog(); } } else { GRDialogInformation _msg0 = new GRDialogInformation(); _msg0.Message = "Debe Ingresar una Observacion"; _msg0.ShowDialog(); TxtObservacion.Focus(); } } }
private void Button_Apertura(object sender, RoutedEventArgs e) { ClassScheduleReviewModel classScheduleReview = new ClassScheduleReviewModel(); if (DigitalPersona4500.Instance.Validate(new DigitalPersona4500Template(new System.IO.MemoryStream(_huella1)), new DigitalPersona4500Template(new System.IO.MemoryStream(_huella2)))) { DateTime _date = DateTime.Now; int result = 0; classScheduleReview.IdClassSchedule = int.Parse(LblIdClass.Content.ToString()); classScheduleReview.Observation = TxtObservacion.Text; classScheduleReview.IdStaff = int.Parse(CmbStaf.SelectedValue.ToString()); classScheduleReview.IsTrainer = (LblIdTrainer.Content == CmbTrainer.SelectedValue); //if diferente Trainer then Susititute classScheduleReview.IdTrainer = int.Parse(CmbTrainer.SelectedValue.ToString()); classScheduleReview.Members = int.Parse(intMembers.Text); classScheduleReview.Start = new TimeSpan(_date.Hour, _date.Minute, _date.Second); classScheduleReview.Estatus = (int)Constants.StatusClass.OPEN; result = services.Add(classScheduleReview); if (result > 0) { GRDialogInformation _msg = new GRDialogInformation(); _msg.Message = "Huella Registrada"; _msg.ShowDialog(); this.Close(); } else { GRDialogError _err = new GRDialogError(); _err.Message = "Error guardando datos"; _err.ShowDialog(); } } else { GRDialogError _err0 = new GRDialogError(); _err0.Message = "Error, Verificando huella"; _err0.ShowDialog(); } }
private void Button_Cierre(object sender, RoutedEventArgs e) { ClassScheduleReviewModel classScheduleReview = new ClassScheduleReviewModel(); if (!string.IsNullOrEmpty(TxtObservacion.Text.Trim())) { if (int.Parse(intMembers.Text.ToString()) > 0) { #region Validar Huella Staff / Cerrar Clase if ( DigitalPersona4500.Instance.Validate( new DigitalPersona4500Template(new System.IO.MemoryStream(_huellaStaff1)), new DigitalPersona4500Template(new System.IO.MemoryStream(_huellaStaff2)))) { DateTime _date = DateTime.Now; bool result = false; classScheduleReview.Id = int.Parse(LblId.Content.ToString()); classScheduleReview.IdClassSchedule = int.Parse(LblIdClass.Content.ToString()); classScheduleReview.Observation = TxtObservacion.Text; classScheduleReview.IdStaff = int.Parse(CmbStaf.SelectedValue.ToString()); classScheduleReview.IsTrainer = (LblIdTrainer.Content == CmbTrainer.SelectedValue); //if diferente Trainer then Susititute classScheduleReview.IdTrainer = int.Parse(CmbTrainer.SelectedValue.ToString()); classScheduleReview.Members = int.Parse(intMembers.Text); classScheduleReview.End = new TimeSpan(_date.Hour, _date.Minute, _date.Second); classScheduleReview.Estatus = (int)Constants.StatusClass.CLOSE; result = services.Update(classScheduleReview); //result = task.Result; if (result) { GRDialogInformation _msg = new GRDialogInformation(); _msg.Message = "Clase Cerrada"; _msg.ShowDialog(); this.Close(); } else { GRDialogError _err = new GRDialogError(); _err.Message = "Error guardando datos"; _err.ShowDialog(); } } else { GRDialogError _err0 = new GRDialogError(); _err0.Message = "Error, Verificando huella"; _err0.ShowDialog(); } #endregion } else { GRDialogInformation _msg1 = new GRDialogInformation(); _msg1.Message = "Debe Ingresar en número de asistentes a la clase"; _msg1.ShowDialog(); intMembers.Focus(); } } else { GRDialogInformation _msg1 = new GRDialogInformation(); _msg1.Message = "Debe Ingresar una Observacion"; _msg1.ShowDialog(); TxtObservacion.Focus(); } }
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(); } }
private void Button_Aplicar(object sender, RoutedEventArgs e) { int result = 0; bool ValidateCode = false; WorkoutModel _workout = new WorkoutModel(); _workout.CodigoWorkout = TxtCodigo.Text.Trim(); _workout.Name = TxtName.Text.Trim(); _workout.Description = TxtDescription.Text.Trim(); _workout.Parent = int.Parse(CmbParent.SelectedValue.ToString()); _workout.Color = CmbColor.brushSelectionBox.Text.Replace("System.Windows.Media.SolidColorBrush ", " ").Trim(); _workout.Active = CmbActive.Text == "Activo"; if ((!string.IsNullOrEmpty(TxtName.Text.Trim())) || (!string.IsNullOrEmpty(TxtCodigo.Text.Trim()))) { if (LblId.Content == "0") //ADD { var existCode = _workoutServices.GetByCode(TxtCodigo.Text.Trim()); if (existCode == null) { result = _workoutServices.Add(_workout); //result = task0.Result; LblId.Content = result.ToString(); } else { ValidateCode = true; GRDialogInformation _error01 = new GRDialogInformation(); _error01.Message = "El codigo ingresado pertenece a otro registro"; _error01.ShowDialog(); TxtCodigo.Focus(); } } else //EDIT { int _id = int.Parse(LblId.Content.ToString()); _workout.Id = _id; var task = _workoutServices.Update(_workout); result = task ? _id : 0; } if (result > 0) { GRDialogConsultation _var = new GRDialogConsultation(); _var.Message = "Registro Guardado, desea crear otro Registro?"; if (_var.ShowDialog() == true) { CleanControls(); TxtName.Focus(); } else { var window = new WorkoutList(); this.Close(); window.ShowDialog(); } } else { if (!ValidateCode) { GRDialogError _error = new GRDialogError(); _error.Message = "Ocurrion un error al guardar el resgitro"; _error.ShowDialog(); } } } else { GRDialogInformation _error1 = new GRDialogInformation(); _error1.Message = "Verificar campos obligatorios"; _error1.ShowDialog(); } }
private void Button_Aplicar(object sender, RoutedEventArgs e) { bool hourStart = Common.ValidateHour(mkbHoraInicio.Text); bool hourEnd = Common.ValidateHour(mkbHoraFin.Text); if (!string.IsNullOrEmpty(TxtSucursal.Text.Trim()) || !string.IsNullOrEmpty(TxtCodigo.Text.Trim())) { if ((hourStart) && (hourEnd)) { if (TimeSpan.Parse(mkbHoraInicio.Text) < TimeSpan.Parse(mkbHoraFin.Text)) { int result = 0; BranchOfficeModel _class = new BranchOfficeModel(); _class.Code = TxtCodigo.Text.Trim(); _class.Name = TxtSucursal.Text.Trim(); _class.Adress = TxtDir.Text.Trim(); _class.Observation = TxtObs.Text.Trim(); _class.StarHour = TimeSpan.Parse(mkbHoraInicio.Text); _class.EndHour = TimeSpan.Parse(mkbHoraFin.Text); _class.Active = CmbActive.Text == "Activo"; var existBranchOffice = branchOfficeServices.GetByCode(TxtCodigo.Text.Trim()); if (LblId.Content == "0") //ADD { if (existBranchOffice == null) { result = branchOfficeServices.Add(_class); LblId.Content = result.ToString(); } else { GRDialogInformation _error0 = new GRDialogInformation(); _error0.Message = "El Codigo ingresado ya esta en uso"; _error0.ShowDialog(); TxtCodigo.Focus(); } } else //EDIT { int _id = int.Parse(LblId.Content.ToString()); if ((existBranchOffice == null) || (existBranchOffice.Id == _id)) { _class.Id = _id; var task = branchOfficeServices.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(); TxtSucursal.Focus(); } else { var window = new BranchOfficeList(); this.Close(); window.ShowDialog(); } } else { GRDialogError _error = new GRDialogError(); _error.Message = "Ocurrion un error al guardar el resgitro"; _error.ShowDialog(); } } else { GRDialogInformation _error1 = new GRDialogInformation(); _error1.Message = "La Hora de Inicio no puede ser mayor a la Hora Fin"; _error1.ShowDialog(); } } else { GRDialogInformation _error2 = new GRDialogInformation(); _error2.Message = "Verificar campos Obligatorios / Formato de Horas"; _error2.ShowDialog(); } } else { GRDialogInformation _error2 = new GRDialogInformation(); _error2.Message = "Verificar campos Obligatorios"; _error2.ShowDialog(); } }
private void Button_Aplicar(object sender, RoutedEventArgs e) { int result = 0; bool ValidateCode = false; TrainerModel _trainer = new TrainerModel(); _trainer.Code = TxtCodigo.Text.Trim(); _trainer.Name = TxtName.Text.Trim(); _trainer.Description = TxtDescription.Text.Trim(); _trainer.Type = int.Parse(CmbType.SelectedValue.ToString()); _trainer.Active = CmbActive.Text == "Activo"; _trainer.Huella1 = _huella1; _trainer.Huella2 = _huella2; if (String.IsNullOrEmpty(TxtCosto.Text.Trim())) { _trainer.Price = 0; } else { _trainer.Price = Double.Parse(TxtCosto.Text.Trim()); } _trainer.PhotoLink = _photoLink == string.Empty? null: _photoLink; if ((!string.IsNullOrEmpty(TxtName.Text.Trim())) || (!string.IsNullOrEmpty(TxtCodigo.Text.Trim()))) { if (LblId.Content == "0") //ADD { var existCode = trainerServices.GetByCode(TxtCodigo.Text.Trim()); if (existCode == null) { result = trainerServices.Add(_trainer); //result = task0.Result; LblId.Content = result.ToString(); } else { ValidateCode = true; GRDialogInformation _error01 = new GRDialogInformation(); _error01.Message = "El codigo ingresado pertenece a otro registro"; _error01.ShowDialog(); TxtCodigo.Focus(); } } else //EDIT { int _id = int.Parse(LblId.Content.ToString()); _trainer.Id = _id; var task = trainerServices.Update(_trainer); result = task ? _id : 0; } if (result > 0) { GRDialogConsultation _var = new GRDialogConsultation(); _var.Message = "Registro Guardado, desea crear otro Registro?"; if (_var.ShowDialog() == true) { CleanControls(); TxtName.Focus(); } else { var window = new TrainerList(); this.Close(); window.ShowDialog(); } } else { if (!ValidateCode) { GRDialogError _error = new GRDialogError(); _error.Message = "Error"; _error.ShowDialog(); } } } else { GRDialogError _error = new GRDialogError(); _error.Message = "Verificar campos obligatorios"; _error.ShowDialog(); } }