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();
        }
Example #2
0
        private void Init()
        {
            CutlistData cd;

            if (cutlist_data != null)
            {
                cd = cutlist_data;
            }
            else
            {
                cd = new CutlistData();
            }

            cbBy.DataSource    = cd.GetAuthors().Tables[0];
            cbBy.DisplayMember = "NAME";
            cbBy.ValueMember   = "USERNAME";

            if (!Revs.Contains("REVISION " + (char)(nodeCount + 65)))
            {
                cbBy.SelectedValue = System.Environment.UserName;
                string theRev = "REVISION " + (char)(nodeCount + 65);
                Text = "Creating new " + theRev + "...";
                if (nodeCount < 1)
                {
                    tbDesc.Text = "RELEASED";
                    tbECO.Text  = "NA";
                }
            }
            else
            {
                string     theRev = "REVISION " + (char)(nodeCount + 65);
                DrawingRev r      = Revs.GetRev(theRev);
                tbECO.Text         = r.Eco.Value;
                tbDesc.Text        = r.Description.Value;
                cbBy.SelectedValue = cd.GetAuthorUserName(r.List.Value);
                System.DateTime dt = new System.DateTime();
                if (DateTime.TryParse(r.Date.Value, out dt))
                {
                    dtpDate.Value = dt;
                }
                Text = "Editing " + theRev + "...";
            }

            for (int i = 0; i < Properties.Settings.Default.RevLimit; i++)
            {
                cbRev.Items.Add("A" + (char)(i + 65));
            }

            cbRev.SelectedIndex = (nodeCount);
        }