Beispiel #1
0
        public BE_Json UpdateOptionGeneral([FromBody] BE_Option bE_Option)
        {
            BE_Json objJson     = null;
            var     objListaAux = string.Empty;

            try
            {
                BL_Option bL_Option = new BL_Option(AppConfig.DbConnection);
                // bL_Option.connectionString = AppConfig.DbConnection;
                objListaAux = JsonConvert.SerializeObject(bL_Option.UpdateOptionGeneral(bE_Option));

                objJson        = new BE_Json();
                objJson.data   = objListaAux;
                objJson.status = CManager.RESULTADO_WCF.OK;
            }
            catch (Exception ex)
            {
                objJson        = new BE_Json();
                objJson.data   = "Hubo en error en servidor:" + ex.Message + ";" + ex.StackTrace + ";" + ex.ToString();
                objJson.status = CManager.RESULTADO_WCF.ERROR;
                objJson.status = CManager.RESULTADO_WCF.ERROR;
            }
            finally
            {
                objListaAux = null;
            }
            return(objJson);
        }
Beispiel #2
0
        public BE_Json GetOptionMenuByUserName(string userName, bool?isMenu)
        {
            BE_Json objJson     = null;
            var     objListaAux = string.Empty;

            try
            {
                BL_Option bL_Option = new BL_Option(AppConfig.DbConnection);
                //bL_Option.connectionString = AppConfig.DbConnection;
                objListaAux = JsonConvert.SerializeObject(bL_Option.GetOptionMenuByUserName(userName, (isMenu == null)? false: (bool)isMenu));

                objJson        = new BE_Json();
                objJson.data   = objListaAux;
                objJson.status = CManager.RESULTADO_WCF.OK;
            }
            catch (Exception ex)
            {
                objJson        = new BE_Json();
                objJson.data   = "Hubo en error en servidor:" + ex.Message + ";" + ex.StackTrace + ";" + ex.ToString();
                objJson.status = CManager.RESULTADO_WCF.ERROR;
                objJson.status = CManager.RESULTADO_WCF.ERROR;
            }
            finally
            {
                objListaAux = null;
            }
            return(objJson);
        }
Beispiel #3
0
        /*
         * public VE_Invoice updateInvoiceGeneral(VE_Invoice _vE_Invoice)
         * {
         *  _database = new MySQLDatabase(connectionString);
         *  return new DA_Invoice(_database).updateInvoiceGeneral(_vE_Invoice);
         * }*/

        public VE_Invoice updateInvoiceGeneral(VE_Invoice _VeInvoice)
        {
            _database = new MySQLDatabase(connectionString);

            BL_Option bL_Option = new BL_Option(this.connectionString);
            //bL_Option.connectionString = connectionString;
            var ok = bL_Option.ValidateOption(9, _VeInvoice.userName);

            if (ok == 0)
            {
                throw new ApplicationException("Ud. no cuenta con los permisos necesarios");
            }

            if (_VeInvoice.documentId != null)
            {
                var numbers = _VeInvoice.documentId.Split('-');
                if (numbers.Count() < 2)
                {
                    throw new ApplicationException("Ingrese una factura válida");
                }
                _VeInvoice.nroSerie       = numbers[0];
                _VeInvoice.nroComprobante = numbers[1];
            }


            new DA_Invoice(_database).updateInvoiceGeneral(_VeInvoice);

            var invoice = new DA_Invoice(_database).getInvoiceGeneral(new BEInvoiceFilter {
                invoiceIdList = _VeInvoice.invoiceId
            });

            if (_VeInvoice.invoiceStatusId != invoice[0].invoiceStatusId)
            {
                BL_WorkFlow _blWorkFlow = new BL_WorkFlow();
                _blWorkFlow.connectionString = connectionString;
                var  mensaje = "";
                bool bOk     = false;
                if (_VeInvoice.invoiceStatusId == 2)
                {
                    bOk = _blWorkFlow.NextWorkFlowStep(ref mensaje, 9, int.Parse(_VeInvoice.invoiceId), _VeInvoice.userName, false);
                }
                else
                {
                    bOk = _blWorkFlow.NextWorkFlowStep(ref mensaje, 1, int.Parse(_VeInvoice.invoiceId), _VeInvoice.userName, false);
                }

                if (!bOk)
                {
                    throw new ApplicationException(mensaje);
                }
            }
            new DA_Invoice(_database).DeleteInvoiceDetailByInvoiceId(_VeInvoice.invoiceId);

            if (_VeInvoice.invoiceDetail != null)
            {
                foreach (VE_InvoiceDetail _veInvoiceDetail in _VeInvoice.invoiceDetail)
                {
                    _veInvoiceDetail.invoiceId = int.Parse(_VeInvoice.invoiceId);
                    new DA_Invoice(_database).createInvoiceDetail(_veInvoiceDetail);
                }
            }
            return(_VeInvoice);
        }