Пример #1
0
        private static void FillProperties(LabelModel labelModel, SAPbobsCOM.UserTable userTable)
        {
            userTable.Name = labelModel.Name;
            userTable.UserFields.Fields.Item(nameof(LabelModel.U_PrinterName)).Value = labelModel.U_PrinterName;

            userTable.UserFields.Fields.Item(nameof(LabelModel.U_LabelAlignTop)).Value  = labelModel.U_LabelAlignTop;
            userTable.UserFields.Fields.Item(nameof(LabelModel.U_LabelAlignLeft)).Value = labelModel.U_LabelAlignLeft;
            userTable.UserFields.Fields.Item(nameof(LabelModel.U_Width)).Value          = labelModel.U_Width;
            userTable.UserFields.Fields.Item(nameof(LabelModel.U_Length)).Value         = labelModel.U_Length;

            if (!string.IsNullOrEmpty(labelModel.U_ZplCode))
            {
                userTable.UserFields.Fields.Item(nameof(LabelModel.U_ZplCode)).Value = labelModel.U_ZplCode;
            }
            if (!string.IsNullOrEmpty(labelModel.U_Query))
            {
                userTable.UserFields.Fields.Item(nameof(LabelModel.U_Query)).Value = labelModel.U_Query;
            }
            if (!string.IsNullOrEmpty(labelModel.U_FieldsName))
            {
                userTable.UserFields.Fields.Item(nameof(LabelModel.U_FieldsName)).Value = labelModel.U_FieldsName;
            }

            userTable.UserFields.Fields.Item(nameof(LabelModel.U_DecimalPlaces)).Value = labelModel.U_DecimalPlaces;
            userTable.UserFields.Fields.Item(nameof(LabelModel.U_NColumns)).Value      = labelModel.U_NColumns;
        }
        public static void getTransaccionbyId(string idLog)
        {
            Procesos.responseStatus = "";
            try
            {
                string documento, fecha, request;
                SAPbobsCOM.UserTables tbls = null;
                SAPbobsCOM.UserTable  tbl  = null;

                tbls = Procesos.oCompany.UserTables;
                tbl  = tbls.Item("FEDIAN_MONITORLOG");

                tbl.GetByKey(idLog.ToString());

                request   = tbl.UserFields.Fields.Item("U_Det_Peticion").Value;
                documento = tbl.UserFields.Fields.Item("U_Prefijo").Value + tbl.UserFields.Fields.Item("U_Folio").Value;
                fecha     = (tbl.UserFields.Fields.Item("U_Fecha_Envio").Value).ToString("yyyymm");

                ServiceClient Cl = new ServiceClient();
                var           R  = Cl.GetTransaccionbyIdentificacion(documento, fecha);

                Procesos.UpdateLogConexus(idLog, R, request);

                System.Runtime.InteropServices.Marshal.ReleaseComObject(tbls);
                tbls = null;
                System.Runtime.InteropServices.Marshal.ReleaseComObject(tbl);
                tbl = null;
                GC.Collect();
            }
            catch (Exception ex)
            {
                Procesos.EscribirLogFileTXT("getTransaccionbyId: " + ex.Message);
            }
        }
