public new bool InitForm(string uid, string xmlPath, ref SAPbouiCOM.Application application, ref SAPbobsCOM.Company company, ref CSBOFunctions SBOFunctions, ref TGlobalVid _GlobalSettings) { Int32 CantRol; bool Result = base.InitForm(uid, xmlPath, ref application, ref company, ref SBOFunctions, ref _GlobalSettings); oRecordSet = (SAPbobsCOM.Recordset)(FCmpny.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)); Funciones.SBO_f = FSBOf; try { Lista = new List <string>(); FSBOf.LoadForm(xmlPath, "VID_FEMonDTE.srf", uid); //EnableCrystal := true; oForm = FSBOApp.Forms.Item(uid); oForm.Freeze(true); oForm.AutoManaged = false; oForm.SupportedModes = -1; // afm_All oForm.EnableMenu("1282", false); //Crear oForm.EnableMenu("1281", false); //Actualizar // Ok Ad Fnd Vw Rq Sec //Lista.Add('DocNum , f, f, t, f, n, 1'); //Lista.Add('DocDate , f, t, f, f, r, 1'); //Lista.Add('CardCode , f, t, t, f, r, 1'); //FSBOf.SetAutoManaged(var oForm, Lista); oDBDSHC = oForm.DataSources.DBDataSources.Add("@VID_FEDTECPRA"); oDBDSHV = oForm.DataSources.DBDataSources.Add("@VID_FEDTEVTA"); oForm.DataSources.UserDataSources.Add("FechaD", BoDataType.dt_DATE, 10); oEditText = (EditText)(oForm.Items.Item("FechaD").Specific); oEditText.DataBind.SetBound(true, "", "FechaD"); oEditText.Value = DateTime.Now.ToString("yyyyMMdd"); oForm.DataSources.UserDataSources.Add("FechaH", BoDataType.dt_DATE, 10); oEditText = (EditText)(oForm.Items.Item("FechaH").Specific); oEditText.DataBind.SetBound(true, "", "FechaH"); oEditText.Value = DateTime.Now.ToString("yyyyMMdd"); oComboBox = (ComboBox)(oForm.Items.Item("TipoDTE").Specific); oForm.DataSources.UserDataSources.Add("TipoDTE", BoDataType.dt_SHORT_TEXT, 10); oComboBox.DataBind.SetBound(true, "", "TipoDTE"); oComboBox.ValidValues.Add("V", "Venta"); oComboBox.ValidValues.Add("C", "Compra"); oComboBox.Select("V", BoSearchKey.psk_ByValue); oForm.Items.Item("TipoDTE").DisplayDesc = true; oDataTable = oForm.DataSources.DataTables.Add("dt"); oGrid = (Grid)(oForm.Items.Item("grid").Specific); oGrid.DataTable = oDataTable; DSOpFec = oForm.DataSources.UserDataSources.Add("FechaEmi", SAPbouiCOM.BoDataType.dt_SHORT_TEXT, 1); ((OptionBtn)oForm.Items.Item("FechaEmi").Specific).DataBind.SetBound(true, "", "FechaEmi"); ((OptionBtn)oForm.Items.Item("FechaRecep").Specific).DataBind.SetBound(true, "", "FechaEmi"); ((OptionBtn)oForm.Items.Item("FechaRecep").Specific).GroupWith("FechaEmi"); ((OptionBtn)oForm.Items.Item("FechaEmi").Specific).Selected = true; oComboBox = (ComboBox)(oForm.Items.Item("Cliente").Specific); oForm.DataSources.UserDataSources.Add("Cliente", BoDataType.dt_SHORT_TEXT, 10); oComboBox.DataBind.SetBound(true, "", "Cliente"); if (GlobalSettings.RunningUnderSQLServer) { s = @"SELECT 'Todos' Code, 'Todos' Name UNION ALL SELECT T1.FldValue Code, T1.Descr Name FROM CUFD T0 JOIN UFD1 T1 ON T1.TableID = T0.TableID AND T1.FieldID = T0.FieldID WHERE T0.TableID = '{0}' AND T0.AliasID = 'EstadoC'"; } else { s = @"SELECT 'Todos' ""Code"", 'Todos' ""Name"" FROM DUMMY UNION ALL SELECT T1.""FldValue"" ""Code"", T1.""Descr"" ""Name"" FROM ""CUFD"" T0 JOIN ""UFD1"" T1 ON T1.""TableID"" = T0.""TableID"" AND T1.""FieldID"" = T0.""FieldID"" WHERE T0.""TableID"" = '{0}' AND T0.""AliasID"" = 'EstadoC'"; } s = String.Format(s, "@VID_FEDTEVTA"); oRecordSet.DoQuery(s); FSBOf.FillCombo(oComboBox, ref oRecordSet, false); oComboBox.Select("Todos", BoSearchKey.psk_ByValue); oComboBox = (ComboBox)(oForm.Items.Item("SII").Specific); oForm.DataSources.UserDataSources.Add("SII", BoDataType.dt_SHORT_TEXT, 10); oComboBox.DataBind.SetBound(true, "", "SII"); if (GlobalSettings.RunningUnderSQLServer) { s = @"SELECT 'Todos' Code, 'Todos' Name UNION ALL SELECT T1.FldValue Code, T1.Descr Name FROM CUFD T0 JOIN UFD1 T1 ON T1.TableID = T0.TableID AND T1.FieldID = T0.FieldID WHERE T0.TableID = '{0}' AND T0.AliasID = 'EstadoSII'"; } else { s = @"SELECT 'Todos' ""Code"", 'Todos' ""Name"" FROM DUMMY UNION ALL SELECT T1.""FldValue"" ""Code"", T1.""Descr"" ""Name"" FROM ""CUFD"" T0 JOIN ""UFD1"" T1 ON T1.""TableID"" = T0.""TableID"" AND T1.""FieldID"" = T0.""FieldID"" WHERE T0.""TableID"" = '{0}' AND T0.""AliasID"" = 'EstadoSII'"; } s = String.Format(s, "@VID_FEDTEVTA"); oRecordSet.DoQuery(s); FSBOf.FillCombo(oComboBox, ref oRecordSet, false); oComboBox.Select("Todos", BoSearchKey.psk_ByValue); oComboBox = (ComboBox)(oForm.Items.Item("Ley").Specific); oForm.DataSources.UserDataSources.Add("Ley", BoDataType.dt_SHORT_TEXT, 10); oComboBox.DataBind.SetBound(true, "", "Ley"); if (GlobalSettings.RunningUnderSQLServer) { s = @"SELECT 'Todos' Code, 'Todos' Name UNION ALL SELECT T1.FldValue Code, T1.Descr Name FROM CUFD T0 JOIN UFD1 T1 ON T1.TableID = T0.TableID AND T1.FieldID = T0.FieldID WHERE T0.TableID = '{0}' AND T0.AliasID = 'EstadoLey'"; } else { s = @"SELECT 'Todos' ""Code"", 'Todos' ""Name"" FROM DUMMY UNION ALL SELECT T1.""FldValue"" ""Code"", T1.""Descr"" ""Name"" FROM ""CUFD"" T0 JOIN ""UFD1"" T1 ON T1.""TableID"" = T0.""TableID"" AND T1.""FieldID"" = T0.""FieldID"" WHERE T0.""TableID"" = '{0}' AND T0.""AliasID"" = 'EstadoLey'"; } s = String.Format(s, "@VID_FEDTEVTA"); oRecordSet.DoQuery(s); FSBOf.FillCombo(oComboBox, ref oRecordSet, false); oComboBox.Select("Todos", BoSearchKey.psk_ByValue); BuscarDatos(); } catch (Exception e) { OutLog("InitForm: " + e.Message + " ** Trace: " + e.StackTrace); FSBOApp.MessageBox(e.Message + " ** Trace: " + e.StackTrace, 1, "Ok", "", ""); } finally { if (oForm != null) { oForm.Freeze(false); } } return(Result); }//fin InitForm
private void ClearUnManagedObject() { if (oLinkedButton != null) { Marshal.ReleaseComObject(oLinkedButton); } oLinkedButton = null; if (oDB_M != null) { Marshal.ReleaseComObject(oDB_M); } oDB_M = null; if (oDB_1 != null) { Marshal.ReleaseComObject(oDB_1); } oDB_1 = null; if (oMatrix != null) { Marshal.ReleaseComObject(oMatrix); } oMatrix = null; if (oComboBox != null) { Marshal.ReleaseComObject(oComboBox); } oComboBox = null; if (oUserData != null) { Marshal.ReleaseComObject(oUserData); } oUserData = null; if (oEditText != null) { Marshal.ReleaseComObject(oEditText); } oEditText = null; if (oButton != null) { Marshal.ReleaseComObject(oButton); } oButton = null; if (oForm != null) { Marshal.ReleaseComObject(oForm); } oForm = null; //ADD YOUR ACTION CODE HERE ... System.GC.Collect(); System.GC.WaitForPendingFinalizers(); }
private void AddDataSourceNoForm() { oUserDataSource = oForm.DataSources.UserDataSources.Add("IntPhone", BoDataType.dt_SHORT_TEXT, 20); oDBDataSource = oForm.DataSources.DBDataSources.Add("OCRD"); }
public new bool InitForm(string uid, string xmlPath, ref Application application, ref SAPbobsCOM.Company company, ref CSBOFunctions SBOFunctions, ref TGlobalVid _GlobalSettings) { //SAPbouiCOM.ComboBox oCombo; TFunctions Param; SAPbouiCOM.CheckBox oCheckBox; SAPbouiCOM.EditText oEditText; // // obetener recurso // try // ..... // finally // liberar recurso // end bool Result = base.InitForm(uid, xmlPath, ref application, ref company, ref SBOFunctions, ref _GlobalSettings); oRecordSet = (SAPbobsCOM.Recordset)(FCmpny.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)); try { //Lista := New list<string>; FSBOf.LoadForm(xmlPath, "strCnn.srf", uid); //EnableCrystal := true; oForm = FSBOApp.Forms.Item(uid); oForm.Freeze(true); oForm.AutoManaged = false; oForm.SupportedModes = -1; // afm_All //oForm.DataBrowser.BrowseBy := "DocNum"; // Ok Ad Fnd Vw Rq Sec //Lista.Add('DocNum , f, f, t, f, n, 1'); //Lista.Add('DocDate , f, t, f, f, r, 1'); //Lista.Add('CardCode , f, t, t, f, r, 1'); //FSBOf.SetAutoManaged(var oForm, Lista); oDBDSHeader = (DBDataSource)(oForm.DataSources.DBDataSources.Item("@VID_FEPARAM")); oCheckBox = (CheckBox)(oForm.Items.Item("chkMon").Specific); oCheckBox.ValOn = "Y"; oCheckBox.ValOff = "N"; oCheckBox = (CheckBox)(oForm.Items.Item("chkDteTra").Specific); oCheckBox.ValOn = "Y"; oCheckBox.ValOff = "N"; //oCheckBox = (CheckBox)(oForm.Items.Item("chkCrearD").Specific); //oCheckBox.ValOn = "Y"; //oCheckBox.ValOff = "N"; //oCheckBox = (CheckBox)(oForm.Items.Item("chkCrearDS").Specific); //oCheckBox.ValOn = "Y"; //oCheckBox.ValOff = "N"; oCheckBox = (CheckBox)(oForm.Items.Item("chkPrint").Specific); oCheckBox.ValOn = "Y"; oCheckBox.ValOff = "N"; oCheckBox = (CheckBox)(oForm.Items.Item("chkDistrib").Specific); oCheckBox.ValOn = "Y"; oCheckBox.ValOff = "N"; oCheckBox = (CheckBox)(oForm.Items.Item("chkVal90").Specific); oCheckBox.ValOn = "Y"; oCheckBox.ValOff = "N"; oCheckBox = (CheckBox)(oForm.Items.Item("MultiSoc").Specific); oCheckBox.ValOn = "Y"; oCheckBox.ValOff = "N"; oCheckBox = (CheckBox)(oForm.Items.Item("ValDescL").Specific); oCheckBox.ValOn = "Y"; oCheckBox.ValOff = "N"; oCheckBox = (CheckBox)(oForm.Items.Item("GeneraT").Specific); oCheckBox.ValOn = "Y"; oCheckBox.ValOff = "N"; oCheckBox = (CheckBox)(oForm.Items.Item("SubirSuc").Specific); oCheckBox.ValOn = "Y"; oCheckBox.ValOff = "N"; oCheckBox = (CheckBox)(oForm.Items.Item("AbrirDoc").Specific); oCheckBox.ValOn = "Y"; oCheckBox.ValOff = "N"; oCheckBox = (CheckBox)(oForm.Items.Item("chkFProv").Specific); oCheckBox.ValOn = "Y"; oCheckBox.ValOff = "N"; oEditText = (EditText)(oForm.Items.Item("Pasword").Specific); oEditText.IsPassword = true; //Configuración RadioButtons DSOpDif = oForm.DataSources.UserDataSources.Add("rbOpDif", SAPbouiCOM.BoDataType.dt_SHORT_TEXT, 1); ((OptionBtn)oForm.Items.Item("opDifPor").Specific).DataBind.SetBound(true, "", "rbOpDif"); //1 ((OptionBtn)oForm.Items.Item("opDifMon").Specific).DataBind.SetBound(true, "", "rbOpDif"); //2 ((OptionBtn)oForm.Items.Item("opDifMon").Specific).GroupWith("opDifPor"); if (!GlobalSettings.RunningUnderSQLServer) { oForm.Items.Item("btnProcFE").Visible = false; } else { oForm.Items.Item("btnProcFE").Visible = true; } //s := 'Select count(*) cant from [@VID_FEPARAM]'; if (GlobalSettings.RunningUnderSQLServer) { s = @"Select count(*) CANT ,U_Usuario ,U_Password ,U_UserWSCL ,U_PassWSCL ,ISNULL(U_TipoDif,'M') 'U_TipoDif' from [@VID_FEPARAM] group by U_Usuario ,U_Password ,U_UserWSCL ,U_PassWSCL ,ISNULL(U_TipoDif,'M')"; } else { s = @"Select count(*) ""CANT"" ,""U_Usuario"" ,""U_Password"" ,""U_UserWSCL"" ,""U_PassWSCL"" ,IFNULL(""U_TipoDif"",'M') ""U_TipoDif"" from ""@VID_FEPARAM"" group by ""U_Usuario"" ,""U_Password"" ,""U_UserWSCL"" ,""U_PassWSCL"" ,IFNULL(""U_TipoDif"",'M') "; } oRecordSet.DoQuery(s); if ((System.Int32)(oRecordSet.Fields.Item("CANT").Value) > 0) { Param = new TFunctions(); Param.SBO_f = FSBOf; oForm.SupportedModes = 1; oForm.Mode = BoFormMode.fm_UPDATE_MODE; oDBDSHeader.Query(null); s = Param.DesEncriptar((System.String)(oRecordSet.Fields.Item("U_Usuario").Value).ToString().Trim()); oDBDSHeader.SetValue("U_Usuario", 0, s); s = Param.DesEncriptar((System.String)(oRecordSet.Fields.Item("U_Password").Value).ToString().Trim()); oDBDSHeader.SetValue("U_Password", 0, s); s = Param.DesEncriptar((System.String)(oRecordSet.Fields.Item("U_UserWSCL").Value).ToString().Trim()); oDBDSHeader.SetValue("U_UserWSCL", 0, s); s = Param.DesEncriptar((System.String)(oRecordSet.Fields.Item("U_PassWSCL").Value).ToString().Trim()); oDBDSHeader.SetValue("U_PassWSCL", 0, s); oForm.PaneLevel = 101; if (((System.String)oDBDSHeader.GetValue("U_MultiSoc", 0)).Trim() == "Y") { oForm.Items.Item("chkDistrib").Visible = false; oForm.Items.Item("AbrirDoc").Visible = true; } else if (((System.String)oDBDSHeader.GetValue("U_MultiSoc", 0)).Trim() == "N") { oForm.Items.Item("chkDistrib").Visible = true; oForm.Items.Item("AbrirDoc").Visible = false; } oForm.Freeze(false); if (((System.String)oRecordSet.Fields.Item("U_TipoDif").Value).Trim() == "M") { DSOpDif.Value = "2"; } //((OptionBtn)oForm.Items.Item("opDifMon").Specific).Selected = true; else { DSOpDif.Value = "1"; } //((OptionBtn)oForm.Items.Item("opDifPor").Specific).Selected = true; } else { oForm.SupportedModes = 3; oForm.Mode = BoFormMode.fm_ADD_MODE; oForm.PaneLevel = 101; ((OptionBtn)oForm.Items.Item("opDifMon").Specific).Selected = true; } } catch (Exception e) { OutLog("InitForm: " + e.Message + " ** Trace: " + e.StackTrace); FSBOApp.MessageBox(e.Message + " ** Trace: " + e.StackTrace, 1, "Ok", "", ""); } finally { oForm.Freeze(false); } return(Result); }//fin InitForm