public void SaveFocalWork(Bus_FocalWork focalWork) { using (DepotManagementDataContext ctx = CommentParameter.DepotDataContext) { Bus_FocalWork work = new Bus_FocalWork(); var varData = from a in ctx.Bus_FocalWork where a.F_Id == focalWork.F_Id select a; if (varData.Count() == 1) { work = varData.Single(); work.DutyUser = focalWork.DutyUser; work.EndDate = focalWork.EndDate; work.ExpectedGoal = focalWork.ExpectedGoal; work.F_CreateDate = ServerTime.Time; work.F_CreateUser = BasicInfo.LoginID; work.StartDate = focalWork.StartDate; work.TaskDescription = focalWork.TaskDescription; work.TaskName = focalWork.TaskName; } else { work.F_CreateDate = ServerTime.Time; work.F_CreateUser = BasicInfo.LoginID; focalWork.TaskStatus = ServerTime.Time.Date >= ((DateTime)focalWork.StartDate).Date ? "进行中" : "待启动"; ctx.Bus_FocalWork.InsertOnSubmit(focalWork); } ctx.SubmitChanges(); } }
public 重点工作详细信息(string keyValue, string yearMonth) { InitializeComponent(); _Lnq_FocalWork = _Service_FocalWork.GetSingle_FocalWork(keyValue); _Table_KeyPoint = _Service_FocalWork.GetTable_KeyPoint(keyValue); _YearMonth = yearMonth; }
Bus_FocalWork GetInfo() { Bus_FocalWork result = new Bus_FocalWork(); if (GlobalObject.GeneralFunction.IsNullOrEmpty(txtDutyUser.Text)) { throw new Exception("请选择【责任人】"); } else { result.DutyUser = txtDutyUser.Tag.ToString(); } if (GeneralFunction.IsNullOrEmpty(txtTaskName.Text)) { throw new Exception("请填写【重点工作】"); } else { result.TaskName = txtTaskName.Text; result.F_Id = txtTaskName.Tag == null?Guid.NewGuid().ToString() : txtTaskName.Tag.ToString(); } if (dtpStartDate.Value > dtpEndDate.Value) { throw new Exception("【启动时间】必须小于【完成时间】"); } else { result.EndDate = dtpEndDate.Value; result.StartDate = dtpStartDate.Value; } if (GeneralFunction.IsNullOrEmpty(txtExpectedGoal.Text)) { throw new Exception("请填写【预期目标】"); } else { result.ExpectedGoal = txtExpectedGoal.Text; } if (GeneralFunction.IsNullOrEmpty(txtTaskDescription.Text)) { throw new Exception("请填写【工作描述】"); } else { result.TaskDescription = txtTaskDescription.Text; } return(result); }
private void btnAdd_Click(object sender, EventArgs e) { try { Bus_FocalWork focalWork = GetInfo(); focalWork.F_Id = Guid.NewGuid().ToString(); _Service_FocalWork.SaveFocalWork(focalWork); customDataGridView1.DataSource = _Service_FocalWork.GetTable_FocalWork(); ClearContrl(); } catch (Exception ex) { MessageDialog.ShowPromptMessage(ex.Message); } }
void SetFocalWorkRadioButton() { if (GeneralFunction.IsNullOrEmpty(cmbYear.Text) || GeneralFunction.IsNullOrEmpty(cmbMonth.Text)) { return; } if (_List_Content == null || _List_Content.Count == 0) { _Lnq_BillInfo.YearMonth = cmbYear.Text + cmbMonth.Text; _List_Content = _Service_FocalWork.GetList_ProgressContent(_Lnq_BillInfo); _List_KeyPoint = _Service_FocalWork.GetList_ProgressKeyPoint(_Lnq_BillInfo, _List_Content); } flowLayoutPanel1.Controls.Clear(); foreach (Bus_FocalWork_MonthlyProgress_Content content in _List_Content) { RadioButton rb = new RadioButton(); Bus_FocalWork focalWork = _Service_FocalWork.GetSingle_FocalWork(content.FocalWorkId); rb.AutoSize = true; rb.TabStop = true; rb.Name = focalWork.F_Id; rb.Text = focalWork.TaskName; rb.Tag = content; rb.CheckedChanged += new EventHandler(rb_CheckedChanged); flowLayoutPanel1.Controls.Add(rb); } if (flowLayoutPanel1.Controls.Count > 0) { RadioButton rb1 = flowLayoutPanel1.Controls[0] as RadioButton; rb1.Checked = true; } }
private void customDataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) { if (customDataGridView1.CurrentRow == null) { return; } txtTaskName.Tag = customDataGridView1.CurrentRow.Cells["F_Id"].Value; Bus_FocalWork focalWork = _Service_FocalWork.GetSingle_FocalWork(txtTaskName.Tag.ToString()); View_HR_Personnel personnel = UniversalFunction.GetPersonnelInfo(focalWork.DutyUser); txtDutyUser.Text = personnel.姓名; txtDutyUser.Tag = personnel.工号; txtTaskDescription.Text = focalWork.TaskDescription; txtExpectedGoal.Text = focalWork.ExpectedGoal; txtTaskName.Text = focalWork.TaskName; dtpStartDate.Value = (DateTime)focalWork.StartDate; dtpEndDate.Value = (DateTime)focalWork.EndDate; }
private bool 重点工作明细_PanelGetDataInfo(CE_FlowOperationType flowOperationType) { try { foreach (Control cl in flowLayoutPanel1.Controls) { if (cl is RadioButton) { if (!((RadioButton)cl).Checked) { continue; } RadioButton rb = cl as RadioButton; Bus_FocalWork_MonthlyProgress_Content content = rb.Tag as Bus_FocalWork_MonthlyProgress_Content; content.ProgressContent = txtProgressContent.Text; content.NextPlan = txtNextPlan.Text; if (rbYes.Checked) { content.Evaluate = "已完成"; } else if (rbNo.Checked) { content.Evaluate = "未完成"; } else if (rbDelay.Checked) { content.Evaluate = "延期"; } break; } } if (flowOperationType == CE_FlowOperationType.提交) { foreach (Bus_FocalWork_MonthlyProgress_Content content in _List_Content) { Bus_FocalWork focalWork = _Service_FocalWork.GetSingle_FocalWork(content.FocalWorkId); if (GeneralFunction.IsNullOrEmpty(content.Evaluate)) { throw new Exception("【" + focalWork.TaskName + "】,未进行评价"); } if (GeneralFunction.IsNullOrEmpty(content.NextPlan)) { throw new Exception("【" + focalWork.TaskName + "】,未填写【下月计划】"); } if (GeneralFunction.IsNullOrEmpty(content.ProgressContent)) { throw new Exception("【" + focalWork.TaskName + "】,未填写【工作进展】"); } List <Bus_FocalWork_MonthlyProgress_KeyPoint> lstTempKey = (from a in _List_KeyPoint where a.BillNo == _Lnq_BillInfo.BillNo && a.FocalWorkId == content.FocalWorkId select a).ToList(); foreach (Bus_FocalWork_MonthlyProgress_KeyPoint keyPoint in lstTempKey) { if (GeneralFunction.IsNullOrEmpty(keyPoint.Evaluate)) { Bus_FocalWork_KeyPoint tempKey = _Service_FocalWork.GetSingle_KeyPoint(keyPoint.KeyPointId); throw new Exception("【" + focalWork.TaskName + "】中的关键节点【" + tempKey.KeyPointName + "】,未进行评价"); } } } } this.FlowInfo_BillNo = _Lnq_BillInfo.BillNo; this.ResultInfo = _Lnq_BillInfo; this.ResultList = new List <object>(); this.ResultList.Add(flowOperationType); this.ResultList.Add(_List_Content); this.ResultList.Add(_List_KeyPoint); return(true); } catch (Exception ex) { MessageDialog.ShowPromptMessage(ex.Message); return(false); } }
void rb_CheckedChanged(object sender, EventArgs e) { RadioButton rb = sender as RadioButton; if (rb.Checked) { Bus_FocalWork_MonthlyProgress_Content content = rb.Tag as Bus_FocalWork_MonthlyProgress_Content; Bus_FocalWork focalWork = _Service_FocalWork.GetSingle_FocalWork(content.FocalWorkId); txtExpectedGoal.Text = focalWork.ExpectedGoal; txtTaskDescription.Text = focalWork.TaskDescription; txtDutyUser.Text = UniversalFunction.GetPersonnelInfo(focalWork.DutyUser).姓名; dtpEndDate.Value = (DateTime)focalWork.EndDate; dtpStartDate.Value = (DateTime)focalWork.StartDate; btnKeyPoint.Tag = focalWork.F_Id; txtProgressContent.Text = content.ProgressContent; txtNextPlan.Text = content.NextPlan; List <Bus_FocalWork_MonthlyProgress_KeyPoint> lstKey = (from a in _List_KeyPoint where a.FocalWorkId == content.FocalWorkId select a).ToList(); btnSetKeyPoint.Tag = lstKey; if (lstKey == null || lstKey.Count() == 0) { btnSetKeyPoint.Visible = false; } else { btnSetKeyPoint.Visible = true; } if (!GeneralFunction.IsNullOrEmpty(content.Evaluate)) { switch (content.Evaluate) { case "已完成": rbYes.Checked = true; break; case "未完成": rbNo.Checked = true; break; case "延期": rbDelay.Checked = true; break; default: rbDelay.Checked = false; rbNo.Checked = false; rbYes.Checked = false; break; } } else { rbDelay.Checked = false; rbNo.Checked = false; rbYes.Checked = false; } } else { Bus_FocalWork_MonthlyProgress_Content content = rb.Tag as Bus_FocalWork_MonthlyProgress_Content; content.ProgressContent = txtProgressContent.Text; content.NextPlan = txtNextPlan.Text; if (rbYes.Checked) { content.Evaluate = "已完成"; } else if (rbNo.Checked) { content.Evaluate = "未完成"; } else if (rbDelay.Checked) { content.Evaluate = "延期"; } } }