/// <summary> /// 窗体控件的数据绑定 /// </summary> private void DataBindFuntion() { string drawingstr = string.Empty; string sqlstr = string.Empty; string responuser = string.Empty; this.DRAWINGNOcomboBox.Items.Clear(); if (this.DRAWINGNOcomboBox.Text.Length != 0) { this.DRAWINGNOcomboBox.Text.Remove(0); } this.querybtn.Enabled = true; this.DRAWINGNOcomboBox.Items.Clear(); if (this.drawingrbn.Checked == true) { sqlstr = "SELECT DRAWING_NO FROM PLM.PROJECT_DRAWING_TAB where drawing_type is null AND Project_Id = (select T.ID from PROJECT_TAB T where T.NAME='" + this.textBox1.Text.ToString() + "') AND DOCTYPE_ID IN (7) AND DOCTYPE_ID != 71 AND LASTFLAG = 'Y' AND NEW_FLAG = 'Y' AND DELETE_FLAG = 'N' ORDER BY DRAWING_ID DESC"; } else if (this.modifyrbn.Checked == true) { sqlstr = "SELECT DRAWING_NO FROM PLM.PROJECT_DRAWING_TAB where drawing_type is null AND Project_Id = (select T.ID from PROJECT_TAB T where T.NAME='" + this.textBox1.Text.ToString() + "') AND DRAWING_NO IN (SELECT DISTINCT S.MODIFYDRAWINGNO FROM SP_SPOOL_TAB S WHERE S.FLAG = 'Y' AND S.MODIFYDRAWINGNO IS NOT NULL) AND DOCTYPE_ID = 71 AND LASTFLAG = 'Y' AND NEW_FLAG = 'Y' AND DELETE_FLAG = 'N' ORDER BY DRAWING_ID DESC"; } FillComboBox.GetFlowStatus(this.DRAWINGNOcomboBox, sqlstr); DataSet ds = new DataSet(); drawingstr = "SELECT distinct PLM.USER_API.CHINESENAME(RESPONSIBLE_USER) FROM PLM.PROJECT_DRAWING_TAB where Project_Id = (select T.ID from PROJECT_TAB T where T.NAME='" + this.textBox1.Text.ToString() + "') AND DOCTYPE_ID IN (7) AND DOCTYPE_ID != 71 AND LASTFLAG = 'Y' AND NEW_FLAG = 'Y' AND DELETE_FLAG = 'N'"; FillComboBox.GetFlowStatus(this.RESPONSIBLEcb, drawingstr); responuser = "******" + this.textBox1.Text.ToString() + "') AND DOCTYPE_ID IN (7) AND DOCTYPE_ID != 71 AND LASTFLAG = 'Y' AND NEW_FLAG = 'Y' AND DELETE_FLAG = 'N' ORDER BY DRAWING_ID DESC"; User.DataBaseConnect(responuser, ds); this.DrawingsDgv.DataSource = ds.Tables[0]; ds.Dispose(); SetStatus(); }
private void frmKotaBrowse_Load(object sender, EventArgs e) { try { if (!SecurityManager.IsManager()) { cmdAdd.Enabled = false; cmdEdit.Enabled = false; cmdDelete.Enabled = false; } this.Cursor = Cursors.WaitCursor; dtProv = FillComboBox.DBGetProvinsi(Guid.Empty); if (dtProv.Rows.Count > 0) { dtProv.DefaultView.Sort = "Nama"; gridProvinsi.DataSource = dtProv.DefaultView; LoadKota(); } else { dtKota.Clear(); gridKota.DataSource = dtKota.DefaultView; } } catch (Exception ex) { Error.LogError(ex); } finally { this.Cursor = Cursors.Default; } }
private void frmKonsinyasiUpdate_Load(object sender, EventArgs e) { try { this.Cursor = Cursors.WaitCursor; DataTable dt = FillComboBox.DBGetCabang(""); dt.DefaultView.Sort = "NamaPanjang ASC"; cboCabang.DisplayMember = "NamaPanjang"; cboCabang.ValueMember = "CabangID"; cboCabang.DataSource = dt.DefaultView; DataTable dt2 = FillComboBox.DBGetMataUang(Guid.Empty, ""); dt2.DefaultView.Sort = "MataUangID ASC"; cboMataUang.DisplayMember = "MataUangID"; cboMataUang.ValueMember = "MataUangID"; cboMataUang.DataSource = dt2.DefaultView; if (mode == FormMode.New) { lookUpStokMotor1.txtNopol.Text = ""; txtTanggal.DateValue = GlobalVar.GetServerDate; txtHarga.Text = "0"; DataTable dummyMU = new DataTable(); using (Database dbsubMU = new Database()) { dbsubMU.Commands.Add(dbsubMU.CreateCommand("usp_AppSetting_LIST")); dbsubMU.Commands[0].Parameters.Add(new Parameter("@key", SqlDbType.VarChar, "DEFMATAUANG")); dummyMU = dbsubMU.Commands[0].ExecuteDataTable(); cboMataUang.Text = dummyMU.Rows[0]["Value"].ToString(); } } else { DataTable _dt = new DataTable(); using (Database db = new Database()) { db.Commands.Add(db.CreateCommand("usp_Konsinyasi_LIST")); db.Commands[0].Parameters.Add(new Parameter("@RowID", SqlDbType.UniqueIdentifier, _rowID)); db.Commands[0].Parameters.Add(new Parameter("@CabangID", SqlDbType.VarChar, _cabangID)); _dt = db.Commands[0].ExecuteDataTable(); } lblNoBukti.Text = Tools.isNull(_dt.Rows[0]["Bukti"], "").ToString(); _pembRowID = (Guid)Tools.isNull(_dt.Rows[0]["PembRowID"], Guid.Empty); lookUpStokMotor1.txtNopol.Text = Tools.isNull(_dt.Rows[0]["Nopol"], "").ToString(); txtTanggal.DateValue = (DateTime)Tools.isNull(_dt.Rows[0]["Tanggal"], DateTime.MinValue); cboMataUang.Text = Tools.isNull(_dt.Rows[0]["MataUangID"], "").ToString(); txtHarga.Text = Tools.isNull(_dt.Rows[0]["Harga"], "").ToString(); cboCabang.Text = Tools.isNull(_dt.Rows[0]["CabangPenerima"], "").ToString(); } } catch (Exception ex) { Error.LogError(ex); } finally { this.Cursor = Cursors.Default; } }
private void LoadKolektor() { displayPanel("Kolektor"); DataTable dtKol, dt; if (formMode == enumFormMode.New) { txtKolArea.Text = _area; lkKolektor.txtNamaKolektor.Text = ""; txtTMT.Text = ""; this.Text = "Master Kolektor"; this.Title = "Master Kolektor"; } else { dt = FillComboBox.DBGetAreaKolektor(_rowID, Guid.Empty, Guid.Empty); txtKolArea.Text = _area; _areaRowID = (Guid)Tools.isNull(dt.Rows[0]["AreaRowID"], ""); _kolRowID = (Guid)Tools.isNull(dt.Rows[0]["KolektorRowID"], ""); dtKol = FillComboBox.DBGetKolektor(_kolRowID); lkKolektor.txtNamaKolektor.Text = Tools.isNull(dtKol.Rows[0]["Nama"], "").ToString(); txtTMT.DateValue = (DateTime)Tools.isNull(dt.Rows[0]["TMT"], ""); this.Text = "Master Kolektor Update"; this.Title = "Master Kolektor Update"; } }
private void ListLeasing() { try { DataTable dt = FillComboBox.DBGetLeasing(Guid.Empty); if (dt.Rows.Count > 0) { dt.DefaultView.Sort = "Nama ASC"; cboLeasing.DisplayMember = "Nama"; cboLeasing.ValueMember = "RowID"; DataRow dr = dt.NewRow(); dr["RowID"] = Guid.Empty; dr["Nama"] = ""; dt.Rows.Add(dr); cboLeasing.DataSource = dt.DefaultView; } else { dt.Clear(); cboLeasing.DataSource = dt; } } catch (Exception ex) { Error.LogError(ex); } }
private void LoadKolektor() { try { if (gridArea.SelectedCells.Count > 0) { Guid RowID = (Guid)gridArea.SelectedCells[0].OwningRow.Cells["RowID"].Value; this.Cursor = Cursors.WaitCursor; dtKolektor = FillComboBox.DBGetAreaKolektor(Guid.Empty, RowID, Guid.Empty); if (dtKolektor.Rows.Count > 0) { gridKolektor.AutoGenerateColumns = false; dtKolektor.DefaultView.Sort = "Kolektor"; gridKolektor.DataSource = dtKolektor.DefaultView; } else { dtKolektor.Clear(); gridKolektor.DataSource = dtKolektor.DefaultView; } } } catch (System.Exception ex) { Error.LogError(ex); } finally { this.Cursor = Cursors.Default; } }
private void LoadWilayah() { try { if (gridArea.SelectedCells.Count > 0) { Guid RowID = (Guid)gridArea.SelectedCells[0].OwningRow.Cells["RowID"].Value; this.Cursor = Cursors.WaitCursor; dtWilayah = FillComboBox.DBGetWilayah(Guid.Empty, RowID, Guid.Empty); DataColumn cConcatenated = new DataColumn("conWilayah", Type.GetType("System.String"), "'Kec. ' + Kecamatan + ', ' + Kota + ', ' + Provinsi"); dtWilayah.Columns.Add(cConcatenated); if (dtWilayah.Rows.Count > 0) { gridKolektor.AutoGenerateColumns = false; dtWilayah.DefaultView.Sort = "Kecamatan"; gridWilayah.DataSource = dtWilayah.DefaultView; } else { dtWilayah.Clear(); gridWilayah.DataSource = dtWilayah.DefaultView; } } } catch (System.Exception ex) { Error.LogError(ex); } finally { this.Cursor = Cursors.Default; } }
private void LoadKec() { try { Guid RowIDKota = (Guid)gridKota.SelectedCells[0].OwningRow.Cells["KotaRowID"].Value; this.Cursor = Cursors.WaitCursor; dtKec = FillComboBox.DBGetKecamatan(Guid.Empty, RowIDKota); if (dtKec.Rows.Count > 0) { dtKec.DefaultView.Sort = "Nama"; gridKecamatan.AutoGenerateColumns = false; gridKecamatan.DataSource = dtKec.DefaultView; LoadKel(); } else { dtKec.Clear(); gridKecamatan.DataSource = dtKec.DefaultView; } } catch (System.Exception ex) { Error.LogError(ex); } finally { this.Cursor = Cursors.Default; } }
private void frmUangMukaSubsidiUpdate_Load(object sender, EventArgs e) { txtTglJual.Enabled = false; txtTglJual.ReadOnly = true; txtTglPelunasan.Enabled = false; txtTglPelunasan.ReadOnly = true; txtTglPelunasan.DateValue = GlobalVar.GetServerDate; cbxBentukPembayaran.SelectedIndex = 1; txtNoTrans.Text = ""; txtNoTrans.Enabled = false; txtNoTrans.ReadOnly = true; txtNominal.Text = "0"; DisabledControlBG(); DataTable dt2 = FillComboBox.DBGetMataUang(Guid.Empty, ""); dt2.DefaultView.Sort = "MataUangID ASC"; cbxMataUang.DisplayMember = "MataUangID"; cbxMataUang.ValueMember = "MataUangID"; cbxMataUang.DataSource = dt2.DefaultView; DataTable dt = new DataTable(); using (Database db = new Database()) { db.Commands.Add(db.CreateCommand("usp_Penjualan_LIST_for_DPSubsidi")); db.Commands[0].Parameters.Add(new Parameter("@RowID", SqlDbType.UniqueIdentifier, _PenjualanRowID)); dt = db.Commands[0].ExecuteDataTable(); } if (dt.Rows.Count > 0) { _LeasingRowID = new Guid(Tools.isNull(dt.Rows[0]["LeasingRowID"], "").ToString()); _PembelianRowID = new Guid(Tools.isNull(dt.Rows[0]["PembRowID"], "").ToString()); lblAlamat.Text = Tools.isNull(dt.Rows[0]["AlamatLeasing"], "").ToString(); lblKotaProv.Text = Tools.isNull(dt.Rows[0]["KotaProv"], "").ToString(); lblNamaLeasing.Text = Tools.isNull(dt.Rows[0]["NamaLeasing"], "").ToString(); lblNominalSubsidi.Text = Convert.ToDouble(Tools.isNull(dt.Rows[0]["DPSubsidi"], 0)).ToString("N2"); lblNopol.Text = Tools.isNull(dt.Rows[0]["NoPol"], "").ToString(); lblNoTrans.Text = Tools.isNull(dt.Rows[0]["NoTrans"], "").ToString(); txtTglJual.Text = Tools.isNull(dt.Rows[0]["TglJual"], DateTime.MaxValue).ToString(); lblSisaSubsidi.Text = Convert.ToDouble(Tools.isNull(dt.Rows[0]["SBDSisa"], 0)).ToString("N2"); _SisaSBD = Convert.ToDouble(Tools.isNull(dt.Rows[0]["SBDSisa"], 0)); txtNominal.Text = Convert.ToDouble(Tools.isNull(dt.Rows[0]["SBDSisa"], 0)).ToString(); txtRefund.Text = Convert.ToDouble(Tools.isNull(dt.Rows[0]["SBDSisa"], 0)).ToString();; txtSelisih.Text = "0"; } else { MessageBox.Show("Data tidak dapat ditemukan!"); this.Close(); } if (GlobalVar.CabangID.Contains("06")) { txtTglPelunasan.Enabled = true; txtTglPelunasan.ReadOnly = false; } }
private void LoadWilayah() { displayPanel("Wilayah"); DataTable dtProp, dt; if (formMode == enumFormMode.New) { txtWilArea.Text = _area; dtProp = FillComboBox.DBGetProvinsi(Guid.Empty); dtProp.DefaultView.Sort = "Nama ASC"; cboProvinsi.DisplayMember = "Nama"; cboProvinsi.ValueMember = "RowID"; cboProvinsi.DataSource = dtProp.DefaultView; this.Text = "Master Kota"; this.Title = "Master Kota"; // ambil dari app setting DataTable dummyPR = new DataTable(); using (Database dbsubPR = new Database()) { dbsubPR.Commands.Add(dbsubPR.CreateCommand("usp_AppSetting_LIST")); dbsubPR.Commands[0].Parameters.Add(new Parameter("@key", SqlDbType.VarChar, "PROVPEMILIKBPKB")); dummyPR = dbsubPR.Commands[0].ExecuteDataTable(); if (dummyPR.Rows.Count > 0) { cboProvinsi.Text = dummyPR.Rows[0]["Value"].ToString(); } } DataTable dummyKT = new DataTable(); using (Database dbsubKT = new Database()) { dbsubKT.Commands.Add(dbsubKT.CreateCommand("usp_AppSetting_LIST")); dbsubKT.Commands[0].Parameters.Add(new Parameter("@key", SqlDbType.VarChar, "KOTAPEMILIKBPKB")); dummyKT = dbsubKT.Commands[0].ExecuteDataTable(); if (dummyKT.Rows.Count > 0) { cboKota.Text = dummyKT.Rows[0]["Value"].ToString(); } } } else { dt = FillComboBox.DBGetWilayah(_rowID, Guid.Empty, Guid.Empty); dtProp = FillComboBox.DBGetProvinsi(Guid.Empty); dtProp.DefaultView.Sort = "Nama ASC"; cboProvinsi.DisplayMember = "Nama"; cboProvinsi.ValueMember = "RowID"; cboProvinsi.DataSource = dtProp.DefaultView; txtWilArea.Text = _area; _areaRowID = (Guid)Tools.isNull(dt.Rows[0]["AreaRowID"], ""); cboProvinsi.Text = Tools.isNull(dt.Rows[0]["Provinsi"], "").ToString(); cboKota.Text = Tools.isNull(dt.Rows[0]["Kota"], "").ToString(); cboKecamatan.Text = Tools.isNull(dt.Rows[0]["Kecamatan"], "").ToString(); this.Text = "Master Kota Update"; this.Title = "Master Kota Update"; } }
private void RegisterComputers_Load(object sender, EventArgs e) { FillComboBox fill = new FillComboBox(); txtInsertBY.Text = UserSession.LoggedUser.Username; txtInsertBY.ReadOnly = true; txtInsertDate.Text += DateTime.Now.ToShortDateString(); txtInsertDate.ReadOnly = true; BindData(); }
private void InitControls() { DataTable dt2 = FillComboBox.DBGetMataUang(Guid.Empty, ""); dt2.DefaultView.Sort = "MataUangID ASC"; cboMataUang.DisplayMember = "MataUangID"; cboMataUang.ValueMember = "MataUangID"; cboMataUang.DataSource = dt2.DefaultView; cbxBentukPembayaran.SelectedIndex = 0; }
private void cboKota_SelectedIndexChanged(object sender, EventArgs e) { Guid rowID = (Guid)cboKota.SelectedValue; DataTable dtK = FillComboBox.DBGetKecamatan(Guid.Empty, rowID); dtK.DefaultView.Sort = "Nama ASC"; cboKecamatan.DisplayMember = "Nama"; cboKecamatan.ValueMember = "RowID"; cboKecamatan.DataSource = dtK.DefaultView; }
private void cmdDELETE_Click(object sender, EventArgs e) { DateTimeFormatInfo dfi = DateTimeFormatInfo.CurrentInfo; DateTime date = GlobalVar.GetServerDate; Calendar cal = dfi.Calendar; int mingguKe = cal.GetWeekOfYear(date, dfi.CalendarWeekRule, dfi.FirstDayOfWeek); if (dataGridView1.SelectedCells.Count > 0) { string namacustomer = dataGridView1.SelectedCells[0].OwningRow.Cells["Nama"].Value.ToString(); Guid rowID = (Guid)dataGridView1.SelectedCells[0].OwningRow.Cells["RowID"].Value; if (MessageBox.Show(Messages.Question.AskDelete, "Anda yakin akan menghapus data ini ?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { try { DataTable dtSales = FillComboBox.DBGetTargetSales(Guid.Empty, rowID); if (dtSales.Rows.Count > 0) { MessageBox.Show("Terdapat keterkaitan data !"); return; } else { // pake cekDelete punya Pak Novi if (Class.PenerimaanUang.checkDelete(rowID, "Sales") == true) // this.ceckDelete(rowID) == true -> ke Sales { Tools.pin(PinId.Periode.Hari, mingguKe, date, PinId.Bagian.Piutang, Convert.ToInt32(PinId.ModulId.HapusMaster), "Hapus Master.\nSudah lewat tanggal, tidak diperkenankan menghapus data ini !"); if (GlobalVar.pinResult == false) { return; } } using (Database db = new Database()) { DataTable dt = new DataTable(); db.Commands.Add(db.CreateCommand("usp_Sales_DELETE")); db.Commands[0].Parameters.Add(new Parameter("@RowID", SqlDbType.UniqueIdentifier, rowID)); dt = db.Commands[0].ExecuteDataTable(); } dataGridView1.Rows.Remove(dataGridView1.SelectedCells[0].OwningRow); MessageBox.Show("Data berhasil dihapus"); } } catch (Exception ex) { Error.LogError(ex); } } } else { MessageBox.Show(Messages.Error.RowNotSelected); } }
public CableListFrm() { InitializeComponent(); drwtb.Text = ProjectDrawingCableFrm.drawingno; drwentb.Text = ProjectDrawingCableFrm.drawingtitle; drwcntb.Text = ProjectDrawingCableFrm.drawingtitlecn; textBox1.Text = ProjectDrawingCableFrm.duty; DataBind(sql); FillComboBox.GetFlowStatus(fequipcb, devicesql); FillComboBox.GetFlowStatus(tequipcb, devicesql); FillComboBox.GetFlowStatus(cablesizecb, cablesizesql); }
private void ComputersEdit_Load(object sender, EventArgs e) { FillComboBox fill = new FillComboBox(); txtUpdateDate.Text += DateTime.Now.ToShortDateString(); txtUpdateDate.ReadOnly = true; txtupdateby.Text += UserSession.LoggedUser.Username; txtupdateby.ReadOnly = true; txtComputerID.ReadOnly = true; txtComputerID.Visible = false; txtUpdateNo.ReadOnly = true; BindData(); count++; txtUpdateNo.Text = count.ToString(); }
private void cboKecamatanDom_SelectedIndexChanged(object sender, EventArgs e) { try { Guid rowID = (Guid)cboKecamatanDom.SelectedValue; DataTable dt = FillComboBox.DBGetKelurahan(Guid.Empty, rowID); dt.DefaultView.Sort = "Nama ASC"; cboKelurahanDom.DisplayMember = "Nama"; cboKelurahanDom.ValueMember = "RowID"; cboKelurahanDom.DataSource = dt.DefaultView; } catch (Exception ex) { Error.LogError(ex); } }
private void cboProvinsi_SelectedIndexChanged(object sender, EventArgs e) { try { Guid _provRowID = (Guid)cboProvinsi.SelectedValue; DataTable dt = FillComboBox.DBGetKota(Guid.Empty, _provRowID); dt.DefaultView.Sort = "Nama ASC"; cboKota.DisplayMember = "Nama"; cboKota.ValueMember = "RowID"; cboKota.DataSource = dt.DefaultView; } catch (Exception ex) { Error.LogError(ex); } }
private void LoadProvinsi() { displayPanel("Provinsi"); if (formMode == enumFormMode.New) { txtProvinsi.Text = ""; this.Text = "Master Kota"; this.Title = "Master Kota"; } else { DataTable dt = FillComboBox.DBGetProvinsi(_rowID); txtProvinsi.Text = Tools.isNull(dt.Rows[0]["Nama"], "").ToString(); this.Text = "Master Kota Update"; this.Title = "Master Kota Update"; } }
private void LoadArea() { displayPanel("Area"); if (formMode == enumFormMode.New) { txtArea.Text = ""; this.Text = "Wilayah"; this.Title = "Wilayah"; } else { DataTable dt = FillComboBox.DBGetArea(_rowID); txtArea.Text = Tools.isNull(dt.Rows[0]["Area"], "").ToString(); this.Text = "Wilayah Update"; this.Title = "Wilayah Update"; } }
private void frmLapPenjualan_Load(object sender, EventArgs e) { rangeDateBox1.FromDate = new DateTime(GlobalVar.GetServerDate.Year, GlobalVar.GetServerDate.Month, 1); rangeDateBox1.ToDate = GlobalVar.GetServerDate; cboOrderBy.SelectedIndex = 0; cboStatusLunas.SelectedIndex = 0; cboKondisi.SelectedIndex = 0; DataTable dtProp = FillComboBox.DBGetProvinsi(Guid.Empty); dtProp.Rows.Add(Guid.Empty, ""); dtProp.DefaultView.Sort = "Nama ASC"; cboProvinsi.DisplayMember = "Nama"; cboProvinsi.ValueMember = "RowID"; cboProvinsi.DataSource = dtProp.DefaultView; txtStatusKirim.SelectedIndex = 0; DataTable dummyPR = new DataTable(); using (Database dbsubPR = new Database()) { dbsubPR.Commands.Add(dbsubPR.CreateCommand("usp_AppSetting_LIST")); dbsubPR.Commands[0].Parameters.Add(new Parameter("@key", SqlDbType.VarChar, "PROVPEMILIKBPKB")); dummyPR = dbsubPR.Commands[0].ExecuteDataTable(); if (dummyPR.Rows.Count > 0) { cboProvinsi.Text = dummyPR.Rows[0]["Value"].ToString(); } } DataTable dummyKT = new DataTable(); using (Database dbsubKT = new Database()) { dbsubKT.Commands.Add(dbsubKT.CreateCommand("usp_AppSetting_LIST")); dbsubKT.Commands[0].Parameters.Add(new Parameter("@key", SqlDbType.VarChar, "KOTAPEMILIKBPKB")); dummyKT = dbsubKT.Commands[0].ExecuteDataTable(); if (dummyKT.Rows.Count > 0) { cboKota.Text = dummyKT.Rows[0]["Value"].ToString(); } } updatePerubahanJenisBayar(); }
private void frmAngsuranChange_Load(object sender, EventArgs e) { try { this.Cursor = Cursors.WaitCursor; DataTable dt = new DataTable(); using (Database db = new Database()) { db.Commands.Add(db.CreateCommand("usp_PenerimaanANG_LIST_ALL")); db.Commands[0].Parameters.Add(new Parameter("@RowID", SqlDbType.UniqueIdentifier, _penjRowID)); db.Commands[0].Parameters.Add(new Parameter("@CabangID", SqlDbType.VarChar, _cabangID)); dt = db.Commands[0].ExecuteDataTable(); lblNama.Text = Tools.isNull(dt.Rows[0]["Nama"], "").ToString(); lblAlamat.Text = Tools.isNull(dt.Rows[0]["Alamat"], "").ToString(); lblKelkec.Text = Tools.isNull(dt.Rows[0]["KelKec"], "").ToString(); lblKotaProv.Text = Tools.isNull(dt.Rows[0]["KotaProv"], "").ToString(); lblTglJual.Text = String.Format("{0:dd-MM-yyyy}", (DateTime)dt.Rows[0]["TglJual"]); _tgjJual = (DateTime)dt.Rows[0]["TglJual"]; lblNoFaktur.Text = Tools.isNull(dt.Rows[0]["NoFaktur"], "").ToString(); lblNoTrans.Text = "K" + Numerator.NextNumber("NKJ"); _saldo = Convert.ToDouble(Tools.isNull(dt.Rows[0]["Saldo"], 0)); DataTable dt2 = FillComboBox.DBGetMataUang(Guid.Empty, ""); dt2.DefaultView.Sort = "MataUangID ASC"; cboMataUang.DisplayMember = "MataUangID"; cboMataUang.ValueMember = "MataUangID"; cboMataUang.DataSource = dt2.DefaultView; this.ListPembulatan(); this.refresh(); } } catch (Exception ex) { Error.LogError(ex); } finally { this.Cursor = Cursors.Default; } }
private void frmTitipanAdjustment_Load(object sender, EventArgs e) { txtTanggal.DateValue = GlobalVar.GetServerDate; DataTable dt = FillComboBox.DBGetMataUang(Guid.Empty, ""); dt.DefaultView.Sort = "MataUangID ASC"; cboMataUang.DisplayMember = "MataUangID"; cboMataUang.ValueMember = "MataUangID"; cboMataUang.DataSource = dt.DefaultView; using (Database db = new Database()) { DataTable dummy = new DataTable(); db.Commands.Add(db.CreateCommand("usp_PenerimaanTitipan_LIST_Adjustment")); db.Commands[0].Parameters.Add(new Parameter("@TitipanRowID", SqlDbType.UniqueIdentifier, _TitipanRowID)); dummy = db.Commands[0].ExecuteDataTable(); if (dummy.Rows.Count > 0) { _CustomerRowID = new Guid(Tools.isNull(dummy.Rows[0]["CustomerRowID"], Guid.Empty).ToString()); lblNama.Text = Tools.isNull(dummy.Rows[0]["Nama"], "").ToString().Trim(); lblNoTrans.Text = Tools.isNull(dummy.Rows[0]["NoTrans"], "").ToString().Trim(); txtNominal.Text = Convert.ToDouble(Tools.isNull(dummy.Rows[0]["SaldoTitipan"], "").ToString()).ToString(); txtSaldoTitipan.Text = Convert.ToDouble(Tools.isNull(dummy.Rows[0]["SaldoTitipan"], "").ToString()).ToString(); txtSaldoTitipan.Enabled = false; txtSaldoTitipan.ReadOnly = true; rbKorPA.Checked = true; cmdSearch.Enabled = true; txtNoAngs.Enabled = false; txtNoAngs.ReadOnly = true; } else { MessageBox.Show("Data tidak dapat diproses!"); this.Close(); return; } } }
private void LoadArea() { this.Cursor = Cursors.WaitCursor; dtArea = FillComboBox.DBGetArea(Guid.Empty); if (dtArea.Rows.Count > 0) { dtArea.DefaultView.Sort = "Area"; gridArea.DataSource = dtArea.DefaultView; this.LoadWilayah(); this.LoadKolektor(); } else { dtWilayah = new DataTable(); dtWilayah.Clear(); gridWilayah.DataSource = dtArea.DefaultView; dtKolektor = new DataTable(); dtKolektor.Clear(); gridKolektor.DataSource = dtKolektor.DefaultView; } }
public void RefreshRowData(string Sts, Guid _areaRowID, Guid _rowid) { using (Database db = new Database()) { switch (Sts) { case "Area": dtRefresh = FillComboBox.DBGetArea(Guid.Empty); break; case "Wilayah": dtRefresh = FillComboBox.DBGetWilayah(Guid.Empty, _areaRowID, Guid.Empty); break; case "Kolektor": dtRefresh = FillComboBox.DBGetAreaKolektor(Guid.Empty, _areaRowID, Guid.Empty); break; } } if (dtRefresh.Rows.Count > 0) { switch (Sts) { case "Area": gridArea.FindRow("RowID", _rowid.ToString()); break; case "Wilayah": gridWilayah.FindRow("WilRowID", _rowid.ToString()); break; case "Kolektor": gridKolektor.FindRow("KolRowID", _rowid.ToString()); break; } } }
private void ListProvinsiDomisili() { try { DataTable dt = FillComboBox.DBGetProvinsi(Guid.Empty); if (dt.Rows.Count > 0) { dt.DefaultView.Sort = "Nama ASC"; cboProvinsiDom.DisplayMember = "Nama"; cboProvinsiDom.ValueMember = "RowID"; cboProvinsiDom.DataSource = dt.DefaultView; } else { dt.Clear(); cboProvinsiDom.DataSource = dt; } } catch (Exception ex) { Error.LogError(ex); } }
private void cmdDelete_Click(object sender, EventArgs e) { DateTimeFormatInfo dfi = DateTimeFormatInfo.CurrentInfo; DateTime date = GlobalVar.GetServerDate; Calendar cal = dfi.Calendar; int mingguKe = cal.GetWeekOfYear(date, dfi.CalendarWeekRule, dfi.FirstDayOfWeek); switch (selectedGrid) { case enumSelectedGrid.GridArea: if (gridArea.RowCount > 0) { if (MessageBox.Show(Messages.Question.AskDelete, "Anda yakin akan menghapus data ini ?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { Guid rowID = (Guid)gridArea.SelectedCells[0].OwningRow.Cells["RowID"].Value; DataTable dtW = FillComboBox.DBGetWilayah(Guid.Empty, rowID, Guid.Empty); DataTable dtK = FillComboBox.DBGetAreaKolektor(Guid.Empty, rowID, Guid.Empty); if (dtW.Rows.Count > 0) { MessageBox.Show("Terdapat keterkaitan data !"); } else if (dtK.Rows.Count > 0) { MessageBox.Show("Terdapat keterkaitan data !"); } else { // pake cek delete punya Pak Novi if (Class.PenerimaanUang.checkDelete(rowID, "Area") == true) // this.ceckDelete(rowID) == true -> ke Area { Tools.pin(PinId.Periode.Hari, mingguKe, date, PinId.Bagian.Piutang, Convert.ToInt32(PinId.ModulId.HapusMaster), "Hapus Master.\nSudah lewat tanggal, tidak diperkenankan menghapus data ini !"); if (GlobalVar.pinResult == false) { return; } } using (Database db = new Database()) { db.Commands.Add(db.CreateCommand("usp_Area_DELETE")); db.Commands[0].Parameters.Add(new Parameter("@RowID", SqlDbType.UniqueIdentifier, rowID)); db.Commands[0].ExecuteNonQuery(); } gridArea.Rows.Remove(gridArea.SelectedCells[0].OwningRow); MessageBox.Show("Data berhasil dihapus"); } } } break; case enumSelectedGrid.GridWilayah: if (gridWilayah.RowCount > 0) { if (MessageBox.Show(Messages.Question.AskDelete, "Anda yakin akan menghapus data ini ?", MessageBoxButtons.YesNo) == DialogResult.Yes) { Guid rowID = (Guid)gridWilayah.SelectedCells[0].OwningRow.Cells["WilRowID"].Value; // pake cek delete punya Pak Novi if (Class.PenerimaanUang.checkDelete(rowID, "Wilayah") == true) // this.ceckDelete(rowID) == true -> ke Wilayah { Tools.pin(PinId.Periode.Hari, mingguKe, date, PinId.Bagian.Piutang, Convert.ToInt32(PinId.ModulId.HapusMaster), "Hapus Master.\nSudah lewat tanggal, tidak diperkenankan menghapus data ini !"); if (GlobalVar.pinResult == false) { return; } } using (Database db = new Database()) { db.Commands.Add(db.CreateCommand("usp_Wilayah_DELETE")); db.Commands[0].Parameters.Add(new Parameter("@RowID", SqlDbType.UniqueIdentifier, rowID)); db.Commands[0].ExecuteNonQuery(); } gridWilayah.Rows.Remove(gridWilayah.SelectedCells[0].OwningRow); MessageBox.Show("Data berhasil dihapus"); } } break; case enumSelectedGrid.GridKolektor: if (gridKolektor.RowCount > 0) { if (MessageBox.Show(Messages.Question.AskDelete, "Anda yakin akan menghapus data ini ?", MessageBoxButtons.YesNo) == DialogResult.Yes) { Guid rowID = (Guid)gridKolektor.SelectedCells[0].OwningRow.Cells["KolRowID"].Value; // pake cek delete punya Pak Novi if (Class.PenerimaanUang.checkDelete(rowID, "AreaKolektor") == true) // this.ceckDelete(rowID) == true -> ke AreaKolektor { Tools.pin(PinId.Periode.Hari, mingguKe, date, PinId.Bagian.Piutang, Convert.ToInt32(PinId.ModulId.HapusMaster), "Hapus Master.\nSudah lewat tanggal, tidak diperkenankan menghapus data ini !"); if (GlobalVar.pinResult == false) { return; } } using (Database db = new Database()) { db.Commands.Add(db.CreateCommand("usp_Area_Kolektor_DELETE")); db.Commands[0].Parameters.Add(new Parameter("@RowID", SqlDbType.UniqueIdentifier, rowID)); db.Commands[0].ExecuteNonQuery(); } gridKolektor.Rows.Remove(gridKolektor.SelectedCells[0].OwningRow); MessageBox.Show("Data berhasil dihapus"); } } break; } }
private void frmKonversiUpdate_Load(object sender, EventArgs e) { this.ListAngsuran(); this.ListPembulatan(); try { using (Database db = new Database()) { DataTable dt = new DataTable(); db.Commands.Add(db.CreateCommand("usp_Konversi_LIST")); db.Commands[0].Parameters.Add(new Parameter("@RowID", SqlDbType.UniqueIdentifier, _penjRowID)); db.Commands[0].Parameters.Add(new Parameter("@CabangID", SqlDbType.VarChar, _cabangID)); dt = db.Commands[0].ExecuteDataTable(); lblNama.Text = Tools.isNull(dt.Rows[0]["Nama"], "").ToString(); lblAlamat.Text = Tools.isNull(dt.Rows[0]["Alamat"], "").ToString(); lblKelkec.Text = Tools.isNull(dt.Rows[0]["KelKec"], "").ToString(); lblKotaProv.Text = Tools.isNull(dt.Rows[0]["KotaProv"], "").ToString(); lblTglJual.Text = String.Format("{0:dd-MM-yyyy}", (DateTime)dt.Rows[0]["TglJual"]); lblNoFaktur.Text = Tools.isNull(dt.Rows[0]["NoFaktur"], "").ToString(); lblNoTrans.Text = Tools.isNull(dt.Rows[0]["NoTrans"], "").ToString(); lblJnsPenjualan.Text = Tools.isNull(dt.Rows[0]["JnsPenjualan"], "").ToString(); lblMerkType.Text = Tools.isNull(dt.Rows[0]["Merk"], "").ToString() + " / " + Tools.isNull(dt.Rows[0]["Type"], "").ToString();; lblHargaJadi.Text = Tools.isNull(dt.Rows[0]["HargaJadi"], 0).ToString(); lblBBN.Text = Tools.isNull(dt.Rows[0]["BBN"], "").ToString(); lblHargaTotal.Text = (Convert.ToDouble(lblHargaJadi.Text) + Convert.ToDouble(lblBBN.Text)).ToString(); _pembRowID = (Guid)Tools.isNull(dt.Rows[0]["PembRowID"], ""); _salesRowID = (Guid)Tools.isNull(dt.Rows[0]["SalesRowID"], ""); _keterangan = Tools.isNull(dt.Rows[0]["Keterangan"], "").ToString(); DataTable dt2 = FillComboBox.DBGetMataUang(Guid.Empty, ""); dt2.DefaultView.Sort = "MataUangID ASC"; cboMataUang.DisplayMember = "MataUangID"; cboMataUang.ValueMember = "MataUangID"; cboMataUang.DataSource = dt2.DefaultView; DataTable dummyMU = new DataTable(); using (Database dbsubMU = new Database()) { dbsubMU.Commands.Add(dbsubMU.CreateCommand("usp_AppSetting_LIST")); dbsubMU.Commands[0].Parameters.Add(new Parameter("@key", SqlDbType.VarChar, "DEFMATAUANG")); dummyMU = dbsubMU.Commands[0].ExecuteDataTable(); cboMataUang.Text = dummyMU.Rows[0]["Value"].ToString(); } txtTglLunas.DateValue = GlobalVar.GetServerDate; txtUangMuka.Text = Tools.isNull(dt.Rows[0]["UangMuka"], 0).ToString(); txtPiutangPokok.Text = (Convert.ToDouble(lblHargaTotal.Text) - Convert.ToDouble(txtUangMuka.Text)).ToString(); txtPiutangBunga.Text = "0"; txtJumlahPiutang.Text = (Convert.ToDouble(lblHargaTotal.Text) - Convert.ToDouble(txtUangMuka.Text)).ToString(); numKredit.Value = 0; txtBunga.Text = "0.00"; numTgl.Value = int.Parse(String.Format("{0:dd}", txtTglLunas.DateValue)); txtAwalAngs.DateValue = txtTglLunas.DateValue; _tglJT = (DateTime)txtAwalAngs.DateValue; txtAkhirAngs.DateValue = _tglJT.AddMonths(int.Parse(numKredit.Value.ToString())); } } catch (Exception ex) { Error.LogError(ex); } }
private void frmLeasingUpdate_Load(object sender, EventArgs e) { try { this.Cursor = Cursors.WaitCursor; if (formMode == enumFormMode.Update) { DataTable dt = new DataTable(); using (Database db = new Database()) { db.Commands.Add(db.CreateCommand("usp_Leasing_LIST")); db.Commands[0].Parameters.Add(new Parameter("@RowID", SqlDbType.UniqueIdentifier, _rowID)); dt = db.Commands[0].ExecuteDataTable(); } txtNama.Text = Tools.isNull(dt.Rows[0]["Nama"], "").ToString(); txtAlamat.Text = Tools.isNull(dt.Rows[0]["Alamat"], "").ToString(); txtTelepon.Text = Tools.isNull(dt.Rows[0]["Telepon"], "").ToString(); DataTable dt2 = FillComboBox.DBGetProvinsi(Guid.Empty); dt2.DefaultView.Sort = "Nama ASC"; cboProvinsi.DisplayMember = "Nama"; cboProvinsi.ValueMember = "RowID"; cboProvinsi.DataSource = dt2.DefaultView; cboProvinsi.Text = Tools.isNull(dt.Rows[0]["Provinsi"], "").ToString(); Guid _provRowID = (Guid)cboProvinsi.SelectedValue; DataTable dt3 = FillComboBox.DBGetKota(Guid.Empty, _provRowID); dt3.DefaultView.Sort = "Nama ASC"; cboKota.DisplayMember = "Nama"; cboKota.ValueMember = "RowID"; cboKota.DataSource = dt3.DefaultView; cboKota.Text = Tools.isNull(dt.Rows[0]["Kota"], "").ToString(); } else { DataTable dt = FillComboBox.DBGetProvinsi(Guid.Empty); dt.DefaultView.Sort = "Nama ASC"; cboProvinsi.DisplayMember = "Nama"; cboProvinsi.ValueMember = "RowID"; cboProvinsi.DataSource = dt.DefaultView; Guid _provRowID = (Guid)cboProvinsi.SelectedValue; DataTable dt2 = FillComboBox.DBGetKota(Guid.Empty, _provRowID); dt2.DefaultView.Sort = "Nama ASC"; cboKota.DisplayMember = "Nama"; cboKota.ValueMember = "RowID"; cboKota.DataSource = dt2.DefaultView; // ambil dari app setting DataTable dummyPR = new DataTable(); using (Database dbsubPR = new Database()) { dbsubPR.Commands.Add(dbsubPR.CreateCommand("usp_AppSetting_LIST")); dbsubPR.Commands[0].Parameters.Add(new Parameter("@key", SqlDbType.VarChar, "PROVPEMILIKBPKB")); dummyPR = dbsubPR.Commands[0].ExecuteDataTable(); if (dummyPR.Rows.Count > 0) { cboProvinsi.Text = dummyPR.Rows[0]["Value"].ToString(); } } DataTable dummyKT = new DataTable(); using (Database dbsubKT = new Database()) { dbsubKT.Commands.Add(dbsubKT.CreateCommand("usp_AppSetting_LIST")); dbsubKT.Commands[0].Parameters.Add(new Parameter("@key", SqlDbType.VarChar, "KOTAPEMILIKBPKB")); dummyKT = dbsubKT.Commands[0].ExecuteDataTable(); if (dummyKT.Rows.Count > 0) { cboKota.Text = dummyKT.Rows[0]["Value"].ToString(); } } } } catch (Exception ex) { Error.LogError(ex); } finally { this.Cursor = Cursors.Default; } }
private void frmVendorUpdate_Load(object sender, EventArgs e) { try { this.Cursor = Cursors.WaitCursor; this.ListIdentitas(); if (formMode == enumFormMode.Update) { DataTable dt = new DataTable(); using (Database db = new Database()) { db.Commands.Add(db.CreateCommand("usp_Vendor_LIST")); db.Commands[0].Parameters.Add(new Parameter("@RowID", SqlDbType.UniqueIdentifier, _rowID)); dt = db.Commands[0].ExecuteDataTable(); txtNama.Text = Tools.isNull(dt.Rows[0]["Nama"], "").ToString(); string _idt = dt.Rows[0]["Identitas"].ToString(); switch (Tools.Left(_idt, 1)) { case "K": cboIdentitas.SelectedIndex = 1; break; case "S": cboIdentitas.SelectedIndex = 2; break; case "P": cboIdentitas.SelectedIndex = 3; break; } txtNoIdentitas.Text = Tools.isNull(dt.Rows[0]["NoIdentitas"], "").ToString(); txtAlamatIdt.Text = Tools.isNull(dt.Rows[0]["AlamatIdt"], "").ToString(); txtRTIdt.Text = Tools.isNull(dt.Rows[0]["RTIdt"], "").ToString(); txtRWIdt.Text = Tools.isNull(dt.Rows[0]["RWIdt"], "").ToString(); DataTable dtProp = FillComboBox.DBGetProvinsi(Guid.Empty); dtProp.DefaultView.Sort = "Nama ASC"; cboProvinsiIdt.DisplayMember = "Nama"; cboProvinsiIdt.ValueMember = "RowID"; cboProvinsiIdt.DataSource = dtProp.DefaultView; cboProvinsiIdt.Text = Tools.isNull(dt.Rows[0]["ProvinsiIdt"], "").ToString(); cboKotaIdt.Text = Tools.isNull(dt.Rows[0]["KotaIdt"], "").ToString(); cboKecamatanIdt.Text = Tools.isNull(dt.Rows[0]["KecamatanIdt"], "").ToString(); cboKelurahanIdt.Text = Tools.isNull(dt.Rows[0]["KelurahanIdt"], "").ToString(); txtAlamatDom.Text = Tools.isNull(dt.Rows[0]["AlamatDom"], "").ToString(); txtRTDom.Text = Tools.isNull(dt.Rows[0]["RTDom"], "").ToString(); txtRWDom.Text = Tools.isNull(dt.Rows[0]["RWDom"], "").ToString(); cboProvinsiDom.DisplayMember = "Nama"; cboProvinsiDom.ValueMember = "RowID"; cboProvinsiDom.DataSource = dtProp.DefaultView; cboProvinsiDom.Text = Tools.isNull(dt.Rows[0]["ProvinsiDom"], "").ToString(); cboKotaDom.Text = Tools.isNull(dt.Rows[0]["KotaDom"], "").ToString(); cboKecamatanDom.Text = Tools.isNull(dt.Rows[0]["KecamatanDom"], "").ToString(); cboKelurahanDom.Text = Tools.isNull(dt.Rows[0]["KelurahanDom"], "").ToString(); txtTelp.Text = Tools.isNull(dt.Rows[0]["NoTelp"], "").ToString(); txtHP.Text = Tools.isNull(dt.Rows[0]["NoHP"], "").ToString(); txtKeterangan.Text = Tools.isNull(dt.Rows[0]["Keterangan"], "").ToString(); } } else { this.ListProvinsiIdentitas(); this.ListProvinsiDomisili(); /* * DataTable dtn = new DataTable(); * dtn.Clear(); * cboKecamatanIdt.DataSource = dtn; * cboKecamatanDom.DataSource = dtn; * cboKelurahanIdt.DataSource = dtn; * cboKelurahanDom.DataSource = dtn; */ txtNama.Text = ""; txtNoIdentitas.Text = ""; txtAlamatIdt.Text = ""; txtRTIdt.Text = ""; txtRWIdt.Text = ""; cboKelurahanIdt.Text = ""; cboKecamatanIdt.Text = ""; cboKotaIdt.Text = ""; cboProvinsiIdt.Text = ""; txtAlamatDom.Text = ""; txtRTDom.Text = ""; txtRWDom.Text = ""; cboKelurahanDom.Text = ""; cboKecamatanDom.Text = ""; cboKotaDom.Text = ""; cboProvinsiDom.Text = ""; txtTelp.Text = ""; txtHP.Text = ""; txtKeterangan.Text = ""; // ambil dari app setting DataTable dummyPR = new DataTable(); using (Database dbsubPR = new Database()) { dbsubPR.Commands.Add(dbsubPR.CreateCommand("usp_AppSetting_LIST")); dbsubPR.Commands[0].Parameters.Add(new Parameter("@key", SqlDbType.VarChar, "PROVPEMILIKBPKB")); dummyPR = dbsubPR.Commands[0].ExecuteDataTable(); if (dummyPR.Rows.Count > 0) { cboProvinsiIdt.Text = dummyPR.Rows[0]["Value"].ToString(); cboProvinsiDom.Text = dummyPR.Rows[0]["Value"].ToString(); } } DataTable dummyKT = new DataTable(); using (Database dbsubKT = new Database()) { dbsubKT.Commands.Add(dbsubKT.CreateCommand("usp_AppSetting_LIST")); dbsubKT.Commands[0].Parameters.Add(new Parameter("@key", SqlDbType.VarChar, "KOTAPEMILIKBPKB")); dummyKT = dbsubKT.Commands[0].ExecuteDataTable(); if (dummyKT.Rows.Count > 0) { cboKotaIdt.Text = dummyKT.Rows[0]["Value"].ToString(); cboKotaDom.Text = dummyKT.Rows[0]["Value"].ToString(); } } } } catch (Exception ex) { Error.LogError(ex); } finally { this.Cursor = Cursors.Default; } }