public void NoInlineAttributeCannotBeAppliedToNonConstField() { Prepare("public class C1 { [System.Runtime.CompilerServices.NoInline] public static int X1 = 0; }", expectErrors: true); Assert.That(AllErrors.Count, Is.EqualTo(1)); Assert.That(AllErrors.Any(m => m.Code == 7160 && m.FormattedMessage.Contains("C1.X1") && m.FormattedMessage.Contains("NoInlineAttribute"))); }
private void btnGenerate_Click(object sender, EventArgs e) { var customer = (Customer)cboCustomer.SelectedItem; var invoiceCode = (string)cboInvoice.SelectedItem; if (IsValid == false) { MessageBox.Show(AllErrors.ErrorMessageString(), Constants.ALERTMESSAGEHEADER); return; } var request = new CreditNoteRequest { CreditNote = new CreditNote { TransactionDate = dtCosting.Value, Amount = Convert.ToDecimal(txtAmount.Text), CustomerCode = customer.CustomersCode, IsActive = true, Description = txtDescription.Text, InvoiceNo = invoiceCode } }; var response = _transactionService.CreateCreditNote(request); if (false == response.IsValid) { MessageBox.Show(response.AllErrors.ErrorMessageString(), Constants.ALERTMESSAGEHEADER); return; } ShowCreditNoteReport(request.CreditNote.Id); }
private void btnConnect_Click(object sender, EventArgs e) { if (IsValid == false) { MessageBox.Show(AllErrors.ErrorMessageString(), Constants.ALERTMESSAGEHEADER); return; } var request = new SqlConnectionStringBuilder { DataSource = txtServerName.Text, InitialCatalog = DbName }; bool authType = (cboAuthType.SelectedIndex == (Int16)AuthType.Windows); request.IntegratedSecurity = authType; if (authType == false) { request.UserID = txtUserName.Text; request.Password = txtPassword.Text; } string connectionString = _connectionProvider.CreateConnectionString(request); Cursor = Cursors.WaitCursor; if (_connectionProvider.CheckConnection(connectionString) == false) { var error = String.Format("Cannot connect to {0} \n \n Additional Information \n \n {1}", txtServerName.Text, _connectionProvider.AllErrors.FirstOrDefault()); MessageBox.Show(error, Resources.frmConnection_btnConnect_Click_Connection_to_server_failed_); Cursor = Cursors.Default; return; } Cursor = Cursors.Default; CoreSettings.UpdateAppSettings("appSettings", Constants.SQLCONNECTIONSTRING, connectionString); MessageBox.Show(Resources.frmConnection_btnConnect_Click_Connection_to_server_succeeded__Please_restart_your_application_, Resources.frmConnection_btnConnect_Click_Connection_to_server_succeeded_); Cursor = Cursors.Default; Application.Exit(); }
private bool TryCreateJewelLookup(out TransactionLookup lookup) { lookup = null; if (IsValid == false) { MessageBox.Show(AllErrors.ErrorMessageString(), Constants.ALERTMESSAGEHEADER); return(false); } CostingRates costingRates; if (VALIDATEDATAGRID(out costingRates) == false) { return(false); } List <JewelTransaction> jewelTransaction; Calculate(dgvJewel, costingRates, out jewelTransaction); lookup = new TransactionLookup { ContactName = txtContactName.Text, DocNumber = txtDocNo.Text, Remarks = txtRemarks.Text, TransactionDate = dtCosting.Value, TransactionPartyRef = ((Customer)cboCustomer.SelectedItem).CustomersCode, TransactionType = rdoApprovalMemo.Checked ? TransactionType.ApprovalTransaction : TransactionType.MarketingTransaction, JewelTransactions = jewelTransaction }; return(true); }
public void Run() { Guid id; Guid.TryParse(DataTransferObject.ParentInstanceID, out id); ID = DataTransferObject.ResourceID; ParentID = DataTransferObject.ParentID; WorkspaceID = DataTransferObject.WorkspaceID; // handle queuing WaitForSlot(); // abort the execution - no space at the inn if (!ExecutableServiceRepository.Instance.DoesQueueHaveSpace()) { _instance.Abort(); } else { ExecutableServiceRepository.Instance.Add(this); // here is space at the inn ;) var wfappUtils = new WfApplicationUtils(); if (DataTransferObject.IsDebugMode()) { ErrorResultTO invokeErrors; wfappUtils.DispatchDebugState(DataTransferObject, StateType.Start, AllErrors.HasErrors(), AllErrors.MakeDisplayReady(), out invokeErrors, null, true); AllErrors.MergeErrors(invokeErrors); } _previousNumberOfSteps = DataTransferObject.NumberOfSteps; DataTransferObject.NumberOfSteps = 0; _instance.Run(); } }
void OnSaveClick(object sender, EventArgs e) { if (PurchaseTransactionItems.Any()) { _jewelCalculation.Calculate(CostingRate, PurchaseTransactionItems); var lookup = new TransactionLookup { ContactName = txtContactName.Text, DocNumber = txtDocNo.Text, Remarks = txtRemarks.Text, TransactionDate = dtCosting.Value, TransactionPartyRef = ((Supplier)cboCustomer.SelectedItem).SupplierCode, TransactionType = TransactionType.PurchaseTransaction, JewelTransactions = PurchaseTransactionItems }; var request = new JewelTransactionRequest { TransactionLookup = lookup, }; var response = _costingServices.CreateJewelTransaction(request); if (response.IsValid == false) { MessageBox.Show(AllErrors.ErrorMessageString(), Constants.ALERTMESSAGEHEADER); return; } ShowManagedModalForm <frmCostingConfirmation>(Owner as frmCostingBase, response.TransactionLookup); Close(); } }
private void btnShowHistoryRecords() { if (txtJewelNumber.Text.IsEmpty() && txtDesignCode.Text.IsEmpty() && txtCertiNo.Text.IsEmpty()) { MessageBox.Show(Resources.frmJewelHistory_btnShowHistory_Click_Please_enter_jewelnumber_or_design_code_); return; } if (IsValid == false) { MessageBox.Show(AllErrors.ErrorMessageString(), Constants.ALERTMESSAGEHEADER); return; } List <JewelTransaction> table = null; if (!txtJewelNumber.Text.IsEmpty()) { table = _transactionService.GetJewelTransactions().Where(x => x.JewelNumber.ToLower() == txtJewelNumber.Text.ToLower()).OrderByDescending(x => x.AccessedDate).ToList(); } else if (!txtDesignCode.Text.IsEmpty()) { table = _transactionService.GetJewelTransactions().Where(x => x.DesignCode.ToLower() == txtDesignCode.Text.ToLower()).OrderByDescending(x => x.AccessedDate).ToList(); } else if (!txtCertiNo.Text.IsEmpty()) { table = _transactionService.GetJewelTransactions().Where(x => x.CertificateNumber.ToLower() == txtCertiNo.Text.ToLower()).OrderByDescending(x => x.AccessedDate).ToList(); } if (!table.Any()) { MessageBox.Show(Resources.frmJewelHistory_btnShowHistory_Click_No_transaction_found_, Constants.ALERTMESSAGEHEADER); return; } FindTransaction(table); }
private void UpdateDimensionList(ReactiveList <LocalDimension> list) { list.ChangeTrackingEnabled = false; foreach (var dim in list) { dim.IsDuplicate = false; dim.RaisePropertyChanged(nameof(dim.Name)); } var duplicatgroups = list .GroupBy(dim => dim.Name) .Where(g => g.Count() > 1) .ToList(); foreach (var group in duplicatgroups) { foreach (var dim in group) { dim.IsDuplicate = true; dim.RaisePropertyChanged(nameof(dim.Name)); } } list.ChangeTrackingEnabled = true; CanCreate = !AllErrors.Any() && ColumnList.Count(col => col.HasErrors) == 0 && RowList.Count(row => row.HasErrors) == 0; }
private void btnSave_Click(object sender, EventArgs e) { if (base.IsValid == false) { MessageBox.Show(AllErrors.ErrorMessageString(), Constants.ALERTMESSAGEHEADER); return; } BindForm(); MessageBox.Show(Resources.frmLooseDiamonds_btnSave_Click_Record_saved_); }
public void PropertyOfNonSerializableClassThatImplementsSerializedInterfaceMemberMustBeImplementedAsAutoProperty() { Prepare(@"using System; [Serializable] public interface I1 { int Prop1 { get; set; } } class C1 : I1 { public int Prop1 { get { return 0; } set {} } }", expectErrors: true); Assert.That(AllErrors.Count, Is.EqualTo(1)); Assert.That(AllErrors.Any(m => m.Severity == MessageSeverity.Error && m.Code == 7156 && m.FormattedMessage.Contains("C1.Prop1") && m.FormattedMessage.Contains("I1.Prop1") && m.FormattedMessage.Contains("auto-property"))); Prepare(@"using System; [Serializable] public interface I1 { int Prop1 { get; } } class C1 : I1 { public int Prop1 { get { return 0; } } }", expectErrors: true); Assert.That(AllErrors.Count, Is.EqualTo(1)); Assert.That(AllErrors.Any(m => m.Severity == MessageSeverity.Error && m.Code == 7156 && m.FormattedMessage.Contains("C1.Prop1") && m.FormattedMessage.Contains("I1.Prop1") && m.FormattedMessage.Contains("auto-property"))); Prepare(@"using System; [Serializable] public interface I1 { int Prop1 { set; } } class C1 : I1 { public int Prop1 { set {} } }", expectErrors: true); Assert.That(AllErrors.Count, Is.EqualTo(1)); Assert.That(AllErrors.Any(m => m.Severity == MessageSeverity.Error && m.Code == 7156 && m.FormattedMessage.Contains("C1.Prop1") && m.FormattedMessage.Contains("I1.Prop1") && m.FormattedMessage.Contains("auto-property"))); }
private void btnShowReport_Click(object sender, EventArgs e) { if (IsValid == false) { MessageBox.Show(AllErrors.ErrorMessageString(), Constants.ALERTMESSAGEHEADER); return; } var transactionType = (TransactionType)Enum.Parse(typeof(TransactionType), cboTransactionType.SelectedItem.ToString()); var request = new TaxInvoiceReportRequest { TransactionNumber = txtInvoiceNo.Text, TransactionType = transactionType }; var response = new TaxInvoiceReportResponse(); var reportDocument = new ReportDocument(); if (rdoDetail.Checked) { response = _reportService.GetTransactionDetailReport(request); reportDocument.Load(ReportUtility.GetTaxInvoiceDetailReportPath(transactionType)); } else if (rdoSummary.Checked) { response = _reportService.GetTransactionSumaryReport(request); reportDocument.Load(ReportUtility.GetTaxInvoiceSummaryReportPath(transactionType)); } if (false == response.IsValid) { MessageBox.Show(response.AllErrors.ErrorMessageString(), Constants.ALERTMESSAGEHEADER); crystalReportViewer.ReportSource = null; return; } if (rdoDetail.Checked) { reportDocument.SetDataSource(response.TaxInvoiceDetailDataSet); } else if (rdoSummary.Checked) { reportDocument.SetDataSource(response.TaxInvoiceSummaryDataSet); } crystalReportViewer.ReportSource = reportDocument; crystalReportViewer.Refresh(); }
private void btnShowTransactions_Click(object sender, EventArgs e) { if (dtFromDate.Value > dtToDate.Value) { MessageBox.Show(Resources.frmPartyTransaction_btnShowTransactions_Click_Please_correct_transaction_date_); return; } if (IsValid == false) { MessageBox.Show(AllErrors.ErrorMessageString(), Constants.ALERTMESSAGEHEADER); return; } FindTransaction(); }
/// <summary> /// Creates a new instance of the <see cref="GenerateResult"/> class. /// </summary> public GenerateResult([NotNull] IEnumerable <GeneratedFile> generatedFiles, [NotNull] IEnumerable <GenerationIssue> errors) { if (generatedFiles == null) { throw new ArgumentNullException(nameof(generatedFiles)); } if (errors == null) { throw new ArgumentNullException(nameof(errors)); } GeneratedFiles = generatedFiles; Errors = errors; AllErrors = Errors.Concat(GeneratedFiles.SelectMany(f => f.Errors)); Success = !AllErrors.Any(); }
public void Initialize(ViewRequest viewRequest) { shell.AddVMCommand("File", "Save", "SaveChangesCommand", this) .SetHotKey(ModifierKeys.Control, Key.S); if (viewRequest is CronEditorRequest request) { Id = request.Schedule.Id; if (Id == 0) { CreateCronString(); Name = "New schedule"; } else { FullExpression = request.Schedule.Schedule; Name = request.Schedule.Name; } } categories.Connect() .Bind(out var categs) .WhenAnyPropertyChanged() .Subscribe(_ => { CreateCronString(); }); void Changed(object sender, PropertyChangedEventArgs e) { IsDirty = true; if (Title.Last() != '*') { Title += '*'; } } AllErrors.Connect() .Subscribe(_ => IsValid = !AllErrors.Items.Any()); PropertyChanged += Changed; Categories = categs; }
private void btnGo_Click(object sender, EventArgs e) { if (IsValid == false) { MessageBox.Show(AllErrors.ErrorMessageString(), Constants.ALERTMESSAGEHEADER); return; } var customer = (Customer)cboCustomer.SelectedValue; var ledger = _transactionServices.GetJewelStockLedgers(); dgvJewel.Rows.Clear(); var jewelTransactions = from tran in _transactionServices.GetJewelTransactions() join lg in ledger on tran.JewelNumber equals lg.JewelNumber where lg.JewelState_Enum == (short)JewelState.OnApproval && lg.StockStatus_Enum == (short)StockStatus.ItemOutOfStock && tran.TransactionLookup.TransactionPartyRef == customer.CustomersCode && tran.TransactionType_Enum == (short)TransactionType.ApprovalTransaction && tran.UpdatedTransactionBy == null select tran; foreach (var tran in jewelTransactions) { var _newRowNumber = dgvJewel.RowCount; dgvJewel.Rows.Add(1); dgvJewel.Rows[_newRowNumber].Height = 50; dgvJewel.Rows[_newRowNumber].Cells[_columnselectchk.ToLowerCaseColumnName()].Value = false; dgvJewel.Rows[_newRowNumber].Cells[_columnselectchk.ToLowerCaseColumnName()].Tag = tran.JewelTransactionId; dgvJewel.Rows[_newRowNumber].Cells[_columnjewelnumber.ToLowerCaseColumnName()].Value = tran.JewelNumber; dgvJewel.Rows[_newRowNumber].Cells[_columndesigncode.ToLowerCaseColumnName()].Value = tran.DesignCode; dgvJewel.Rows[_newRowNumber].Cells[_columntype.ToLowerCaseColumnName()].Value = tran.JewelItemCategory; dgvJewel.Rows[_newRowNumber].Cells[_columngoldkt.ToLowerCaseColumnName()].Value = tran.KT; dgvJewel.Rows[_newRowNumber].Cells[_columntotalwt.ToLowerCaseColumnName()].Value = tran.TotalWeight; dgvJewel.Rows[_newRowNumber].Cells[_columnmetalweight.ToLowerCaseColumnName()].Value = tran.MetalWeight; dgvJewel.Rows[_newRowNumber].Cells[_columndiamondweight.ToLowerCaseColumnName()].Value = tran.StoneWeight; dgvJewel.Rows[_newRowNumber].Cells[_columndiapcs.ToLowerCaseColumnName()].Value = tran.StonePcs; dgvJewel.Rows[_newRowNumber].Cells[_columncolwt.ToLowerCaseColumnName()].Value = tran.CStoneWeight; dgvJewel.Rows[_newRowNumber].Cells[_columncolpcs.ToLowerCaseColumnName()].Value = tran.CStonePcs; dgvJewel.Rows[_newRowNumber].Cells[_columntotalAmount.ToLowerCaseColumnName()].Value = tran.TotalAmount; dgvJewel[_columnimage.ToLowerCaseColumnName(), _newRowNumber].Value = ImageExtension.ResolveImage(tran.DesignCode); dgvJewel.FirstDisplayedScrollingRowIndex = dgvJewel.RowCount - 1; } }
private void btnSave_Click(object sender, EventArgs e) { if (IsValid == false) { MessageBox.Show(AllErrors.ErrorMessageString(), Constants.ALERTMESSAGEHEADER); return; } if (cboCategory.SelectedValue.ToString() == ProductCategory.NotSet.ToString()) { MessageBox.Show(Resources.frmConfiguration_btnSave_Click_Please_select_costing_category, Constants.ALERTMESSAGEHEADER); return; } var request = new ConfigMasterRequest { ConfigurationMaster = CurrentItem.Entity }; if (MdiMode == FormMode.Add) { request.ConfigurationMaster = new ConfigurationMaster { Particulars = txtPerticulars.Text, ConfigurationValue = txtValue.Text, Remarks = txtRemarks.Text, ProductCategory_Enum = Convert.ToInt16(cboCategory.SelectedValue) }; } request.ConfigurationMaster.JewelItemCategory = rdoStockTpeAlloy.Checked ? JewelItemCategory.Alloy : (rdoStockTpeGold.Checked ? JewelItemCategory.Gold : (rdoStockTpeSilver.Checked ? JewelItemCategory.Silver : JewelItemCategory.NotSet)); request.ConfigurationMaster.Active = chkDisabled.Checked; var response = _configurationService.SaveConfiguration(request); if (false == response.IsValid) { MessageBox.Show(response.AllErrors.ErrorMessageString(), Constants.ALERTMESSAGEHEADER); return; } MdiMode = FormMode.Normal; BindConfigForm(); }
private void btnSave_Click(object sender, EventArgs e) { if (IsValid == false) { MessageBox.Show(AllErrors.ErrorMessageString(), Constants.ALERTMESSAGEHEADER); return; } if (chkcancelled.Checked) { if (MessageBox.Show(Resources.frmFinancialYear_btnSave_Click_, Constants.ALERTMESSAGEHEADER, MessageBoxButtons.YesNo) == DialogResult.No) { return; } } var request = new FinancialYearRequest { FinancialYearMaster = CurrentItem.Entity }; if (MdiMode == FormMode.Add) { request.FinancialYearMaster = new FinancialYearMaster { YearCode = txtYearCode.Text, DateFrom = dtFrom.Value, DateTo = dtTo.Value }; } request.FinancialYearMaster.IsActive = chkActive.Checked; request.FinancialYearMaster.IsCancelled = chkcancelled.Checked; var response = _configurationService.CreateFinancialYear(request); if (false == response.IsValid) { MessageBox.Show(response.AllErrors.ErrorMessageString(), Constants.ALERTMESSAGEHEADER); return; } grpFinYear.Enabled = chkActive.Enabled = chkcancelled.Enabled = btnSave.Enabled = false; MessageBox.Show(Resources.frmFinancialYear_btnSave_Click_Record_saved_); }
public Ncgr(BinaryReader br, Nclr nclr, Ncer ncer, string diretorio, string exportPath) : base(br, diretorio) { if (Errors.Count == 0 && nclr.Errors.Count == 0 && ncer.Errors.Count == 0) { ArquivoNcer = ncer; ArquivoNclr = nclr; SetNgcrProperties(br, exportPath); //CarregarImagemNCGRComNCER(); } else { AllErrors.AddRange(Errors); AllErrors.AddRange(nclr.Errors); AllErrors.AddRange(ncer.Errors); } br.Close(); }
private void btnSave_Click(object sender, EventArgs e) { if (IsValid == false) { MessageBox.Show(AllErrors.ErrorMessageString(), Constants.ALERTMESSAGEHEADER); return; } if (cboJewelNumber.SelectedIndex == -1) { return; } var ledger = (JewelStockLedger)cboJewelNumber.SelectedValue; var request = new JewelUpdateRequest(ledger.JewelNumber) { CertificateNumber = ledger.CertificateNumber, DesignCode = ledger.DesignCode, MetalColor = ledger.MetalColor }; switch (cboHeads.SelectedItem.ToString()) { case "CertificateNumber": request.CertificateNumber = txtNewValue.Text; break; case "DesignCode": request.DesignCode = txtNewValue.Text; break; case "Cancel Transactoion": request.IsCancelled = true; break; case "MetalColor": request.MetalColor = txtNewValue.Text; break; } _transactionService.UpdateJewelDetail(request); MessageBox.Show(Resources.frmMasterMaintenance_btnSave_Click_); BindFormData(); }
public Ncgr(BinaryReader br, Nclr nclr, string diretorio, string exportPath) : base(br, diretorio) { if (Errors.Count == 0 && nclr.Errors.Count == 0) { ExportPath = exportPath; ArquivoNclr = nclr; SetNgcrProperties(br, exportPath); CarregarImagens(); ImportarNgcr = new Importar(ImportaNCGR); ExportarImagem = new Exportar(ExportarNcgrComOuSemNscr); } else { AllErrors.AddRange(Errors); AllErrors.AddRange(nclr.Errors); } br.Close(); }
public string this[string columnName] { get { if (validator != null) { var errs = validator.Validate(this).Errors; AllErrors.Clear(); AllErrors.AddRange(errs.Select(e => new KeyValuePair <string, string>(e.PropertyName, e.ErrorMessage))); var firstOrDefault = errs.FirstOrDefault(lol => lol.PropertyName == columnName); if (firstOrDefault != null) { return(validator != null ? firstOrDefault.ErrorMessage : ""); } } return(""); } }
private void btnLOGIN_Click(object sender, EventArgs e) { if (IsValid == false) { MessageBox.Show(AllErrors.ErrorMessageString(), Constants.ALERTMESSAGEHEADER); return; } var request = new UserLoginRequest { UserName = txtUsername.Text, Password = txtPassword.Text }; var user = _userService.AuthenticateUser(request); if (user != null) { LocalStore.CurrentUser = user; ShowManagedForm <frmMDIParent>(null); Hide(); return; } MessageBox.Show(Resources.frmLogin_btnLOGIN_Click_Invalid_username_or_password, Constants.ALERTMESSAGEHEADER); }
public bool HasErrors() => Errors.Any(s => !string.IsNullOrEmpty(s)) || AllErrors.Any(s => !string.IsNullOrEmpty(s));
public bool IsAfterAnyErrorLine(LineChr lineChr) { return(AllErrors.Where(a => a.Severity == CodeAnalysisError.ErrorSeverity.Error).Any(error => lineChr.Line > error.LineChr.Line)); }
public bool IsAfterAnyErrorPosition(LineChr lineChr) { var pos = TextDocument.GetPosition(lineChr); return(AllErrors.Any(error => pos > TextDocument.GetPosition(error.LineChr))); }
private bool _validateDataGrid(DataGridView mapGrid, out ItemDetail itemDetail) { itemDetail = new ItemDetail(); DataGridViewRow row = mapGrid.Rows[0]; if (row == null) { throw new IndexOutOfRangeException("No rows found"); } // Validate inline row details AllErrors.Clear(); if (row.ValidateDependentProperties(_columntype) == false) { AllErrors.Add("JewelType", "JewelType is required."); } if (row.ValidateDependentProperties(_columnjewelnumber) == false) { AllErrors.Add("JewelNumber", "JewelNumber is required."); } if (row.ValidateDependentProperties(_columnntwt) == false) { AllErrors.Add("MetalWeight", "Total MetalWeight is required."); } if (JewelHasStone) { if (IsStoneMode) { if (row.ValidateDependentProperties(_columndiawt) == false) { AllErrors.Add("DiamondWeight", "Total Diamond Weight is required."); } if (row.ValidateDependentProperties(_columndiapcs) == false) { AllErrors.Add("DiamondPcs", "Total Diamond Pcs required."); } if (row.ValidateDependentProperties(_columngrwt, _columndiawt)) { if (row.GetParsedCellValue <decimal>(_columngrwt) - row.GetParsedCellValue <decimal>(_columndiawt) < 0) { AllErrors.Add("InvalidDiamondWeight", "Invalid diamond weight."); } } } else if (IsColorStoneMode) { if (row.ValidateDependentProperties(_columncstonewt) == false) { AllErrors.Add("ColorStoneWeight", "Total ColorStone Weight is required."); } if (row.ValidateDependentProperties(_columncstonepcs) == false) { AllErrors.Add("ColorStonePcs", "Total ColorStone Pcs is required."); } if (row.ValidateDependentProperties(_columngrwt, _columncstonewt)) { if (row.GetParsedCellValue <decimal>(_columngrwt) - row.GetParsedCellValue <decimal>(_columncstonewt) < 0) { AllErrors.Add("InvalidColorStoneWeight", "Invalid ColorStone weight."); } } } if (row.ValidateDependentProperties(_columngrwt, _columndiawt, _columncstonewt)) { if (row.GetParsedCellValue <decimal>(_columngrwt) - (row.GetParsedCellValue <decimal>(_columndiawt) + row.GetParsedCellValue <decimal>(_columncstonewt)) < 0) { AllErrors.Add("InvalidTotalWeight", "Invalid total stone weights."); } } } if (row.ValidateDependentProperties(_columnamount) == false) { AllErrors.Add("TotalAmount", "TotalAmount is required."); } if (AllErrors.Count > 0) { MessageBox.Show(AllErrors.ErrorMessageString(), Constants.ALERTMESSAGEHEADER); return(false); } if (JewelHasStone) { if (IsStoneMode) { // Validate DiamondPcs with the bifercation row details Int32 returnValdiaPcs = default(Int32); Decimal returnValdiaWt = default(decimal); var diaPcs = Convert.ToInt32(row.GetCellValue(_columndiapcs)); var diaWt = Convert.ToDecimal(row.GetCellValue(_columndiawt)); foreach (DataGridViewRow curRow in mapGrid.Rows) { if (curRow.ValidateDependentProperties(_columndiapcsdetails) && curRow.ValidateDependentProperties(_columndiawtdetails)) { returnValdiaPcs += Convert.ToInt32(curRow.Cells[_columndiapcsdetails.ToLowerCaseColumnName()].Value); } if (curRow.ValidateDependentProperties(_columndiawtdetails) && curRow.ValidateDependentProperties(_columndiapcsdetails)) { returnValdiaWt += Convert.ToDecimal(curRow.Cells[_columndiawtdetails.ToLowerCaseColumnName()].Value); } } if (returnValdiaPcs != diaPcs) { AllErrors.Add("InvalidDiamondPcs", "Invalid diamond pcs count."); } if (returnValdiaWt != diaWt) { AllErrors.Add("TotalDiamondPcs", "Total diamond weight must match with sum of diamonds weight."); } if (mapGrid.Rows.Cast <DataGridViewRow>().Where(curRow => curRow.ValidateDependentProperties(_columnavrdia)).Any(curRow => row.ValidateDependentProperties(_columndiapr) == false)) { AllErrors.Add("TotalDiamondPrices", "Invalid diamond prices, please define costing."); } if (ItemCategory == JewelItemCategory.Gold && false == CostingRate.CertificateRate.Items.Any(x => x.RangeMinValue <= diaWt && x.RangeMaxValue >= diaWt)) { AllErrors.Add("CertificateCosting", "Certificate costing is not defined."); } } else if (IsColorStoneMode) { if (row.ValidateDependentProperties(_columncstonepcs) == false) { AllErrors.Add("ColorStonePices", "ColorStone pcs is required."); } if (row.ValidateDependentProperties(_columncstonewt) == false) { AllErrors.Add("ColorStoneWeight", "Total ColorStoneWeight is required."); } else { var grwt = Convert.ToDecimal(row.Cells[_columngrwt.ToLowerCaseColumnName()].Value); var cstonewt = Convert.ToDecimal(row.Cells[_columncstonewt.ToLowerCaseColumnName()].Value); if ((grwt - cstonewt) <= 0) { AllErrors.Add("ColorStoneWeight", "Invalid Total ColorStone Weight."); } } } } if (AllErrors.Count > 0) { MessageBox.Show(AllErrors.ErrorMessageString(), Constants.ALERTMESSAGEHEADER); return(false); } itemDetail.ItemDescription = row.GetCellValue(_columntype); itemDetail.CertificateNumber = row.GetCellValue(_columncerno); itemDetail.DesignCode = row.GetCellValue(_columndesignno); itemDetail.ItemCategory = ItemCategory.ToString(); itemDetail.TotalWeight = Convert.ToDecimal(row.GetCellValue(_columngrwt, true)); itemDetail.StampingCharges = Convert.ToDecimal(row.GetCellValue(_columnstamp, true)); itemDetail.LabourCharges = Convert.ToDecimal(row.GetCellValue(_columnlabr, true)); row.GetCellValue(_columnmetaltype); itemDetail.MetalDetail = new MetalDetail { MetalKT = row.GetCellValue(_columnmetaltype), MetalNetAmount = Convert.ToDecimal(row.GetCellValue(_columngamt)), MetalNetWt = Convert.ToDecimal(row.GetCellValue(_columnntwt)), MetalType = row.GetCellValue(_columnmetaltype) }; if (JewelHasStone) { var stoneAmount = 0M; if (IsStoneMode) { itemDetail.CertificateCharges = Convert.ToDecimal(row.GetCellValue(_columncert)); // I am unknown Func <List <StoneMetaDetail> > getMetaData = () => (from DataGridViewRow gridRow in mapGrid.Rows where gridRow.ValidateDependentProperties(_columnavrdia) && gridRow.ValidateDependentProperties(_columndiapr) select new StoneMetaDetail { StoneSieveSz = gridRow.GetCellValue(_columnsievsz), StoneWt = Convert.ToDecimal(gridRow.GetCellValue(_columndiawtdetails)), StonePcs = Convert.ToInt32(gridRow.GetCellValue(_columndiapcsdetails)), StoneValue = Convert.ToDecimal(gridRow.GetCellValue(_columndiaval)) }).ToList(); var detail = new StoneDetail { StoneType = row.GetCellValue(_columnstonetype), StoneNetWt = Convert.ToDecimal(row.GetCellValue(_columndiawt)), TotalStonePcs = Convert.ToInt32(row.GetCellValue(_columndiapcs)), StoneChart = new StoneChart { StoneMetaDetailList = getMetaData.Invoke() } }; stoneAmount = detail.StoneChart.StoneMetaDetailList.Sum(x => x.StoneValue); detail.StoneNetAmount = stoneAmount; itemDetail.StoneDetail = detail; } if (IsColorStoneMode) { itemDetail.ColorStoneDetail = new ColorStoneDetail { ColorStoneType = row.GetCellValue(_columncsstonetype), ColorStoneNetWt = Convert.ToDecimal(row.GetCellValue(_columncstonewt)), ColorStoneNetAmount = Convert.ToDecimal(row.GetCellValue(_columndiavalsum)) - stoneAmount, ColorTotalStonePcs = Convert.ToInt32(row.GetCellValue(_columncstonepcs)) }; } } return(true); }
private void btnSave_Click(object sender, EventArgs e) { if (base.IsValid == false) { MessageBox.Show(AllErrors.ErrorMessageString(), Constants.ALERTMESSAGEHEADER); return; } if (txtEmail1.Text != String.Empty && !Regex.IsMatch(txtEmail1.Text, Constants.EMAILPATTERN)) { txtEmail1.Focus(); MessageBox.Show(Resources.frmSupplierDataEntry_btnSave_Click_Please_Enter_Valid_Email_Address_, Constants.ALERTMESSAGEHEADER); return; } if (txtEmail2.Text != String.Empty && !Regex.IsMatch(txtEmail2.Text, Constants.EMAILPATTERN)) { txtEmail2.Focus(); MessageBox.Show(Resources.frmSupplierDataEntry_btnSave_Click_Please_Enter_Valid_Email_Address_, Constants.ALERTMESSAGEHEADER); return; } var request = new SupplierRequest { Supplier = CurrentItem.Entity }; if (MdiMode == FormMode.Add) { request.Supplier = new Supplier { Address = new Address() }; } request.Supplier.CSTNumber = txtCSTNumber.Text; request.Supplier.PANNumber = txtPANWNumber.Text; request.Supplier.Address.AddressLine1 = txtAddressL1.Text; request.Supplier.Address.AddressLine2 = txtAddressL2.Text; request.Supplier.Address.City = txtCity.Text; request.Supplier.Address.Country = cboCountry.Text; request.Supplier.Address.Fax = txtFax.Text; request.Supplier.Address.Phone = txtPhone.Text; request.Supplier.Address.PostalCode = txtPostalCode.Text; request.Supplier.Address.State = cboState.Text; request.Supplier.CompanyName = txtComapnyName.Text; request.Supplier.ContactName = txtContactName.Text; request.Supplier.SupplierStatus = rdoActive.Checked ? SupplierStatus.Active : SupplierStatus.InActive; request.Supplier.Properties = new SupplierProperties { AccountNumber = txtacNumber.Text, BankName = txtbankNumber.Text, DOB = dtDob.Value, Email1 = txtEmail1.Text, Email2 = txtEmail2.Text, FirstName = txtFname.Text, LastName = txtLname.Text, MiddleName = txtMname.Text, Note = txtNote.Text, Website = txtWebsite.Text }; request.Supplier.VATNumber = txtVatNumber.Text; var supplierResponse = _supplierService.SaveSupplier(request); if (false == supplierResponse.IsValid) { MessageBox.Show(supplierResponse.AllErrors.ErrorMessageString(), Constants.ALERTMESSAGEHEADER); return; } groupBox.Enabled = groupBox1.Enabled = groupBox2.Enabled = btnSave.Enabled = false; MessageBox.Show(Resources.frmSupplierDataEntry_btnSave_Click_Record_saved_); }
private void OnCompleted(WorkflowApplicationCompletedEventArgs args) { _result = args.GetInstanceExtensions <IDSFDataObject>().ToList().First(); IDictionary <string, object> outputs = args.Outputs; try { if (!_isDebug) { // Travis.Frisinger : 19.10.2012 - Duplicated Recordset Data Bug 6038 object parentId; outputs.TryGetValue("ParentWorkflowInstanceId", out parentId); parentId = _result.ParentWorkflowInstanceId; object parentServiceName; outputs.TryGetValue("ParentServiceName", out parentServiceName); var parentServiceNameStr = string.IsNullOrEmpty(_result.ParentServiceName) ? string.Empty : _result.ParentServiceName; if (!string.IsNullOrEmpty(parentServiceNameStr) && Guid.TryParse(parentId.ToString(), out _parentWorkflowInstanceID)) { if (_parentWorkflowInstanceID != _currentInstanceID) { // BUG 7850 - TWR - 2013.03.11 - ResourceCatalog refactor var services = ResourceCatalog.Instance.GetDynamicObjects <DynamicServiceObjectBase>(_workspace.ID, parentServiceNameStr); if (services != null && services.Count > 0) { var service = services[0] as DynamicService; if (service != null) { _currentInstanceID = _parentWorkflowInstanceID; var actionSet = service.Actions; if (_result.WorkflowResumeable) { var serviceAction = actionSet.First(); PooledServiceActivity wfActivity = serviceAction.PopActivity(); try { ErrorResultTO invokeErrors; _result = _owner.InvokeWorkflow(wfActivity.Value, _result, _executionExtensions, _parentWorkflowInstanceID, _workspace, "dsfResumption", out invokeErrors); // attach any execution errors if (AllErrors != null) { AllErrors.MergeErrors(invokeErrors); } } finally { serviceAction.PushActivity(wfActivity); } } } } } } } } catch (Exception ex) { Dev2Logger.Log.Error(ex); ExecutionStatusCallbackDispatcher.Instance.Post(_result.ExecutionCallbackID, ExecutionStatusCallbackMessageType.ErrorCallback); } finally { try { if (_waitHandle != null) { _waitHandle.Set(); } ExecutableServiceRepository.Instance.Remove(this); if (DataTransferObject != null) { DataTransferObject.NumberOfSteps = _previousNumberOfSteps; } } catch (Exception e) { // Best effort ;) Dev2Logger.Log.Error(e); } } // force a throw to kill the engine ;) if (args.TerminationException != null) { _instance.Terminate("Force Terminate", new TimeSpan(0, 0, 1, 0)); } // Not compatable with run.Dispose() }
private void btnSave_Click(object sender, EventArgs e) { if (IsValid == false) { MessageBox.Show(AllErrors.ErrorMessageString(), Constants.ALERTMESSAGEHEADER); return; } if (!Regex.IsMatch(email_textBox.Text, Constants.EMAILPATTERN)) { email_textBox.Focus(); MessageBox.Show(Resources.frmManageUser_btnSave_Click_Please_Enter_Valid_Email_Address_, Constants.ALERTMESSAGEHEADER); return; } var request = new UserRequest { User = CurrentItem.Entity }; switch (MdiMode) { case FormMode.Normal: break; case FormMode.Add: request.User = new User(); var userLoginInfo = new LoginInformation { AccessedBy = 1, IsActive = true, Username = username_textBox.Text, Password = password_textBox.Text, UserType = UserType.User, }; request.User.LoginInformations = userLoginInfo; request.User.Address = new Address(); break; case FormMode.Edit: request.User.LoginInformations.Password = password_textBox.Text; break; } request.User.Address.AddressLine1 = address1_textBox.Text; request.User.Address.AddressLine2 = address2_textBox.Text; request.User.Address.City = city_textBox.Text; request.User.Address.Country = cboCountry.Text; request.User.Address.Fax = fax_textBox.Text; request.User.Address.Phone = phone_textBox.Text; request.User.Address.PostalCode = postalcode_textBox.Text; request.User.Address.State = cbostate.Text; request.User.Properties = new UserProperties { Email = email_textBox.Text, FirstName = txtFname.Text, LastName = txtLname.Text, MiddleName = txtMname.Text }; request.User.Email = email_textBox.Text; request.User.UserStatus = (radioButton1.Checked) ? UserStatus.Active : UserStatus.InActive; var addUserResponse = _userService.SaveUser(request); if (false == addUserResponse.IsValid) { MessageBox.Show(addUserResponse.AllErrors.ErrorMessageString(), Constants.ALERTMESSAGEHEADER); return; } groupBoxLoginInfo.Enabled = groupBoxUserInfo.Enabled = btnSave.Enabled = false; MessageBox.Show(Resources.frmManageUser_btnSave_Click_Record_saved_); }
public string FetchErrors() => string.Join(Environment.NewLine, AllErrors.Union(Errors));