public void InsUpd(bool Ainsert, string Abez, string Acode, string Atext, int Aprgid, DateTime Adat) { int rowsaffected = 0, udat; string sql; // set Country to this new one bez = Abez; code = Acode; text = Atext; prg_id = Aprgid; tdb.Prg P = new tdb.Prg(); P.Get(prg_id, ref rowsaffected); tdb.Season S = new tdb.Season(); S.Get(P.ObjSaiid, ref rowsaffected); svon = S.ObjFrom; sbis = S.ObjTo; sai = S.ObjBez; if (Adat < svon || Adat > sbis) { id = -2; return; } sai_id = P.ObjSaiid; udat = Datetime.ToUnix(Adat); // Begin Trx BeginTrx(); if (Ainsert) { // first get a new unique ID for bez and then sai id = NewId("arrangement", "ARR_ID"); rowsaffected = InsBez(); rowsaffected = InsText(); // insert sql = String.Format("insert into tdbadmin.arrangement values({0}, '{1}', {2}, {3}, {4}, {5}, {6})", id, code, bez_id, udat, prg_id, text_id, sai_id); rowsaffected = DBcmd(sql); } else { rowsaffected = UpdBez(); rowsaffected = UpdText(); // update sai sql = String.Format("update tdbadmin.arrangement set code = '{0}', textid = {1}, prg_id = {2}, a_dat = {3}, sai_id = {4} where arr_id = {5}", code, text_id, prg_id, udat, sai_id, id); rowsaffected = DBcmd(sql); } // commit Commit(); }
public void InsUpd(bool Ainsert, string Abez, string Atext, int Aparentid, string Acode, int Asupid, int Aofftype, DateTime Aduration, int Aactid, int Afromcity, int Atocity, int Aorder, string Alocation) { int udat, rowsaffected = 0; string sql; // set to new one bez = Abez; text = Atext; code = Acode; parentid = Aparentid; supid = Asupid; fromcity = Afromcity; tocity = Atocity; duration = Aduration; udat = Datetime.ToUnix(Aduration); order = Aorder; location = Alocation; offtype = Aofftype; actid = Aactid; // Begin Trx BeginTrx(); if (Ainsert) { // first get a new unique ID for bez and then sai id = NewId("dienst_angebot", "DLA_ID"); rowsaffected = InsBez(); rowsaffected = InsText(); // insert sql = String.Format("insert into tdbadmin.dienst_angebot values({0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}, {10}, {11}, {12})", id, code, parentid, order, supid, bez_id, actid, location, offtype, udat, text_id, fromcity, tocity); rowsaffected = DBcmd(sql); } else { rowsaffected = UpdBez(); rowsaffected = UpdText(); // update sai sql = String.Format("update tdbadmin.dienst_angebot set code = {0}, h_dla_id = {1}, ord = {2}, dlt_id = {3}, akt_id = {4}, ort = {5}, art_id = {6}, art_id = {7}, dau = {8}, textid = {9}, von = {10}, nach = {11} where dla_id = {12}", code, parentid, order, supid, actid, location, offtype, udat, text_id, fromcity, tocity, id); rowsaffected = DBcmd(sql); } // commit Commit(); }
public void InsUpd(bool Ainsert, string Abez, string Atext, string Acode, int Aseasonid, DateTime Astartdate, DateTime Aenddate) { int rowsaffected = 0, udat, udat2; string sql; // set to new one bez = Abez; text = Atext; code = Acode; startdate = Astartdate; udat = Datetime.ToUnix(startdate); enddate = Aenddate; udat2 = Datetime.ToUnix(enddate); seasonid = Aseasonid; // Begin Trx BeginTrx(); if (Ainsert) { // first get a new unique ID for bez and then sai id = NewId("dlg_parts", "DL_ID"); rowsaffected = InsBez(); rowsaffected = InsText(); // insert sql = String.Format("insert into tdbadmin.dlg_parts values({0}, {1}, {2}, {3}, {4}, {5}, {6})", id, code, bez_id, text_id, seasonid, udat, udat2); rowsaffected = DBcmd(sql); } else { rowsaffected = UpdBez(); rowsaffected = UpdText(); // update sai sql = String.Format("update tdbadmin.dlg_parts set sai_id = {0}, a_zeit = {1}, e_zeit = {2}, code = {3}, textid = {4} where dl_id = {5}", seasonid, udat, udat2, code, text_id, id); rowsaffected = DBcmd(sql); } // commit Commit(); }
public void InsUpd(bool Ainsert, string Abez, string Acode, DateTime Avon, DateTime Abis, string Atext) { int rowsaffected, uvon, ubis; string sql; // set season to this new one bez = Abez; code = Acode; von = Avon; bis = Abis; text = Atext; // convert to unix timestamp uvon = Datetime.ToUnix(Avon); ubis = Datetime.ToUnix(Abis); // Begin Trx BeginTrx(); if (Ainsert) { // first get a new unique ID for bez and then sai id = NewId("saison", "SAI_ID"); rowsaffected = InsBez(); rowsaffected = InsText(); // insert sai sql = String.Format("insert into tdbadmin.saison values({0}, '{1}', {2}, {3}, {4}, {5})", id, Acode, bez_id, uvon, ubis, text_id); rowsaffected = DBcmd(sql); } else { // update bez with user lang rowsaffected = UpdBez(); rowsaffected = UpdText(); // update sai sql = String.Format("update tdbadmin.saison set code = '{0}', von = {1}, bis = {2}, textid = {3} where sai_id = {4}", code, uvon, ubis, text_id, id); rowsaffected = DBcmd(sql); } // commit Commit(); }