public Fa_Clien GetFaClien(int emp_codi, string cli_coda, string cli_clav)
        {
            OException oException = new OException();

            try
            {
                StringBuilder sql = new StringBuilder();
                sql.Append("  SELECT *                    ");
                sql.Append("  FROM   FA_CLIEN             ");
                sql.Append("  WHERE  EMP_CODI = @EMP_CODI      ");
                sql.Append("  AND CLI_CODA = @CLI_CODA   ");
                sql.Append("  AND CLI_ESTA = 'A'          ");
                sql.Append(" AND CLI_CLAV = @CLI_CLAV");
                List <SQLParams> sQLParams = new List <SQLParams>();
                sQLParams.Add(new SQLParams("EMP_CODI", emp_codi));
                sQLParams.Add(new SQLParams("CLI_CODA", cli_coda));
                sQLParams.Add(new SQLParams("CLI_CLAV", cli_clav));
                return(new DbConnection().Get <Fa_Clien>(sql.ToString(), sQLParams));
            }
            catch (Exception ex)
            {
                oException.Throw(this.GetType().ToString(), "GetFaClien", ex);
                return(null);
            }
        }
        public void ShouldAtemptGenerateInsertDocumentAndContent_ThrowsException()
        {
            OException ex = Assert.Throws <OException>(new TestDelegate(GenerateInvalidInsertStatementUsingObject));

            Assert.That(ex.Type, Is.EqualTo(OExceptionType.Query));
            Assert.That(ex.Message, Is.EqualTo("Cannot have SET and CONTENT keywords in the same query"));
        }
        public void ShouldAtemptGenerateUpdateContentAndSetQuery_ThrowsException()
        {
            OException ex = Assert.Throws <OException>(new TestDelegate(GenerateInvalidKeywordCombinationUpdateStatement));

            Assert.That(ex.Type, Is.EqualTo(OExceptionType.Query));
            Assert.That(ex.Message, Is.EqualTo("Only one Keyword of SET|ADD|REMOVE|CONTENT|MERGE is allowed in query"));
        }
Esempio n. 4
0
        /// <summary>
        /// Retorna toda la lista de empresas existentes
        /// </summary>
        /// <returns></returns>
        public List <Gn_Empre> GetGnEmpre()
        {
            OException o = new OException();

            try
            {
                StringBuilder sql = new StringBuilder();

                sql.Append("SELECT * FROM GN_EMPRE ");
                List <SQLParams> sQLParams = new List <SQLParams>();
                return(new DbConnection().GetList <Gn_Empre>(sql.ToString(), sQLParams));
            }
            catch (Exception ex)
            {
                o.Throw("DAO_Gn_Empre", "GetGnEmpre", ex);
                return(null);
            }
        }
        public String GetCliCoda(int emp_codi, int cli_codi)
        {
            OException oException = new OException();

            try
            {
                StringBuilder sql = new StringBuilder();
                sql.Append("  SELECT CLI_CODA                    ");
                sql.Append("  FROM   FA_CLIEN             ");
                sql.Append("  WHERE  EMP_CODI = @EMP_CODI      ");
                sql.Append("  AND CLI_CODI = @CLI_CODI   ");
                sql.Append("  AND CLI_ESTA = 'A'          ");
                List <SQLParams> sQLParams = new List <SQLParams>();
                sQLParams.Add(new SQLParams("EMP_CODI", emp_codi));
                sQLParams.Add(new SQLParams("CLI_CODI", cli_codi));
                var result = new DbConnection().ExecuteScalar(sql.ToString(), sQLParams);
                return(result == null ? "" : (string)result);
            }
            catch (Exception ex)
            {
                oException.Throw(this.GetType().ToString(), "GetFaClien", ex);
                return(null);
            }
        }