Пример #3
0
        public void WriteLogTable(SAPbobsCOM.Company company, string tipoDocumento, string numVtex, string numSAP, string status, string mensagem)
        {
            try
            {
                if (company.Connected)
                {
                    SAPbobsCOM.UserTable userTableLog = (SAPbobsCOM.UserTable)company.UserTables.Item("LOG_INTPLUGGTO");

                    userTableLog.UserFields.Fields.Item("U_data").Value          = DateTime.Now.ToString();
                    userTableLog.UserFields.Fields.Item("U_tipoDocumento").Value = tipoDocumento;
                    userTableLog.UserFields.Fields.Item("U_numPluggto").Value    = numVtex;
                    userTableLog.UserFields.Fields.Item("U_numSAP").Value        = numSAP;
                    userTableLog.UserFields.Fields.Item("U_status").Value        = status;
                    userTableLog.UserFields.Fields.Item("U_mensagem").Value      = mensagem;

                    userTableLog.Add();

                    System.Runtime.InteropServices.Marshal.ReleaseComObject(userTableLog);
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #4
0
        private void Button0_ClickBefore(object sboObject, SAPbouiCOM.SBOItemEventArg pVal, out bool BubbleEvent)
        {
            BubbleEvent = true;


            oUserTable = oCompany.UserTables.Item("SECCIONESCOL");
            //hago un getbykey para obtener el valor key necesario para actualizar los datos
            if (oUserTable.GetByKey(EditText0.Value.ToString()))
            {
                // oUserTable.UserFields.Fields.Item("U_CodigoEDC").Value = EditText0.Value.ToString();
                oUserTable.UserFields.Fields.Item("U_NombreSEC").Value = EditText1.Value.ToString();
            }
            oUserTable.UserFields.Fields.Item("U_SupraSeccionSEC").Value = EditText2.Value.ToString();
            oUserTable.UserFields.Fields.Item("U_PrecioSEC").Value       = EditText4.Value.ToString();


            //oUserTable.Update();


            int i = oUserTable.Update();

            //oApp.SetStatusBarMessage("valor"+ i);
            if (i != 0)
            {
                oApp.SetStatusBarMessage("Error en la actualización: " + oCompany.GetLastErrorDescription(), SAPbouiCOM.BoMessageTime.bmt_Medium, false);
            }
            else
            {
                oApp.SetStatusBarMessage("Exito en la actualizacón", SAPbouiCOM.BoMessageTime.bmt_Medium, false);
                //oForm = oApp.Forms.Item("fmacted");
                //oForm.Close();
            }
        }
Пример #5
0
        private void Button0_ClickBefore(object sboObject, SAPbouiCOM.SBOItemEventArg pVal, out bool BubbleEvent)
        {
            BubbleEvent = true;

            oUserTable      = oCompany.UserTables.Item("SECCIONESCOL");
            oUserTable.Code = EditText0.Value.ToString();
            oUserTable.Name = EditText0.Value.ToString();
            oUserTable.UserFields.Fields.Item("U_CodigoSEC").Value       = EditText0.Value.ToString();
            oUserTable.UserFields.Fields.Item("U_NombreSEC").Value       = EditText1.Value.ToString();
            oUserTable.UserFields.Fields.Item("U_SupraSeccionSEC").Value = EditText3.Value.ToString();
            oUserTable.UserFields.Fields.Item("U_PrecioSEC").Value       = EditText2.Value.ToString();
            oUserTable.UserFields.Fields.Item("U_ProyectoSEC").Value     = "";
            //oUserTable.Add();

            int i = oUserTable.Add();


            if (i != 0)
            {
                oApp.SetStatusBarMessage("Error" + oCompany.GetLastErrorDescription(), SAPbouiCOM.BoMessageTime.bmt_Medium, false);
            }
            else
            {
                oApp.SetStatusBarMessage("Exito en la inserción", SAPbouiCOM.BoMessageTime.bmt_Medium, false);
                oForm = oApp.Forms.Item("creasecc");
                oForm.Close();
            }
        }
Пример #6
0
        private void Button2_ClickBefore(object sboObject, SAPbouiCOM.SBOItemEventArg pVal, out bool BubbleEvent)
        {
            BubbleEvent = true;
            //oApp = (SAPbouiCOM.Application)Application.SBO_Application;
            //oCompany = (SAPbobsCOM.Company)oApp.Company.GetDICompany();

            oUserTable      = oCompany.UserTables.Item("EDICIONESCOL");
            oUserTable.Code = EditText4.Value.ToString();
            oUserTable.Name = EditText4.Value.ToString();
            oUserTable.UserFields.Fields.Item("U_CodigoEDC").Value   = EditText4.Value.ToString();
            oUserTable.UserFields.Fields.Item("U_NombreEDC").Value   = EditText7.Value.ToString();
            oUserTable.UserFields.Fields.Item("U_ProyectoEDC").Value = EditText5.Value.ToString();
            //oUserTable.Add();

            int i = oUserTable.Add();


            if (i != 0)
            {
                oApp.SetStatusBarMessage("Error" + oCompany.GetLastErrorDescription(), SAPbouiCOM.BoMessageTime.bmt_Medium, false);
            }
            else
            {
                oApp.SetStatusBarMessage("Exito en la inserción", SAPbouiCOM.BoMessageTime.bmt_Medium, false);
                oForm = oApp.Forms.Item("fmcred");
                oForm.Close();
            }
        }
Пример #7
0
        private void Button4_ClickBefore(object sboObject, SAPbouiCOM.SBOItemEventArg pVal, out bool BubbleEvent)
        {
            BubbleEvent = true;
            if (Grid0.Rows.SelectedRows.Count > 0)   //VERIFICA QUE EXISTA UN ROW SELECCIONADO
            {
                int    nSelecRow  = (Grid0.Rows.SelectedRows.Item(0, SAPbouiCOM.BoOrderType.ot_RowOrder));
                String sValorGrid = Convert.ToString(Grid0.DataTable.GetValue("CÓDIGO", nSelecRow));
                oUserTable = oCompany.UserTables.Item("SECCIONESCOL");
                if (oUserTable.GetByKey(sValorGrid))
                {
                    int i = oUserTable.Remove();


                    if (i != 0)
                    {
                        oApp.SetStatusBarMessage("Error al eliminar : " + oCompany.GetLastErrorDescription(), SAPbouiCOM.BoMessageTime.bmt_Medium, false);
                    }
                    else
                    {
                        oApp.SetStatusBarMessage("Edición Eliminada", SAPbouiCOM.BoMessageTime.bmt_Medium, false);
                        //oForm = oApp.Forms.Item("fmacted");
                        //oForm.Close();
                        //presiono el boton refrescar
                        Button3_ClickBefore(sboObject, pVal, out BubbleEvent);
                    }
                }
            }
            else
            {
                oApp.SetStatusBarMessage("Error, no has seleccionado una fila", SAPbouiCOM.BoMessageTime.bmt_Medium, false);
            }
        }
Пример #8
0
        private void RegistrarVersion(string NombreAddon, string Version)
        {
            SAPbobsCOM.UserTable oUT = null;
            string NombreTabla       = "";

            try
            {
                NombreTabla = NombreAddon.ToUpper();
                oUT         = Conexion.company.UserTables.Item(NombreTabla);
                oUT.Code    = Version;
                oUT.Name    = NombreAddon + " V-" + Version;
                m_iErrCode  = oUT.Add();
                if (m_iErrCode == 0)
                {
                    StatusMessageSuccess("Se ingreso un nuevo registro a la BD ");
                }
                else
                {
                    StatusMessageError("Error ingresar el registro en la tabla: " + NombreTabla);
                }
            }
            catch (Exception ex)
            {
                StatusMessageError("Error: EstructuraDatos.cs > RegistrarVersion():" + ex.Message);
            }
            finally
            {
                LiberarObjetoGenerico(oUT);
                oUT = null;
            }
        }
Пример #9
0
        public async Task <IActionResult> GetCRMID(string id)
        {
            SAPContext context = HttpContext.RequestServices.GetService(typeof(SAPContext)) as SAPContext;

            SAPbobsCOM.BusinessPartners  items    = (SAPbobsCOM.BusinessPartners)context.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oBusinessPartners);
            SAPbobsCOM.SalesPersons      seller   = (SAPbobsCOM.SalesPersons)context.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oSalesPersons);
            SAPbobsCOM.PaymentTermsTypes payment  = (SAPbobsCOM.PaymentTermsTypes)context.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oPaymentTermsTypes);
            SAPbobsCOM.UserTable         sboTable = (SAPbobsCOM.UserTable)context.oCompany.UserTables.Item("SO1_01FORMAPAGO");

            JToken pagos = context.XMLTOJSON(sboTable.GetAsXML())["OCRD"];

            if (items.GetByKey(id))
            {
                JToken temp = context.XMLTOJSON(items.GetAsXML());
                temp["OCRD"] = temp["OCRD"][0];

                if (seller.GetByKey(temp["OCRD"]["SlpCode"].ToObject <int>()))
                {
                    JToken temp2 = context.XMLTOJSON(seller.GetAsXML());
                    temp["OSLP"] = temp2["OSLP"][0];
                }
                if (payment.GetByKey(temp["OCRD"]["GroupNum"].ToObject <int>()))
                {
                    JToken temp3 = context.XMLTOJSON(payment.GetAsXML());
                    temp["OCTG"] = temp3["OCTG"][0];
                }

                temp["PAGO"] = pagos;
                return(Ok(temp));
            }
            return(NotFound("No Existe Contacto"));
        }
