Example #1
0
        private void btnSendMessage_Click(object sender, EventArgs e)
        {
            ServiceReference1.TowTruckServiceClient myService = new ServiceReference1.TowTruckServiceClient();
            myService.Endpoint.Address = new EndpointAddress(new Uri("http://" + ServiceRef.ServiceAddress));
            ServiceReference1.TruckMessage thisMessage = new ServiceReference1.TruckMessage();
            thisMessage.MessageID   = Guid.NewGuid();
            thisMessage.MessageText = txtMessage.Text;
            TruckData selTruck = (TruckData)cboTrucks.SelectedItem;
            string    TruckIP  = selTruck.IPAddress;
            CreatedBy selUser  = (CreatedBy)cboUsers.SelectedItem;
            string    UserID   = selUser.UserName;

            thisMessage.UserEmail = UserID;
            thisMessage.TruckIP   = TruckIP;
            thisMessage.SentTime  = DateTime.Now;
            if (chkExpectResponse.Checked == true)
            {
                thisMessage.MessageType = 1;
            }
            else
            {
                thisMessage.MessageType = 0;
            }
            thisMessage.MessageResponse = "0";
            myService.SendMessage(thisMessage);
            MessageBox.Show("Message sent");
        }
Example #2
0
        private void LoadUsers()
        {
            List <CreatedBy> theseUsers = new List <CreatedBy>();

            using (SqlConnection conn = new SqlConnection(GetConn()))
            {
                conn.Open();
                SqlCommand    cmd = new SqlCommand("select UserID as 'userid', LastName + ',' + FirstName as 'name' From users union all select DriverID as 'userid', LastName + ',' + FirstName as 'name' FROM Drivers ORDER BY name", conn);
                SqlDataReader rdr = cmd.ExecuteReader();
                while (rdr.Read())
                {
                    CreatedBy thisUser = new CreatedBy();
                    thisUser.UserID   = new Guid(rdr[0].ToString());
                    thisUser.UserName = rdr[1].ToString();
                    theseUsers.Add(thisUser);
                }
            }
            cboUsers.DataSource    = theseUsers;
            cboUsers.DisplayMember = "UserName";
            cboUsers.ValueMember   = "UserID";
        }
Example #3
0
        private void btnPostAssist_Click(object sender, EventArgs e)
        {
            ServiceReference1.TowTruckServiceClient myService = new ServiceReference1.TowTruckServiceClient();
            myService.Endpoint.Address = new EndpointAddress(new Uri("http://" + ServiceRef.ServiceAddress));
            ServiceReference1.MTCPreAssistData pad = new ServiceReference1.MTCPreAssistData();
            CreatedBy chosenCreator = (CreatedBy)cboUsers.SelectedItem;
            string    userName      = chosenCreator.UserName;
            TruckData selTruck      = (TruckData)cboTrucks.SelectedItem;
            string    ipAddr        = selTruck.IPAddress;
            string    dir           = "";

            if (rbEB.Checked == true)
            {
                dir = "EB";
            }
            if (rbNB.Checked == true)
            {
                dir = "NB";
            }
            if (rbSB.Checked == true)
            {
                dir = "SB";
            }
            if (rbWB.Checked == true)
            {
                dir = "WB";
            }
            pad.DispatchCode = cboDispatchCodes.Text;
            pad.Comment      = txtComment.Text;
            pad.CrossStreet  = txtCrossStreet.Text;
            pad.Direction    = dir;
            pad.FSPLocation  = txtFSPLocation.Text;
            pad.Freeway      = txtFreeway.Text;
            pad.LaneNumber   = txtLaneNumber.Text;
            myService.addAssist(userName, ipAddr, pad);
            MessageBox.Show("Added");
        }