Ejemplo n.º 1
0
Archivo: User.cs Proyecto: oeli/yafra
        public void LoadProfile(string Auser)
        {
            dbt = new DBtools(tdb.User.Uhelper, tdb.User.Udbcon);
            tdb.Season sai = new tdb.Season();
            tdb.Language lang = new tdb.Language();
            tdb.Customer pers = new tdb.Customer();
            ProfileDS prof;
            string sql;

            // load profile from DB by user name
            prof = new ProfileDS();
            sql = String.Format("Select * from tdbadmin.mp_profil where mpuser like '{0}'", Auser);
            dbt.FillDS(prof, sql, new string[] { "mp_profil" });
            ProfileDS.mp_profilRow Rprof = prof.mp_profil[0];

            // set now the user profile data
            // Console.WriteLine("Prof Id {0}", Rprof.MPID);
            Useclevel = Rprof.SECLEVEL;
            Ulangid = Rprof.S_ID;
            if (Ulangid > 0)
                Ulang = lang.GetBez(Ulangid);
            else
                Ulang = "";
            Uofficeid = Rprof.BCHST;
            if (Uofficeid > 0)
                Uoffice = pers.GetBez(Uofficeid);
            else
                Ulang = "";
            Udlatid = Rprof.DLAT_ID;
            Usaiid = Rprof.SAI_ID;
            if (Usaiid > 0)
                Usai = sai.GetBez(Usaiid);
            else
                Usai = "";
        }
Ejemplo n.º 2
0
        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();
        }
Ejemplo n.º 3
0
Archivo: User.cs Proyecto: oeli/yafra
        public void LoadProfile(string Auser)
        {
            dbt = new DBtools(tdb.User.Uhelper, tdb.User.Udbcon);
            tdb.Season   sai  = new tdb.Season();
            tdb.Language lang = new tdb.Language();
            tdb.Customer pers = new tdb.Customer();
            ProfileDS    prof;
            string       sql;

            // load profile from DB by user name
            prof = new ProfileDS();
            sql  = String.Format("Select * from tdbadmin.mp_profil where mpuser like '{0}'", Auser);
            dbt.FillDS(prof, sql, new string[] { "mp_profil" });
            ProfileDS.mp_profilRow Rprof = prof.mp_profil[0];

            // set now the user profile data
            // Console.WriteLine("Prof Id {0}", Rprof.MPID);
            Useclevel = Rprof.SECLEVEL;
            Ulangid   = Rprof.S_ID;
            if (Ulangid > 0)
            {
                Ulang = lang.GetBez(Ulangid);
            }
            else
            {
                Ulang = "";
            }
            Uofficeid = Rprof.BCHST;
            if (Uofficeid > 0)
            {
                Uoffice = pers.GetBez(Uofficeid);
            }
            else
            {
                Ulang = "";
            }
            Udlatid = Rprof.DLAT_ID;
            Usaiid  = Rprof.SAI_ID;
            if (Usaiid > 0)
            {
                Usai = sai.GetBez(Usaiid);
            }
            else
            {
                Usai = "";
            }
        }
Ejemplo n.º 4
0
        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();
        }