protected void rpt_admEmployeeTransportationSetting_list_ItemCommand(object source, RepeaterCommandEventArgs e) { this.lt_akert_msg.Text = ""; Dictionary <string, object> dicObj = new Dictionary <string, object>(); switch (e.CommandName) { case "update": TextBox lb_admEmployeeTransportationSetting_list_trnasId = e.Item.FindControl("lb_admEmployeeTransportationSetting_list_trnasId") as TextBox; dicObj.Add("TransId", lb_admEmployeeTransportationSetting_list_trnasId.Text.Trim()); break; case "delete": dicObj.Add("Deleted", true); break; } CommonViewModel.Result updateRet = this.formOptSvc.updateEmployeeTransportationSetting(long.Parse(e.CommandArgument.ToString()), dicObj); //若不成功 則要顯示錯誤訊息 if (!updateRet.success) { this.lt_akert_msg.Text = updateRet.resultException; } else { this.reload(); } }
/// <summary> /// 發起流程 /// </summary> public CommonViewModel.Result createProcess() { CommonViewModel.Result ret = new CommonViewModel.Result(); try { if (this.procInstance == null) { ret.success = false; ret.resultCode = "301"; ret.resultMessage = "not specific process instance"; return(ret); } ret = this.procInstance.create(); UtilitySvc.writeLog("============ create Process result: ============"); UtilitySvc.writeLog(DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss:fff")); UtilitySvc.writeLog(Newtonsoft.Json.JsonConvert.SerializeObject(ret)); } catch (Exception ex) { ret.success = false; ret.resultCode = "500"; ret.resultException = ex.ToString(); UtilitySvc.writeLog("============ create Process exception: ============"); UtilitySvc.writeLog(DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss:fff")); UtilitySvc.writeLog(ex.ToString()); } return(ret); }
// Insert value to temp table public CommonViewModel.Result addEP_AP_INVOICE_INTERFACE(AccountItemViewModel.EP_AP_INVOICE_INTERFACE invoice) { CommonViewModel.Result ret = new CommonViewModel.Result(); // build sql statement string sql = "INSERT INTO XXX.EP_AP_INVOICE_INTERFACE ({fieldArr}) VALUES ({valueArr})"; List <string> fieldArr = new List <string>(); List <string> valueArr = new List <string>(); List <string> ignoreField = new List <string>() { "CHECK_FLAG", "ERR_MSG", "SUCCESS_DATE", "IMPORT_FLAG", "GL_DATE" }; if (invoice.INVOICE_CURRENCY_CODE == "TWD") { ignoreField.AddRange(new List <string>() { "EXCHANGE_RATE", "EXCHANGE_RATE_TYPE", "EXCHANGE_DATE" }); } Type cl = invoice.GetType(); foreach (var field in cl.GetProperties()) { if (!ignoreField.Contains(field.Name)) { fieldArr.Add(field.Name); valueArr.Add("?"); } } sql = sql.Replace("{fieldArr}", string.Join(", ", fieldArr.ToArray())).Replace("{valueArr}", string.Join(", ", valueArr.ToArray())); using (OleDbConnection cn = new OleDbConnection(this.ERPConnectionString)) { using (OleDbCommand cmd = new OleDbCommand(sql, cn)) { cn.Open(); foreach (var field in cl.GetProperties()) { if (!ignoreField.Contains(field.Name)) { cmd.Parameters.AddWithValue(":" + field.Name, field.GetValue(invoice)); } } ret.success = cmd.ExecuteNonQuery() > 0; ret.resultCode = "200"; }; } return(ret); }
/// <summary> /// 發起表單 /// </summary> public CommonViewModel.Result invokeProcess(string processId, string userId, string orgUnitId, string formOID, string formFieldValue, string subject) { CommonViewModel.Result ret = new CommonViewModel.Result(); try { string processSerialNumber = this.plmSvc.invokeProcess(processId, userId, orgUnitId, formOID, formFieldValue, subject); ret.resultMessage = processSerialNumber; ret.success = !string.IsNullOrEmpty(processSerialNumber); ret.resultCode = "200"; } catch (Exception ex) { ret.success = false; ret.resultCode = "500"; ret.resultException = ex.ToString(); UtilitySvc.writeLog("======== invokeProcess Start ========="); UtilitySvc.writeLog("processId:" + processId); UtilitySvc.writeLog("userId:" + userId); UtilitySvc.writeLog("orgUnitId:" + orgUnitId); UtilitySvc.writeLog("formOID:" + formOID); UtilitySvc.writeLog("formFieldValue:" + formFieldValue); UtilitySvc.writeLog("subject:" + subject); UtilitySvc.writeLog("excption:" + ex.ToString()); UtilitySvc.writeLog("======== invokeProcess End ========="); } return(ret); }
public CommonViewModel.Result isEmployeeExist(string empId) { CommonViewModel.Result ret = new CommonViewModel.Result(); ret.success = this.empDao.getEmpInfoByEmpId(empId) != null; ret.resultCode = "200"; return(ret); }
public CommonViewModel.Result CreatHireEmployeeProcess (HireEmployeeProcessViewModel.CreateHireEmployeeProcessRequestParameter param) { CommonViewModel.Result ret = new CommonViewModel.Result(); IProcessAction hireEmpAct = new HireEmployeeProcess(param); this.procSvc.procInstance = hireEmpAct; ret = this.procSvc.createProcess(); return(ret); }
public CommonViewModel.Result CreateNewEmployeeEvaluationProcess (NewEmployeeEvaluationViewModel.CreateNewEmployeeEvaluationProcessParameter param) { CommonViewModel.Result ret = new CommonViewModel.Result(); IProcessAction NewEmpEvaAct = new NewEmployeeEvaluationProcess(param); this.procSvc.procInstance = NewEmpEvaAct; ret = this.procSvc.createProcess(); return(ret); }
/// <summary> /// 加簽關卡 /// </summary> public CommonViewModel.Result addCustomActivity(string processSerialNumber, string activityID, string refActId, NaNaProcessViewModel.AddActivityParameter param) { CommonViewModel.Result ret = new CommonViewModel.Result(); XmlDocument defXML = this.getAddCustomAcivityXML(param); UtilitySvc.writeLog(defXML.OuterXml); this.plmSvc.addCustomParallelAndSerialActivity(processSerialNumber, activityID, refActId, defXML.OuterXml); return(ret.setResultValue(true, "200", string.Empty, string.Empty)); }
public CommonViewModel.Result updateFormFieldSettion(string id, Dictionary <string, object> dicObj) { CommonViewModel.Result ret = new CommonViewModel.Result(); try { ret.success = this.formOptionSettingDao.updateFormFieldSetting(id, dicObj); ret.resultCode = "200"; } catch (Exception ex) { ret.success = true; ret.resultCode = "500"; ret.resultException = ex.ToString(); } return(ret); }
public bool postHireEmployeeData(string processSerialNumber) { bool ret = false; UtilitySvc.writeLog("=========== 回傳錄用核定表資訊至HR系統 Start ==========="); try { CommonViewModel.Result deliveryRet = this.hireEmpSvc.deliverHireEmployeeInfo(processSerialNumber); ret = deliveryRet.success; UtilitySvc.writeLog(Newtonsoft.Json.JsonConvert.SerializeObject(deliveryRet)); } catch (Exception ex) { ret = false; UtilitySvc.writeLog(Newtonsoft.Json.JsonConvert.SerializeObject(ex.ToString())); } UtilitySvc.writeLog("=========== 回傳錄用核定表資訊至HR系統 End ==========="); //ret = true; return(ret); }
// Call Procedure public CommonViewModel.Result callXXX_EP_AP_INTERFACE_PKG(string formSerialNumber) { CommonViewModel.Result ret = new CommonViewModel.Result(); using (OleDbConnection cn = new OleDbConnection(this.ERPConnectionString)) { using (OleDbCommand cmd = new OleDbCommand()) { cmd.Connection = cn; cn.Open(); cmd.CommandText = "APPS.XXX_EP_AP_INT_PKG.CHECK_DATA"; cmd.CommandType = System.Data.CommandType.StoredProcedure; OleDbParameter P_INV_NUM = new OleDbParameter("@P_INV_NUM", OleDbType.VarChar, 100); OleDbParameter X_RETCODE = new OleDbParameter("@X_RETCODE", OleDbType.VarChar, 100); OleDbParameter X_ERRBUF = new OleDbParameter("@X_ERRBUF", OleDbType.VarChar, 100); P_INV_NUM.Direction = System.Data.ParameterDirection.Input; X_RETCODE.Direction = System.Data.ParameterDirection.Output; X_ERRBUF.Direction = System.Data.ParameterDirection.Output; P_INV_NUM.Value = formSerialNumber; //X_RETCODE.Direction = System.Data.ParameterDirection.ReturnValue; //X_ERRBUF.Direction = System.Data.ParameterDirection.ReturnValue; cmd.Parameters.Add(P_INV_NUM); cmd.Parameters.Add(X_RETCODE); cmd.Parameters.Add(X_ERRBUF); cmd.ExecuteNonQuery(); ret.success = true; ret.resultCode = "200"; ret.resultMessage = string.Format("XXX_EP_AP_INTERFACE_PKG return value, X_RETCODE = {0} , X_ERRBUF = {1} " , X_RETCODE, X_ERRBUF); UtilitySvc.writeLog(DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss")); UtilitySvc.writeLog("X_RETCODE=" + X_RETCODE.Value); UtilitySvc.writeLog("X_ERRBUF=" + X_ERRBUF.Value); }; } return(ret); }
protected void btn_save_Click(object sender, EventArgs e) { Dictionary <string, object> dicObj = new Dictionary <string, object>(); if (string.IsNullOrEmpty(this.ddl_fields.SelectedValue)) { this.lt_msg.Text = UtilitySvc.alertMsg("請選擇欄位"); return; } dicObj.Add("extData1", this.hid_current_select_emp_id_arr.Value); CommonViewModel.Result ret = this.formSvc.updateFormFieldSettion(this.ddl_fields.SelectedValue, dicObj); if (ret.success) { this.lt_msg.Text = ""; this.getSelectedEmpList(); } else { this.lt_msg.Text = ret.resultException; } }
protected void rpt_formClassSettingForInfoSystemApply_list_ItemCommand(object source, RepeaterCommandEventArgs e) { this.lt_akert_msg.Text = ""; Dictionary <string, object> dicObj_ERAC = new Dictionary <string, object>(); Dictionary <string, object> dicObj_ERAP = new Dictionary <string, object>(); TextBox txt_formClassSettingForInfoSystemApply_list_name; HiddenField hidd_rptPersonnelID; HiddenField hidd_rptAPersonnelID; HiddenField hidd_drp_rptdepartmentID; DropDownList drp_rptdepartmentID; switch (e.CommandName) { case "update": //類別名稱 txt_formClassSettingForInfoSystemApply_list_name = e.Item.FindControl("txt_formClassSettingForInfoSystemApply_list_name") as TextBox; dicObj_ERAC.Add("name", txt_formClassSettingForInfoSystemApply_list_name.Text.Trim()); hidd_rptPersonnelID = e.Item.FindControl("hidd_rptPersonnelID") as HiddenField; //處理人員 hidd_rptAPersonnelID = e.Item.FindControl("hidd_rptActivityPersonnelID") as HiddenField; //加簽人員 hidd_drp_rptdepartmentID = e.Item.FindControl("hid_formClassSettingForInfoSystemApply_list_departmentID") as HiddenField; //部門(隱藏) drp_rptdepartmentID = e.Item.FindControl("ddl_formClassSettingForInfoSystemApply_list_departmentID") as DropDownList; //部門 //if (hidd_rptPersonnelID.Value != "") { // this.hid_ddl_departmentID.SelectedValue = hidd_rptPersonnelID.Value; // var rptPersonnelID_departmentID = this.ddl_departmentID.Items.FindByText(this.hid_ddl_departmentID.SelectedItem.Text).Value; // this.hid_ddl_departmentID.SelectedValue = "";//清空 // dicObj_ERAC.Add("personnelID", hidd_rptPersonnelID.Value); // dicObj_ERAC.Add("departmentID", rptPersonnelID_departmentID); //} else { // dicObj_ERAC.Add("personnelID", ""); // dicObj_ERAC.Add("departmentID", drp_rptdepartmentID); //} dicObj_ERAC.Add("personnelID", hidd_rptPersonnelID.Value); dicObj_ERAC.Add("departmentID", drp_rptdepartmentID.SelectedValue == "" ? hidd_drp_rptdepartmentID.Value : drp_rptdepartmentID.SelectedValue); dicObj_ERAC.Add("addActivityPersonnelID", hidd_rptAPersonnelID.Value); //if (hidd_rptAPersonnelID.Value != "") { // dicObj_ERAC.Add("addActivityPersonnelID", hidd_rptAPersonnelID.Value); //} drp_rptdepartmentID = e.Item.FindControl("ddl_formClassSettingForInfoSystemApply_list_departmentID") as DropDownList; break; case "delete": txt_formClassSettingForInfoSystemApply_list_name = e.Item.FindControl("txt_formClassSettingForInfoSystemApply_list_name") as TextBox; int i = this.checkSubClassCount(txt_formClassSettingForInfoSystemApply_list_name.Text.Trim()); if (i > 0) { this.lt_akert_msg.Text = UtilitySvc.alertMsg("請先刪除主類別底下的子類別"); return; } else { dicObj_ERAC.Add("deleted", true); dicObj_ERAP.Add("deleted", true); } break; case "advanced": //主類別與關鍵字查詢 var k = string.IsNullOrEmpty(Request.QueryString["k"]) ? "" : Request.QueryString["k"].ToString(); var c = string.IsNullOrEmpty(Request.QueryString["c"]) ? "" : Request.QueryString["c"].ToString(); //處理人員與加簽人員 this.hid_ViewAdvanced_PersonnelID = e.Item.FindControl("hidd_rptPersonnelID") as HiddenField; this.hid_ViewAdvanced_ActivityPersonnelID = e.Item.FindControl("hidd_rptActivityPersonnelID") as HiddenField; Response.Redirect("FormClassSettingForInfoSystemApply.aspx?pg=" + pg_str + "&id=" + e.CommandArgument.ToString() + "&k=" + k + "&c=" + c + "&pID=" + HttpUtility.UrlEncode(this.hid_ViewAdvanced_PersonnelID.Value) + "&spID=" + HttpUtility.UrlEncode(this.hid_ViewAdvanced_ActivityPersonnelID.Value)); break; } CommonViewModel.Result updateRet_ERAC = this.formOptSvc.updateERACategoryForInf(long.Parse(e.CommandArgument.ToString()), dicObj_ERAC); //ERACategoryForInf CommonViewModel.Result updateRet_ERAP = this.formOptSvc.updateERAPermissionForInf(long.Parse(e.CommandArgument.ToString()), dicObj_ERAP); //ERAPermissionForInf //若不成功 則要顯示錯誤訊息 if (!updateRet_ERAC.success || !updateRet_ERAC.success) { this.lt_akert_msg.Text = updateRet_ERAC.resultException + updateRet_ERAP.resultException; } else { this.reload(); } }
//Insert value to temp table public CommonViewModel.Result addXXX_EP_INT_INV_GV(AccountItemViewModel.XXX_EP_INT_INV_GVP ep_int_inv) { CommonViewModel.Result ret = new CommonViewModel.Result(); // build sql statement string sql = "INSERT INTO XXX.XXX_EP_INT_INV_GV ({fieldArr}) VALUES ({valueArr})"; List <string> fieldArr = new List <string>(); List <string> valueArr = new List <string>(); List <string> ignoreField = new List <string>() { "CLAIM_TAXNO", "ERR_MSG" }; //如果INVOICE TYPE 是空白則用資料庫預設的 if (string.IsNullOrEmpty(ep_int_inv.INVOICE_TYPE)) { ignoreField.Add("INVOICE_TYPE"); } //如果 發票號碼-代號 及 發票號碼-編號 都是空值則不用insert value if (string.IsNullOrEmpty(ep_int_inv.GUI_WORD) && ep_int_inv.GUI_NO == null) { ignoreField.Add("GUI_WORD"); ignoreField.Add("GUI_NO"); } /*else { * ignoreField.Add("OTHER_DESC"); * }*/ //UtilitySvc.writeLog(Newtonsoft.Json.JsonConvert.SerializeObject(ep_int_inv)); Type cl = ep_int_inv.GetType(); foreach (var field in cl.GetProperties()) { if (!ignoreField.Contains(field.Name)) { fieldArr.Add(field.Name); valueArr.Add("?"); } } sql = sql.Replace("{fieldArr}", string.Join(", ", fieldArr.ToArray())).Replace("{valueArr}", string.Join(", ", valueArr.ToArray())); using (OleDbConnection cn = new OleDbConnection(this.ERPConnectionString)) { using (OleDbCommand cmd = new OleDbCommand(sql, cn)) { cn.Open(); foreach (var field in cl.GetProperties()) { if (!ignoreField.Contains(field.Name)) { cmd.Parameters.AddWithValue(":" + field.Name, field.GetValue(ep_int_inv)); } } ret.success = cmd.ExecuteNonQuery() > 0; ret.resultCode = "200"; }; } return(ret); }
//儲存 protected void btn_View_advancedSave_Click(object sender, EventArgs e) { string ckl_id_save = ""; //額外動態欄位 for (int i = 0; i < this.ckl_DisplayOtherField.Items.Count; i++) { if (this.ckl_DisplayOtherField.Items[i].Selected) { ckl_id_save += this.ckl_DisplayOtherField.Items[i].Value; } } //範本下載 for (int i = 0; i < this.chk_TemplateDownload.Items.Count; i++) { if (this.chk_TemplateDownload.Items[i].Selected) { ckl_id_save += this.chk_TemplateDownload.Items[i].Value; } } //如果使用者有更新checkboxlist if (this.lbl_cklValues.Text != ckl_id_save) { FormOptionsSettingViewModel.FormClassSettingForInfoSystemApplyQueryParameter View_advanced_forList = new FormOptionsSettingViewModel.FormClassSettingForInfoSystemApplyQueryParameter { desc = true, orderField = "Id", pageIndex = 1, pageSize = int.MaxValue, id = int.Parse(query_id), cateogryId = int.Parse(query_id) }; //判斷該筆資料是否已存在(目前使用cateogryId當條件) FormOptionsSettingViewModel.ERACategoryDynamicFieldListResult list_ret = this.formOptSvc.getERACategoryDynamicFieldListResult(View_advanced_forList); CommonViewModel.Result updateRet_ERACDF; Dictionary <string, object> dicObj_ERACDF = new Dictionary <string, object>(); //新增ERACategoryDynamicField項目作法 FormOptionsSettingViewModel.ERACategoryDynamicFieldResult add_ret_ERAF; ERACategoryDynamicField ef; if (list_ret.count > 0) { dicObj_ERACDF.Add("deleted", true);//更新原有舊資料deleted為1 //因為有多筆所以使用迴圈 for (int i = 0; i < list_ret.count; i++) { updateRet_ERACDF = this.formOptSvc.updateERACategoryDynamicField(list_ret.list[i].Id, dicObj_ERACDF);//ERACategoryDynamicField } } //將使用者新勾選資料新增 for (int i = 0; i < this.ckl_DisplayOtherField.Items.Count; i++) { if (this.ckl_DisplayOtherField.Items[i].Selected) { ef = new ERACategoryDynamicField() { dynamicFieldSettingId = long.Parse(ckl_DisplayOtherField.Items[i].Value), cateogryId = long.Parse(query_id), deleted = false, dateCreated = DateTime.Now }; add_ret_ERAF = this.formOptSvc.addERACategoryDynamicField(ef); this.lt_akert_msg.Text += (!add_ret_ERAF.success) ? UtilitySvc.alertMsg(add_ret_ERAF.resultException) : ""; } } for (int i = 0; i < this.chk_TemplateDownload.Items.Count; i++) { if (this.chk_TemplateDownload.Items[i].Selected) { ef = new ERACategoryDynamicField() { dynamicFieldSettingId = long.Parse(chk_TemplateDownload.Items[i].Value), cateogryId = long.Parse(query_id), deleted = false, dateCreated = DateTime.Now }; add_ret_ERAF = this.formOptSvc.addERACategoryDynamicField(ef); this.lt_akert_msg.Text += (!add_ret_ERAF.success) ? UtilitySvc.alertMsg(add_ret_ERAF.resultException) : ""; } } } this.lbl_cklValues.Text = "";//清空隱藏判斷欄位 //修改ERACategoryForInf Dictionary <string, object> dicObj_ERAC = new Dictionary <string, object>(); //處理人員 dicObj_ERAC.Add("personnelID", this.hid_ViewAdvanced_PersonnelID.Value); //if (this.hid_ViewAdvanced_PersonnelID.Value != "") { // dicObj_ERAC.Add("personnelID", this.hid_ViewAdvanced_PersonnelID.Value); //} //加簽人員 dicObj_ERAC.Add("addActivityPersonnelID", this.hid_ViewAdvanced_ActivityPersonnelID.Value); //if (this.hid_ViewAdvanced_ActivityPersonnelID.Value != "") { // dicObj_ERAC.Add("addActivityPersonnelID", this.hid_ViewAdvanced_ActivityPersonnelID.Value); //} //部門名稱 dicObj_ERAC.Add("departmentID", this.ddl_ViewAdvanced_DepartmentID.SelectedValue == "" ? this.hid_ViewAdvanced_departmentID.Value : this.ddl_ViewAdvanced_DepartmentID.SelectedValue); //dicObj_ERAC.Add("departmentID", this.hid_ViewAdvanced_departmentID.Value); //if (this.hid_ViewAdvanced_PersonnelID.Value != "") { // dicObj_ERAC.Add("departmentID", this.hid_ViewAdvanced_departmentID.Value); //} else { // dicObj_ERAC.Add("departmentID", ""); //} //if (this.hid_ViewAdvanced_departmentID.Value != "") { // dicObj_ERAC.Add("departmentID", this.hid_ViewAdvanced_departmentID.Value); //} //主類別 var vpID = this.ddl_ViewAdvanced_PartentID.SelectedValue == "-" ? "-1" : this.ddl_ViewAdvanced_PartentID.SelectedValue; dicObj_ERAC.Add("parentID", long.Parse(vpID)); dicObj_ERAC.Add("name", this.txt_ViewAdvanced_ClassName.Text.Trim()); //類別名稱 dicObj_ERAC.Add("dicisionProcessLevel", this.ddl_ViewAdvanced_DicisionProcessLevel.SelectedValue); //核決層級 CommonViewModel.Result updateRet_ERAC = this.formOptSvc.updateERACategoryForInf(long.Parse(query_id), dicObj_ERAC); //ERACategoryForInf //修改ERACategoryForInf Dictionary <string, object> dicObj_ERAP = new Dictionary <string, object>(); bool bIsforAll = this.ddl_ViewAdvanced_IsforAll.SelectedValue == "0" ? false : true; dicObj_ERAP.Add("isforAll", bIsforAll); //是否適用全單位 dicObj_ERAP.Add("departmentID", this.ddl_ViewAdvanced_PermissionDepartmentID.SelectedValue); //權限單位 CommonViewModel.Result updateRet_ERAP = this.formOptSvc.updateERAPermissionForInf(long.Parse(query_id), dicObj_ERAP); //ERAPermissionForInf //若不成功 則要顯示錯誤訊息 if (!updateRet_ERAC.success || !updateRet_ERAP.success) { this.lt_akert_msg.Text += updateRet_ERAC.resultException + updateRet_ERAP.resultException; } else { this.lt_akert_msg.Text = UtilitySvc.alertMsg("儲存成功"); this.AdvancedReload(); this.MultiView.ActiveViewIndex = 1; } }
/// <summary> /// 驗證拋入參數 /// </summary> /// <returns></returns> private CommonViewModel.Result validateCreateProcessParam() { CommonViewModel.Result ret = new CommonViewModel.Result(); //填單人工號是否存在 if (string.IsNullOrEmpty(this.createParam.issuerId)) { return(ret.setResultValue(false, "301", "填單人工號不能為空值", string.Empty)); } if (!string.IsNullOrEmpty(this.createParam.applyerId) && this.createParam.issuerId != this.createParam.applyerId) { return(ret.setResultValue(false, "301", "若申請人有填寫則須與填單人工號相同", string.Empty)); } //評鑑人員是否存在 if (string.IsNullOrEmpty(this.createParam.evaluationEmpId)) { return(ret.setResultValue(false, "301", "評鑑人員工號不能為空值", string.Empty)); } //受評人相關 //是否存在於 HCP this.hcpEvaEmpInfoList = this.newEmpEvaDao.getHCPInfoByEmpId(this.createParam.evaluationEmpId); if (this.hcpEvaEmpInfoList.Count == 0) { return(ret.setResultValue(false, "302", "於HCP中查無受評人資料", string.Empty)); } //是否存在於 EP this.evaEmpInfoList = this.newEmpEvaDao.getEmpInfoByID(this.createParam.evaluationEmpId); if (this.evaEmpInfoList.Count == 0) { return(ret.setResultValue(false, "303", "於EP中查無受評人資料", string.Empty)); } //起單人相關 this.issuerEmpInfoList = this.newEmpEvaDao.getEmpInfoByID(this.createParam.issuerId); if (this.issuerEmpInfoList.Count == 0) { return(ret.setResultValue(false, "304", "於EP中查無填單人資料", string.Empty)); } //流程是否正在進行中 if (this.newEmpEvaDao.isProcessing(this.createParam.evaluationEmpId)) { ret.success = false; ret.resultCode = "306"; ret.resultMessage = "此評核人員正在評鑑中"; return(ret); } //是否是已開過的流程 if (this.newEmpEvaDao.isProcessComplete(this.createParam.evaluationEmpId)) { ret.success = false; ret.resultCode = "307"; ret.resultMessage = "此評核人員已評鑑過"; return(ret); } ret.success = true; ret.resultCode = "200"; return(ret); }
/// <summary> /// 新增一流程 /// </summary> /// <returns></returns> public CommonViewModel.Result create() { CommonViewModel.Result ret = new CommonViewModel.Result(); //validate ret = this.validateCreateProcessParam(); if (!ret.success) { return(ret); } //get xml template NaNaFormViewModel.FormTemplateSimpleResult formOIDRet = this.nanaFormSvc.findFormOIDsOfProcess(this.ProcessID); if (!formOIDRet.success) { ret.resultMessage = "form Instance not found"; ret.resultCode = "301"; return(ret); } string[] formArr = formOIDRet.formOID.Split(','); NaNaFormViewModel.FormTemplateSimpleResult formTemplateRet = this.nanaFormSvc.getFormFieldTemplate(formArr[0]); if (!formTemplateRet.success) { ret.resultMessage = "form Template not found"; ret.resultCode = "301"; return(ret); } //parse xml document XmlDocument doc = new XmlDocument(); doc.LoadXml(formTemplateRet.xmlTemplate); //set post data string FormID = "HR_NewEmployee_1"; //申請日期 UtilitySvc.trySetXmlDocInnerText(ref doc, FormID + "/txtDate", DateTime.Now.ToString("yyyy/MM/dd")); //其他初始值 UtilitySvc.trySetXmlDocInnerText(ref doc, FormID + "/txtCount", "0"); UtilitySvc.trySetXmlDocInnerText(ref doc, FormID + "/txtAdvice", string.Empty); UtilitySvc.trySetXmlDocInnerText(ref doc, FormID + "/hfCheckExtendMonth", "0"); //取得填單人的資料 UtilitySvc.trySetXmlDocInnerText(ref doc, FormID + "/txtUserInfo_Dep1", this.issuerEmpInfoList[1]); UtilitySvc.trySetXmlDocInnerText(ref doc, FormID + "/txtUserInfo_Dep2", this.issuerEmpInfoList[2]); UtilitySvc.trySetXmlDocInnerText(ref doc, FormID + "/txtUserInfo_Id", this.issuerEmpInfoList[3]); UtilitySvc.trySetXmlDocInnerText(ref doc, FormID + "/txtUserInfo_Name", this.issuerEmpInfoList[4]); //取得受評人的EP組織資料(部門名稱、ID...) UtilitySvc.trySetXmlDocInnerText(ref doc, FormID + "/hfUpUpDepName", this.evaEmpInfoList[0]); UtilitySvc.trySetXmlDocInnerText(ref doc, FormID + "/txtDep1", this.evaEmpInfoList[1]); UtilitySvc.trySetXmlDocInnerText(ref doc, FormID + "/txtDep2", this.evaEmpInfoList[2]); UtilitySvc.trySetXmlDocInnerText(ref doc, FormID + "/txtUserID", this.evaEmpInfoList[3]); UtilitySvc.trySetXmlDocInnerText(ref doc, FormID + "/txtUserName", this.evaEmpInfoList[4]); UtilitySvc.trySetXmlDocInnerText(ref doc, FormID + "/txtDep2Id", this.evaEmpInfoList[5]); //取得受評人的HCP資料(到職日、職等...) UtilitySvc.trySetXmlDocInnerText(ref doc, FormID + "/txtTitle", this.hcpEvaEmpInfoList[0]); UtilitySvc.trySetXmlDocInnerText(ref doc, FormID + "/txtTrial", this.hcpEvaEmpInfoList[1]); UtilitySvc.trySetXmlDocInnerText(ref doc, FormID + "/hfLevel", this.hcpEvaEmpInfoList[2]); UtilitySvc.trySetXmlDocInnerText(ref doc, FormID + "/hfMaturityDate1", this.hcpEvaEmpInfoList[3]); UtilitySvc.trySetXmlDocInnerText(ref doc, FormID + "/hfMaturityDate2", this.hcpEvaEmpInfoList[4]); UtilitySvc.trySetXmlDocInnerText(ref doc, FormID + "/hfOkayDate", this.hcpEvaEmpInfoList[5]); UtilitySvc.trySetXmlDocInnerText(ref doc, FormID + "/hfActTrialDate", this.hcpEvaEmpInfoList[6]); //取得填單人的核決層級 string issuerDicisionLevel = this.newEmpEvaDao.getDecisionLevelByEmpId(this.createParam.issuerId); if (string.IsNullOrEmpty(issuerDicisionLevel)) { UtilitySvc.trySetXmlDocInnerText(ref doc, FormID + "/hfApproveLvl", "6000"); } else { UtilitySvc.trySetXmlDocInnerText(ref doc, FormID + "/hfApproveLvl", issuerDicisionLevel); } //取得受評人的核決層級 string evaEmpDicisionLevel = this.newEmpEvaDao.getDecisionLevelByEmpId(this.createParam.issuerId); if (string.IsNullOrEmpty(evaEmpDicisionLevel)) { UtilitySvc.trySetXmlDocInnerText(ref doc, FormID + "/hfApproveLvl1", "6000"); } else { UtilitySvc.trySetXmlDocInnerText(ref doc, FormID + "/hfApproveLvl1", evaEmpDicisionLevel); } //取得部門相關資訊 List <string> evaEmpDetpInfo = this.newEmpEvaDao.getDeptInfoByDeptName(evaEmpInfoList[2]); UtilitySvc.trySetXmlDocInnerText(ref doc, FormID + "/hfManagerName", evaEmpDetpInfo[0]); UtilitySvc.trySetXmlDocInnerText(ref doc, FormID + "/hfManagerId", evaEmpDetpInfo[1]); UtilitySvc.trySetXmlDocInnerText(ref doc, FormID + "/hfManagerNameUp", evaEmpDetpInfo[2]); UtilitySvc.trySetXmlDocInnerText(ref doc, FormID + "/hfManagerIdUp", evaEmpDetpInfo[3]); //設定最後發起流程的資訊 List <string> evaEmpProcessInfo = this.newEmpEvaDao.getLastEvaluationProcessByEmpId(this.createParam.evaluationEmpId); UtilitySvc.trySetXmlDocInnerText(ref doc, FormID + "/rbtAppraisal", "0"); if (evaEmpProcessInfo.Count > 0) { int ddl2rdItem = 0; int.TryParse(evaEmpProcessInfo[0], out ddl2rdItem); if (ddl2rdItem > 0) { UtilitySvc.trySetXmlDocInnerText(ref doc, FormID + "/hfMaturityDate1", evaEmpProcessInfo[1]); UtilitySvc.trySetXmlDocInnerText(ref doc, FormID + "/hfMaturityDate2", evaEmpProcessInfo[2]); UtilitySvc.trySetXmlDocInnerText(ref doc, FormID + "/hfOkayDate", evaEmpProcessInfo[3]); UtilitySvc.trySetXmlDocInnerText(ref doc, FormID + "/rbtAppraisal", "1"); UtilitySvc.trySetXmlDocInnerText(ref doc, FormID + "/txtTrial", evaEmpProcessInfo[4]); } } UtilitySvc.writeLog("===================== xml template:" + DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss") + " ================"); UtilitySvc.writeLog("form xml:"); UtilitySvc.writeLog(doc.OuterXml); ret = this.nanaProcSvc.invokeProcess(this.ProcessID, this.createParam.issuerId, this.issuerEmpInfoList[5], formArr[0], doc.OuterXml, string.Empty); UtilitySvc.writeLog("===================== create process at:" + DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss") + " ================"); UtilitySvc.writeLog("process serial number:"); UtilitySvc.writeLog(ret.resultMessage); return(ret); }