public Main() { InitializeComponent(); int i = Login.accountType; int u = Login.userId; if (i == 0) //If patient { btnDispatch.IsEnabled = false; btnPatients.IsEnabled = false; btnSupplies.IsEnabled = false; MainWindow mw = new MainWindow(); Cc.Content = mw; } else if (i == 1) //If admin { btnOrder.IsEnabled = false; AboutUsWindow ab = new AboutUsWindow(); Cc.Content = ab; } }
private void BtnEdit_Click(object sender, RoutedEventArgs e) { int i = cmbStates.SelectedIndex + 1; if (Convert.ToInt32(lblAcs.Content.ToString()) == i) { notifier.error("Account is already in that state"); } else { //checkbox //lblac User u = new User(); u.updateState(i, Convert.ToInt32(lblu.Content.ToString()), check); notifier.success("Account Updated Succesfully"); AboutUsWindow main = new AboutUsWindow(); Content = main; } }
private void btnAdd_Click(object sender, RoutedEventArgs e) { if (txtName.Text != String.Empty || txtDesc.Text != String.Empty || txtPrice.Text != String.Empty) { int n; if (int.TryParse(txtPrice.Text, out n)) { string name = txtName.Text; string desc = txtDesc.Text; int price = int.Parse(txtPrice.Text); int val = cmbType.SelectedIndex; string type = typeList[val].SupplyType; MedicalSupply ms = new MedicalSupply(name, type, desc, price); if (ms.InsertMedicalSupply(ms)) { notifier.success("Medical Supply added succesfully"); AboutUsWindow main = new AboutUsWindow(); Content = main; } else { notifier.error("Error adding Medical supply"); } } else { notifier.error("Price must be a number"); } } else { notifier.error("Fields cannot be empty"); } }