コード例 #1
0
 /// <summary>
 /// Deprecated Method for adding a new object to the MsDestination EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToMsDestination(MsDestination msDestination)
 {
     base.AddObject("MsDestination", msDestination);
 }
コード例 #2
0
 /// <summary>
 /// Create a new MsDestination object.
 /// </summary>
 /// <param name="destinationID">Initial value of the DestinationID property.</param>
 /// <param name="destinationName">Initial value of the DestinationName property.</param>
 /// <param name="destinationTitle">Initial value of the DestinationTitle property.</param>
 /// <param name="destinationContactNumber">Initial value of the DestinationContactNumber property.</param>
 /// <param name="destinationCountry">Initial value of the DestinationCountry property.</param>
 /// <param name="destinationCity">Initial value of the DestinationCity property.</param>
 /// <param name="destinationZip">Initial value of the DestinationZip property.</param>
 /// <param name="destinationAddress">Initial value of the DestinationAddress property.</param>
 public static MsDestination CreateMsDestination(global::System.String destinationID, global::System.String destinationName, global::System.Int32 destinationTitle, global::System.String destinationContactNumber, global::System.String destinationCountry, global::System.String destinationCity, global::System.String destinationZip, global::System.String destinationAddress)
 {
     MsDestination msDestination = new MsDestination();
     msDestination.DestinationID = destinationID;
     msDestination.DestinationName = destinationName;
     msDestination.DestinationTitle = destinationTitle;
     msDestination.DestinationContactNumber = destinationContactNumber;
     msDestination.DestinationCountry = destinationCountry;
     msDestination.DestinationCity = destinationCity;
     msDestination.DestinationZip = destinationZip;
     msDestination.DestinationAddress = destinationAddress;
     return msDestination;
 }
コード例 #3
0
        private void btnRecordd_Click(object sender, EventArgs e)
        {
            //when button record for destination is clicked, validate all the fields according to the project case
            if (txtNamed.Text.Equals(""))
                lblError.Text = "DestinationName must not be empty";
            else if (!checkNameDest())
                lblError.Text = "DestinationName can only accept alphabet";
            else if (txtNamed.Text.Length > 50)
                lblError.Text = "Max DestinationName length is 50 characters";
            else if (cmbTitled.SelectedIndex < 0)
                lblError.Text = "Select Destination title";
            else if (txtContactd.Text.Equals(""))
                lblError.Text = "DestinationContact must not be empty";
            else if (!checkContactDest())
                lblError.Text = "DestinationContact must only number or '+' as first character";
            else if (txtContactd.Text.Length > 20)
                lblError.Text = "Max DestinationContact length is 20 characters";
            else if (txtCountryd.Text.Equals(""))
                lblError.Text = "DestinationCountry must not be empty";
            else if (txtCountryd.Text.Length > 50)
                lblError.Text = "Max DestinationCountry length is 50 characters";
            else if (txtCityd.Text.Equals(""))
                lblError.Text = "DestinationCity must not be empty";
            else if (txtCityd.Text.Length > 50)
                lblError.Text = "Max DestinationCity length is 50 characters";
            else if (txtZipd.Text.Equals(""))
                lblError.Text = "DestinationZip code must not be empty";
            else if (txtZipd.Text.Length > 15)
                lblError.Text = "Max DestinationZip length is 15 digits";
            else if (!checkZipDest())
                lblError.Text = "DestinationZip can only accept numeric";
            else if (!txtAddrd.Text.StartsWith("Street"))
                lblError.Text = "DestinationAddress must be started with 'Street'";
            else
            {
                MessageBox.Show("Destination Data is successfully recorded");
                newDestination = new MsDestination();
                newDestination.DestinationID = newdid;
                newDestination.DestinationName = txtNamed.Text;
                newDestination.DestinationAddress = txtAddrd.Text;
                newDestination.DestinationCity = txtCityd.Text;
                newDestination.DestinationContactNumber = txtContactd.Text;
                newDestination.DestinationCountry = txtCountryd.Text;

                newDestination.DestinationTitle = cmbTitled.SelectedIndex + 1;
                newDestination.DestinationZip = txtZipd.Text;
            }
        }