private void BttonSearch_Click(object sender, EventArgs e) { try { UfidaPMS.Models.ProjectWeekStatus p = WSAL.WSProjectWeekStatus.GetModelByWeek((int)nsYear.Value, (int)nsMonth.Value, (int)nsWeek.Value); if (p != null) { nsYear.Value = (decimal)p.year; nsMonth.Value = (decimal)p.moth; nsWeek.Value = (decimal)p.week; tbYear2.Text = p.year.ToString(); tbMonth2.Text = p.moth.ToString(); tbWeek2.Text = p.week.ToString(); tbCreatedate2.Text = p.createdate.ToShortDateString(); tbWaitImprove2.Text = p.problem; tbImproveMethod2.Text = p.measure; tbRemarks2.Text = p.remarks; tbWeekstatus2.Text = p.state; dgvList2.DataSource = p.DSSubProjectWeekStatus.Tables[0]; } else { MessageBox.Show("获取数据发生错误,请重试!"); } } catch { MessageBox.Show("获取数据发生错误,请重试!"); } }
public AddProjectStatue(string ProjectName, string SubProjectName, string SubProjectId) { InitializeComponent(); this.SubProjectId = SubProjectId; tbProject.Text = ProjectName; tbProject2.Text = ProjectName; tbProject.ReadOnly = true; tbSubProject.Text = SubProjectName; tbSubProject2.Text = SubProjectName; tbSubProject.ReadOnly = true; try { dtMilestone = WSAL.WSMilestone.GetMilestoneNowList(SubProjectId); MileStone.DataSource = dtMilestone; MileStone.ValueMember = "milestonename"; MileStone.DisplayMember = "milestonename"; dtpCreateTime.Value = WSAL.WSCommon.GetServerTime().Date; } catch (Exception ex) { MessageBox.Show("加载数据出错,请稍候重试!"); this.Dispose(); } try { UfidaPMS.Models.ProjectWeekStatus p = WSAL.WSProjectWeekStatus.GetLatestModelBySubProject(SubProjectId); if (p != null) { nsYear.Value = (decimal)p.year; nsMonth.Value = (decimal)p.moth; nsWeek.Value = (decimal)p.week; tbYear2.Text = p.year.ToString(); tbMonth2.Text = p.moth.ToString(); tbWeek2.Text = p.week.ToString(); tbCreatedate2.Text = p.createdate.ToShortDateString(); tbWaitImprove2.Text = p.problem; tbImproveMethod2.Text = p.measure; tbRemarks2.Text = p.remarks; tbWeekstatus2.Text = p.state; dgvList2.DataSource = p.DSSubProjectWeekStatus.Tables[0]; if (nsWeek.Value >= 5) { nuWeek.Value = nsWeek.Value + 1; if (nsMonth.Value >= 12) { nuMonth.Value = 1; nuYear.Value = nsYear.Value + 1; } else { nuMonth.Value = nsMonth.Value + 1; nuYear.Value = nsYear.Value; } } else { nuWeek.Value = nsWeek.Value + 1; nuMonth.Value = nsMonth.Value; nuYear.Value = nsYear.Value; } } else { MessageBox.Show("暂时无该项目数据!"); } } catch { MessageBox.Show("暂时无该项目数据!"); } }