private void btnSave_Click(object sender, EventArgs e) { try { bool IsNew = false; VariableSetting VariableSetting = VariableSettingRepo.GetBy(txtKey.Text); if (VariableSetting == null) { IsNew = true; VariableSetting = new VariableSetting(); } VariableSetting.Key = txtKey.Text; VariableSetting.Value = cbEncrypt.Checked ? WFUtils.Encrypt(txtValue.Text) : txtValue.Text; VariableSetting.Description = txtDescription.Text; VariableSetting.CanModify = cbEncrypt.Checked ? 1 : 2; int i = 0; if (IsNew) { i = VariableSettingRepo.Create(VariableSetting); } else { i = VariableSettingRepo.Edit(VariableSetting); } MessageBox.Show("Data berhasil disimpan [" + txtKey.Text + "]"); } catch (Exception ex) { MessageBox.Show(ex.GetFullMessage() + " - Harap periksa data input kembali"); return; } BindGrid(xcurrentPage); btnReset.PerformClick(); }
void Poincare2DMouseRightButtonUp(object sender, MouseButtonEventArgs e) { if (simulator.IsBusy) { Stop(); return; } if (WFUtils.IsCtrlDown()) { simulator.Data.PoincarePoints.Clear(); poincare2d.Redraw(); return; } if (simulator.Data.PoincarePoints.Count > 0) { poincare2d.CloneData(); } Point pt = poincare2d.DipToData(e.GetPosition(poincare2d)); if (simulator.Data.Init(pt.X, pt.Y)) { trajectory.Clear(); Start(); } }
private void button1_Click(object sender, EventArgs e) { if (textBox1.Text == "mpob1234") { if (RedirectToForm == null) { try { WFUtils.SyncToServer(); MessageBox.Show("Sinkronisasi data dengan Server selesai."); string directory = AppDomain.CurrentDomain.BaseDirectory + string.Format(@"\Logs\AppLogs\{0}\", DateTime.Now.ToString("MM.yyyy")); System.Diagnostics.Process.Start(directory); } catch (Exception ex) { MessageBox.Show(ex.GetFullMessage()); } } else { DisplayForm(SourceMdiParent, RedirectToForm); this.Close(); } //else if (RedirectToForm == typeof(VariableSettingForm)) //{ // foreach (Form f in SourceMdiParent.MdiChildren) // { // if (f.GetType() == typeof(VariableSettingForm)) // { // f.Close(); // //f.Activate(); // //return; // } // } // Form form = new VariableSettingForm(); // form.MdiParent = SourceMdiParent; // form.Show(); //} //MessageBox.Show("OK"); } else { MessageBox.Show("Harap masukkan code dengan benar."); } }
/// <summary> /// Called when the size has changed. /// </summary> void MySizeChanged(object sender, SizeChangedEventArgs e) { Point dpi = WFUtils.GetResolution(this); dpiScaleX = dpi.X / 96.0; dpiScaleY = dpi.Y / 96.0; int width = (int)(ActualWidth * dpiScaleX); int height = (int)(ActualHeight * dpiScaleY); bitmap = new WriteableBitmap(width, height, dpi.X, dpi.Y, PixelFormats.Pbgra32, null); image.Source = bitmap; pixelMapper.Init(this); Redraw(); }
private void RestoreSizeAndPosition() { var name = Properties.Settings.Default.ScreenName; var screen = WFUtils.GetScreenByName(name); if (screen == null) { return; } this.Top = Properties.Settings.Default.Top; this.Left = Properties.Settings.Default.Left; this.Width = Properties.Settings.Default.Width; this.Height = Properties.Settings.Default.Height; this.WindowState = (WindowState)Properties.Settings.Default.WindowState; this.WindowStartupLocation = WindowStartupLocation.Manual; }
private void StoreSizeAndPosition() { Properties.Settings.Default.WindowState = (int)this.WindowState; if (this.WindowState != WindowState.Normal) { this.WindowState = WindowState.Normal; } var pt = new Point(this.Left, this.Top); var screen = WFUtils.GetScreenByPixel(ToPixel(pt)); Properties.Settings.Default.ScreenName = screen?.Name; Properties.Settings.Default.Top = this.Top; Properties.Settings.Default.Left = this.Left; Properties.Settings.Default.Width = this.Width; Properties.Settings.Default.Height = this.Height; Properties.Settings.Default.Save(); }
private IDbConnection MySQLConnectin() { try { if (_mysqlCon == null) { IVariableSettingRepo VariableSettingRepo = new VariableSettingRepo(); VariableSetting VariableSetting = VariableSettingRepo.GetBy("Status"); if (VariableSetting != null) { if (!string.IsNullOrEmpty(VariableSetting.Value) && VariableSetting.Value.ToUpper() == "PRODUCTION") { VariableSetting VariableSettingConStr = VariableSettingRepo.GetBy("MySQLConn"); _mysqlCon = new MySqlConnection(WFUtils.Decrypt(VariableSettingConStr.Value)); } else { _mysqlCon = new MySqlConnection("Server=127.0.0.1;Database=tsspk1511;Uid=root;Pwd=;"); } } else { _mysqlCon = new MySqlConnection("Server=127.0.0.1;Database=tsspk1511;Uid=root;Pwd=;"); } } if (_mysqlCon.State != ConnectionState.Open) { _mysqlCon.Open(); } } catch (Exception) { _mysqlCon = null; } return(_mysqlCon); }
private void button1_Click(object sender, EventArgs e) { try { //if (txtnama.CheckEmpty() && txtaddr1.CheckEmpty()) //{ // return; //} IList <Control> lstCtrlEmptyCheck = new List <Control>(); lstCtrlEmptyCheck.Add(txtappdate); lstCtrlEmptyCheck.Add(txtnama); lstCtrlEmptyCheck.Add(txticno); lstCtrlEmptyCheck.Add(txtnolesen); //lstCtrlEmptyCheck.Add(cbbangsa); lstCtrlEmptyCheck.Add(txtaddr1); lstCtrlEmptyCheck.Add(txtaddr2); //lstCtrlEmptyCheck.Add(txtaddr3); lstCtrlEmptyCheck.Add(txtbandar); lstCtrlEmptyCheck.Add(txtposkod); lstCtrlEmptyCheck.Add(cbnegeri); //lstCtrlEmptyCheck.Add(cbdaerah); //lstCtrlEmptyCheck.Add(cbdun); //lstCtrlEmptyCheck.Add(cbparlimen); lstCtrlEmptyCheck.Add(txthometel); lstCtrlEmptyCheck.Add(txtofficetel); lstCtrlEmptyCheck.Add(txthptel); lstCtrlEmptyCheck.Add(txtemail); if (WFUtils.CheckControllCollectionEmpty(lstCtrlEmptyCheck)) { return; } bool IsNew = false; appinfo appinfo = AppInfoRepo.GetBy(appinfo_id); if (appinfo == null) { appinfo = new appinfo(); appinfo_id = Convert.ToInt32(WFUtils.DateTimeToUnixTimestamp(DateTime.Now)); IsNew = true; refno_new = GenerateRefNo(cbnegeri.SelectedValue.ToString()); } appinfo.id = appinfo_id; appinfo.appdate = txtappdate.Text; appinfo.nama = txtnama.Text; appinfo.type_id = 0;//txttype_id.Text; appinfo.icno = txticno.Text; appinfo.nolesen = txtnolesen.Text; appinfo.bangsa = cbbangsa.SelectedValue == null ? "" : cbbangsa.SelectedValue.ToString(); appinfo.addr1 = txtaddr1.Text; appinfo.addr2 = txtaddr2.Text; appinfo.addr3 = txtaddr3.Text; appinfo.bandar = txtbandar.Text; appinfo.daerah = cbdaerah.SelectedValue == null ? "" : cbdaerah.SelectedValue.ToString(); appinfo.dun = cbdun.SelectedValue == null ? "" : cbdun.SelectedValue.ToString(); int? sparlimen = (int?)cbparlimen.SelectedValue; parlimen parlimen = ParlimenRepo.GetBy(sparlimen); appinfo.parlimen = parlimen == null ? null : (int?)parlimen.Id; appinfo.poskod = txtposkod.Text; appinfo.negeri = cbnegeri.SelectedValue.ToString(); appinfo.hometel = txthometel.Text; appinfo.officetel = txtofficetel.Text; appinfo.hptel = txthptel.Text; appinfo.sts_bck = 0; appinfo.status = 0; appinfo.sop = 0; appinfo.date_approved = DateTime.MinValue; appinfo.approved_by = ""; //appinfo.faks = txtfaks.Text; appinfo.email = txtemail.Text; //appinfo.kelompok = txtkelompok.Text; appinfo.refno_new = refno_new;// GenerateRefNo(appinfo.negeri); if (IsNew) { try { appinfo.created = DateTime.Now; appinfo.createdby = VariableSettingRepo.GetBy("UserKeyIn").Value; AppInfoRepo.Create(appinfo); MessageBox.Show("Data berhasil disimpan [" + appinfo.refno_new + "]"); } catch (Exception ex) { MessageBox.Show(ex.GetFullMessage()); } } else { try { AppInfoRepo.Edit(appinfo); MessageBox.Show("Data berhasil disimpan [" + appinfo.refno_new + "]"); } catch (Exception ex) { MessageBox.Show(ex.GetFullMessage()); } } } catch (Exception ex) { MessageBox.Show(ex.GetFullMessage() + " - Harap periksa data input kembali"); return; } button2.PerformClick(); }
private void btnSave_Click(object sender, EventArgs e) { try { if (appinfo_id <= 0) { MessageBox.Show("Harap masukan data dari Maklumat Pemohon."); return; } IList <Control> lstCtrlEmptyCheck = new List <Control>(); lstCtrlEmptyCheck.Add(txtaddr1); lstCtrlEmptyCheck.Add(txtaddr2); lstCtrlEmptyCheck.Add(cbnegeri); //lstCtrlEmptyCheck.Add(cbdaerah); //lstCtrlEmptyCheck.Add(cbdun); //lstCtrlEmptyCheck.Add(cbparlimen); lstCtrlEmptyCheck.Add(txtnolot); lstCtrlEmptyCheck.Add(txtluasmatang); lstCtrlEmptyCheck.Add(cbsyarattanah); lstCtrlEmptyCheck.Add(txtnolesen); lstCtrlEmptyCheck.Add(cbjenishakmiliktanah); lstCtrlEmptyCheck.Add(cbpengurusan); lstCtrlEmptyCheck.Add(cbpemilikan); if (WFUtils.CheckControllCollectionEmpty(lstCtrlEmptyCheck)) { return; } bool IsNew = false; makkebun makkebun = MakkebunRepo.GetBy(id_makkebun); if (makkebun == null) { makkebun = new makkebun(); IsNew = true; } makkebun.appinfo_id = appinfo_id; makkebun.addr1 = txtaddr1.Text; makkebun.addr2 = txtaddr2.Text; makkebun.addr3 = txtaddr3.Text; makkebun.catatan = txtcatatan.Text; makkebun.luaslesen = Convert.ToDouble(string.IsNullOrEmpty(txtluaslesen.Text) ? 0 : Convert.ToDouble(txtluaslesen.Text)); makkebun.luasmatang = Convert.ToDouble(txtluasmatang.Text); makkebun.nolesen = txtnolesen.Text; makkebun.nolot = txtnolot.Text; makkebun.tarikhtebang = txttarikhtebang.Text; makkebun.negeri = cbnegeri.SelectedValue.ToString(); makkebun.daerah = cbdaerah.SelectedValue == null ? "" : cbdaerah.SelectedValue.ToString(); makkebun.dun = cbdun.SelectedValue == null ? "" : cbdun.SelectedValue.ToString(); makkebun.parlimen = ParlimenRepo.GetParlimenIDBy(cbparlimen.SelectedValue.ToString()); makkebun.syarattanah = cbsyarattanah.SelectedValue.ToString(); makkebun.hakmiliktanah = cbjenishakmiliktanah.SelectedValue.ToString(); makkebun.pemilikan = cbpemilikan.SelectedValue.ToString(); makkebun.pengurusan = cbpengurusan.SelectedValue.ToString(); makkebun.tncr = cbtncr.SelectedValue.ToString(); makkebun.tebang = rbSudah.Checked ? "SUDAH" : rbBelum.Checked ? "BELUM" : ""; if (IsNew) { try { makkebun.created = DateTime.Now; makkebun.createdby = VariableSettingRepo.GetBy("UserKeyIn").Value; MakkebunRepo.Create(makkebun); MessageBox.Show("Data berhasil disimpan [" + refno_new + " | " + txtnolot.Text + "]"); } catch (Exception ex) { MessageBox.Show(ex.GetFullMessage()); } } else { try { MakkebunRepo.Edit(makkebun); MessageBox.Show("Data berhasil disimpan [" + refno_new + " | " + txtnolot.Text + "]"); } catch (Exception ex) { MessageBox.Show(ex.GetFullMessage()); } } } catch (Exception ex) { MessageBox.Show(ex.GetFullMessage() + " - Harap periksa data input kembali"); return; } BindGrid(page); btnReset.PerformClick(); }