Example #1
0
        public static bool registerUser(string login, string password, string cpf)
        {
            bool   result = false;
            string sql    = "INSERT INTO `ROS_PERSON`(`PER_NAME`,`PER_CPF`, `PER_RG_CTPS`) " +
                            "VALUES(\"" + login + "\", \"" + cpf + "\", NULL);";

            try
            {
                using (DatabaseROS db = new DatabaseROS())
                {
                    long personId = db.executeScalarSQL(sql);
                    if (personId == -1)
                    {
                        throw new ArgumentException("Problema ao cadastrar usuário com este CPF");
                    }
                    else
                    {
                        string userSql = "INSERT INTO `ROS_USER`(`USR_LOGIN`,`USR_PASSWORD`, `USR_PER_ID`, `USR_PRO_ID`) " +
                                         "VALUES(\"" + login + "\", \"" + password + "\", " + personId + ", \"1\");";
                        db.executeCommandSQL(userSql);
                    }
                }
                result = true;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(result);
        }
Example #2
0
        public static long registerPerson(string name, string cpf, string rg_ctps)
        {
            string sql = "INSERT INTO `ROS_PERSON`(`PER_NAME`,`PER_CPF`, `PER_RG_CTPS`) " +
                         "VALUES(\"" + name + "\", \"" + cpf + "\", \"" + rg_ctps + "\");";
            long id;

            try
            {
                using (DatabaseROS db = new DatabaseROS())
                {
                    id = db.executeScalarSQL(sql);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(id);
        }
Example #3
0
        public static long registerSecurityCertificate(long supplierId, long certId, string date)
        {
            string sql = "INSERT INTO ROS_SECURITY_CERTIFICATE (SEC_SUP_ID, SEC_CET_ID, SEC_DATE)" +
                         "VALUES(" + supplierId + "," + certId + ",\"" + date + "\");";
            long id;

            try
            {
                using (DatabaseROS db = new DatabaseROS())
                {
                    id = db.executeScalarSQL(sql);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(id);
        }
Example #4
0
        public static long registerSupplier(long personId, long companyId)
        {
            string sql = "INSERT INTO `ROS_SUPPLIER`(`SUP_PER_ID`, `SUP_COM_ID`) " +
                         "VALUES(" + personId + "," + companyId + ");";
            long id;

            try
            {
                using (DatabaseROS db = new DatabaseROS())
                {
                    id = db.executeScalarSQL(sql);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(id);
        }
Example #5
0
        public static long registerCompany(string name)
        {
            string sql = "INSERT INTO `ROS_COMPANY`(`COM_NAME`) " +
                         "VALUES(\"" + name + "\");";
            long id;

            try
            {
                using (DatabaseROS db = new DatabaseROS())
                {
                    id = db.executeScalarSQL(sql);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(id);
        }