private void olv_Data_CellEditStarting(object sender, SynapseAdvancedControls.CellEditEventArgs e) { if (((o_GasEmission)e.RowObject).Valid == true) { e.Cancel = true; } if (((o_GasEmission)e.RowObject).Date > lastdata.AddDays(1)) { MessageBox.Show(SynapseForm.GetLabel("messages.errorcannotedit")); e.Cancel = true; } if (e.Value != null && e.Value.ToString() == (0).ToString("0.000E+00")) { e.Control.Text = ""; } if (((e.Column == col_GazVolume) || (e.Column == col_GazDischarge) || (e.Column == col_Remarque)) && ((o_GasEmission)e.RowObject).HS == true) { if (MessageBox.Show(SynapseForm.GetLabel("messages.errorcannotediths"), SynapseForm.GetLabel("messages.errorcannotedithstitle"), MessageBoxButtons.YesNo, MessageBoxIcon.Stop) == System.Windows.Forms.DialogResult.No) { e.Cancel = true; } } }
private void olv_Data_CellEditValidating(object sender, SynapseAdvancedControls.CellEditEventArgs e) { //MessageBox.Show("edit validated"); e.Control.Text = e.Control.Text.Replace('.', Convert.ToChar(CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator)).Replace(',', Convert.ToChar(CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator)); e.NewValue = e.Control.Text; }
private void olv_Data_CellEditFinishing(object sender, SynapseAdvancedControls.CellEditEventArgs e) { try { if (e.Column == col_GazVolume && (double)e.NewValue.AsScientific() != 0) { if (((o_GasEmission)e.RowObject).Date > lastdata) { lastdata = ((o_GasEmission)e.RowObject).Date; } } if (e.Column == col_GazDischarge && (double)e.NewValue.AsScientific() != 0) { if (((o_GasEmission)e.RowObject).Date > lastdata) { lastdata = ((o_GasEmission)e.RowObject).Date; } } ////ici // if (((e.Column == col_GazVolume && e.Value.AsScientific() != e.NewValue.AsScientific()) || // (e.Column == col_GazDischarge && e.Value.AsScientific() != e.NewValue.AsScientific()) || // (e.Column == col_Remarque && e.Value != e.NewValue)) && ((o_GasEmission)e.RowObject).HS == true) // { // if (MessageBox.Show(SynapseForm.GetLabel("messages.errorcannotediths"), SynapseForm.GetLabel("messages.errorcannotedithstitle"), MessageBoxButtons.YesNo, MessageBoxIcon.Stop) == System.Windows.Forms.DialogResult.No) // e.Cancel = true; // } if (e.Column == col_GazDischarge && e.Value.AsScientific() != e.NewValue.AsScientific()) { double EmissionAvg = Helper.LastDaysEmissionAvg(((o_GasEmission)e.RowObject).Date, ((o_GasEmission)e.RowObject).ChainID); double prc = (Math.Abs(e.NewValue.AsScientific() - EmissionAvg) / EmissionAvg); if (prc > Helper.ToleranceWarning) { MessageBox.Show(SynapseForm.GetLabel("messages.farfromavg") + " " + (prc).ToString("0.00 %")); } UpdateEncoder(e.RowObject); } if (e.Column == col_GazVolume && e.Value.AsScientific() != e.NewValue.AsScientific()) { double VolumeAvg = Helper.LastDaysVolumeAvg(((o_GasEmission)e.RowObject).Date, ((o_GasEmission)e.RowObject).ChainID); double prc = (Math.Abs(e.NewValue.AsScientific() - VolumeAvg) / VolumeAvg); if (prc > Helper.ToleranceWarning) { MessageBox.Show(SynapseForm.GetLabel("messages.farfromavg") + " " + (prc).ToString("0.00 %")); } UpdateEncoder(e.RowObject); } if (e.Column == col_Remarque && e.Value != e.NewValue) { UpdateEncoder(e.RowObject); } if (e.Column == col_OtherChainHS && e.Value != e.NewValue) { UpdateEncoder(e.RowObject); } } catch (InvalidScienitficException) { MessageBox.Show(SynapseForm.GetLabel("messages.errorinvalidformat")); e.Cancel = true; } //MessageBox.Show("cell edit finishing"); //e.ListViewItem }
private void objectListView1_CellEditFinishing(object sender, SynapseAdvancedControls.CellEditEventArgs e) { }