public override void MenuEvent(ref SAPbouiCOM.MenuEvent pVal, out bool BubbleEvent) { BubbleEvent = true; this.UIAPIRawForm.Freeze(true); try { if (pVal.MenuUID == "AddLine") { if (this.UIAPIRawForm.Mode == SAPbouiCOM.BoFormMode.fm_ADD_MODE || this.UIAPIRawForm.Mode == SAPbouiCOM.BoFormMode.fm_OK_MODE) { if (fldrItems.Selected == true) { mtxItems.AddLine(); } else { mtxCost.AddLine(); } } } if (pVal.MenuUID == "DeleteLine") { if (RowToDeleteIndex > 0) { mtxItems.DeleteRow(RowToDeleteIndex); mtxItems.FlushToDataSource(); } } } catch (Exception ex) { Application.SBO_Application.SetStatusBarMessage(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Long, true); } this.UIAPIRawForm.Freeze(false); }
public override void MenuEvent(ref SAPbouiCOM.MenuEvent pVal, out bool BubbleEvent) { BubbleEvent = true; this.UIAPIRawForm.Freeze(true); try { if (pVal.MenuUID == "AddLine") { if (this.UIAPIRawForm.Mode == SAPbouiCOM.BoFormMode.fm_UPDATE_MODE || this.UIAPIRawForm.Mode == SAPbouiCOM.BoFormMode.fm_OK_MODE || this.UIAPIRawForm.Mode == SAPbouiCOM.BoFormMode.fm_ADD_MODE) { mtxCost.AddLine(); //mtxCost.AddRowIndex(); mtxCost.FlushToDataSource(); } } if (pVal.MenuUID == "DeleteLine") { if (RowToDeleteIndex > 0) { mtxCost.DeleteRow(RowToDeleteIndex); mtxCost.FlushToDataSource(); this.UIAPIRawForm.Mode = SAPbouiCOM.BoFormMode.fm_UPDATE_MODE; } } } catch (Exception ex) { Utilities.LogException(ex); } finally { this.UIAPIRawForm.Freeze(false); } }
public static void DelRowWithoutDSource(ref SAPbouiCOM.Matrix matrix) { try { var lineSelected = matrix.GetCellFocus().rowIndex; matrix.DeleteRow(lineSelected); } catch (Exception ex) { throw ex; } }
private void Button2_ClickBefore(object sboObject, SAPbouiCOM.SBOItemEventArg pVal, out bool BubbleEvent) { BubbleEvent = true; if (SelectedRow != 0) { UserController.DeleteUser(Users[SelectedRow - 1].Id); Users.RemoveAt(SelectedRow - 1); Matrix0.DeleteRow(SelectedRow); SelectedRow = 0; } else { MessageBox.Show("Select item"); } }
private void SBO_ItemEvnt(string FormUID, ref SAPbouiCOM.ItemEvent pVal, out bool BubbleEvent) { BubbleEvent = true; try { GetCFL_EDIT(FormUID, ref pVal, out BubbleEvent, "CardCode", "2"); //f.item(UID);;f.item.col.row GetCFL_M1_EDIT(FormUID, ref pVal, out BubbleEvent, "m1", "4"); if (pVal.Before_Action == false) { if (pVal.ItemUID == "del") { if (pVal.EventType == SAPbouiCOM.BoEventTypes.et_CLICK) { int i = m1.GetNextSelectedRow(0, SAPbouiCOM.BoOrderType.ot_RowOrder); if (i > 0) { m1.DeleteRow(i); } else { SubMain.MessageBox("½Ð¿ï¨ú"); } } } else if (pVal.ItemUID == "add") { if (pVal.EventType == SAPbouiCOM.BoEventTypes.et_CLICK) { //http://scn.sap.com/thread/23469 //f.DataSources.DataTables.Item("RDR1").Rows.Add(1); //m1.AddRow(1,m1.RowCount); //f.DataSources.DBDataSources.Item(1).Clear(); m1.AddRow(1, m1.RowCount); //((SAPbouiCOM.EditText)m1.Columns.Item(1).Cells.Item(1).Specific).Value = "0003013021000"; } } } } catch (Exception ex) { SubMain.MessageBox(ex.Message); } }
public static void GetValuedRows(this SAPbouiCOM.Matrix mtxControl) { for (int i = 1; i <= mtxControl.RowCount; i++) { int c = mtxControl.Columns.Count - 1; bool isEmpty = true; while (c >= 0) { var cellValue = ((dynamic)mtxControl.Columns.Item(c).Cells.Item(i).Specific).Value; if (cellValue != string.Empty && mtxControl.Columns.Item(c).UniqueID != Constants.Hash && cellValue != "0.0") { isEmpty = false; break; } c--; } if (isEmpty) { mtxControl.DeleteRow(i); } } }
public bool HandleItemEvents(SAPbouiCOM.ItemEvent itemEvent) { var res = true; try { switch (itemEvent.ItemUID) { case EDT_COD_VENDEDOR: if (!itemEvent.BeforeAction && itemEvent.EventType == SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST) { var selectedObjects = ((SAPbouiCOM.IChooseFromListEvent)itemEvent).SelectedObjects; if (selectedObjects != null) { dsCabecera.SetValue("Code", 0, selectedObjects.GetValue("SlpCode", 0).ToString().Trim()); dsCabecera.SetValue("Name", 0, selectedObjects.GetValue("SlpName", 0).ToString().Trim()); if (mForm.Mode == SAPbouiCOM.BoFormMode.fm_OK_MODE) { mForm.Mode = SAPbouiCOM.BoFormMode.fm_UPDATE_MODE; } } } break; case MATRIZ_ALMACENES: if (!itemEvent.BeforeAction && itemEvent.EventType == SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST) { var selectedObjects = ((SAPbouiCOM.IChooseFromListEvent)itemEvent).SelectedObjects; if (selectedObjects != null) { dsDetAlmacenes.SetValue("U_MSSM_COD", itemEvent.Row - 1, selectedObjects.GetValue("WhsCode", 0).ToString().Trim()); dsDetAlmacenes.SetValue("U_MSSM_NOM", itemEvent.Row - 1, selectedObjects.GetValue("WhsName", 0).ToString().Trim()); mtxAlmacenes.LoadFromDataSource(); if (mForm.Mode == SAPbouiCOM.BoFormMode.fm_OK_MODE) { mForm.Mode = SAPbouiCOM.BoFormMode.fm_UPDATE_MODE; } } } break; case EDT_EQUIPO_ASIGNADO: if (!itemEvent.BeforeAction && itemEvent.EventType == SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST) { var selectedObjects = ((SAPbouiCOM.IChooseFromListEvent)itemEvent).SelectedObjects; if (selectedObjects != null) { dsCabecera.SetValue("U_MSSM_EQP", 0, selectedObjects.GetValue("Code", 0).ToString().Trim()); if (mForm.Mode == SAPbouiCOM.BoFormMode.fm_OK_MODE) { mForm.Mode = SAPbouiCOM.BoFormMode.fm_UPDATE_MODE; } } } break; case EDT_PROYECTO: if (!itemEvent.BeforeAction && itemEvent.EventType == SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST) { var selectedObjects = ((SAPbouiCOM.IChooseFromListEvent)itemEvent).SelectedObjects; if (selectedObjects != null) { dsCabecera.SetValue("U_MSSM_PRJ", 0, selectedObjects.GetValue("PrjCode", 0).ToString().Trim()); if (mForm.Mode == SAPbouiCOM.BoFormMode.fm_OK_MODE) { mForm.Mode = SAPbouiCOM.BoFormMode.fm_UPDATE_MODE; } } } break; case EDT_VEHICULO: if (!itemEvent.BeforeAction && itemEvent.EventType == SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST) { var selectedObjects = ((SAPbouiCOM.IChooseFromListEvent)itemEvent).SelectedObjects; if (selectedObjects != null) { dsCabecera.SetValue("U_MSSM_VEH", 0, selectedObjects.GetValue("Code", 0).ToString().Trim()); if (mForm.Mode == SAPbouiCOM.BoFormMode.fm_OK_MODE) { mForm.Mode = SAPbouiCOM.BoFormMode.fm_UPDATE_MODE; } } } break; //case MATRIZ_GRUPOS_ARTICULOS: // if (!itemEvent.BeforeAction && itemEvent.EventType == SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST) // { // var selectedObjects = ((SAPbouiCOM.IChooseFromListEvent)itemEvent).SelectedObjects; // if (selectedObjects != null) // { // dsDetalle1.SetValue("U_MSSM_COD", itemEvent.Row - 1, selectedObjects.GetValue("ItmsGrpCod", 0).ToString().Trim()); // dsDetalle1.SetValue("U_MSSM_NOM", itemEvent.Row - 1, selectedObjects.GetValue("ItmsGrpNam", 0).ToString().Trim()); // mtxGruposArticulo.LoadFromDataSource(); // if (mForm.Mode == SAPbouiCOM.BoFormMode.fm_OK_MODE) // mForm.Mode = SAPbouiCOM.BoFormMode.fm_UPDATE_MODE; // } // } // break; //case MATRIZ_GRUPOS_CLIENTES: // if (!itemEvent.BeforeAction && itemEvent.EventType == SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST) // { // var selectedObjects = ((SAPbouiCOM.IChooseFromListEvent)itemEvent).SelectedObjects; // if (selectedObjects != null) // { // dsDetalle2.SetValue("U_MSSM_COD", itemEvent.Row - 1, selectedObjects.GetValue("GroupCode", 0).ToString().Trim()); // dsDetalle2.SetValue("U_MSSM_NOM", itemEvent.Row - 1, selectedObjects.GetValue("GroupName", 0).ToString().Trim()); // mtxGruposCliente.LoadFromDataSource(); // if (mForm.Mode == SAPbouiCOM.BoFormMode.fm_OK_MODE) // mForm.Mode = SAPbouiCOM.BoFormMode.fm_UPDATE_MODE; // } // } // break; case BTN_ADD_ROW_P1: if (!itemEvent.BeforeAction) { dsDetAlmacenes.InsertRecord(dsDetAlmacenes.Size); dsDetAlmacenes.SetValue("U_MSSM_COD", dsDetAlmacenes.Size - 1, string.Empty); dsDetAlmacenes.SetValue("U_MSSM_NOM", dsDetAlmacenes.Size - 1, string.Empty); mtxAlmacenes.LoadFromDataSource(); } break; //case BTN_ADD_ROW_P2: // if (!itemEvent.BeforeAction) // { // dsDetalle2.InsertRecord(dsDetalle2.Size); // dsDetalle2.SetValue("U_MSSM_COD", dsDetalle2.Size - 1, string.Empty); // dsDetalle2.SetValue("U_MSSM_NOM", dsDetalle2.Size - 1, string.Empty); // mtxGruposCliente.LoadFromDataSource(); // } // break; //case BTN_ADD_ROW_P3: // if (!itemEvent.BeforeAction) // { // dsDetalle3.InsertRecord(dsDetalle3.Size); // dsDetalle3.SetValue("U_MSSM_COD", dsDetalle3.Size - 1, string.Empty); // dsDetalle3.SetValue("U_MSSM_NOM", dsDetalle3.Size - 1, string.Empty); // mtxGruposZona.LoadFromDataSource(); // } // break; case BTN_DEL_ROW_P1: if (!itemEvent.BeforeAction) { List <int> indexes = new List <int>(); for (int i = 1; i <= mtxAlmacenes.RowCount; i++) { if (mtxAlmacenes.IsRowSelected(i)) { indexes.Add(i); } } if (indexes.Count > 0) { int counter = 0; while (counter <= indexes.Count) { for (int i = 1; i <= mtxAlmacenes.RowCount; i++) { if (mtxAlmacenes.IsRowSelected(i)) { mtxAlmacenes.DeleteRow(i); break; } } counter++; } if (mForm.Mode == SAPbouiCOM.BoFormMode.fm_OK_MODE) { mForm.Mode = SAPbouiCOM.BoFormMode.fm_UPDATE_MODE; } mtxAlmacenes.FlushToDataSource(); } } break; //case BTN_DEL_ROW_P2: // if (!itemEvent.BeforeAction) // { // List<int> indexes = new List<int>(); // for (int i = 1; i <= mtxGruposCliente.RowCount; i++) // { // if (mtxGruposCliente.IsRowSelected(i)) // indexes.Add(i); // } // if (indexes.Count > 0) // { // int counter = 0; // while (counter <= indexes.Count) // { // for (int i = 1; i <= mtxGruposCliente.RowCount; i++) // { // if (mtxGruposCliente.IsRowSelected(i)) // { // mtxGruposCliente.DeleteRow(i); // break; // } // } // counter++; // } // if (mForm.Mode == SAPbouiCOM.BoFormMode.fm_OK_MODE) // mForm.Mode = SAPbouiCOM.BoFormMode.fm_UPDATE_MODE; // mtxGruposCliente.FlushToDataSource(); // } // } // break; //case BTN_DEL_ROW_P3: // if (!itemEvent.BeforeAction) // { // } // break; case BTN_PRINCIPAL: if (itemEvent.BeforeAction && (mForm.Mode == SAPbouiCOM.BoFormMode.fm_UPDATE_MODE || mForm.Mode == SAPbouiCOM.BoFormMode.fm_ADD_MODE)) { res = validarObjeto(); } break; default: break; } } catch (Exception ex) { StatusMessageError("HandleItemEvents() > " + ex.Message); } return(res); }
internal void DeleteRow() { int lIntSelectedRow = mObjMtxInspDetails.GetNextSelectedRow(0, SAPbouiCOM.BoOrderType.ot_RowOrder); if (lIntSelectedRow > 0) { string lStrType = ((SAPbouiCOM.EditText)mObjMtxInspDetails.Columns.Item(1).Cells.Item(lIntSelectedRow).Specific).Value.ToString(); double lDbQuantity = double.Parse(((SAPbouiCOM.EditText)mObjMtxInspDetails.Columns.Item(2).Cells.Item(lIntSelectedRow).Specific).Value); int lIntQntity = (int)lDbQuantity; string lStrQuery = mObjinspectionDAO.GetInspectionByID(Convert.ToInt16(mlstInspection[0].IdInspection)); string lStrRowCode = GetRowCodeFromDatasource(lIntSelectedRow); //string lIntMvmType = mObjInspectionCheckListDAO.GetTypeCharByNameComplete(lStrType); string lIntMvmType = ((SAPbouiCOM.EditText)(mObjMtxInspDetails.Columns.Item("ColTypeM").Cells.Item(lIntSelectedRow).Specific)).Value; SAPbobsCOM.Recordset lObjRecordSet = (SAPbobsCOM.Recordset)DIApplication.Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset); lObjRecordSet.DoQuery(lStrQuery); if (lObjRecordSet.RecordCount > 0) { if (lStrRowCode != string.Empty) { if (lIntMvmType == "N") { lIntHeadNPCounter += lIntQntity; } else { lIntHeadRejCounter += lIntQntity; } //mObjInspDetailsService.DeleteInspectionDetails(lStrRowCode); lLstRowCode.Add((lStrRowCode)); } mObjMtxInspDetails.DeleteRow(lIntSelectedRow); } else { if (lIntMvmType == "N") { lIntHeadNPCounter += lIntQntity; } else { lIntHeadRejCounter += lIntQntity; } var TempList = llstInspDetDTO.Single(x => x.RowCode == null && x.Type == lStrType && x.Quantity == lIntQntity); llstInspDetDTO.Remove(TempList); mObjMtxInspDetails.DeleteRow(lIntSelectedRow); } MemoryUtility.ReleaseComObject(lObjRecordSet); if (btnAdd.Item.Enabled == false) { btnAdd.Item.Enabled = true; btnOk.Item.Enabled = false; } if (mObjMtxInspDetails.RowCount == 0) { btnCancel.Item.Enabled = true; } //if (btnOk.Item.Enabled == false) //{ // btnOk.Item.Enabled = true; //} } else { Application.SBO_Application.StatusBar.SetText("Seleccionar una línea" , SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error); } }
private void AddChooseFromList()//aqui break point { lObjFormXml.DataSources.UserDataSources.Add("UDCFL", SAPbouiCOM.BoDataType.dt_SHORT_TEXT, 254); string Cbx = lObjComboBox.Value.Trim(); try { SAPbouiCOM.ChooseFromListCollection oCFLs = null; SAPbouiCOM.Conditions oCons = null; SAPbouiCOM.Condition oCon = null; SAPbouiCOM.Column oColumn = null; oCFLs = lObjFormXml.ChooseFromLists; SAPbouiCOM.ChooseFromListCreationParams lObjCFLCreationParams = null; lObjCFLCreationParams = (SAPbouiCOM.ChooseFromListCreationParams)SAPbouiCOM.Framework.Application.SBO_Application.CreateObject (SAPbouiCOM.BoCreatableObjectType.cot_ChooseFromListCreationParams); // Adding 2 CFL, one for the button and one for the edit text. //string strCFLID = oCFLCreationParams.UniqueID lObjCFLCreationParams.MultiSelection = false; if (lStrDocType.Equals("Servicios")) { lObjCFLCreationParams.ObjectType = "1"; } else { lObjCFLCreationParams.ObjectType = "4"; } lObjCFLCreationParams.UniqueID = "CFLACT"; pObjChooseFromList = oCFLs.Add(lObjCFLCreationParams); // Adding Conditions to CFL1 oCons = pObjChooseFromList.GetConditions(); //Onlu Postable Accounts if (lStrDocType.Equals("Servicios") && lStrFormType != "65301") { if (Cbx == "MXP") { #region MXP oCon = oCons.Add(); oCon.Alias = "Postable"; oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL; oCon.CondVal = "Y"; oCon.Relationship = SAPbouiCOM.BoConditionRelationship.cr_AND; oCon = oCons.Add(); oCon.Alias = "LocManTran"; oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL; oCon.CondVal = "N"; oCon.Relationship = SAPbouiCOM.BoConditionRelationship.cr_AND; oCon = oCons.Add(); oCon.Alias = "ActCurr"; oCon.Operation = SAPbouiCOM.BoConditionOperation.co_NOT_EQUAL; oCon.CondVal = "EUR"; oCon.Relationship = SAPbouiCOM.BoConditionRelationship.cr_AND; oCon = oCons.Add(); oCon.Alias = "ActCurr"; oCon.Operation = SAPbouiCOM.BoConditionOperation.co_NOT_EQUAL; oCon.CondVal = "USD"; #endregion } else if (Cbx == "USD") { #region USD oCon = oCons.Add(); oCon.Alias = "Postable"; oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL; oCon.CondVal = "Y"; oCon.Relationship = SAPbouiCOM.BoConditionRelationship.cr_AND; oCon = oCons.Add(); oCon.Alias = "LocManTran"; oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL; oCon.CondVal = "N"; oCon.Relationship = SAPbouiCOM.BoConditionRelationship.cr_AND; oCon = oCons.Add(); oCon.Alias = "ActCurr"; oCon.Operation = SAPbouiCOM.BoConditionOperation.co_NOT_EQUAL; oCon.CondVal = "EUR"; oCon.Relationship = SAPbouiCOM.BoConditionRelationship.cr_AND; oCon = oCons.Add(); oCon.Alias = "ActCurr"; oCon.Operation = SAPbouiCOM.BoConditionOperation.co_NOT_EQUAL; oCon.CondVal = "MXP"; #endregion } else if (Cbx == "EUR") { #region EUR oCon = oCons.Add(); oCon.Alias = "Postable"; oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL; oCon.CondVal = "Y"; oCon.Relationship = SAPbouiCOM.BoConditionRelationship.cr_AND; oCon = oCons.Add(); oCon.Alias = "LocManTran"; oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL; oCon.CondVal = "N"; oCon.Relationship = SAPbouiCOM.BoConditionRelationship.cr_AND; oCon = oCons.Add(); oCon.Alias = "ActCurr"; oCon.Operation = SAPbouiCOM.BoConditionOperation.co_NOT_EQUAL; oCon.CondVal = "USD"; oCon.Relationship = SAPbouiCOM.BoConditionRelationship.cr_AND; oCon = oCons.Add(); oCon.Alias = "ActCurr"; oCon.Operation = SAPbouiCOM.BoConditionOperation.co_NOT_EQUAL; oCon.CondVal = "MXP"; #endregion } } else if (lStrDocType.Equals("Servicios") && lStrFormType == "65301") { #region advances to suppliers oCon = oCons.Add(); oCon.Alias = "AcctCode"; oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL; oCon.CondVal = "11410000"; #endregion } else { oCon = oCons.Add(); oCon.Alias = "validFor"; oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL; oCon.CondVal = "Y"; } pObjChooseFromList.SetConditions(oCons); if (oMatrix.RowCount > 0) { for (int i = oMatrix.RowCount; i >= 1; i--) { if (oMatrix.RowCount == 1) { oMatrix.ClearRowData(i); oMatrix.DeleteRow(i); } else { oMatrix.DeleteRow(i); } } } oColumn = oMatrix.Columns.Item("Col_0"); try { oColumn.DataBind.SetBound(true, "", "UDCFL"); } catch (Exception) { } oColumn.ChooseFromListUID = pObjChooseFromList.UniqueID; if (lStrDocType.Equals("Servicios")) { oColumn.ChooseFromListAlias = "AcctCode"; } else { oColumn.ChooseFromListAlias = "ItemCode"; } } catch (Exception ex) { SAPbouiCOM.Framework.Application.SBO_Application.MessageBox(string.Format("InitCustomerChooseFromListException: {0}", ex.Message)); } }