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(); } }
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; } }
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(); } }
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; } }
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); } }
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; } } } }
//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); } }
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; } }