Beispiel #1
0
        public int Modify(Account _item)
        {
            int result = -1;

            DataTable dt = util.CreateDT2SP();
            dt.Rows.Add("@I_ID_MASTER", util.userid);
            dt.Rows.Add("@I_ID", _item.ID);
            dt.Rows.Add("@I_PWD", util.GetSHA1(_item.PWD));
            dt.Rows.Add("@I_PWD_NEW", util.GetSHA1(_item.PWD_NEW));
            dt.Rows.Add("@I_NAME", _item.NAME);
            dt.Rows.Add("@I_MEMO", _item.MEMO);

            using (FirebirdDBHelper db = new FirebirdDBHelper(util.strFBDBConn2))
            {
                try
                {
                    db.BeginTran();
                    result = int.Parse(db.GetDataSP("UDT_USR", dt).ToString());
                    db.Commit();

                    Account __obj = _list.FirstOrDefault(x => x.ID == _item.ID);
                    __obj.NAME = _item.NAME;
                    __obj.MEMO = _item.MEMO;
                }
                catch (FirebirdSql.Data.FirebirdClient.FbException fe)
                {
                    db.Rollback();
                }
            }

            return result;
        }
Beispiel #2
0
        public void Remove(Account _item)
        {
            DataTable dt = util.CreateDT2SP();
            dt.Rows.Add("@I_ID", _item.ID);

            using (FirebirdDBHelper db = new FirebirdDBHelper(util.strFBDBConn2))
            {
                try
                {
                    db.BeginTran();
                    db.ExcuteSP("RMV_USR", dt);
                    db.Commit();

                    Account __obj = _list.FirstOrDefault(x => x.ID == _item.ID);
                    _list.Remove(__obj);
                }
                catch (FirebirdSql.Data.FirebirdClient.FbException fe)
                {
                    db.Rollback();
                }
            }
        }
Beispiel #3
0
        public void Add(Account _item)
        {
            DataTable dt = util.CreateDT2SP();
            dt.Rows.Add("@I_ID", _item.ID);
            dt.Rows.Add("@I_PWD", util.GetSHA1(_item.PWD));
            dt.Rows.Add("@I_NAME", _item.NAME);
            dt.Rows.Add("@I_MEMO", _item.MEMO);

            using (FirebirdDBHelper db = new FirebirdDBHelper(util.strFBDBConn2))
            {
                try
                {
                    db.BeginTran();
                    db.ExcuteSP("INS_USR", dt);
                    db.Commit();

                    _list.Add(_item);
                }
                catch (FirebirdSql.Data.FirebirdClient.FbException fe)
                {
                    db.Rollback();
                }
            }
        }