Пример #10
0
 internal SAPbobsCOM.UserTable GetFreight()
 {
     SAPbobsCOM.UserTable lObjsboTable = (SAPbobsCOM.UserTable)DIApplication.Company.UserTables.Item("UG_TR_INTLFRGHT");
     try
     {
         return(lObjsboTable);
     }
     catch (Exception ex)
     {
         UIApplication.ShowError(string.Format("GetFreight: {0}", ex.Message));
         LogService.WriteError("RouteListDAO (GetFreight): " + ex.Message);
         LogService.WriteError(ex);
         return(null);
     }
 }
Пример #11
0
    private void DelUDORecord(string Code, string sTable)
    {
        string sErrMsg;

        SAPbobsCOM.UserTable otable = oCompany.UserTables.Item(sTable);
        otable.GetByKey(Code);
        int ret = otable.Remove();

        if (ret != 0)
        {
            oCompany.GetLastError(out ret, out sErrMsg);
            string msg = "{0} - {1}移除失敗!!{2}";
            msg = string.Format(msg, sTable, Code, sErrMsg);
            throw new Exception(msg);
        }
    }
Пример #12
0
 private void AddExtractFormat(ExtractFormat pFormat)
 {
     SAPbobsCOM.UserTable lObjUserTable = mObjBankDAO.GetUserTable();
     try
     {
         lObjUserTable.Code = pFormat.RowCode;
         lObjUserTable.Name = pFormat.RowName;
         lObjUserTable.Add();
     }
     catch (Exception e)
     {
         throw new TableException(e.Message, e);
     }
     finally
     {
         MemoryUtility.ReleaseComObject(lObjUserTable);
     }
 }