Esempio n. 6
0
        public List <TOXbAuliq> GetAuliquidacion(short emp_codi, long cli_codi, Boolean saldo = true)
        {
            OException exception = new OException();

            try
            {
                StringBuilder sql = new StringBuilder();

                sql.Append("SELECT RCX.ITE_CTSE,    CXC.EMP_CODI,                            ");
                sql.Append("ITE.ITE_CODI,                                       ");
                sql.Append("ITE.ITE_NOMB CTS_NOMB,                              ");
                sql.Append("RCX.RCX_VIGE,                                       ");
                sql.Append("TOPE.TOP_CODI,                                      ");
                sql.Append("TOPE.TOP_NOMB,                                      ");
                sql.Append("CXC.CXC_DESC,                                       ");
                sql.Append("CXC.CXC_TOTA,                                       ");
                sql.Append("CXC.CXC_SALD,                                       ");
                sql.Append("CXC.CXC_CONT,                                       ");
                sql.Append("CXC.CXC_FEVE,                                         ");
                sql.Append("CXC.DCL_CODD,                                       ");
                sql.Append("CXC.CXC_FUPA                                       ");
                sql.Append("FROM   CA_CXCOB CXC                                 ");
                sql.Append("INNER JOIN CA_RCXCV RCX                             ");
                sql.Append("ON CXC.EMP_CODI = RCX.EMP_CODI                      ");
                sql.Append("AND CXC.CXC_CONT = RCX.CXC_CONT                     ");
                sql.Append("INNER JOIN GN_TOPER TOPE                            ");
                sql.Append("ON CXC.EMP_CODI = TOPE.EMP_CODI                     ");
                sql.Append("AND CXC.TOP_CODI = TOPE.TOP_CODI                    ");
                sql.Append("INNER JOIN GN_ITEMS ITE                             ");
                sql.Append("ON RCX.ITE_CTSE = ITE.ITE_CONT                      ");
                sql.Append("WHERE CXC.EMP_CODI = @EMP_CODI                            ");
                sql.Append("AND CXC.CLI_CODI = @CLI_CODI                        ");
                sql.Append("AND CXC.TOP_CODI = (SELECT PCE.TOP_COCO             ");
                sql.Append("                FROM   XB_PCECA PCE                 ");
                sql.Append("                WHERE PCE.EMP_CODI = @EMP_CODI)     ");
                if (saldo)
                {
                    sql.Append("AND CXC.CXC_SALD > 0                                ");
                }
                sql.Append("UNION                                               ");
                sql.Append("SELECT                                              ");
                sql.Append("CPC.ITE_CTSE,  CXC.EMP_CODI,                                         ");
                sql.Append("ITE.ITE_CODI,                                       ");
                sql.Append("ITE.ITE_NOMB CTS_NOMB,                              ");
                sql.Append("CPC.RVM_VIGE,                                       ");
                sql.Append("TOPE.TOP_CODI,                                      ");
                sql.Append("TOPE.TOP_NOMB,                                      ");
                sql.Append("CXC.CXC_DESC,                                       ");
                sql.Append("CXC.CXC_TOTA,                                       ");
                sql.Append("CXC.CXC_SALD,                                       ");
                sql.Append("CXC.CXC_CONT,                                       ");
                sql.Append("CXC.CXC_FEVE,                                       ");
                sql.Append("CXC.DCL_CODD,                                        ");
                sql.Append("CXC.CXC_FUPA                                       ");
                sql.Append("FROM   CA_CXCOB CXC                                 ");
                sql.Append("INNER JOIN CA_RVMSA CPC                             ");
                sql.Append("ON CXC.EMP_CODI = CPC.EMP_CODI                      ");
                sql.Append("AND CXC.CXC_CONT = CPC.CXC_CONT                     ");
                sql.Append("INNER JOIN GN_TOPER TOPE                            ");
                sql.Append("ON CXC.EMP_CODI = TOPE.EMP_CODI                     ");
                sql.Append("AND CXC.TOP_CODI = TOPE.TOP_CODI                    ");
                sql.Append("INNER JOIN GN_ITEMS ITE                             ");
                sql.Append("ON CPC.ITE_CTSE = ITE.ITE_CONT                      ");
                sql.Append("WHERE CXC.EMP_CODI = @EMP_CODI                      ");
                sql.Append("AND CXC.CLI_CODI = @CLI_CODI                        ");
                sql.Append("AND CXC.TOP_CODI = (SELECT PCE.TOP_CORE             ");
                sql.Append("                FROM   XB_PCECA PCE                 ");
                sql.Append("                WHERE PCE.EMP_CODI = @EMP_CODI)     ");
                if (saldo)
                {
                    sql.Append("AND CXC.CXC_SALD > 0                                ");
                }


                List <SQLParams> sQLParams = new List <SQLParams>();
                sQLParams.Add(new SQLParams("EMP_CODI", emp_codi));
                sQLParams.Add(new SQLParams("CLI_CODI", cli_codi));
                return(new DbConnection().GetList <TOXbAuliq>(sql.ToString(), sQLParams));
            }
            catch (Exception ex)
            {
                exception.Throw(this.GetType().Name, "GetAuliquidacion", ex);
                return(null);
            }
        }