} //end ulozSlevyDoDB internal static bool smazStarouDavkuSlev(Session sesna, int extApp, string davka, string perioda, ref POPLATNIK_SLEVA_RESP resp) { try { sesna.ExecuteNonQuery("delete from P_ODPADY_EULEVY where ZPRAC = 'I' and EA = " + extApp.ToString() + " and DAVKA = '" + davka + "'"); sesna.ExecuteNonQuery("delete from P_ODPADY_EULEVY where ZPRAC = 'I' and EA = " + extApp.ToString() + " and PER = '" + perioda + "'"); return(true); } catch (Exception e) { resp.ERRORMESS = string.Format("Chyba odmazání dávky {0}. \n", davka, e.Message); resp.result = Result.ERROR; resp.status = Status.ERROR; return(false); } }
internal static void ulozSlevyDoDB(Session sesna, int EXT_APP_KOD, POPLATNIK_SLEVA sleva, ref POPLATNIK_SLEVA_RESP resp) { try { DBUtil dbu = new DBUtil(sesna); MyUnitOfWork uow = new MyUnitOfWork(sesna.DataLayer); P_ODPADY_EULEVY pul = null; foreach (SLEVA item in sleva.SLEVA) { pul = new P_ODPADY_EULEVY(uow); pul.EUL_ID = dbu.LIZNI_SEQ("P_ODPADY_EULEVY_ID"); pul.DAVKA = sleva.DAVKA_ID; pul.EA = EXT_APP_KOD; pul.POPL = sleva.POPLATEK; pul.PER = sleva.PERIODA; pul.ROK = sleva.ROK; pul.KC_ZAPER = item.SLEVA_KC; pul.VS = item.VS; pul.ZPRAC = "I"; pul.Save(); } uow.CommitTransaction(); uow.Dispose(); resp.ZPRACOVANO = sleva.SLEVA.Count(); } catch (Exception e) { resp.result = Result.ERROR; resp.status = Status.ERROR; resp.ERRORMESS = "PlatceZaKOSleva - Chyba při ukládání dávky" + e.Message; } } //end ulozSlevyDoDB