Exemple #1
0
        public virtual long loadFromDB(string key, UserObjectFactory oFactory)
        {
            long ret = 0;

            //necessario remover os zeros a esquerda...
            key = "" + Convert.ToInt32(key);
            userTable.GetByKey(key);
            code = userTable.Code;
            name = userTable.Name;

            return(ret);
        }
Exemple #2
0
        public virtual void loadKey(UserObjectFactory oFactory)
        {
            Recordset rs = null;

            try
            {
                rs = (Recordset)oFactory.OConnection.Company.GetBusinessObject(BoObjectTypes.BoRecordset);
                //rs.DoQuery("SELECT MAX(CONVERT(INT, Code))+1[Code] FROM [@" + userTable.TableName + "]");
                //code = Convert.ToString(rs.Fields.Item("Code").Value);

                code           = Convert.ToString(Convert.ToInt32(DB.DBFacade.getInstance().Max("[@" + userTable.TableName + "]")) + 1);
                name           = code;
                userTable.Code = code;
                userTable.Name = name;
            }
            catch (Exception e)
            {
                if (rs != null && rs.RecordCount > 0)
                {
                    code = "1";
                }
            }
        }