public void Insert(object sender, EventArgs e) { using (uscPutniNalog user_control = new uscPutniNalog(Enums.FormEditMode.Insert)) { if (user_control.ShowDialogForm("Unos putnog naloga") == DialogResult.OK) { try { BusinessLogic.pSelectedIndex = ugdRegistarNabave.ActiveRow.Index; } catch { } LoadGridPutniNalog(); } } }
public void Update(object sender, EventArgs e) { if (ugdRegistarNabave.ActiveRow != null) { BusinessLogic.pID = (int)ugdRegistarNabave.ActiveRow.Cells["ID"].Value; BusinessLogic.pID_Radnik = (int)ugdRegistarNabave.ActiveRow.Cells["Šifra radnika"].Value; BusinessLogic.pDatumPutnogNaloga = (DateTime)ugdRegistarNabave.ActiveRow.Cells["Datum putnog naloga"].Value; BusinessLogic.pID_Likvidator = (int)ugdRegistarNabave.ActiveRow.Cells["ID_Likvidator"].Value; BusinessLogic.pSifraPutnogNaloga = ugdRegistarNabave.ActiveRow.Cells["Šifra putnog naloga"].Value.ToString(); BusinessLogic.pID_NacinIsplate = (int)ugdRegistarNabave.ActiveRow.Cells["ID_NacinIsplate"].Value; BusinessLogic.pTroskoviPutovanja = (decimal)ugdRegistarNabave.ActiveRow.Cells["TroskoviPutovanja"].Value; BusinessLogic.pTroskoviVlastitogVozila = (decimal)ugdRegistarNabave.ActiveRow.Cells["TroskoviVlastitogVozila"].Value; BusinessLogic.pOstaliTroskovi = (decimal)ugdRegistarNabave.ActiveRow.Cells["OstaliTroskovi"].Value; BusinessLogic.pDnevnice = (decimal)ugdRegistarNabave.ActiveRow.Cells["Dnevnice"].Value; BusinessLogic.pTroskoviSmjestaja = (decimal)ugdRegistarNabave.ActiveRow.Cells["TroskoviSmjestaja"].Value; BusinessLogic.pIsTroskoviSmjestaja = (bool)ugdRegistarNabave.ActiveRow.Cells["IsTroskoviSmjestaja"].Value; BusinessLogic.pIsTroskoviAutoputa = (bool)ugdRegistarNabave.ActiveRow.Cells["IsTroskoviAutoputa"].Value; BusinessLogic.pIsDrugiTroskovi = (bool)ugdRegistarNabave.ActiveRow.Cells["IsDrugiTroskovi"].Value; BusinessLogic.pAkontacija = (decimal)ugdRegistarNabave.ActiveRow.Cells["Akontacija"].Value; if (ugdRegistarNabave.ActiveRow.Cells["DatumObracuna"].Value != DBNull.Value) { BusinessLogic.pDatumObracuna = (DateTime)ugdRegistarNabave.ActiveRow.Cells["DatumObracuna"].Value; } else { BusinessLogic.pDatumObracuna = null; } BusinessLogic.pVrstaRadnika = Convert.ToInt16(ugdRegistarNabave.ActiveRow.Cells["VrstaDjelatnika"].Value); using (uscPutniNalog user_control = new uscPutniNalog(Enums.FormEditMode.Update)) { if (user_control.ShowDialogForm("Unos putnog naloga") == DialogResult.OK) { try { BusinessLogic.pSelectedIndex = ugdRegistarNabave.ActiveRow.Index; } catch { } LoadGridPutniNalog(); } } } }