private void TryAgian(string message, dynamic data) { double exact = 0; if (data != null) { exact = ( 0 + Double.Parse(data.id_prob.Value) * (data.id.Value == null?0:1) + Double.Parse(data.name_prob.Value) * (data.name.Value == null ? 0 : 1) + Double.Parse(data.dob_prob.Value) * (ExtraFunction.ValidDateTime(data.dob.Value) == false ? 0 : 1) + Double.Parse(data.address_prob.Value) * (data.address.Value == null ? 0 : 1) ) / 4; } //object a = JsonConvert.DeserializeObject<object>((string)param); MessageBoxResult messageBoxResult = System.Windows.MessageBox.Show($"{message} \n Exactly :{exact}% (<75% -> Let's retry) \n Do you Try Again?", "Confirmation", System.Windows.MessageBoxButton.YesNo, MessageBoxImage.Question); if (messageBoxResult == MessageBoxResult.Yes) { counter = defaultLife; //Window_Loaded(null, null); Start(); } else { _tcs.SetResult(data); myCam.Stop(); this.Close(); } }
/// <summary> /// This happens when you click the button. /// </summary> /// <param name="arg"></param> //[AuthorizationAttribute(AuthorizationType.Allow, "HumanResources")] private void Execute_SwitchView(object param) { var p = param as ParametersForSwitchView; p.transitioningContentSlide.OnApplyTemplate(); p.gridCursor.Margin = new Thickness(0, (100 + (60 * p.selectedIndex)), 0, 0); SelectedViewModel = ExtraFunction.getUserControl(p.selectedIndex, session.Role); }
public void SupportConvert() { Fullname = name; IdentityCard = id; id = "0"; if (!ExtraFunction.ValidDateTime(dob)) { dob = ""; } }
public MainViewModel() { ModeTheme = MyColors[0]; session = Session.GetCurrentSingleton(); Roles role = session.Role; _featuresCollection = ExtraFunction.featureOfRole(role); _selectedViewModel = new MyBaseViewModel(); _selectedViewModel = ExtraFunction.getUserControl(0, role); ////if (IsInDesignMode) ////{ //// // Code runs in Blend --> create design time data. ////} ////else ////{ //// // Code runs "for real" ////} }
private void Execute_AddStaff(object obj) { var p = (staff)obj; //insert account UserName = ExtraFunction.generateUserName(p); var acc = new account { UserName = UserName, Password = p.IdentityCard, Role = RoleID + 1, }; accountRepository.Insert(acc); accountRepository.Save(); //insert staff p.Account_id = acc.ID; staffRepository.Insert(p); staffRepository.Save(); Visibility = Visibility.Visible; System.Windows.Forms.MessageBox.Show("Successfully Auto Created", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information); }
private void Execute_UpdateInfoStaff(object obj) { MessageBoxResult messageBoxResult = System.Windows.MessageBox.Show("Are you sure?", "Confirmation", System.Windows.MessageBoxButton.YesNo, MessageBoxImage.Question); if (messageBoxResult == MessageBoxResult.Yes) { var p = (staff)obj; staffRepository.Update(p); staffRepository.Save(); var selectedAcc = accountRepository.Get(acc => acc.ID == p.Account_id).FirstOrDefault(); selectedAcc.UserName = ExtraFunction.generateUserName(p); accountRepository.Update(selectedAcc); accountRepository.Save(); var UID = session.AccountID; var res = staffRepository.Get(s => s.Account_id != UID); StaffList.Clear(); res.Distinct().ToList().ForEach(i => StaffList.Add(i)); System.Windows.Forms.MessageBox.Show("Successfully updated", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void GetInfo() { var cameraDevices = myCam.GetCameraSources(); var cameraResolution = myCam.GetSupportedResolutions(); TypeCamera.Items.Clear(); foreach (var d in cameraDevices) { TypeCamera.Items.Add(d); } Resolution.Items.Clear(); foreach (var r in cameraResolution) { Resolution.Items.Add(r); } TypeCamera.SelectedIndex = 0; Resolution.SelectedIndex = 0; var resolution = ExtraFunction.getWH(cameraResolution[0]); pictureBoxLoading.Width = resolution[0]; pictureBoxLoading.Height = resolution[1]; Scan.Visibility = Visibility.Visible; }