Ejemplo n.º 1
0
        //Loads the available contracts form and closes the selection form
        private void available_contracts_btn_Click(object sender, EventArgs e)
        {
            AvailableContracts newAvailableContractsForm = new AvailableContracts();

            newAvailableContractsForm.Show();
            this.Close();
        }
Ejemplo n.º 2
0
        //Close this form and return the user to the Available Contracts form
        private void exit_btn_Click_1(object sender, EventArgs e)
        {
            AvailableContracts newAvailableContracts = new AvailableContracts();

            newAvailableContracts.Show();
            this.Close();
        }
Ejemplo n.º 3
0
        //Constructor used to load from the Contract table
        public ContractInfo(String contractNumber)
        {
            InitializeComponent();

            selectedContractNumber = contractNumber;

            source = @"Data Source=(LocalDB)\v11.0;AttachDbFilename=" + dbPath + ";Integrated Security=True;Connect Timeout=30";
            conn   = new SqlConnection(source);

            cmd.Connection  = conn;
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "spLoadContractDetails";
            SqlDataReader reader;

            cmd.Parameters.AddWithValue("@ContractNumber", selectedContractNumber).Direction = ParameterDirection.Input;

            cmd.Parameters.Add("@DueDate", SqlDbType.Date).Direction   = ParameterDirection.Output;
            cmd.Parameters.Add("@EntryDate", SqlDbType.Date).Direction = ParameterDirection.Output;
            cmd.Parameters.Add("@ExpectedCompletionDate", SqlDbType.Date).Direction     = ParameterDirection.Output;
            cmd.Parameters.Add("@CurrentLocation", SqlDbType.VarChar, 3).Direction      = ParameterDirection.Output;
            cmd.Parameters.Add("@StartLocation", SqlDbType.VarChar, 3).Direction        = ParameterDirection.Output;
            cmd.Parameters.Add("@NecessaryProcesses", SqlDbType.VarChar, 100).Direction = ParameterDirection.Output;
            cmd.Parameters.Add("@Selected", SqlDbType.VarChar, 1).Direction             = ParameterDirection.Output;

            {
                conn.Open();
                reader = cmd.ExecuteReader();

                if (reader.HasRows)
                {
                    //Load all of the details into the form
                    reader.Read();

                    selectedDueDate   = (System.DateTime)reader.GetValue(0);
                    selectedEntryDate = (System.DateTime)reader.GetValue(1);
                    selectedExpectedCompletionDate = (System.DateTime)reader.GetValue(2);
                    selectedCurrentLocation        = (String)reader.GetValue(3);
                    selectedStartLocation          = (String)reader.GetValue(4);
                    selectedProcesses = (String)reader.GetValue(5);
                    selectedBusy      = (String)reader.GetValue(6);

                    conn.Close();
                    cmd.Parameters.Clear();
                    reader.Close();
                    this.Show();
                }
                else
                {
                    MessageBox.Show("Contract Not Found");
                    AvailableContracts newAvailableContracts = new AvailableContracts();
                    newAvailableContracts.Show();
                    conn.Close();
                    cmd.Parameters.Clear();
                }
            }
        }