private void btnFinish_ClickAfter(object sboObject, SBOItemEventArg pVal) { string lStrMessage = mLstJournalEntryDTO.Count() > 0 ? " Aun tiene registros por guardar " : ""; Auction lObjAuction = mObjPaymentServiceFactory.GetPaymentService().GetAuction(mStrAuctionId); if (!lObjAuction.AutAuction) { if (UIApplication.ShowOptionBox(lStrMessage + "¿Desea terminar cobro? ") == 1) { lObjAuction.AutAuction = true; int lIntResult = mObjPaymentServiceFactory.GetAuctionService().Update(lObjAuction); if (lIntResult == 0)//&& lObjAuction.AutCorral && lObjAuction.AutTransp) { List <MessageDTO> lLstMessagesDTO = mObjPaymentServiceFactory.GetPaymentService().GetMessages(mStrAuctionId); bool lBolAlert = false; foreach (MessageDTO lObjMessage in lLstMessagesDTO) { if (mObjPaymentServiceFactory.GetAlertService().SaveAlert(lObjMessage)) { lBolAlert = true; } } if (lBolAlert) { UIApplication.ShowMessageBox("Proceso terminado \n Se envió una alerta al departamento de crédito y cobranza"); } } } } else { UIApplication.ShowMessageBox("Proceso ya se ha terminado anteriormente"); } }
/// <summary> /// Validate before /// </summary> /// <returns></returns> private bool Validate() { if (String.IsNullOrEmpty(cbxType.Value)) { UIApplication.ShowMessageBox("Seleccionar Tipo de Cobro"); return(false); } if (Object.ReferenceEquals(pendingInvoices, null) || pendingInvoices.Count <= 0) { return(false); } switch (cbxType.Value) { case "Cobro Normal": if (selectedRow.Equals(0)) { UIApplication.ShowMessageBox("Seleccionar Cliente"); return(false); } if (dt0.GetValue("C_Debt", selectedRow - 1).ToString().Equals("0")) { UIApplication.ShowMessageBox("Ya se ha facturado la deuda del cliente: " + dt0.GetValue("C_Name", selectedRow - 1).ToString()); return(false); } break; case "Cobro Cierre": case "Facturación Subasta": if (UIApplication.ShowOptionBox("Se realizará la factura de tipo " + cbxType.Value) == 2) { return(false); } break; } return(true); }
bool Validations() { if (livestockInCorals.Count == 0 || !btnCreate.Item.Enabled) { return(false); } if (cbAll.Checked) { if (UIApplication.ShowOptionBox("Estas seguro de trasladar todo el ganado a subsata") == 2) { return(false); } } SetLivestockTransferQuantities(cbAll.Checked ? "C_Exist" : "C_Quantity"); if (livestockInCorals.Where(l => l.Quantity == 0).AsParallel().Count() == livestockInCorals.Count) { UIApplication.ShowMessageBox("No se ha ingresado cantidad para dar traslado al ganado"); return(false); } if (!Task.Factory.StartNew(() => { return(Parallel.ForEach(Partitioner.Create(0, livestockInCorals.Count), (range, state) => { for (int i = range.Item1; i < range.Item2; i++) { if (livestockInCorals[i].Quantity > livestockInCorals[i].Exist) { state.Stop(); } } }).IsCompleted); }).Result) { UIApplication.ShowMessageBox("La cantidad no debe ser mayor que la existencia"); return(false); } return(true); }
/// <summary> /// Validate After and Before fill the quantities for Stock Exit in Livestock Matrix /// </summary> /// <param name="beforeQuantities"></param> /// <returns></returns> public bool ValidateLivestockExit(bool beforeQuantities) { if (beforeQuantities) { if (selectedRow.Equals(0)) { UIApplication.ShowMessageBox("Selecionar Cliente"); return(false); } if (String.IsNullOrEmpty(cbxType.Value)) { return(false); } if (cbxType.Value.Equals("Facturación Subasta")) { return(false); } if (cbOutAll.Checked) { if (UIApplication.ShowOptionBox("Estas seguro se sar salida a todo el ganado") == 2) { return(false); } } if (!pendingInvoices[selectedRow - 1].Debt.Equals(0)) { UIApplication.ShowMessageBox("No se puede dar salida al ganado sin haber facturado la deuda"); return(false); } } else //Validate the Quantities { var appraisalImport = 0.0; var debtImport = 0.0; if (livestock.Where(l => l.Quantity == 0).AsParallel().Count() == livestock.Count) { UIApplication.ShowMessageBox("No se ha ingresado cantidad para dar salida al ganado"); return(false); } //This task validate that the Quantity have to be less or equal than Existence var task = Task.Factory.StartNew(() => { var cts = new CancellationTokenSource(); var po = new ParallelOptions(); po.CancellationToken = cts.Token; ParallelLoopResult result = Parallel.ForEach(Partitioner.Create(0, livestock.Count), (range, state) => { for (int i = range.Item1; i < range.Item2; i++) { if (livestock[i].Quantity > livestock[i].Exist) { cts.Cancel(); //cancel the loop } } }); if (cts.IsCancellationRequested) { return(false); } return(true); }); task.Wait(); if (!task.Result) { UIApplication.ShowMessageBox("La cantidad no debe ser mayor que la existencia"); return(false); } //Validate Appraisal Import and Debt Import var task2 = Task.Factory.StartNew(() => { appraisalImport = CalculateAppraisalImport(livestock); }); var task3 = Task.Factory.StartNew(() => { debtImport = massInvoicingDAO.GetDebtImport(pendingInvoices[selectedRow - 1].Code, user.WhsCode); }); Task.WaitAll(task2, task3); if (appraisalImport < debtImport) { if (UIApplication.ShowOptionBox("El importe avaluo es menor que el importe deuda, estas seguro de dar salida al ganado") == 2) { mBoolAuthP = false; return(false); } else { mBoolAuthP = true; user.AppraisalValidation = true; } } } return(true); }