private void ShowDialogForm() { try { DataTable dt = new DataTable(); using (Database db = new Database(GlobalVar.DBName)) { db.Commands.Add(db.CreateCommand("usp_LookUp_NotaToko_KartuPiutang")); db.Commands[0].Parameters.Add(new Parameter("@KodeToko", SqlDbType.VarChar, kodeToko)); if (TextBox.Text != "") { db.Commands[0].Parameters.Add(new Parameter("@str", SqlDbType.VarChar, TextBox.Text)); } dt = db.Commands[0].ExecuteDataTable(); } frmNotaPiutangLookup ifrmDialog = new frmNotaPiutangLookup(dt); ifrmDialog.ShowDialog(); if (ifrmDialog.DialogResult == DialogResult.OK) { GetDialogResult(ifrmDialog); } } catch (Exception ex) { Error.LogError(ex); } }
private void GetDialogResult(frmNotaPiutangLookup dialogForm) { if (noReg != "") { this.kpid = dialogForm.RowID; this.TextBox.Text = dialogForm.NoNota; this.tglJTempo = dialogForm.TglJatuhTempo; this.rpNota = dialogForm.RpNota; this.rpTagih = dialogForm.RpTagih; this.kprecid = dialogForm.RecordID; this.jenis = dialogForm.Jenis; this.tgltransaksi = dialogForm.TglTransaksi; this.rowidorderpenjualan = dialogForm.RowIDOrderPenjualan; DataTable dtTagihan = cekNoRegNota(); if (dtTagihan.Rows.Count > 0) { this.tagihDetailID = (Guid)dtTagihan.Rows[0]["RowID"]; this.tagihDetailRecID = dtTagihan.Rows[0]["RecordID"].ToString(); this.tglReg = (DateTime)dtTagihan.Rows[0]["TglReg"]; } else { this.kpid = Guid.Empty; MessageBox.Show("Nota belum terdaftar di register."); TextBox.Focus(); } //this.tagihDetailID = Guid.NewGuid(); //this.tagihDetailRecID = Tools.CreateFingerPrint(GlobalVar.PerusahaanID, SecurityManager.UserInitial); //if (this.SelectData != null) //{ // this.SelectData(this, new EventArgs()); //} } else { this.kpid = dialogForm.RowID; this.TextBox.Text = dialogForm.NoNota; this.tglJTempo = dialogForm.TglJatuhTempo; this.rpNota = dialogForm.RpNota; this.rpTagih = dialogForm.RpTagih; this.kprecid = dialogForm.RecordID; this.jenis = dialogForm.Jenis; this.tgltransaksi = dialogForm.TglTransaksi; this.rowidorderpenjualan = dialogForm.RowIDOrderPenjualan; } if (this.SelectData != null) { this.SelectData(this, new EventArgs()); } //else //{ // this.kpid = dialogForm.RowID; // //DataTable dtTagihan = cekNoRegNota(); // //if (dtTagihan.Rows.Count > 0) // //{ // this.TextBox.Text = dialogForm.NoNota; // this.tglJTempo = dialogForm.TglJatuhTempo; // this.rpNota = dialogForm.RpNota; // this.rpTagih = dialogForm.RpTagih; // this.kprecid = dialogForm.RecordID; // this.jenis = dialogForm.Jenis; // this.tagihDetailID = Guid.NewGuid(); // this.tagihDetailRecID = Tools.CreateFingerPrint(GlobalVar.PerusahaanID, SecurityManager.UserInitial); // //this.tagihDetailID = (Guid)dtTagihan.Rows[0]["RowID"]; // //this.tagihDetailRecID = dtTagihan.Rows[0]["RecordID"].ToString(); // //} // //else // //{ // // this.kpid = Guid.Empty; // // MessageBox.Show("Nota belum terdaftar di register."); // // TextBox.Focus(); // //} // if (this.SelectData != null) // { // this.SelectData(this, new EventArgs()); // } //} }