예제 #1
0
        public void autoFillForm()
        {
            string     query = maintain.getQueryAjustment() + " WHERE Parcel_ID =" + parcelID;
            SqlCommand cmd   = new SqlCommand(query, con);

            //cbCompanyName.SelectedValue = 3;

            con.Open();
            SqlDataReader dr = cmd.ExecuteReader();

            if (dr.Read())
            {
                //MessageBox.Show(dr.GetString(18));
                cbCompanyName.SelectedValue    = dr.GetValue(18);
                dateDueDelivery.Value          = (DateTime)dr.GetValue(2);
                cbDeliveryStatus.SelectedValue = dr.GetValue(19);
                nudWeight.Value               = int.Parse(dr.GetValue(4).ToString());
                nudLenght.Value               = int.Parse(dr.GetValue(5).ToString());
                nudWidth.Value                = int.Parse(dr.GetValue(6).ToString());
                nudHeight.Value               = int.Parse(dr.GetValue(7).ToString());
                tbxStreetNumber.Text          = dr.GetValue(8).ToString();
                tbxStreetName.Text            = dr.GetValue(9).ToString();
                tbxBuildingName.Text          = dr.GetValue(10).ToString();
                cbPostalCode.SelectedValue    = dr.GetValue(20);
                tbxRecipientContactNr.Text    = dr.GetValue(12).ToString();
                tbxRecipientAltContactNr.Text = dr.GetValue(13).ToString();
                //tbDelivered.SelectedItem = dr.GetValue(14);
                tbxRecepientName.Text = dr.GetValue(15).ToString();
            }
            con.Close();
        }
        public void autoFillForm()
        {
            string query = maintain.getQueryAjustment() + " WHERE Parcel_ID =" + parcelID;

            cmd  = new SqlCommand(query, con);
            flag = false;

            con.Open();
            try
            {
                SqlDataReader dr = cmd.ExecuteReader();
                if (dr.Read() && Int32.TryParse(parcelID, out int c))
                {
                    cbCompanyName.SelectedValue    = dr.GetValue(18);
                    dateDueDelivery.Value          = (DateTime)dr.GetValue(2);
                    cbDeliveryStatus.SelectedValue = dr.GetValue(19);
                    nudWeight.Value               = int.Parse(dr.GetValue(4).ToString());
                    nudLenght.Value               = int.Parse(dr.GetValue(5).ToString());
                    nudWidth.Value                = int.Parse(dr.GetValue(6).ToString());
                    nudHeight.Value               = int.Parse(dr.GetValue(7).ToString());
                    tbxStreetNumber.Text          = dr.GetValue(8).ToString();
                    tbxStreetName.Text            = dr.GetValue(9).ToString();
                    tbxBuildingName.Text          = dr.GetValue(10).ToString();
                    cbPostalCode.SelectedValue    = dr.GetValue(20);
                    tbxRecipientContactNr.Text    = dr.GetValue(12).ToString();
                    tbxRecipientAltContactNr.Text = dr.GetValue(13).ToString();
                    tbxRecepientName.Text         = dr.GetValue(15).ToString();
                }
            }
            catch (SqlException m) { Console.WriteLine(m.Message); }
            con.Close();
            flag = true;
            populateClient();
        }