Пример #13
0
        private UGRS.Core.SDK.DI.Auctions.Tables.Auction GetSAPAuction(UGRS.Core.Auctions.Entities.Auctions.Auction pObjAuction, bool pBoolToUpdate = false)
        {
            if (pBoolToUpdate)
            {
                mObjsboTable = null;
                mObjsboTable = (SAPbobsCOM.UserTable)DIApplication.Company.UserTables.Item("UG_SU_AUTN");
                mObjsboTable.GetByKey(GetKeyByFolio(pObjAuction.Folio));
            }


            return(new UGRS.Core.SDK.DI.Auctions.Tables.Auction()
            {
                //Id = pObjAuction.Id,
                Id = !pBoolToUpdate?GetNextId() : GetAuctionId(pObjAuction.Folio),
                         LocationId = (int)pObjAuction.Location,
                         Location = pObjAuction.CostingCode,
                         Folio = pObjAuction.Folio,
                         TypeId = (int)pObjAuction.Type,
                         Type = pObjAuction.Type.GetDescription(),
                         CategoryId = (int)pObjAuction.Category,
                         Category = pObjAuction.Category.GetDescription(),
                         Commission = pObjAuction.Commission,
                         Date = pObjAuction.Date,
                         Opened = pObjAuction.Opened,
                         Protected = pObjAuction.Protected,
                         Removed = pObjAuction.Removed,
                         Active = pObjAuction.Active,
                         CreationDate = pObjAuction.CreationDate,
                         CreationTime = pObjAuction.CreationDate,
                         ModificationDate = DateTime.Now,
                         ModificationTime = DateTime.Now,
                         AutAuction = !pBoolToUpdate ? false : mObjsboTable.UserFields.Fields.Item("U_AutAuction").Value.ToString() == "Y" ? true : false,
                         AutCorral = !pBoolToUpdate ? false : mObjsboTable.UserFields.Fields.Item("U_AutCorral").Value.ToString() == "Y" ? true : false,
                         AutCyC = !pBoolToUpdate ? false : mObjsboTable.UserFields.Fields.Item("U_AutCyC").Value.ToString() == "Y" ? true : false,
                         AutFz = !pBoolToUpdate ? false : mObjsboTable.UserFields.Fields.Item("U_AutFz").Value.ToString() == "Y" ? true : false,
                         AutTransp = !pBoolToUpdate ? false : mObjsboTable.UserFields.Fields.Item("U_AutTransp").Value.ToString() == "Y" ? true : false,
            });
        }
Пример #14
0
        private bool UpdateCertificate(string pStrKey)
        {
            SAPbobsCOM.UserTable lObjsboTable = (SAPbobsCOM.UserTable)DIApplication.Company.UserTables.Item("UG_CU_CERT");
            if (lObjsboTable.GetByKey(pStrKey))
            {
                lObjsboTable.UserFields.Fields.Item("U_CreditNote").Value = "Y";

                if (lObjsboTable.Update() != 0)
                {
                    string lStrError = DIApplication.Company.GetLastErrorDescription();
                    UIApplication.ShowError(lStrError);
                }
                else
                {
                    return(true);
                }
            }
            else
            {
                string lStrError = "Registro: " + pStrKey + " No encontrado";
            }
            return(false);
        }
