public string GetFormResult(Fast.EB.WKF.ExternalUtility.ApplyTask applyTask) { XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(applyTask.CurrentDocXML); CTB_HR_PERTUCO l_pert = new CTB_HR_PERTUCO(); //訂單需要同意才進入 if (applyTask.FormResult == Fast.EB.WKF.Engine.ApplyResult.Adopt) { string l_str考核種類 = ""; DataRow l_row = l_pert.NewRow(); l_row["PERTNO"] = Guid.NewGuid().ToString(); l_row["GUID"] = xmlDoc.SelectSingleNode("/Form/FormFieldValue/FieldItem[@fieldId='GUID']").Attributes["fieldValue"].Value; string l_strTaskid = applyTask.TaskId; CTB_HR_ASSESS_ASSISTAN_MANAGERUCO l_MANAGER = new CTB_HR_ASSESS_ASSISTAN_MANAGERUCO(); DataTable dt = l_MANAGER.getlast(l_strTaskid); l_row["SMID"] = dt.Rows[0]["SMID"].ToString(); string l_strSMID = dt.Rows[0]["SMID"].ToString(); l_row["RANK"] = dt.Rows[0]["RANK"].ToString(); l_row["RANK_Y"] = dt.Rows[0]["RANK_Y"].ToString(); int l_int月份 = DateTime.Today.Month; if (l_int月份 > 9 || l_int月份 < 3) { l_row["ASSESS_TYPE"] = "年終"; l_str考核種類 = "年終"; } else if (2 < l_int月份 && l_int月份 < 7) { l_row["ASSESS_TYPE"] = "端午"; l_str考核種類 = "端午"; } else if (6 < l_int月份 && l_int月份 < 10) { l_row["ASSESS_TYPE"] = "中秋"; l_str考核種類 = "中秋"; } l_row["Form_TYPE"] = "副理級以上"; l_row["EDIT_DATE"] = DateTime.Today.ToString("yyyy/MM/dd"); l_row["YEAR"] = DateTime.Today.Year.ToString(); l_row["TASK_ID"] = applyTask.TaskId; string l_年度 = DateTime.Today.Year.ToString(); DataTable l_dt = l_pert.check(l_strSMID, l_str考核種類, l_年度); if (l_dt != null && l_dt.Rows.Count > 0) { return(""); } else { l_pert.Insert(l_row); } } //訂單否決刪除單子 else { //刪除明細檔 CTB_HR_ASSESS_ASSISTAN_MANAGERUCO l_MANAGER = new CTB_HR_ASSESS_ASSISTAN_MANAGERUCO(); l_MANAGER.DeletebyReject(applyTask.TaskId); } return(""); }
public string GetFormResult(Fast.EB.WKF.ExternalUtility.ApplyTask applyTask) { XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(applyTask.CurrentDocXML); CTB_HR_ASSESS_ASSISTAN_MANAGERUCO l_MANAGER = new CTB_HR_ASSESS_ASSISTAN_MANAGERUCO(); //簽核中需要同意才進入 if (applyTask.SignResult == Fast.EB.WKF.Engine.SignResult.Approve) { DataRow row = l_MANAGER.NewRow(); row["GUID"] = xmlDoc.SelectSingleNode("/Form/FormFieldValue/FieldItem[@fieldId='GUID']").Attributes["fieldValue"].Value; //自訂欄位的寫法 row["SMID"] = xmlDoc.SelectSingleNode("/Form/FormFieldValue/FieldItem[@fieldId='Assiatan_Manager']/FieldValue").Attributes["SMID"].Value; row["KPI_Performance"] = xmlDoc.SelectSingleNode("/Form/FormFieldValue/FieldItem[@fieldId='Assiatan_Manager']/FieldValue").Attributes["KPI_Performance"].Value; row["KPI_Ploy"] = xmlDoc.SelectSingleNode("/Form/FormFieldValue/FieldItem[@fieldId='Assiatan_Manager']/FieldValue").Attributes["KPI_Ploy"].Value; row["KPI_Improve"] = xmlDoc.SelectSingleNode("/Form/FormFieldValue/FieldItem[@fieldId='Assiatan_Manager']/FieldValue").Attributes["KPI_Improve"].Value; row["Cooperation"] = xmlDoc.SelectSingleNode("/Form/FormFieldValue/FieldItem[@fieldId='Assiatan_Manager']/FieldValue").Attributes["Cooperation"].Value; row["Subordinate"] = xmlDoc.SelectSingleNode("/Form/FormFieldValue/FieldItem[@fieldId='Assiatan_Manager']/FieldValue").Attributes["Subordinate"].Value; row["Risk"] = xmlDoc.SelectSingleNode("/Form/FormFieldValue/FieldItem[@fieldId='Assiatan_Manager']/FieldValue").Attributes["Risk"].Value; row["Communication"] = xmlDoc.SelectSingleNode("/Form/FormFieldValue/FieldItem[@fieldId='Assiatan_Manager']/FieldValue").Attributes["Communication"].Value; row["Attitude"] = xmlDoc.SelectSingleNode("/Form/FormFieldValue/FieldItem[@fieldId='Assiatan_Manager']/FieldValue").Attributes["Attitude"].Value; row["Total"] = xmlDoc.SelectSingleNode("/Form/FormFieldValue/FieldItem[@fieldId='Assiatan_Manager']/FieldValue").Attributes["Total"].Value; row["RANK"] = xmlDoc.SelectSingleNode("/Form/FormFieldValue/FieldItem[@fieldId='Assiatan_Manager']/FieldValue").Attributes["RANK"].Value; row["SIGNER"] = Current.Name; row["EDIT_DATE"] = DateTime.Today.ToString("yyyy/MM/dd"); row["TASK_ID"] = applyTask.TaskId; row["SITE_CODE"] = applyTask.SiteCode; int l_int月份 = DateTime.Today.Month; //非年終不用進去 if (l_int月份 > 9 || l_int月份 < 3) { row["KPI_Performance_Y"] = xmlDoc.SelectSingleNode("/Form/FormFieldValue/FieldItem[@fieldId='Assiatan_Manager']/FieldValue").Attributes["KPI_Performance_Y"].Value; row["KPI_Ploy_Y"] = xmlDoc.SelectSingleNode("/Form/FormFieldValue/FieldItem[@fieldId='Assiatan_Manager']/FieldValue").Attributes["KPI_Ploy_Y"].Value; row["KPI_Improve_Y"] = xmlDoc.SelectSingleNode("/Form/FormFieldValue/FieldItem[@fieldId='Assiatan_Manager']/FieldValue").Attributes["KPI_Improve_Y"].Value; row["Cooperation_Y"] = xmlDoc.SelectSingleNode("/Form/FormFieldValue/FieldItem[@fieldId='Assiatan_Manager']/FieldValue").Attributes["Cooperation_Y"].Value; row["Subordinate_Y"] = xmlDoc.SelectSingleNode("/Form/FormFieldValue/FieldItem[@fieldId='Assiatan_Manager']/FieldValue").Attributes["Subordinate_Y"].Value; row["Risk_Y"] = xmlDoc.SelectSingleNode("/Form/FormFieldValue/FieldItem[@fieldId='Assiatan_Manager']/FieldValue").Attributes["Risk_Y"].Value; row["Communication_Y"] = xmlDoc.SelectSingleNode("/Form/FormFieldValue/FieldItem[@fieldId='Assiatan_Manager']/FieldValue").Attributes["Communication_Y"].Value; row["Attitude_Y"] = xmlDoc.SelectSingleNode("/Form/FormFieldValue/FieldItem[@fieldId='Assiatan_Manager']/FieldValue").Attributes["Attitude_Y"].Value; row["Staff_Car"] = xmlDoc.SelectSingleNode("/Form/FormFieldValue/FieldItem[@fieldId='Assiatan_Manager']/FieldValue").Attributes["Staff_Car"].Value; row["Total_Y"] = xmlDoc.SelectSingleNode("/Form/FormFieldValue/FieldItem[@fieldId='Assiatan_Manager']/FieldValue").Attributes["Total_Y"].Value; row["RANK_Y"] = xmlDoc.SelectSingleNode("/Form/FormFieldValue/FieldItem[@fieldId='Assiatan_Manager']/FieldValue").Attributes["RANK_Y"].Value; row["ASSESS_TYPE"] = "年終"; } else if (2 < l_int月份 && l_int月份 < 7) { row["ASSESS_TYPE"] = "端午"; } else if (6 < l_int月份 && l_int月份 < 10) { row["ASSESS_TYPE"] = "中秋"; } DataTable l_dt = l_MANAGER.getDatsByID(applyTask.TaskId, applyTask.SiteCode); if (l_dt != null && l_dt.Rows.Count > 0) { l_MANAGER.UpdateByTASKID(row); } else { l_MANAGER.Insert(row); } //xmlDoc.SelectSingleNode("/Form/FormFieldValue/FieldItem[@fieldId='Assiatan_Manager']").InnerXml = ""; //AssessCompetentPO po = new AssessCompetentPO(); //po.UpdateCurrentDoc(applyTask.TaskId, xmlDoc.OuterXml); } return(""); }