Example #1
0
        /// <summary>
        /// Read an CustomisationUIHeader from XML - do some sanity check
        /// </summary>
        /// <param name="xml">the XML action fragment</param>
        /// <returns>True if an action was decoded</returns>
        private Boolean Instance_fromXML(XmlReader reader)
        {
            reader.Read( );

            while (!reader.EOF)
            {
                String devType  = reader.Name;
                String instance = reader["instance"];
                int    instNo   = 0;
                if (!String.IsNullOrWhiteSpace(instance))
                {
                    if (!int.TryParse(instance, out instNo))
                    {
                        instNo = 0;
                    }
                    else
                    {
                        DevRec dr = new DevRec( );
                        dr.devType = devType;
                        dr.instNo  = instNo;
                        m_devInstances.Add(dr);
                    }
                }
                reader.Read( );
                if (reader.NodeType == XmlNodeType.EndElement)
                {
                    break;                                      // expect end of <Devices> here
                }
            }//while

            return(true);
        }
        private void btnDisplay_Click(object sender, EventArgs e)
        {
            pnlDisplay.Visible = true;

            foreach (Developer DevRec in myDev)
            {
                txtFirstName.Text   = DevRec.firstName;
                txtLastName.Text    = DevRec.lastName;
                txtStAddr.Text      = DevRec.stAddr;
                txtCity.Text        = DevRec.city;
                txtState.Text       = DevRec.state;
                txtZip.Text         = DevRec.zip;
                txtAge.Text         = DevRec.age;
                txtMonGrossPay.Text = (DevRec.grossMonPay).ToString();
                txtDeptID.Text      = DevRec.deptID;
                txtDevType.Text     = DevRec.devType;
                txtEmpType.Text     = DevRec.empType;

                double annualTax = DevRec.taxes(DevRec.grossMonPay);
                txtAnnTaxes.Text = annualTax.ToString();

                double annualIncome = DevRec.netPay(DevRec.grossMonPay, annualTax);
                txtAnnNetPay.Text = annualIncome.ToString();

                pnlDisplay.Refresh();

                Thread.Sleep(2000);
            }

            lblDisplayText.Text = "End of Records";
        }
Example #3
0
 /// <summary>
 /// Read an CustomisationUIHeader from XML - do some sanity check
 /// </summary>
 /// <param name="xml">the XML action fragment</param>
 /// <returns>True if an action was decoded</returns>
 private bool Instance_fromXML(XElement devices)
 {
     /*
      *                <devices>
      *                        <keyboard instance="1"/>
      *                        <mouse instance="1"/>
      *                        <joystick instance="1"/>
      *                        <joystick instance="2"/>
      *                </devices>
      */
     foreach (XElement dev in devices.Nodes( ))
     {
         string devType = (string)dev.Name.LocalName;
         int    instNo  = 0;
         IEnumerable <XAttribute> attr = dev.Attributes( ).Where(_a => _a.Name == "instance");
         if (attr.Count( ) > 0)
         {
             if (!int.TryParse(attr.ElementAt(0).Value.ToString( ), out instNo))
             {
                 instNo = 0;
             }
             else
             {
                 DevRec dr = new DevRec( );
                 dr.devType = devType;
                 dr.instNo  = instNo;
                 m_devInstances.Add(dr);
             }
         }
     }
     return(true);
 }
Example #4
0
            /// <summary>
            /// Check clone against This
            /// </summary>
            /// <param name="clone"></param>
            /// <returns>True if the clone is identical but not a shallow copy</returns>
            public bool CheckClone(DevRec clone)
            {
                bool ret = true;

                ret &= (this.devType == clone.devType); // immutable string - shallow copy is OK
                ret &= (this.instNo == clone.instNo);   // value type
                return(ret);
            }
Example #5
0
 public void AddInstances(DevRec dr)
 {
     m_devInstances.Add(dr);
 }
Example #6
0
 public void AddInstances( DevRec dr )
 {
     m_devInstances.Add( dr );
 }
Example #7
0
        /// <summary>
        /// Read an CustomisationUIHeader from XML - do some sanity check
        /// </summary>
        /// <param name="xml">the XML action fragment</param>
        /// <returns>True if an action was decoded</returns>
        public Boolean Instance_fromXML( XmlReader reader )
        {
            reader.Read( );

              while ( !reader.EOF ) {
            String devType = reader.Name;
            String instance = reader["instance"];
            int instNo = 0;
            if ( !String.IsNullOrWhiteSpace( instance ) ) {
              if ( !int.TryParse( instance, out instNo ) ) {
            instNo = 0;
              }
              else {
            DevRec dr = new DevRec( );
            dr.devType = devType;
            dr.instNo = instNo;
            m_devInstances.Add( dr );
              }
            }
            reader.Read( );
            if ( reader.NodeType == XmlNodeType.EndElement ) break; // expect end of <Devices> here
              }//while

              return true;
        }