Ejemplo n.º 1
0
        private void ButtonClick(object sender, EventArgs e)
        {
            Button b = (Button)sender;

            if (b.Name == "buttonCancel")
            {
                this.Close();
            }
            else if (b.Name == "buttonReset")
            {
                ReferenceNumberManager.SetRefNoRange(true);
                this.Close();
            }
            else
            {
                if (_MinVal == 0 && _MaxVal == 0)
                {
                    this.Close();
                }
                else
                {
                    if (_MaxVal > _MinVal)
                    {
                        ReferenceNumberManager.SetRefNoRange(false, _MinVal, _MaxVal);
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("Maximum value must be greater than the minimum", "Validation error");
                    }
                }
            }
        }
Ejemplo n.º 2
0
        private void OnForm_Load(object sender, EventArgs e)
        {
            Text = "Generate reference number";

            if (ReferenceNumberManager.Count == 1)
            {
                lvCodes.Visible = false;
                labelTitle.Text = "A reference number was generated for the sampling.";
                labelRefNo.With(o =>
                {
                    o.Visible    = true;
                    _nextRefCode = ReferenceNumberManager.GetNextReferenceNumber(ReferenceNumberManager.FirstCode);

                    if (ReferenceNumberManager.RefNumberIsFree(_nextRefCode))
                    {
                        o.Text = _nextRefCode;
                    }
                    else
                    {
                        buttonReset.Visible = true;
                        o.Visible           = false;
                    }
                });
            }
            else
            {
                labelTitle.Text      = "Select code of the gear that was used in the sampling";
                labelRefNo.Location  = new Point(lvCodes.Location.X, lvCodes.Location.Y + lvCodes.Height + 5);
                labelRefNo.TextAlign = ContentAlignment.MiddleLeft;
                labelRefNo.Text      = "";
            }
            lvCodes.With(o =>
            {
                o.View = View.Details;
                o.Columns.Add("Code");
                o.Columns.Add("Sub-variation");
                o.Columns.Add("Local names");
                o.FullRowSelect = true;
            });
            foreach (KeyValuePair <string, ReferenceNumberManager.VariationCode> kv in ReferenceNumberManager.VariationCodes)
            {
                var lvi = new ListViewItem(new string[] { kv.Value.GearCode, kv.Value.IsSubVariation.ToString(), kv.Value.LocalNames });
                lvCodes.Items.Add(lvi);
            }

            foreach (ColumnHeader c in lvCodes.Columns)
            {
                switch (c.Text)
                {
                case "Code":
                case "Sub-variation":
                    c.AutoResize(ColumnHeaderAutoResizeStyle.HeaderSize);
                    break;

                case "Local names":
                    c.AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent);
                    break;
                }
            }
        }
Ejemplo n.º 3
0
        private void Onbutton_Click(object sender, EventArgs e)
        {
            switch (((Button)sender).Name)
            {
            case "buttonReset":
                buttonReset.Visible = false;
                ReferenceNumberManager.ResetReferenceNumbers();
                _nextRefCode       = ReferenceNumberManager.GetNextReferenceNumber(ReferenceNumberManager.FirstCode);
                labelRefNo.Visible = true;
                labelRefNo.Text    = _nextRefCode;
                break;

            case "buttonOK":
                if (_nextRefCode.Length > 0)
                {
                    _parent_Form.NewReferenceNumber(_nextRefCode);
                    Close();
                }
                break;

            case "buttonCancel":
                Close();
                break;
            }
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Class constructor
 /// </summary>
 static global()
 {
     IsMapWinGISRegistered();
     _appPath    = Application.StartupPath;
     MappingMode = fad3MappingMode.defaultMode;
     GetAppPreferences();
     _templateMDBFile          = ApplicationPath + "\\template.mdb";
     _connectionStringTemplate = "Provider=Microsoft.JET.OLEDB.4.0;data source=" + _appPath + "\\template.mdb";
     ReferenceNumberManager.ReadRefNoRange();
     GetCoordinateDisplayFormat();
     TestMPH();
 }
Ejemplo n.º 5
0
        private void frmRefNoRange_Load(object sender, EventArgs e)
        {
            long min, max = 0;

            ReferenceNumberManager.ReadRefNoRange();
            ReferenceNumberManager.GetRefNoRange(out min, out max);
            if (min >= 0 && max > 0)
            {
                _MinVal            = min;
                _MaxVal            = max;
                textBoxMinVal.Text = _MinVal.ToString();
                textBoxMaxVal.Text = _MaxVal.ToString();
            }
        }
Ejemplo n.º 6
0
        private void OnlvCodes_MouseDown(object sender, MouseEventArgs e)
        {
            var item = lvCodes.HitTest(e.X, e.Y).Item;

            if (item != null)
            {
                _nextRefCode    = ReferenceNumberManager.GetNextReferenceNumber(item.Text);
                labelRefNo.Text = _nextRefCode;
            }
            else
            {
                labelRefNo.Text = "";
            }
        }