private void radGridView2_CommandCellClick(object sender, EventArgs e) { string lappenjid; GridCommandCellElement cell = (GridCommandCellElement)sender; if (cell.CommandButton.TextElement.Text == "Input Laporan") { //Create Laporan using (sinarekDataSetTableAdapters.lappenTableAdapter tbl = new sinarekDataSetTableAdapters.lappenTableAdapter()) { try { lappenjid = tbl.pInsertLapPenj(int.Parse(cell.RowInfo.Cells["LogID"].Value.ToString()) , DateTime.Now , DateTime.Now , NBConfig.ValidUserName , "UJ").ToString(); EditLaporan(lappenjid , cell.RowInfo.Cells["NOSJ"].Value.ToString() , false); this.uangjalanTableAdapter.FillByNoLap(this.sinarekDataSet.uangjalan); this.vlappenTableAdapter.FillByTanggal(this.sinarekDataSet.vlappen, dtpTanggalLaporan.Value); } catch (Exception ex) { helper.NotifMessage("Laporan UJ untuk " + cell.RowInfo.Cells["NOSJ"].Value.ToString() + " sudah terinput."); helper.SysLog(this.GetType().Name, this.Text, "Create Laporan UJ :" + ex.Message); lappenjid = tbl.GetLapPenID(int.Parse(cell.RowInfo.Cells["LogID"].Value.ToString()) , "UJ").ToString(); } } } }
private void SaveNewItem() { string lappenjid = string.Empty; if (ValidateFields()) { using (sinarekDataSetTableAdapters.lappenTableAdapter tbl = new sinarekDataSetTableAdapters.lappenTableAdapter()) { try { lappenjid = tbl.pInsertLapPenj(int.Parse(row_["logid"].ToString()) , dtpTanggal.Value , dtpKembali.Value , NBConfig.ValidUserName , "Penjualan").ToString(); } catch (Exception ex) { helper.NotifMessage("Laporan untuk " + txtSuratJalan.Text + " sudah terinput."); helper.SysLog(this.GetType().Name, this.Text, "SaveNewItem :" + ex.Message); lappenjid = tbl.GetLapPenID(int.Parse(row_["logid"].ToString()) , "Penjualan").ToString(); } finally { } } //Pas Value to other form this.Hide(); frmInputPenjualan frm = new frmInputPenjualan(row_, lappenjid, dtpKembali.Value, dtpTglSJ.Value, dtpTanggal.Value); frm.StartPosition = FormStartPosition.CenterScreen; frm.ShowDialog(this.Owner); this.Close(); } }
private void radGridView2_CommandCellClick(object sender, EventArgs e) { string lappenjid; GridCommandCellElement cell = (GridCommandCellElement)sender; string question = string.Empty; if (cell.RowInfo.Cells["NOSJ"].Value.ToString() == "KAS") { question = "Yakin " + cell.RowInfo.Cells["sopirname"].Value.ToString() + " sudah kembali dari belanja ?"; } else { question = "Yakin mobil " + cell.RowInfo.Cells["mobilname"].Value.ToString() + " oleh sopir " + cell.RowInfo.Cells["sopirname"].Value.ToString() + " sudah kembali dari " + cell.RowInfo.Cells["tujuan"].Value.ToString(); } switch (cell.CommandButton.TextElement.Text) { case "Input Laporan": //Print DialogResult res = RadMessageBox.Show(question, "SMS - Verification" , MessageBoxButtons.OKCancel , RadMessageIcon.Question , MessageBoxDefaultButton.Button2); if (res == System.Windows.Forms.DialogResult.OK) { //Create Laporan using (sinarekDataSetTableAdapters.lappenTableAdapter tbl = new sinarekDataSetTableAdapters.lappenTableAdapter()) { try { if (cell.RowInfo.Cells["NOSJ"].Value.ToString() != "KAS") { lappenjid = tbl.pInsertLapPenj(int.Parse(cell.RowInfo.Cells["LogID"].Value.ToString()) , DateTime.Now , DateTime.Now , NBConfig.ValidUserName , "UJ").ToString(); EditLaporan(lappenjid , cell.RowInfo.Cells["NOSJ"].Value.ToString() , false); } else { lappenjid = tbl.pInsertLapPenj(int.Parse(cell.RowInfo.Cells["ujid"].Value.ToString()) , DateTime.Now , DateTime.Now , NBConfig.ValidUserName , "UB").ToString(); EditLaporanUB(radGridView2, lappenjid , cell.RowInfo.Cells["NOSJ"].Value.ToString() , false); } this.uangjalanTableAdapter.FillByNoLap(this.sinarekDataSet.uangjalan); this.vlappenTableAdapter.FillByTanggal(this.sinarekDataSet.vlappen, dtpTanggalLaporan.Value, "UJ"); sinarekDataSet.vlappenDataTable dt = new sinarekDataSet.vlappenDataTable(); this.vlappenTableAdapter.FillByTanggal(dt, dtpTanggalKas.Value, "UB"); radGridView4.DataSource = dt; } catch (Exception ex) { helper.NotifMessage("Laporan UJ untuk " + cell.RowInfo.Cells["NOSJ"].Value.ToString() + " sudah terinput."); helper.SysLog(this.GetType().Name, this.Text, "Create Laporan UJ :" + ex.Message); //lappenjid = tbl.GetLapPenID(int.Parse(cell.RowInfo.Cells["LogID"].Value.ToString()), "UJ").ToString(); } } } break; case "Batal": DialogResult res2 = RadMessageBox.Show("Yakin uang jalan mobil " + cell.RowInfo.Cells["mobilname"].Value.ToString() + " oleh sopir " + cell.RowInfo.Cells["sopirname"].Value.ToString() + " tujuan ke " + cell.RowInfo.Cells["tujuan"].Value.ToString() + " akan dibatalkan ?", "SMS - Verification" , MessageBoxButtons.OKCancel , RadMessageIcon.Question , MessageBoxDefaultButton.Button2); if (res2 == System.Windows.Forms.DialogResult.OK) { this.uangjalanTableAdapter.UpdateStatus(3, NBConfig.ValidUserName , int.Parse(cell.RowInfo.Cells["ujid"].Value.ToString())); this.uangjalanTableAdapter.FillByNoLap(this.sinarekDataSet.uangjalan); this.vlappenTableAdapter.FillByTanggal(this.sinarekDataSet.vlappen, dtpTanggalLaporan.Value, "UJ"); } break; } }