public ActionResult GetPersonalAssessmentTempResult(string assessment_id, string checker, string check_object) { //获取本次考核的考核模板 string templeteId = assessmentApp.GetByAssessmentId(assessment_id).templete_id; //根据考核模板获取所有的指标 //根据模板id查找该模板的所有细项指标 List <DimensionDetailEntity> dimensionDetailList = dimensionDetailApp.GetTempleteDimensionDetail(templeteId); List <string> indicatorsDefineList = new List <string>(); for (int i = 0; i < dimensionDetailList.Count; i++) { DimensionDetailEntity entity = dimensionDetailList[i]; string formule = entity.formule; string[] arr = formule.Replace('(', '|').Replace(')', '|').Replace('+', '|').Replace('-', '|').Replace('*', '|').Replace('/', '|').Replace('Σ', '|').Split('|'); for (int j = 0; j < arr.Length; j++) { if (!string.IsNullOrEmpty(arr[j]) && !indicatorsDefineList.Contains(arr[j])) { indicatorsDefineList.Add(arr[j]); } } } //根据考核id,考核对象以及指标名称获取当前指标的分数 //获取最后一个考核人的id AssessmentDetailEntity assessmentDetailEntity = assessmentDetailApp.GetLastChecker(assessment_id, check_object); string lastChecker = string.Empty; if (assessmentDetailEntity != null) { lastChecker = assessmentDetailEntity.checker; } List <AssessmentIndicatorsValueModel> list = assessmentResultApp.GetAllIndicatorsResult(assessment_id, checker, check_object); return(Success("操作成功。", list, list.Count)); }
//[HandlerAuthorize] public ActionResult ChangeDimensionDetailStatue(string id, int statue) { DimensionDetailEntity dimensionDetailEntity = new DimensionDetailEntity(); dimensionDetailEntity.statue = statue; dimensionDetailApp.SubmitForm(dimensionDetailEntity, id); return(Success("操作成功。")); }
public void SubmitForm(DimensionDetailEntity dimensionDetailEntity, string keyValue) { if (!string.IsNullOrEmpty(keyValue)) { dimensionDetailEntity.Modify(keyValue); service.Update(dimensionDetailEntity); } else { dimensionDetailEntity.Create(); service.Insert(dimensionDetailEntity); } }
//[HandlerAuthorize] public ActionResult AddDimensionDetail(string detail_name, string formule, string method_id) { //添加公式之前要对公式中的指标进行验证 if (!String.IsNullOrEmpty(formule)) { List <string> indicatorsDefineList = new List <string>(); if (formule.Contains("^") && formule.Contains("$"))//如果有需要整体公式作为一个指标的 { indicatorsDefineList.Add(formule.Substring(formule.IndexOf("^"), formule.IndexOf("$") + 1)); formule = formule.Substring(formule.IndexOf("$") + 1); } if (formule.Contains("[") && formule.Contains("]"))//如果有考核办法需要外部附加数据的 { formule = formule.Replace('[', '|').Replace(']', '|'); } string[] arr = formule.Replace('(', '|').Replace(')', '|').Replace('+', '|').Replace('-', '|').Replace('*', '|').Replace('/', '|').Replace('Σ', '|').Split('|'); for (int j = 0; j < arr.Length; j++) { if (!string.IsNullOrEmpty(arr[j])) { //根据指标查找数据库中是否存在 if (!indicatorsDefineApp.IsExists(arr[j])) { return(Error("不存在指标:" + arr[j])); } } } } if (dimensionDetailApp.IsExists(detail_name)) { return(Error("已存在相同条目。")); } DimensionDetailEntity dimensioDetailnEntity = new DimensionDetailEntity(); dimensioDetailnEntity.detail_name = detail_name; dimensioDetailnEntity.formule = formule; dimensioDetailnEntity.method_id = method_id; dimensioDetailnEntity.statue = 1; dimensionDetailApp.SubmitForm(dimensioDetailnEntity, string.Empty); return(Success("操作成功。")); }
public ActionResult GetPersonalAssessmentTempleteIsNeedSelfCheck(string templete_id) { //根据考核模板获取所有的指标 //根据模板id查找该模板的所有细项指标 List <DimensionDetailEntity> dimensionDetailList = dimensionDetailApp.GetTempleteDimensionDetail(templete_id); List <string> indicatorsDefineList = new List <string>(); bool result = false; for (int i = 0; i < dimensionDetailList.Count; i++) { DimensionDetailEntity entity = dimensionDetailList[i]; string formule = entity.formule; string checkMethodId = entity.method_id; //判断条件公式空 或者考核办法为空 if (formule.Contains("@")) { result = true; break; } } return(Success("操作成功。", result)); }
public ActionResult DownLoadPersonalAssessmentTemplete(string check_object_list, string templete_id, string assessment_name) { //根据模板id查找该模板的所有细项指标 List <DimensionDetailEntity> dimensionDetailList = dimensionDetailApp.GetTempleteDimensionDetail(templete_id); List <string> indicatorsDefineList = new List <string>(); for (int i = 0; i < dimensionDetailList.Count; i++) { DimensionDetailEntity entity = dimensionDetailList[i]; string formule = entity.formule; List <string> collection = AnalysisFormule(ref formule, null); collection.ForEach(item => { indicatorsDefineList.Add(item); }); if (formule.Contains("[") && formule.Contains("]"))//如果有考核办法需要外部附加数据的 { formule = formule.Replace('[', '|').Replace(']', '|'); } string[] arr = formule.Replace('(', '|').Replace(')', '|').Replace('+', '|').Replace('-', '|').Replace('*', '|').Replace('/', '|').Replace('Σ', '|').Split('|'); for (int j = 0; j < arr.Length; j++) { if (!string.IsNullOrEmpty(arr[j]) && !indicatorsDefineList.Contains(arr[j])) { indicatorsDefineList.Add(arr[j]); } } } //指定excel格式 ExcelConfig excelconfig = new ExcelConfig(); excelconfig.Title = Server.UrlDecode(assessment_name); excelconfig.TitleFont = "微软雅黑"; excelconfig.TitlePoint = 15; excelconfig.FileName = Server.UrlDecode(assessment_name) + "考核数据录入模板.xls"; excelconfig.IsAllSizeColumn = true; excelconfig.ColumnEntity = new List <ColumnEntity>(); //写入Excel表头 //个人信息 excelconfig.ColumnEntity.Add(new ColumnEntity() { Column = "F_RealName", ExcelColumn = "员工姓名", Alignment = "center" }); excelconfig.ColumnEntity.Add(new ColumnEntity() { Column = "F_MobilePhone", ExcelColumn = "手机号", Alignment = "center" }); excelconfig.ColumnEntity.Add(new ColumnEntity() { Column = "F_Duty", ExcelColumn = "职位", Alignment = "center" }); excelconfig.ColumnEntity.Add(new ColumnEntity() { Column = "F_DepartmentId", ExcelColumn = "所属组织", Alignment = "center" }); //行数据 DataTable rowData = new DataTable(); rowData.Columns.Add("F_RealName"); rowData.Columns.Add("F_MobilePhone"); rowData.Columns.Add("F_Duty"); rowData.Columns.Add("F_DepartmentId"); //各个细项指标 for (int i = 0; i < indicatorsDefineList.Count; i++) { string indicatorName = indicatorsDefineList[i]; string columnName = "indicator_" + i; string excelColumnName = indicatorName; excelconfig.ColumnEntity.Add(new ColumnEntity() { Column = columnName, ExcelColumn = excelColumnName, Alignment = "center" }); rowData.Columns.Add(columnName); } //转化所有考核对象列表 List <string> checkObjectIdList = KPI.Code.Json.ToObject <List <string> >(check_object_list); DataRow dr = rowData.NewRow(); for (int i = 0; i < checkObjectIdList.Count; i++) { UserEntity userEntity = userApp.GetForm(checkObjectIdList[i]); dr = rowData.NewRow(); dr["F_RealName"] = userEntity.F_RealName; dr["F_MobilePhone"] = userEntity.F_MobilePhone; dr["F_Duty"] = dutyApp.GetForm(userEntity.F_DutyId).F_FullName; dr["F_DepartmentId"] = organizeApp.GetForm(userEntity.F_DepartmentId).F_FullName; rowData.Rows.Add(dr); } ExcelHelper.ExcelDownload(rowData, excelconfig); return(Success("操作成功。", null)); }
public ActionResult DownLoadBranchAssessmentTemplete(string templete_id, string assessment_name) { //根据模板id查找该模板的所有细项指标 List <DimensionDetailEntity> dimensionDetailList = dimensionDetailApp.GetTempleteDimensionDetail(templete_id); List <string> indicatorsDefineList = new List <string>(); for (int i = 0; i < dimensionDetailList.Count; i++) { DimensionDetailEntity entity = dimensionDetailList[i]; string formule = entity.formule; List <string> collection = AnalysisFormule(ref formule, null); collection.ForEach(item => { indicatorsDefineList.Add(item); }); if (formule.Contains("[") && formule.Contains("]"))//如果有考核办法需要外部附加数据的 { formule = formule.Replace('[', '|').Replace(']', '|'); } string[] arr = formule.Replace('(', '|').Replace(')', '|').Replace('+', '|').Replace('-', '|').Replace('*', '|').Replace('/', '|').Replace('Σ', '|').Split('|'); for (int j = 0; j < arr.Length; j++) { if (!string.IsNullOrEmpty(arr[j]) && !indicatorsDefineList.Contains(arr[j])) { indicatorsDefineList.Add(arr[j]); } } } //指定excel格式 ExcelConfig excelconfig = new ExcelConfig(); excelconfig.Title = Server.UrlDecode(assessment_name); excelconfig.TitleFont = "微软雅黑"; excelconfig.TitlePoint = 15; excelconfig.FileName = Server.UrlDecode(assessment_name) + "考核数据录入模板.xls"; excelconfig.IsAllSizeColumn = true; excelconfig.ColumnEntity = new List <ColumnEntity>(); //写入Excel表头 //分公司 excelconfig.ColumnEntity.Add(new ColumnEntity() { Column = "branch_name", ExcelColumn = "分公司名称", Alignment = "center" }); //行数据 DataTable rowData = new DataTable(); rowData.Columns.Add("branch_name"); //各个细项指标 for (int i = 0; i < indicatorsDefineList.Count; i++) { string indicatorName = indicatorsDefineList[i]; string columnName = "indicator_" + i; string excelColumnName = indicatorName; excelconfig.ColumnEntity.Add(new ColumnEntity() { Column = columnName, ExcelColumn = excelColumnName, Alignment = "center" }); rowData.Columns.Add(columnName); } //获取所有子公司 OrganizeEntity org = organizeApp.GetForm(BlocId); List <OrganizeEntity> branchList = organizeApp.GetListByParentIdOrderById(org.F_Id, CompanyId); DataRow dr = rowData.NewRow(); for (int i = 0; i < branchList.Count; i++) { dr = rowData.NewRow(); dr["branch_name"] = branchList[i].F_FullName; rowData.Rows.Add(dr); } ExcelHelper.ExcelDownload(rowData, excelconfig); return(Success("操作成功。", null)); }