Пример #15
0
        private void Button0_ClickBefore(object sboObject, SAPbouiCOM.SBOItemEventArg pVal, out bool BubbleEvent)
        {
            BubbleEvent = true;
            oUserTable  = oCompany.UserTables.Item("SUPRASECCIONESCOL");
            if (oForm.Mode.Equals(SAPbouiCOM.BoFormMode.fm_OK_MODE) || (Grid0.Rows.SelectedRows.Count == 0))
            {
                Button0.Caption = "OK";
            }

            else
            {
                //if (Grid2.Rows.SelectedRows.Count > 0)   //VERIFICA QUE EXISTA UN ROW SELECCIONADO
                //{


                int nRow = Grid0.Rows.SelectedRows.Item(0, SAPbouiCOM.BoOrderType.ot_RowOrder);
                oApp.SendKeys("({TAB})");//aca aplico tabular para que tome el campo para actualizar



                //Grid2.Rows.SelectedRows.Equals(nRow);
                String sValorGrid = Convert.ToString(Grid0.DataTable.GetValue("Código", nRow));

                // Grid2.Columns.Item("CODE").Click();
                //bool num = (Grid2.Rows.SelectedRows.Count > 0);
                if (oUserTable.GetByKey(sValorGrid.ToString())) // Esto devuelve true si existe el registro
                {
                    //

                    string nom = (string)(Grid0.DataTable.GetValue("Nombre", nRow));



                    // oCompany.StartTransaction();
                    oUserTable.Code = sValorGrid;
                    oUserTable.Name = sValorGrid;
                    oUserTable.UserFields.Fields.Item("U_CodigoSS").Value = sValorGrid;
                    oUserTable.UserFields.Fields.Item("U_NombreSS").Value = nom;


                    int i = oUserTable.Update();

                    if (i != 0)
                    {
                        oApp.SetStatusBarMessage("Error" + oCompany.GetLastErrorDescription(), SAPbouiCOM.BoMessageTime.bmt_Medium, false);
                    }
                    else
                    {
                        oApp.SetStatusBarMessage("Exito en la Actualización", SAPbouiCOM.BoMessageTime.bmt_Medium, false);

                        oForm.Mode = SAPbouiCOM.BoFormMode.fm_OK_MODE;
                        oForm.DataSources.DataTables.Item(0).ExecuteQuery("SELECT U_CodigoSS AS 'Código',U_NombreSS AS 'Nombre' FROM  [@SUPRASECCIONESCOL]");
                        Grid0.DataTable = oForm.DataSources.DataTables.Item("DTSPSEC");

                        Grid0.DataTable.Rows.Add(1);
                        for (int j = 1; j <= this.Grid0.DataTable.Rows.Count; j += 1)
                        {
                            if (j < this.Grid0.DataTable.Rows.Count)
                            {
                                Grid0.Rows.SelectedRows.Add(j);
                            }
                        }

                        RowNumberGrid(Grid0);
                        BubbleEvent = false;
                    }
                }


                //si no existe el dato, lo agregara
                else
                {
                    //   Button0.Caption = "Agregar";
                    //   oUserTable = oCompany.UserTables.Item("EDICIONESCOL");
                    int    nRow2       = Grid0.Rows.SelectedRows.Item(0, SAPbouiCOM.BoOrderType.ot_RowOrder);
                    String sValorGrid2 = Convert.ToString(Grid0.DataTable.GetValue("Código", nRow2));
                    //string nNOM2 = (string)Grid2.DataTable.GetValue("NOM", nRow2);
                    // string cod2 = (string)(Grid2.DataTable.GetValue("Código", nRow2));
                    string nom2 = (string)(Grid0.DataTable.GetValue("Nombre", nRow2));


                    oUserTable.Code = sValorGrid2;
                    oUserTable.Name = sValorGrid2;
                    oUserTable.UserFields.Fields.Item("U_CodigoSS").Value = sValorGrid2;
                    oUserTable.UserFields.Fields.Item("U_NombreSS").Value = nom2;

                    int j = oUserTable.Add();

                    if (j != 0)
                    {
                        oApp.SetStatusBarMessage("Error" + oCompany.GetLastErrorDescription(), SAPbouiCOM.BoMessageTime.bmt_Medium, false);
                    }
                    else
                    {
                        oApp.SetStatusBarMessage("Exito en la inserción", SAPbouiCOM.BoMessageTime.bmt_Medium, false);

                        oForm.Mode = SAPbouiCOM.BoFormMode.fm_OK_MODE;

                        Grid0.DataTable.Rows.Add(1);

                        oForm.DataSources.DataTables.Item(0).ExecuteQuery("SELECT U_CodigoSS AS 'Código',U_NombreSS AS 'Nombre' FROM  [@SUPRASECCIONESCOL]");
                        Grid0.DataTable = oForm.DataSources.DataTables.Item("DTSPSEC");

                        for (int i = 1; i <= this.Grid0.DataTable.Rows.Count; i += 1)
                        {
                            if (i < this.Grid0.DataTable.Rows.Count)
                            {
                                Grid0.Rows.SelectedRows.Add(i);
                            }
                        }

                        RowNumberGrid(Grid0);
                        BubbleEvent = false;
                    }
                }
            }
        }
Пример #16
0
        private void Button0_ClickBefore(object sboObject, SAPbouiCOM.SBOItemEventArg pVal, out bool BubbleEvent)
        {
            BubbleEvent = true;

            SAPbouiCOM.Form oForm = oApp.Forms.ActiveForm;
            switch (oForm.Mode)
            {
            case SAPbouiCOM.BoFormMode.fm_ADD_MODE:

                oUserTable      = oCompany.UserTables.Item("EDICIONESCOL");
                oUserTable.Code = EditText0.Value.ToString();
                oUserTable.Name = EditText0.Value.ToString();
                oUserTable.UserFields.Fields.Item("U_CodigoEDC").Value   = EditText0.Value.ToString();
                oUserTable.UserFields.Fields.Item("U_NombreEDC").Value   = EditText1.Value.ToString();
                oUserTable.UserFields.Fields.Item("U_ProyectoEDC").Value = EditText2.Value.ToString();
                oUserTable.Add();

                int i = oUserTable.Add();
                if (i != 0)
                {
                    oApp.SetStatusBarMessage("Error" + oCompany.GetLastErrorDescription(), SAPbouiCOM.BoMessageTime.bmt_Medium, false);
                }
                else
                {
                    oApp.SetStatusBarMessage("Exito en la inserción", SAPbouiCOM.BoMessageTime.bmt_Medium, false);
                    oForm = oApp.Forms.Item("edm");
                    oForm.Close();
                }

                break;

            case SAPbouiCOM.BoFormMode.fm_UPDATE_MODE:

                oUserTable = oCompany.UserTables.Item("EDICIONESCOL");
                //hago un getbykey para obtener el valor key necesario para actualizar los datos
                if (oUserTable.GetByKey(EditText0.Value.ToString()))
                {
                    // oUserTable.UserFields.Fields.Item("U_CodigoEDC").Value = EditText0.Value.ToString();
                    oUserTable.UserFields.Fields.Item("U_NombreEDC").Value = EditText1.Value.ToString();
                }
                oUserTable.UserFields.Fields.Item("U_ProyectoEDC").Value = EditText2.Value.ToString();

                //oUserTable.Update();


                int J = oUserTable.Update();

                //oApp.SetStatusBarMessage("valor"+ i);
                if (J != 0)
                {
                    oApp.SetStatusBarMessage("Error en la actualización: " + oCompany.GetLastErrorDescription(), SAPbouiCOM.BoMessageTime.bmt_Medium, false);
                }
                else
                {
                    oApp.SetStatusBarMessage("Exito en la actualizacón", SAPbouiCOM.BoMessageTime.bmt_Medium, false);
                    //oForm = oApp.Forms.Item("fmacted");
                    //oForm.Close();
                }


                break;

            case SAPbouiCOM.BoFormMode.fm_FIND_MODE:



                break;
            }
        }
