コード例 #1
0
        private void searchForCustomer_Click(object sender, System.EventArgs e)
        {
            //save all the current info
            tempOrder = new anOrder();

            tempOrder.date = txtDate.Text;
            tempOrder.dueDate = txtDueDate.Text;

            Session["inProgressOrder"] = tempOrder;

            if( Request.QueryString["newOrder"] == "true" )
                Response.Redirect( "SearchCustomers.aspx?fromPage=viewOrder&newOrder=inProgress" );
            else if( Request.QueryString["newOrder"] == "inProgress" )
                Response.Redirect( "SearchCustomers.aspx?fromPage=viewOrder&newOrder=inProgress" );
            else if( Request.QueryString["newOrder"] == "false" )
                Response.Redirect( "SearchCustomers.aspx?fromPage=viewOrder&newOrder=false" );
        }
コード例 #2
0
        //this is for orders that are in the process of being entered
        private void handleInProgressOrder()
        {
            searchForCustomer.Visible = true;
            searchForContact.Visible = true;
            LinkButton1.Visible = false;
            pnlShirtList.Visible = false;

            base.HeaderMessage = "New Order";

            tempOrder = new anOrder();

            string selectedContact = (string)Session["selectedContact"];
            string selectedCust = (string)Session["selectedCustomer"];

            //load all the information from the previously stored temporary session
            tempOrder = (anOrder)Session["inProgressOrder"];
            txtDate.Text = tempOrder.date;
            txtDueDate.Text = tempOrder.dueDate;

            if( selectedContact != null )
            {
                SqlConnection cnOrderTracker = new SqlConnection(
                    ConfigurationSettings.AppSettings["cnOrderTrackerDB.ConnectionString"]);
                SqlDataAdapter adOrder = new SqlDataAdapter(
                    "SELECT CID, name FROM [ContactPeople] WHERE [ContactPeople].CID=@cid", cnOrderTracker );
                adOrder.SelectCommand.Parameters.Add( "@cid", selectedContact );

                try
                {
                    //initialize the dataset and fill it with data
                    dsOrder = new DataSet();
                    adOrder.Fill( dsOrder, "ContactData" );

                    //Session["CustomerData"] = dsOrder;

                    //finally, use the dataset to fill in (there SHOULD only be one)
                    foreach ( DataRow row in dsOrder.Tables["ContactData"].Rows )
                    {
                        txtContactName.Text = row["name"].ToString();
                    }
                }
                finally
                {
                    cnOrderTracker.Close();
                    //adOrder.Dispose();
                }
            }

            if( selectedCust != null )
            {
                SqlConnection cnOrderTracker = new SqlConnection(
                    ConfigurationSettings.AppSettings["cnOrderTrackerDB.ConnectionString"]);
                SqlDataAdapter adOrder = new SqlDataAdapter(
                    "SELECT * FROM [Customers] WHERE [Customers].SID=@cid", cnOrderTracker );
                adOrder.SelectCommand.Parameters.Add( "@cid", selectedCust );

                try
                {
                    //initialize the dataset and fill it with data
                    dsOrder = new DataSet();
                    adOrder.Fill( dsOrder, "CustomerData" );

                    //Session["CustomerData"] = dsOrder;

                    //finally, use the dataset to fill in (there SHOULD only be one)
                    foreach ( DataRow row in dsOrder.Tables["CustomerData"].Rows )
                    {
                        txtCustomerName.Text = row["name"].ToString();
                        txtAddress.Text = row["streetAddress"].ToString();
                        txtCity.Text = row["city"].ToString();
                        txtState.Text = row["state"].ToString();
                        txtZip.Text = row["zip"].ToString();
                        txtPhone.Text = row["phone"].ToString();

                        if( row["cellPhone"].ToString() != null )
                            txtCellPhone.Text = row["cellPhone"].ToString();

                        if( row["fax"].ToString() != null )
                            txtFax.Text = row["fax"].ToString();

                        if( row["email"].ToString() != null )
                            txtEmail.Text = row["email"].ToString();
                    }
                }
                finally
                {
                    cnOrderTracker.Close();
                    //adOrder.Dispose();
                }
            }

            //here we want to try loading the temporary order from the session state
        }
コード例 #3
0
        private void searchForContact_Click(object sender, System.EventArgs e)
        {
            //save all the current info
            tempOrder = new anOrder();

            tempOrder.date = txtDate.Text;
            tempOrder.dueDate = txtDueDate.Text;
            tempOrder.recDate = txtRecDate.Text;
            tempOrder.artDueDate = txtArtDueDate.Text;
            tempOrder.artist = txtArtist.Text;
            //tempOrder.contactUsername = Session["selectedContact"].ToString();
            tempOrder.customerUsername = Session["selectedCustomer"].ToString();

            Session["inProgressOrder"] = tempOrder;

            if( Request.QueryString["newOrder"] == "true" )
                Response.Redirect( "SearchContacts.aspx?fromPage=viewOrder&newOrder=inProgress" );
            else if( Request.QueryString["newOrder"] == "inProgress" )
                Response.Redirect( "SearchContacts.aspx?fromPage=viewOrder&newOrder=inProgress" );
            else if( Request.QueryString["newOrder"] == "false" )
                Response.Redirect( "SearchContacts.aspx?fromPage=viewOrder&newOrder=false" );
        }