private void Lvw_Plan_SelectedIndexChanged(object sender, EventArgs e) { try { Plan plan = new Plan(); ListView view = (ListView) sender; DataSet npByPlanId = plan.GetNpByPlanId(view.SelectedItems[0].SubItems[1].Text); this.Lvw_License.Items.Clear(); this.labRemark.Text = plan.GetPlanRemark(view.SelectedItems[0].SubItems[1].Text); if (npByPlanId.Tables[0].Rows.Count > 0) { for (int i = 0; i < npByPlanId.Tables[0].Rows.Count; i++) { ListViewItem item = new ListViewItem { ImageKey = "NP", Text = npByPlanId.Tables[0].Rows[i]["NpNo"].ToString() }; item.SubItems.Add(npByPlanId.Tables[0].Rows[i]["CodeName"].ToString()); item.SubItems.Add(npByPlanId.Tables[0].Rows[i]["IsFront"].ToString()); item.SubItems.Add(npByPlanId.Tables[0].Rows[i]["IsBack"].ToString()); item.SubItems.Add(npByPlanId.Tables[0].Rows[i]["IsMail"].ToString()); this.Lvw_License.Items.Add(item); } } this.gbx_NpCount.Text = "车牌信息 数量:" + npByPlanId.Tables[0].Rows.Count.ToString(); } catch (Exception) { } }
private void CountAppDataDetails() { Plan plan = new Plan(); this.G_SelectPlan = 0; this.G_SelectTotal = 0; this.G_Total = 0; this.G_TotalNPCount.Clear(); this.G_SelectNPCount.Clear(); for (int i = 0; i < this.Lvw_Plan.Items.Count; i++) { DataSet npCountByPlanID = plan.GetNpCountByPlanID(this.Lvw_Plan.Items[i].SubItems[1].Text); if ((npCountByPlanID != null) && (npCountByPlanID.Tables[0].Rows.Count > 0)) { for (int j = 0; j < npCountByPlanID.Tables[0].Rows.Count; j++) { string key = npCountByPlanID.Tables[0].Rows[j]["NPType"].ToString(); if (this.G_TotalNPCount.ContainsKey(npCountByPlanID.Tables[0].Rows[j]["NPType"].ToString())) { this.G_TotalNPCount[key] = Convert.ToString((int) (int.Parse(this.G_TotalNPCount[key].ToString()) + int.Parse(npCountByPlanID.Tables[0].Rows[j]["Count"].ToString()))); } else { this.G_TotalNPCount.Add(key, 0); this.G_TotalNPCount[key] = Convert.ToString((int) (int.Parse(this.G_TotalNPCount[key].ToString()) + int.Parse(npCountByPlanID.Tables[0].Rows[j]["Count"].ToString()))); } this.G_Total += int.Parse(npCountByPlanID.Tables[0].Rows[j]["Count"].ToString()); if (this.Lvw_Plan.Items[i].Checked) { if (this.G_SelectNPCount.ContainsKey(npCountByPlanID.Tables[0].Rows[j]["NPType"].ToString())) { this.G_SelectNPCount[key] = Convert.ToString((int) (int.Parse(this.G_SelectNPCount[key].ToString()) + int.Parse(npCountByPlanID.Tables[0].Rows[j]["Count"].ToString()))); } else { this.G_SelectNPCount.Add(key, 0); this.G_SelectNPCount[key] = Convert.ToString((int) (int.Parse(this.G_SelectNPCount[key].ToString()) + int.Parse(npCountByPlanID.Tables[0].Rows[j]["Count"].ToString()))); } this.G_SelectTotal += int.Parse(npCountByPlanID.Tables[0].Rows[j]["Count"].ToString()); this.G_SelectPlan++; } } } } }
private void Lvw_Plan_ItemCheck(object sender, ItemCheckEventArgs e) { Plan plan = new Plan(); this.CountAppDataDetails(); DataSet npCountByPlanID = plan.GetNpCountByPlanID(this.Lvw_Plan.Items[e.Index].SubItems[1].Text); if ((npCountByPlanID != null) && (npCountByPlanID.Tables[0].Rows.Count > 0)) { for (int i = 0; i < npCountByPlanID.Tables[0].Rows.Count; i++) { string key = npCountByPlanID.Tables[0].Rows[i]["NPType"].ToString(); if (e.NewValue == CheckState.Checked) { if (this.G_SelectNPCount.ContainsKey(npCountByPlanID.Tables[0].Rows[i]["NPType"].ToString())) { this.G_SelectNPCount[key] = Convert.ToString((int) (int.Parse(this.G_SelectNPCount[key].ToString()) + int.Parse(npCountByPlanID.Tables[0].Rows[i]["Count"].ToString()))); } else { this.G_SelectNPCount.Add(key, 0); this.G_SelectNPCount[key] = Convert.ToString((int) (int.Parse(this.G_SelectNPCount[key].ToString()) + int.Parse(npCountByPlanID.Tables[0].Rows[i]["Count"].ToString()))); } this.G_SelectTotal += int.Parse(npCountByPlanID.Tables[0].Rows[i]["Count"].ToString()); this.G_SelectPlan++; } else { if (this.G_SelectNPCount.ContainsKey(npCountByPlanID.Tables[0].Rows[i]["NPType"].ToString())) { this.G_SelectNPCount[key] = Convert.ToString((int) (int.Parse(this.G_SelectNPCount[key].ToString()) - int.Parse(npCountByPlanID.Tables[0].Rows[i]["Count"].ToString()))); } this.G_SelectTotal -= int.Parse(npCountByPlanID.Tables[0].Rows[i]["Count"].ToString()); this.G_SelectPlan--; } } } this.ShowCountInLabel(); }
private void CountAppData() { Plan plan = new Plan(); int num = 0; int num2 = 0; for (int i = 0; i < this.Lvw_Plan.Items.Count; i++) { DataSet npByPlanId = plan.GetNpByPlanId(this.Lvw_Plan.Items[i].SubItems[1].Text); num2 += npByPlanId.Tables[0].Rows.Count; if (this.Lvw_Plan.Items[i].Checked) { num += npByPlanId.Tables[0].Rows.Count; } } this.labelSelectCount.Text = string.Concat(new object[] { "共有", this.Lvw_Plan.Items.Count, "个计划单", num2.ToString(), "副车牌等待审批!当前选取", num.ToString(), "副" }); }
private void btn_Pass_Click(object sender, EventArgs e) { if (this.Lvw_Plan.CheckedItems.Count != 0) { Plan plan = new Plan(); foreach (ListViewItem item in this.Lvw_Plan.Items) { if (item.Checked && plan.SmtAudiResult(item.SubItems[1].Text.Trim(), true)) { ListViewItem item2 = (ListViewItem) item.Clone(); item2.ImageKey = "Ok"; this.Lvw_Audited.Items.Add(item2); } } this.btn_Refresh_Click(this, new EventArgs()); } }
private void backgroundWorker_DoWork(object sender, DoWorkEventArgs e) { while (this.cbx_AutoRefresh.Checked) { DataSet unApprPlan = new Plan().GetUnApprPlan(User.IsHaveAuthority("特殊审批"), G_IsRemarkAppr); if (unApprPlan.Tables[0].Rows.Count > 0) { for (int i = 0; i < unApprPlan.Tables[0].Rows.Count; i++) { ListViewItem item = new ListViewItem { Tag = unApprPlan.Tables[0].Rows[i]["PlanId"].ToString(), ImageKey = "Plan" }; item.SubItems.Add(unApprPlan.Tables[0].Rows[i]["PlanId"].ToString()); item.SubItems.Add(unApprPlan.Tables[0].Rows[i]["PlanKind"].ToString()); item.SubItems.Add(unApprPlan.Tables[0].Rows[i]["PlanDepart"].ToString()); item.SubItems.Add(unApprPlan.Tables[0].Rows[i]["PlanTime"].ToString()); item.SubItems.Add(unApprPlan.Tables[0].Rows[i]["InputUser"].ToString()); item.SubItems.Add(unApprPlan.Tables[0].Rows[i]["InPutTime"].ToString()); item.SubItems.Add(unApprPlan.Tables[0].Rows[i]["TotalCount"].ToString()); if (this.Lvw_Plan != null) { this.Lvw_Plan.Invoke(this.Ar, new object[] { item }); } } } Thread.Sleep(0x7d0); } if (this.backgroundWorker.CancellationPending) { e.Cancel = true; } }
public void btn_Refresh_Click(object sender, EventArgs e) { this.Cursor = Cursors.WaitCursor; Plan plan = new Plan(); DataSet unApprPlan = plan.GetUnApprPlan(User.IsHaveAuthority("特殊审批"), G_IsRemarkAppr); this.Lvw_Plan.Items.Clear(); for (int i = 0; i < unApprPlan.Tables[0].Rows.Count; i++) { ListViewItem item = new ListViewItem { Checked = this.cbx_Select.Checked, ImageKey = "Plan", Tag = unApprPlan.Tables[0].Rows[i]["PlanId"].ToString() }; item.SubItems.Add(unApprPlan.Tables[0].Rows[i]["PlanId"].ToString()); item.SubItems.Add(unApprPlan.Tables[0].Rows[i]["PlanKind"].ToString()); item.SubItems.Add(unApprPlan.Tables[0].Rows[i]["TotalCount"].ToString()); item.SubItems.Add(unApprPlan.Tables[0].Rows[i]["PlanDepart"].ToString()); item.SubItems.Add(unApprPlan.Tables[0].Rows[i]["PlanTime"].ToString()); item.SubItems.Add(unApprPlan.Tables[0].Rows[i]["InputUser"].ToString()); item.SubItems.Add(unApprPlan.Tables[0].Rows[i]["InPutTime"].ToString()); this.Lvw_Plan.Items.Add(item); } unApprPlan = plan.GetAuditedPlan(User.IsHaveAuthority("特殊审批"), G_IsRemarkAppr); this.Lvw_Audited.Items.Clear(); for (int j = 0; j < unApprPlan.Tables[0].Rows.Count; j++) { ListViewItem item2 = new ListViewItem { ImageKey = (unApprPlan.Tables[0].Rows[j]["IsPass"].ToString() == "1") ? "Ok" : "NotPass" }; item2.SubItems.Add(unApprPlan.Tables[0].Rows[j]["PlanId"].ToString()); item2.SubItems.Add(unApprPlan.Tables[0].Rows[j]["PlanKind"].ToString()); item2.SubItems.Add(unApprPlan.Tables[0].Rows[j]["PlanDepart"].ToString()); item2.SubItems.Add(unApprPlan.Tables[0].Rows[j]["PlanTime"].ToString()); item2.SubItems.Add(unApprPlan.Tables[0].Rows[j]["InputUser"].ToString()); item2.SubItems.Add(unApprPlan.Tables[0].Rows[j]["InPutTime"].ToString()); item2.SubItems.Add(unApprPlan.Tables[0].Rows[j]["TotalCount"].ToString()); this.Lvw_Audited.Items.Add(item2); } this.Lvw_License.Items.Clear(); this.labRemark.Text = ""; this.gbx_NpCount.Text = "车牌信息"; this.CountAppDataDetails(); this.ShowCountInLabel(); this.Cursor = Cursors.Default; }
private void btn_Refresh_Click(object sender, EventArgs e) { DataSet toDoPlan = new Plan().GetToDoPlan(); this.Lvw_Plan.Items.Clear(); this.Lvw_TaskNp.Items.Clear(); for (int i = 0; i < toDoPlan.Tables[0].Rows.Count; i++) { ListViewItem item = new ListViewItem { Checked = this.cbx_SelectAll.Checked, ImageKey = "Plan" }; item.SubItems.Add(toDoPlan.Tables[0].Rows[i]["PlanId"].ToString()); item.SubItems.Add(toDoPlan.Tables[0].Rows[i]["PlanKind"].ToString()); item.SubItems.Add(toDoPlan.Tables[0].Rows[i]["PlanDepart"].ToString()); DateTime time = (DateTime) toDoPlan.Tables[0].Rows[i]["Deadline"]; item.SubItems.Add(time.ToShortDateString()); item.SubItems.Add(toDoPlan.Tables[0].Rows[i]["MakedNum"].ToString()); item.SubItems.Add(toDoPlan.Tables[0].Rows[i]["TotalCount"].ToString()); item.SubItems.Add(toDoPlan.Tables[0].Rows[i]["InputUser"].ToString()); item.SubItems.Add(toDoPlan.Tables[0].Rows[i]["InPutTime"].ToString()); item.SubItems.Add(toDoPlan.Tables[0].Rows[i]["AuditingTime"].ToString()); DateTime time2 = (DateTime) toDoPlan.Tables[0].Rows[i]["PlanTime"]; item.SubItems.Add(time2.ToShortDateString()); this.Lvw_Plan.Items.Add(item); } toDoPlan = new Task().GetNewTask(); this.Lvw_Task.Items.Clear(); for (int j = 0; j < toDoPlan.Tables[0].Rows.Count; j++) { ListViewItem item2 = new ListViewItem { ImageKey = "Task", Text = toDoPlan.Tables[0].Rows[j]["TaskId"].ToString().Trim() }; item2.SubItems.Add(toDoPlan.Tables[0].Rows[j]["TaskTime"].ToString()); item2.SubItems.Add(toDoPlan.Tables[0].Rows[j]["TaskUser"].ToString()); this.Lvw_Task.Items.Add(item2); } this.Lvw_TaskNp.Items.Clear(); this.gbx_TaskNp.Text = "任务单包含的车牌信息"; this.listVwWorkers.Items.Clear(); DataSet set2 = new Sql2KDataAccess().Run_SqlText("SELECT * FROM T_Attendance WHERE (DATEDIFF([day], ArriveTime, GETDATE()) = 0) AND (LeaveTime IS NULL)"); if (set2 != null) { for (int k = 0; k < set2.Tables[0].Rows.Count; k++) { this.listVwWorkers.Items.Add(set2.Tables[0].Rows[k]["personid"].ToString()); } this.listVwWorkers.Columns[0].Text = "当前" + set2.Tables[0].Rows.Count.ToString() + "人"; } }