예제 #1
0
        private void LoadTreeView()
        {
            string drivername;

            jobs = new Jobs(radAll.Checked ? Jobs.ContactView.NonCurrent : Jobs.ContactView.ExpiredNoDriver);
            tvJobs.Nodes.Clear();

            if (radByDate.Checked)
            {
                foreach (Job job in jobs.OrderByDescending(s => s.JobDate))
                {
                    DateTime dt;

                    drivername = job.DriverName == null || job.DriverName.Replace(" ", "") == string.Empty ? "n/a" : job.DriverName;

                    dt = job.JobDate;
                    if (tvJobs.Nodes.Find(job.JobDate.ToShortDateString(), false).Count <TreeNode>() == 0)
                    {
                        TreeNode topnode = tvJobs.Nodes.Add(job.JobDate.ToShortDateString(), job.JobDate.ToShortDateString());
                        topnode.SelectedImageIndex = topnode.ImageIndex = 11;
                    }
                    //job.LoadJobContacts();
                    //TreeNode node = tvJobs.Nodes[job.JobDate.ToShortDateString()].Nodes.Add(job.JobID.ToString(), job.ClientName + Environment.NewLine + "-" + job.PendingStatus);

                    TreeNode node = tvJobs.Nodes[job.JobDate.ToShortDateString()].Nodes.Add(job.JobID.ToString(), "Client=" + job.ClientName + ", Driver = " + drivername);
                    node.ImageIndex = job.StatusID == 18 ? 12 : job.StatusID == 50 ? 14 : 13;
                    node.Nodes.Add(" ");
                }
            }

            if (radByDriver.Checked)
            {
                foreach (Job job in jobs.OrderBy(s => s.DriverName))
                {
                    drivername = job.DriverName;

                    if (drivername == null || drivername == string.Empty || drivername == " ")
                    {
                        continue;
                    }

                    if (tvJobs.Nodes.Find(drivername, false).Count <TreeNode>() == 0)
                    {
                        tvJobs.Nodes.Add(drivername, drivername);
                    }
                    //job.LoadJobContacts();
                    //TreeNode node = tvJobs.Nodes[job.JobDate.ToShortDateString()].Nodes.Add(job.JobID.ToString(), job.ClientName + Environment.NewLine + "-" + job.PendingStatus);
                    TreeNode node = tvJobs.Nodes[drivername].Nodes.Add(job.JobID.ToString(), job.JobDate.ToShortDateString() + ", Client=" + job.ClientName);
                    node.ImageIndex  = job.StatusID == 18 ? 12 : 13;
                    node.ToolTipText = job.StatusID == 18 ? "Cancelled Job" : "Expired Job";


                    node.Nodes.Add(" ");
                }
            }

            if (radByClient.Checked)
            {
                foreach (Job job in jobs.OrderBy(s => s.ClientName))
                {
                    String clientName;

                    drivername = job.DriverName;
                    clientName = job.ClientName;
                    if (tvJobs.Nodes.Find(clientName, false).Count <TreeNode>() == 0)
                    {
                        tvJobs.Nodes.Add(clientName, clientName);
                    }

                    TreeNode node = tvJobs.Nodes[clientName].Nodes.Add(job.JobID.ToString(), job.JobDate.ToShortDateString() + ", Driver = " + drivername);
                    node.ImageIndex  = job.StatusID == 18 ? 12 : 13;
                    node.ToolTipText = job.StatusID == 18 ? "Cancelled Job" : "Expired Job";

                    node.Nodes.Add(" ");
                }
            }
        }
예제 #2
0
 public frmJobSearch()
 {
     InitializeComponent();
     Jobs jobs = new Jobs(Jobs.ContactView.Current);
 }