public void SaveKeyPoint(Bus_FocalWork_KeyPoint keyPoint) { using (DepotManagementDataContext ctx = CommentParameter.DepotDataContext) { Bus_FocalWork_KeyPoint tempKey = new Bus_FocalWork_KeyPoint(); var varData = from a in ctx.Bus_FocalWork_KeyPoint where a.F_Id == keyPoint.F_Id select a; if (varData.Count() == 1) { tempKey = varData.Single(); tempKey.DutyUser = keyPoint.DutyUser; tempKey.EndDate = keyPoint.EndDate; tempKey.StartDate = keyPoint.StartDate; tempKey.FocalWorkId = keyPoint.FocalWorkId; tempKey.KeyPointName = keyPoint.KeyPointName; } else { keyPoint.KeyStatus = ServerTime.Time.Date >= ((DateTime)keyPoint.StartDate).Date ? "进行中" : "待启动"; ctx.Bus_FocalWork_KeyPoint.InsertOnSubmit(keyPoint); } ctx.SubmitChanges(); } }
private void btnAdd_Click(object sender, EventArgs e) { try { Bus_FocalWork_KeyPoint keyPoint = GetInfo(); keyPoint.F_Id = Guid.NewGuid().ToString(); _Service_FocalWork.SaveKeyPoint(keyPoint); customDataGridView1.DataSource = _Service_FocalWork.GetTable_KeyPoint(customGroupBox2.Tag.ToString()); ClearContrl(); } catch (Exception ex) { MessageDialog.ShowPromptMessage(ex.Message); } }
private void customDataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) { if (customDataGridView1.CurrentRow == null) { return; } txtKeyPointName.Tag = customDataGridView1.CurrentRow.Cells["F_Id"].Value; Bus_FocalWork_KeyPoint keyPoint = _Service_FocalWork.GetSingle_KeyPoint(txtKeyPointName.Tag.ToString()); View_HR_Personnel personnel = UniversalFunction.GetPersonnelInfo(keyPoint.DutyUser); txtDutyUser.Text = personnel.姓名; txtDutyUser.Tag = personnel.工号; txtKeyPointName.Text = keyPoint.KeyPointName; dtpStartDate.Value = (DateTime)keyPoint.StartDate; dtpEndDate.Value = (DateTime)keyPoint.EndDate; }
private void 重点工作关键节点_Load(object sender, EventArgs e) { if (_Table_Source != null && _Table_Source.Rows.Count > 0) { customDataGridView1.DataSource = _Table_Source; customDataGridView1.ReadOnly = true; } else if (_List_KeyPoint != null && _List_KeyPoint.Count() > 0) { this.状态.Items.Remove("待启动"); this.状态.Items.Remove("进行中"); foreach (Bus_FocalWork_MonthlyProgress_KeyPoint item in _List_KeyPoint) { Bus_FocalWork_KeyPoint keyPoint = _Service_FocalWork.GetSingle_KeyPoint(item.KeyPointId); View_HR_Personnel personnel = UniversalFunction.GetPersonnelInfo(keyPoint.DutyUser); customDataGridView1.Rows.Add(new object[] { keyPoint.KeyPointName, item.Evaluate, keyPoint.StartDate, keyPoint.EndDate, personnel.姓名, item.F_Id }); } } }
Bus_FocalWork_KeyPoint GetInfo() { Bus_FocalWork_KeyPoint result = new Bus_FocalWork_KeyPoint(); result.FocalWorkId = customGroupBox2.Tag.ToString(); if (GlobalObject.GeneralFunction.IsNullOrEmpty(txtDutyUser.Text)) { throw new Exception("请选择【责任人】"); } else { result.DutyUser = txtDutyUser.Tag.ToString(); } if (GeneralFunction.IsNullOrEmpty(txtKeyPointName.Text)) { throw new Exception("请填写【关键节点】"); } else { result.KeyPointName = txtKeyPointName.Text; result.F_Id = txtKeyPointName.Tag == null?Guid.NewGuid().ToString() : txtKeyPointName.Tag.ToString(); } if (dtpStartDate.Value > dtpEndDate.Value) { throw new Exception("【启动时间】必须小于【完成时间】"); } else { result.EndDate = dtpEndDate.Value; result.StartDate = dtpStartDate.Value; } return(result); }
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); } }