/// <summary> /// AssessActivityPaper中的主管项 /// </summary> /// <returns></returns> public List <AssessActivityItem> NotHrItems() { List <AssessActivityItem> iRet = new List <AssessActivityItem>(); List <AssessTemplateItem> assessTemplateItems = _AssessTemplatePaper.ItsAssessTemplateItems; foreach (AssessTemplateItem ati in assessTemplateItems) { if (ati.ItsOperateType != OperateType.HR) { AssessActivityItem manageItem = new AssessActivityItem(ati.Question, ati.Option, ati.Classfication, ati.Description); manageItem.AssessTemplateItemType = ati.AssessTemplateItemType; manageItem.Note = string.Empty; manageItem.Weight = ati.Weight; if (ati.AssessTemplateItemType == AssessTemplateItemType.Formula) { manageItem.Grade = new CalculateFormula().Calculate(_AssessActivity.ItsEmployee.Account.Id, _AssessActivity.ScopeFrom, _AssessActivity.ScopeTo, ati.Option); } else { manageItem.Grade = 0; } iRet.Add(manageItem); } } return(iRet); }
public List <AssessActivityItem> GetItemsForUI(bool ifHrItem) { List <AssessActivityItem> newItems = new List <AssessActivityItem>(); string itemType = ""; foreach (AssessActivityItem originalItems in _SubmitInfo.ItsAssessActivityItems) { switch (_SubmitInfo.SubmitInfoType.Id) { //HRAssess case 0: itemType = GetHRItemClass(); break; //MyselfAssess case 1: itemType = GetPersonalItemClass(); break; //ManagerAssess case 2: itemType = GetManagerItemClass(); break; } AssessActivityItem item = FindAssessActivityItem(originalItems.Question, itemType, _AssessActivity.ItsAssessActivityPaper.ItsAssessActivityItems); if (item != null) { newItems.Add(item); } } return(newItems); }
private void ExportAssessSystemInfo(ref Microsoft.Office.Interop.Word.Table tb) { decimal grade = 0; for (int i = 0; i < _ItemCount; i++) { //todo yyb AssessActivityItem managerItem = _AssessActivity.ItsAssessActivityPaper.ItsAssessActivityItems[i]; if (managerItem.Classfication == ItemClassficationEmnu._360) { continue; } tb.Cell(6 + i, 1).Range.Text = AssessSystemUtility.GetItemClassficationNameByItemClassfication(managerItem.Classfication); string questionAndNote = managerItem.Question; if (!string.IsNullOrEmpty(managerItem.Note)) { questionAndNote += "(" + managerItem.Note + ")"; } if (managerItem.AssessTemplateItemType == AssessTemplateItemType.Option) { tb.Cell(6 + i, 2).Range.Text = questionAndNote; //如果不是1到5分将存在问题 string[] options = managerItem.Option.Split('/'); int gradecellindex = managerItem.Grade < 6 ? Decimal.ToInt32(managerItem.Grade) : Decimal.ToInt32(managerItem.Grade) / 20; tb.Cell(6 + i, 3).Range.Text = options[5 - gradecellindex]; tb.Cell(6 + i, 4).Range.Text = (managerItem.Grade * managerItem.Weight).ToString(); } else if (managerItem.AssessTemplateItemType == AssessTemplateItemType.Open) { tb.Cell(6 + i, 2).Range.Text = managerItem.Question; tb.Cell(6 + i, 3).Range.Text = managerItem.Note; tb.Cell(6 + i, 4).Range.Text = "不计分"; } else { tb.Cell(6 + i, 2).Range.Text = questionAndNote; tb.Cell(6 + i, 4).Range.Text = (managerItem.Grade * managerItem.Weight).ToString(); } grade += (managerItem.Grade * managerItem.Weight); } tb.Cell(6 + _ItemCount, 4).Range.Text = grade.ToString(); }
private static void RechieveItsSubmitInfo(int paperID, SubmitInfo submitInfo) { SqlCommand cmd = new SqlCommand(); cmd.Parameters.Add(_AssessActivityPaperID, SqlDbType.Int).Value = paperID; using ( SqlDataReader sdr = SqlHelper.ExecuteReader("GetAssessActivityItemByAssessActivityPaperId", cmd)) { while (sdr.Read()) { AssessActivityItem assessActivityItem = new AssessActivityItem(sdr[_DbQuestion].ToString(), sdr[_DbOption].ToString(), (ItemClassficationEmnu)sdr[_DbClassfication], sdr[_DbDescription].ToString()); assessActivityItem.Grade = Convert.ToDecimal(sdr[_DbGrade]); assessActivityItem.Note = sdr[_DbNote].ToString(); assessActivityItem.AssessTemplateItemType = (AssessTemplateItemType)sdr[_DbAssessTemplateItemType]; assessActivityItem.Weight = Convert.ToDecimal(sdr[_DbWeight]); assessActivityItem.AssessActivityItemType = (AssessActivityItemType)sdr[_DbType]; submitInfo.ItsAssessActivityItems.Add(assessActivityItem); } } }
/// <summary> /// 验证从界面传入的Answers是正确的,并且填写有效的Item(介于性能考虑,将2件事情放在一起做了) /// </summary> private void ValidateAnswersFromUi() { if (_ItsAssessActivity.ItsAssessActivityPaper.ItsAssessActivityItems.Count > 0) { foreach (AssessActivityItem answer in _Answers) { string itemType = GetItemType(); AssessActivityItem item = _ItsAssessActivity.ItsAssessActivityPaper.FindAssessActivityItem(answer.Question, itemType); if (item == null) { BllUtility.ThrowException(BllExceptionConst._InvalidFillItems); } else { item.Grade = answer.Grade; item.Note = answer.Note; } } } }