Example #1
0
        private PartDataSet UpdateDataSet(PartDataSet Pdata, DataViewRowState RowState)
        {
            Part Part = new Part(DataList.EpicConn);

            DataList.AddDatum(Pdata, "Part", 0, "PartDescription", Description_txt.Text,RowState);

            if (RowState == DataViewRowState.Unchanged)
                RowState = DataViewRowState.ModifiedCurrent;

            //SearchWord has 8 character limit
            if (Description_txt.Text.Length > 8)
                DataList.AddDatum(Pdata, "Part", 0, "SearchWord", Description_txt.Text.Substring(0, 8), RowState);
            else
                DataList.AddDatum(Pdata, "Part", 0, "SearchWord", Description_txt.Text, RowState);

            DataList.AddDatum(Pdata, "Part", 0, "NetWeight", NetWeight.Text, RowState);

            DataList.AddDatum(Pdata, "Part", 0, "NetWeightUOM", uomweight_cbo.SelectedValue.ToString(), RowState);

            DataList.AddDatum(Pdata, "Part", 0, "IUM", uom_cbo.SelectedValue.ToString(), RowState);

            DataList.AddDatum(Pdata, "Part", 0, "ClassID", class_cbo.SelectedValue.ToString(), RowState);

            DataList.AddDatum(Pdata, "Part", 0, "QtyBearing", qtybearing.Checked.ToString(), RowState);

            DataList.AddDatum(Pdata, "Part", 0, "UsePartRev", userevision.Checked.ToString(), RowState);

            DataList.AddDatum(Pdata, "Part", 0, "PhantomBOM", phantom_chk.Checked.ToString(), RowState);

            string Type_Code = type_cbo.SelectedItem.ToString();

            Part.ChangePartTypeCode(Type_Code, Pdata);

            Part.ChangePartProdCode(group_cbo.SelectedValue.ToString(), Pdata);

            //add trackserial number if necessary
            if (trackserial.Checked && (SerialPrefix != "" || SerialPrefix != null))
            {
                if (SerialPrefix == "" || SerialPrefix == null)
                    MessageBox.Show("Cannot use null serial prefix.  Set the prefix or uncheck 'Track Serial Number'", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                else
                {
                    DataList.AddDatum(Pdata, "Part", 0, "EnableSerialNum", trackserial.Checked.ToString(), RowState);

                    DataList.AddDatum(Pdata, "Part", 0, "TrackSerialNum", trackserial.Checked.ToString(), RowState);

                    Part.ChangePartSNBaseDataType("MASK", Pdata);

                    Part.ChangeSNMask(SerialMask, Pdata);

                    Part.ChangePartSNMaskPrefixSuffix(SerialPrefix, "", Pdata);
                }
            }

            return Pdata;
        }