Пример #17
0
        private bool ValidaVersion(string NombreAddon, string Version)
        {
            bool bRetorno = false;

            SAPbobsCOM.UserTable oUT = null;
            SAPbobsCOM.Recordset oRS = null;
            string NombreTabla       = "";

            try
            {
                NombreTabla = NombreAddon.ToUpper();
                try
                {
                    oUT = Conexion.company.UserTables.Item(NombreTabla);
                }
                catch (Exception ex)
                {
                    if (ex.Message.ToLower().Contains("invalid field name"))
                    {
                        oUT = null;
                    }
                    else
                    {
                        throw ex;
                    }
                }

                if (oUT == null)
                {
                    CreaTablaMD(NombreTabla, m_sDescripcion, SAPbobsCOM.BoUTBTableType.bott_NoObject);
                    bRetorno = true;
                }
                else
                {
                    oRS = (SAPbobsCOM.Recordset)Conexion.company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
                    oRS.DoQuery(Consultas.consultaTablaConfiguracion(Conexion.company.DbServerType, NombreAddon, "", true));
                    if (oRS.RecordCount == 0)
                    {
                        bRetorno = true;
                        StatusMessageInfo("Actualizará la estructura de datos");
                    }
                    else
                    {
                        if (int.Parse(Version.Replace(".", "").ToString()) > int.Parse(oRS.Fields.Item("code").Value.ToString().Replace(".", "")))
                        {
                            bRetorno = true;
                            StatusMessageInfo("Actualizará la estructura de datos");
                        }

                        if (int.Parse(Version.Replace(".", "").ToString()) < int.Parse(oRS.Fields.Item("code").Value.ToString().Replace(".", "")))
                        {
                            StatusMessageError("Detectó una version superior para este Addon");
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                StatusMessageError("Error: EstructuraDatos.cs > ValidaVersion(): " + ex.Message);
            }
            finally
            {
                LiberarObjetoGenerico(oUT);
                LiberarObjetoGenerico(oRS);
                oRS = null;
                oUT = null;
            }
            return(bRetorno);
        }
Пример #18
0
        //private void ListaInter ()
        //{
        //    try
        //    {
        //        SAPbobsCOM.UserTables tbls = null;
        //        SAPbobsCOM.UserTable tbl = null;

        //        tbls = oCompany.UserTables;
        //        tbl = tbls.Item("FEDIAN_CODDOC");

        //        tbl.Code = Constants.CodDIAN_01[0];
        //        tbl.Name = Constants.CodDIAN_01[1];

        //        lRetCode = tbl.Add();

        //        if (lRetCode != 0)
        //        {
        //            if (lRetCode == -1 || lRetCode == -2035 || lRetCode == -5002)
        //            { }
        //            else
        //            {
        //                oCompany.GetLastError(out lRetCode, out sErrMsg);
        //                Procesos.EscribirLogFileTXT("PreCarga: " + lRetCode + " > " + sErrMsg);
        //            }
        //        }

        //        tbl.Code = Constants.CodDIAN_02[0];
        //        tbl.Name = Constants.CodDIAN_02[1];

        //        lRetCode = tbl.Add();

        //        if (lRetCode != 0)
        //        {
        //            if (lRetCode == -1 || lRetCode == -2035 || lRetCode == -5002)
        //            { }
        //            else
        //            {
        //                oCompany.GetLastError(out lRetCode, out sErrMsg);
        //                Procesos.EscribirLogFileTXT("PreCarga: " + lRetCode + " > " + sErrMsg);
        //            }
        //        }

        //        tbl.Code = Constants.CodDIAN_03[0];
        //        tbl.Name = Constants.CodDIAN_03[1];

        //        lRetCode = tbl.Add();

        //        if (lRetCode != 0)
        //        {
        //            if (lRetCode == -1 || lRetCode == -2035 || lRetCode == -5002)
        //            { }
        //            else
        //            {
        //                oCompany.GetLastError(out lRetCode, out sErrMsg);
        //                Procesos.EscribirLogFileTXT("PreCarga: " + lRetCode + " > " + sErrMsg);
        //            }
        //        }

        //        tbl.Code = Constants.CodDIAN_04[0];
        //        tbl.Name = Constants.CodDIAN_04[1];

        //        lRetCode = tbl.Add();

        //        if (lRetCode != 0)
        //        {
        //            if (lRetCode == -1 || lRetCode == -2035 || lRetCode == -5002)
        //            { }
        //            else
        //            {
        //                oCompany.GetLastError(out lRetCode, out sErrMsg);
        //                Procesos.EscribirLogFileTXT("PreCarga: " + lRetCode + " > " + sErrMsg);
        //            }
        //        }

        //        tbl.Code = Constants.CodDIAN_05[0];
        //        tbl.Name = Constants.CodDIAN_05[1];

        //        lRetCode = tbl.Add();

        //        if (lRetCode != 0)
        //        {
        //            if (lRetCode == -1 || lRetCode == -2035 || lRetCode == -5002)
        //            { }
        //            else
        //            {
        //                oCompany.GetLastError(out lRetCode, out sErrMsg);
        //                Procesos.EscribirLogFileTXT("PreCarga: " + lRetCode + " > " + sErrMsg);
        //            }
        //        }
        //    }
        //    catch (Exception ex)
        //    {
        //        Procesos.EscribirLogFileTXT("CargueInicial: " + ex.Message);
        //    }
        //}

        //private void cfgInter ()
        //{
        //    string urlFebos = "";
        //    urlFebos = "https://api.febos.co/pruebas/documentos?simular=no&debug=si&tipo={0}&entrada=txt&foliar=si&firmar=si&obtenerXml=si&obtenerPdf=si";
        //    try
        //    {
        //        SAPbobsCOM.UserTables tbls = null;
        //        SAPbobsCOM.UserTable tbl = null;

        //        tbls = oCompany.UserTables;
        //        tbl = tbls.Item("FEDIAN_INTERF_CFG");

        //        tbl.Code = "1";
        //        tbl.Name = "Factura de Venta";
        //        tbl.UserFields.Fields.Item("U_WS_Activo").Value = "Y";
        //        tbl.UserFields.Fields.Item("U_Job_Activo").Value = "Y";
        //        tbl.UserFields.Fields.Item("U_URL").Value = string.Format(urlFebos, tbl.Code);

        //        lRetCode = tbl.Add();

        //        if (lRetCode != 0)
        //        {
        //            if (lRetCode == -1 || lRetCode == -2035 || lRetCode == -5002)
        //            { }
        //            else
        //            {
        //                oCompany.GetLastError(out lRetCode, out sErrMsg);
        //                Procesos.EscribirLogFileTXT("PreCarga: " + lRetCode + " > " + sErrMsg);
        //            }
        //        }

        //        tbl.Code = "2";
        //        tbl.Name = "Factura de Exportacion";
        //        tbl.UserFields.Fields.Item("U_WS_Activo").Value = "Y";
        //        tbl.UserFields.Fields.Item("U_Job_Activo").Value = "Y";
        //        tbl.UserFields.Fields.Item("U_URL").Value = string.Format(urlFebos, tbl.Code);

        //        lRetCode = tbl.Add();

        //        if (lRetCode != 0)
        //        {
        //            if (lRetCode == -1 || lRetCode == -2035 || lRetCode == -5002)
        //            { }
        //            else
        //            {
        //                oCompany.GetLastError(out lRetCode, out sErrMsg);
        //                Procesos.EscribirLogFileTXT("PreCarga: " + lRetCode + " > " + sErrMsg);
        //            }
        //        }

        //        tbl.Code = "3";
        //        tbl.Name = "Factura de Contingencia";
        //        tbl.UserFields.Fields.Item("U_WS_Activo").Value = "Y";
        //        tbl.UserFields.Fields.Item("U_Job_Activo").Value = "Y";
        //        tbl.UserFields.Fields.Item("U_URL").Value = string.Format(urlFebos, tbl.Code);

        //        lRetCode = tbl.Add();

        //        if (lRetCode != 0)
        //        {
        //            if (lRetCode == -1 || lRetCode == -2035 || lRetCode == -5002)
        //            { }
        //            else
        //            {
        //                oCompany.GetLastError(out lRetCode, out sErrMsg);
        //                Procesos.EscribirLogFileTXT("PreCarga: " + lRetCode + " > " + sErrMsg);
        //            }
        //        }

        //        tbl.Code = "4";
        //        tbl.Name = "Nota de Credito";
        //        tbl.UserFields.Fields.Item("U_WS_Activo").Value = "Y";
        //        tbl.UserFields.Fields.Item("U_Job_Activo").Value = "Y";
        //        tbl.UserFields.Fields.Item("U_URL").Value = string.Format(urlFebos, tbl.Code);

        //        lRetCode = tbl.Add();

        //        if (lRetCode != 0)
        //        {
        //            if (lRetCode == -1 || lRetCode == -2035 || lRetCode == -5002)
        //            { }
        //            else
        //            {
        //                oCompany.GetLastError(out lRetCode, out sErrMsg);
        //                Procesos.EscribirLogFileTXT("PreCarga: " + lRetCode + " > " + sErrMsg);
        //            }
        //        }

        //        tbl.Code = "5";
        //        tbl.Name = "Nota de Debito";
        //        tbl.UserFields.Fields.Item("U_WS_Activo").Value = "Y";
        //        tbl.UserFields.Fields.Item("U_Job_Activo").Value = "Y";
        //        tbl.UserFields.Fields.Item("U_URL").Value = string.Format(urlFebos, tbl.Code);

        //        lRetCode = tbl.Add();

        //        if (lRetCode != 0)
        //        {
        //            if (lRetCode == -1 || lRetCode == -2035 || lRetCode == -5002)
        //            { }
        //            else
        //            {
        //                oCompany.GetLastError(out lRetCode, out sErrMsg);
        //                Procesos.EscribirLogFileTXT("PreCarga: " + lRetCode + " > " + sErrMsg);
        //            }
        //        }

        //        tbl.Code = "6";
        //        tbl.Name = "Lectura de Respuesta DIAN";
        //        tbl.UserFields.Fields.Item("U_WS_Activo").Value = "Y";
        //        tbl.UserFields.Fields.Item("U_Job_Activo").Value = "Y";
        //        tbl.UserFields.Fields.Item("U_URL").Value = Constants.urlstatusFebos;

        //        lRetCode = tbl.Add();

        //        if (lRetCode != 0)
        //        {
        //            if (lRetCode == -1 || lRetCode == -2035 || lRetCode == -5002)
        //            { }
        //            else
        //            {
        //                oCompany.GetLastError(out lRetCode, out sErrMsg);
        //                Procesos.EscribirLogFileTXT("PreCarga: " + lRetCode + " > " + sErrMsg);
        //            }
        //        }

        //        tbl.Code = "7";
        //        tbl.Name = "Lectura por Folio";
        //        tbl.UserFields.Fields.Item("U_WS_Activo").Value = "Y";
        //        tbl.UserFields.Fields.Item("U_Job_Activo").Value = "Y";
        //        tbl.UserFields.Fields.Item("U_URL").Value = Constants.urlstatusFolio;

        //        lRetCode = tbl.Add();

        //        if (lRetCode != 0)
        //        {
        //            if (lRetCode == -1 || lRetCode == -2035 || lRetCode == -5002)
        //            { }
        //            else
        //            {
        //                oCompany.GetLastError(out lRetCode, out sErrMsg);
        //                Procesos.EscribirLogFileTXT("PreCarga: " + lRetCode + " > " + sErrMsg);
        //            }
        //        }
        //    }
        //    catch (Exception ex)
        //    {
        //        Procesos.EscribirLogFileTXT("PreCarga: " + ex.Message);
        //    }
        //}

        public static bool version(SAPbobsCOM.Company oCmpn)
        {
            try
            {
                System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
                FileVersionInfo            fvi      = FileVersionInfo.GetVersionInfo(assembly.Location);
                string version = fvi.FileVersion;
                bool   resultado;

                SAPbobsCOM.UserTables tbls = null;
                SAPbobsCOM.UserTable  tbl  = null;

                tbls = oCmpn.UserTables;
                tbl  = tbls.Item("FEDIAN_VERSION");

                if (tbl.GetByKey("1") == true & tbl.Name == version)
                {
                    resultado = false;
                }
                else if (tbl.GetByKey("1") == true & tbl.Name != version)
                {
                    resultado = true;
                    tbl.Name  = version;

                    lRetCode = tbl.Update();

                    if (lRetCode != 0)
                    {
                        if (lRetCode == -1 || lRetCode == -2035 || lRetCode == -5002)
                        {
                        }
                        else
                        {
                            oCmpn.GetLastError(out lRetCode, out sErrMsg);
                            Procesos.EscribirLogFileTXT("PreCarga: " + lRetCode + " > " + sErrMsg);
                        }
                    }
                }
                else
                {
                    resultado = true;
                    tbl.Code  = "1";
                    tbl.Name  = version;

                    lRetCode = tbl.Add();

                    if (lRetCode != 0)
                    {
                        if (lRetCode == -1 || lRetCode == -2035 || lRetCode == -5002)
                        {
                        }
                        else
                        {
                            oCmpn.GetLastError(out lRetCode, out sErrMsg);
                            Procesos.EscribirLogFileTXT("PreCarga: " + lRetCode + " > " + sErrMsg);
                        }
                    }
                }

                return(resultado);
            }
            catch (Exception ex)
            {
                Procesos.EscribirLogFileTXT("Version: " + ex.Message);
                return(true);
            }
        }