bool ShowEditSampleGroup(SampleGroupDO sg, bool allowEdit) { using (FormEditSampleGroup view = new FormEditSampleGroup()) { return(view.ShowDialog(sg, allowEdit) == DialogResult.OK); } }
protected override void OnClosing(CancelEventArgs e) { base.OnClosing(e); if (this.DialogResult == DialogResult.Cancel) { this.SampleGroup.SetValues(this._initialState); return; } this.EndEdit(); if (this.AllowEdit) { if (SampleGroupDO.CanChangeSamplerType(this.SampleGroup) && this._systematicOpt_ChB.Checked)// if systematic option checked, set SampleSelectorType to Systematic { this.SampleGroup.SampleSelectorType = CruiseDAL.Schema.CruiseMethods.SYSTEMATIC_SAMPLER_TYPE; } if (FormEditSampleGroup.CanEditTallyMode(this.SampleGroup)) { if (this._tallyBySg_RB.Checked) { //TallyMethod = existing tallyMethod - TallyBySpecies + TallyBySampleGroup this.SampleGroup.TallyMethod = (this.SampleGroup.TallyMethod & ~CruiseDAL.Enums.TallyMode.BySpecies) | CruiseDAL.Enums.TallyMode.BySampleGroup; } else if (this._tallyBySpecies_RB.Checked) { //TallyMethod = existing tallyMethod - TallyBySampleGroup + TallyBySpecies this.SampleGroup.TallyMethod = (this.SampleGroup.TallyMethod & ~CruiseDAL.Enums.TallyMode.BySampleGroup) | CruiseDAL.Enums.TallyMode.BySpecies; } } } this.SampleGroup.Validate(); if (this.SampleGroup.HasErrors()) { MessageBox.Show(this.SampleGroup.Error); e.Cancel = true; return; } try { this.SampleGroup.Save(); } catch { MessageBox.Show("Unable to save sample group, make sture values are entered correctly"); e.Cancel = true; return; } }
protected void OnAllowEditChanged() { this._codeTB.Enabled = _allowEdit; this._pProdCB.Enabled = _allowEdit; //this._cutLeaveCB.Enabled = _allowEdit; //this._defaultLD_CB.Enabled = _allowEdit; StratumDO st = this.SampleGroup.Stratum; this._bigBaf_TB.Enabled = _allowEdit && SampleGroupDO.CanEnableBigBAF(st); this._kz_TB.Enabled = _allowEdit && SampleGroupDO.CanEnableKZ(st); this._samplingFreq_TB.Enabled = _allowEdit && SampleGroupDO.CanEnableFrequency(st); this._insuranceFreq_TB.Enabled = _allowEdit && SampleGroupDO.CanEnableIFreq(st); this._tallyBySg_RB.Enabled = this._tallyBySpecies_RB.Enabled = _allowEdit && FormEditSampleGroup.CanEditTallyMode(this.SampleGroup); this._systematicOpt_ChB.Enabled = _allowEdit && ((this.SampleGroup.Stratum.Method == CruiseDAL.Schema.CruiseMethods.STR) && SampleGroupDO.CanChangeSamplerType(this.SampleGroup)); }
public override DialogResult ShowEditSampleGroup(SampleGroupDO sg, bool allowEdit) { using (FormEditSampleGroup view = new FormEditSampleGroup()) { return view.ShowDialog(sg, allowEdit); } }