//构造函数 public JobForm(BathDBDataContext dc, Job job) { db = dc; if (job != null) { newJob = false; m_job = job; } InitializeComponent(); ComboJobList.Items.Add(""); ComboJobList.Items.AddRange(db.Job.Select(x => x.name).ToArray()); ComboJobList.SelectedIndex = 0; ComboDeparts.Items.AddRange((db.Department.Select(x => x.name).ToArray())); }
private void create_one_node(Job job, List<int> jobs, TreeNode pNode) { jobs.Add(job.id); var jobName = job.name; var node1 = new TreeNode(jobName); node1.Name = jobName; node1.Text = jobName; node1.ImageIndex = 1; node1.SelectedImageIndex = 1; if (pNode != null) pNode.Nodes.Add(node1); var childs = db.Job.Where(x => x.leaderId == job.id); if (childs.Any()) { create_one_node(childs.FirstOrDefault(), jobs, node1); } var job_next = db.Job.FirstOrDefault(x => !jobs.Contains(x.id) && ((job.leaderId==null && x.leaderId==null) || (job.leaderId != null && x.leaderId==job.leaderId))); if (job_next == null) return; create_one_node(job_next, jobs, pNode); }
partial void DeleteJob(Job instance);
partial void UpdateJob(Job instance);
partial void InsertJob(Job instance);