private void SearchContracts() { try { ClearMatrix(dtContracts.UniqueID, mtxContracts); string lStrContract = txtContracts.Value.Trim(); string lStrStatus = cboStatus.Selected.Value.Trim(); string lStrMunicipality = cboMunicipality.Selected.Value.Trim(); string lStrStartDate = string.IsNullOrEmpty(txtStartDate.Value) ? string.Empty : DateTimeUtility.StringToDateTime(txtStartDate.Value).ToString("yyyy/MM/dd"); string lStrEndDate = string.IsNullOrEmpty(txtEndDate.Value) ? string.Empty : DateTimeUtility.StringToDateTime(txtEndDate.Value).ToString("yyyy/MM/dd"); if (string.IsNullOrEmpty(txtClient.Value)) { mStrClientCode = string.Empty; } List <ContractsFiltersDTO> lLstContracts = mObjMachineryServiceFactory.GetContractsService().GetContracts(lStrContract, mStrClientCode, lStrStatus, lStrStartDate, lStrEndDate, lStrMunicipality); foreach (var lObjContract in lLstContracts) { AddContract(lObjContract); } } catch (Exception lObjException) { LogUtility.WriteError(string.Format("[frmRiseSearch - SearchContracts] Error al buscar los contratos: {0}", lObjException.Message)); throw new Exception(string.Format("Error al buscar los contratos: {0}", lObjException.Message)); } }
private void LoadContracts() { try { this.UIAPIRawForm.Freeze(true); Application.SBO_Application.StatusBar.SetText("Buscando contratos...", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning); ClearMatrix(); List <ContractsDTO> lLstContracts = mObjMachinerySeviceFactory.GetContractsService().GetContracts(); for (int i = 0; i < lLstContracts.Count; i++) { dtOrdersSale.Rows.Add(); dtOrdersSale.SetValue("#", i, i + 1); dtOrdersSale.SetValue("DocEntry", i, lLstContracts[i].DocEntry); dtOrdersSale.SetValue("DocNum", i, lLstContracts[i].DocNum); dtOrdersSale.SetValue("Date", i, lLstContracts[i].DocDate); dtOrdersSale.SetValue("Type", i, lLstContracts[i].TypeDescription); dtOrdersSale.SetValue("Status", i, lLstContracts[i].StatusDescription); dtOrdersSale.SetValue("TypeCode", i, lLstContracts[i].Type); dtOrdersSale.SetValue("StatusCod", i, lLstContracts[i].Status); dtOrdersSale.SetValue("ImpCod", i, lLstContracts[i].Import); dtOrdersSale.SetValue("CardName", i, lLstContracts[i].CardName); dtOrdersSale.SetValue("MunpId", i, lLstContracts[i].MunicipalityCode); dtOrdersSale.SetValue("Munp", i, lLstContracts[i].Municipality); } mtxOrdersSale.AutoResizeColumns(); mtxOrdersSale.LoadFromDataSource(); } catch (Exception lObjException) { LogUtility.WriteError(String.Format("[frmCFLOrdersSale - LoadContracts] Error: {0}", lObjException.Message)); SAPbouiCOM.Framework.Application.SBO_Application.MessageBox(string.Format("Error al obtener los contratos: {0}", lObjException.Message)); } finally { this.UIAPIRawForm.Freeze(false); } }