Example #1
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            DrawingRev         r     = null;
            swCustomInfoType_e tType = swCustomInfoType_e.swCustomInfoText;
            SwProperty         rev   = new SwProperty("REVISION " + (char)(nodeCount + 65), tType, cbRev.Text, true);
            SwProperty         eco   = new SwProperty("ECO " + (nodeCount + 1).ToString(), tType, tbECO.Text, true);
            // I usually only apply this filter on insertion, but this field is only ever
            // displayed on drawings. We only want all caps for that as well.
            SwProperty desc = new SwProperty("DESCRIPTION " + (nodeCount + 1).ToString(), tType, CutlistData.FilterString(tbDesc.Text, Properties.Settings.Default.FlameWar), true);

            cbBy.ValueMember = "INITIAL";

            SwProperty list;

            if (cbBy.SelectedValue != null)
            {
                list = new SwProperty("LIST " + (nodeCount + 1).ToString(), tType, (cbBy.SelectedValue as string).Substring(0, 2), true);
            }
            else
            {
                list = new SwProperty("LIST " + (nodeCount + 1).ToString(), tType, string.Empty, true);
            }

            SwProperty date = new SwProperty("DATE " + (nodeCount + 1).ToString(), tType, dtpDate.Value.ToShortDateString(), true);

            if (Revs.Contains("REVISION " + (char)(nodeCount + 65)))
            {
                r             = Revs.GetRev("REVISION " + (char)(nodeCount + 65));
                r.Revision    = rev;
                r.Eco         = eco;
                r.Description = desc;
                r.List        = list;
                r.Date        = date;
            }
            else
            {
                r = new DrawingRev(rev, eco, desc, list, date);
                Revs.Add(r);
            }

            r.SwApp = Revs.SwApp;

            if (new_rev)
            {
                try {
                    AddECRItem(r);
                } catch (Exception ex) {
                    r.SwApp.SendMsgToUser2(ex.Message, (int)swMessageBoxIcon_e.swMbStop, (int)swMessageBoxBtn_e.swMbOk);
                }
            }

            this.Close();
        }