/// <summary> /// 取得呼叫WS的BOFind後回傳的資料 /// </summary> /// <param name="progId"></param> /// <param name="selectFields"></param> /// <returns></returns> private DataTable getModifyType(string progId, string selectFields) { DataTable dtSource = new DataTable(); Exception ex = null; dtSource = service.BOFind(progId, selectFields, out ex); if (ex != null) { DebugLog.Log(DebugLog.LogLevel.Error, string.Format(@"UC_KYTI_SCSHR_EMPCHANGE.getModifyType.service.Error:{0}", ex.Message)); } return(dtSource); }
/// <summary> /// 取得離職原因 /// </summary> /// <param name="progId"></param> /// <param name="selectFields"></param> /// <returns></returns> private DataTable getRESIGNVEType(string progId, string selectFields) { DataTable dtSource = new DataTable(); Exception ex = null; dtSource = service.BOFind(progId, selectFields, out ex); if (ex != null) { DebugLog.Log(DebugLog.LogLevel.Error, string.Format(@"UC_KYTI_SCSHR_LEVWITHOUTPAY.getRESIGNVEType.service.Error:{0}", ex.Message)); } DataTable dtReturn = new DataTable(); foreach (DataColumn dc in dtSource.Columns) { dtReturn.Columns.Add(new DataColumn(dc.ColumnName, dc.DataType)); } foreach (DataRow dr in dtSource.Rows) { if (dr["FLAG"].ToString() == "2") { DataRow ndr = dtReturn.NewRow(); foreach (DataColumn dc in dtSource.Columns) { ndr[dc.ColumnName] = dr[dc.ColumnName]; } dtReturn.Rows.Add(ndr); } } return(dtReturn); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { base.AddSiteMapNode("WSTEST"); SCSServicesProxy service = new SCSServicesProxy(SCSHRConfiguration.SCSServicesURL, SCSHRConfiguration.SCSServicesCompanyId, SCSHRConfiguration.SCSServicesAccount, SCSHRConfiguration.SCSServicesPassword); Exception ex; DataTable tblResult = service.BOFind("HUM0010300", "TMP_PDEPARTID,TMP_PDEPARTNAME,PDEPARTID,MANAGERID,TMP_MANAGERID,TMP_MANAGERNAME", out ex); if (ex == null) { gvTest.DataSource = tblResult; gvTest.DataBind(); } tblResult = service.BOFind("HUM0020100", "TMP_VTITLEDEPARTID,TMP_DEPARTID,TMP_DEPARTNAME,JOBSTATUS,StartDate,SEX,PSNEMAIL,COMMTEL,TMP_DutyNAME,SeparationDate,IDNO,BIRTHDATE", out ex); if (ex == null) { gvTest2.DataSource = tblResult; gvTest2.DataBind(); } service.Logout(); } }
private DataTable getFOPUNCHType(string progId, string selectFields) { DataTable dtScource = new DataTable(); Exception ex = null; dtScource = service.BOFind(progId, selectFields, out ex); if (ex != null) { DebugLog.Log(DebugLog.LogLevel.Error, string.Format(@"UC_KYTI_SCSHR_FOPUNCH.getLEAVEType.service.Error:{0}", ex.Message)); } DataRow ndr = dtScource.NewRow(); ndr["SYS_NAME"] = "===請選擇==="; ndr["SYS_VIEWID"] = ""; ndr["SYS_ENGNAME"] = ""; ndr["SYS_ID"] = ""; dtScource.Rows.InsertAt(ndr, 0); return(dtScource); }
/// <summary> /// 顯示時欄位初始值 /// </summary> /// <param name="versionField">欄位集合</param> public override void SetField(Ede.Uof.WKF.Design.VersionField versionField) { FieldOptional fieldOptional = versionField as FieldOptional; if (fieldOptional != null) { #region ==============屬性說明==============『』 //fieldOptional.IsRequiredField『是否為必填欄位,如果是必填(True),如果不是必填(False)』 //fieldOptional.DisplayOnly『是否為純顯示,如果是(True),如果不是(False),一般在觀看表單及列印表單時,屬性為True』 //fieldOptional.HasAuthority『是否有填寫權限,如果有填寫權限(True),如果沒有填寫權限(False)』 //fieldOptional.FieldValue『如果已有人填寫過欄位,則此屬性為記錄其內容』 //fieldOptional.FieldDefault『如果欄位有預設值,則此屬性為記錄其內容』 //fieldOptional.FieldModify『是否允許修改,如果允許(fieldOptional.FieldModify=FieldModifyType.yes),如果不允許(fieldOptional.FieldModify=FieldModifyType.no)』 //fieldOptional.Modifier『如果欄位有被修改過,則Modifier的內容為EBUser,如果沒有被修改過,則會等於Null』 #endregion //#region ==============如果沒有填寫權限時,就要顯示有填寫權限人員的清單,只要把以下註解拿掉即可============== //if (!fieldOptional.HasAuthority『是否有填寫權限) //{ // string strItemName = String.Empty; // Ede.Uof.EIP.Organization.Util.UserSet userSet = ((FieldOptional)versionField).FieldControlData; // for (int i = 0; i < userSet.Items.Count; i++) // { // if (i == userSet.Items.Count - 1) // { // strItemName += userSet.Items[i].Name; // } // else // { // strItemName += userSet.Items[i].Name + "、"; // } // } // lblHasNoAuthority.ToolTip = lblAuthorityMsg.Text + ":" + strItemName; //} //#endregion #region ==============如果有修改,要顯示修改者資訊============== if (fieldOptional.Modifier != null) { lblModifier.Visible = true; lblModifier.ForeColor = System.Drawing.Color.Red; lblModifier.Text = String.Format("( {0}:{1} )", this.lblMsgSigner.Text, fieldOptional.Modifier.Name); } #endregion this.FormFieldMode = fieldOptional.FieldMode; // 記住本次 FieldMode // 初始化kytcontroller kytController = new KYTController(UpdatePanel1); // 取得資料庫連通字串 ConnectionString = new DatabaseHelper().Command.Connection.ConnectionString; service = ConstructorCommonSettings.setSCSSServiceProxDefault(); if (!Page.IsPostBack) // 網頁首次載入 { if (!string.IsNullOrEmpty(fieldOptional.FieldValue)) { kytController.FieldValue = fieldOptional.FieldValue; } kytController.SetAllViewType(KYTViewType.ReadOnly); // 設定所有KYT物件唯讀 btnCheck.Visible = false; // 隱藏檢查 ConstructorCommonSettings.setCommonSettings(); // 設定DebugLog初始值 switch (fieldOptional.FieldMode) // 判斷FieldMode { case FieldMode.Applicant: // 起單或退回申請者 case FieldMode.ReturnApplicant: hidAPIResult.Value = ""; // 清掉先前的旗標 kytController.SetAllViewType(KYTViewType.Input); // 設定所有KYT物件可輸入 ktxtAPPLICANTDEPT.ReadOnly = true; // 部門唯讀 ktxtAPPLICANTDATE.ReadOnly = true; // 申請日期唯讀 ktxtAPPLICANT.ReadOnly = true; // 申請人唯讀 btnCheck.Visible = true; // 顯示檢查 if (this.FormFieldMode == FieldMode.Applicant) // 剛起單 { //EBUser user = new UserUCO().GetEBUser(this.ApplicantGuid); KYT_EBUser KUser = new KYT_UserPO().GetUserDetailByUserGuid(this.ApplicantGuid); // 人員 ktxtAPPLICANTDEPT.Text = KUser.GroupName[0]; // 部門名稱 hidAPPLICANTDEPT.Value = KUser.GroupID[0]; // 部門代碼 hidAPPLICANTDEPT_GROUPCODE.Value = KUser.GroupCode[0]; if (string.IsNullOrEmpty(hidAPPLICANTDEPT_GROUPCODE.Value)) // 如果UOF沒有維護GROUP_CODE,就呼叫WS取得 { List <SCSHR.net.azurewebsites.scsservices_beta.FilterItem> lsItems = new List <SCSHR.net.azurewebsites.scsservices_beta.FilterItem>(); SCSHR.net.azurewebsites.scsservices_beta.FilterItem item = new SCSHR.net.azurewebsites.scsservices_beta.FilterItem(); item.FieldName = "SYS_VIEWID"; item.FilterValue = KUser.Account; lsItems.Add(item); //filters.SetValue(item, 0); Exception ex = null; DataTable dtEmployee = service.BOFind("HUM0020100", "*", lsItems.ToArray(), out ex); if (dtEmployee.Rows.Count > 0) { if (dtEmployee.Columns.Contains("TMP_DEPARTID")) { hidAPPLICANTDEPT_GROUPCODE.Value = dtEmployee.Rows[0]["TMP_DEPARTID"].ToString(); } } } ktxtAPPLICANTDATE.Text = DateTime.Now.ToString("yyyy/MM/dd"); // 申請日期 ktxtAPPLICANT.Text = string.Format(@"{0} ({1})", KUser.Name, KUser.Account); // 申請人姓名 hidAPPLICANT.Value = KUser.UserGUID; // 申請人代碼 hidAPPLICANTAccount.Value = KUser.Account; // 申請人帳號 string[] sAccount = hidAPPLICANTAccount.Value.Split('\\'); hidAPPLICANTAccount.Value = sAccount[sAccount.Length - 1]; hidAPPLICANTGuid.Value = KUser.UserGUID; // 申請人Guid kddlFOPUNCH_REASON.DataSource = getFOPUNCHType(SCSHRConfiguration.SCSSPunchTypeProgID, "SYS_ViewID,SYS_Name,SYS_EngName"); kddlFOPUNCH_REASON.DataValueField = "SYS_VIEWID"; kddlFOPUNCH_REASON.DataTextField = "SYS_NAME"; kddlFOPUNCH_REASON.DataBind(); } // 設定Picker是否能輸入 kdtpFOPUNCH_TIME.TextBoxReadOnly = SCSHRConfiguration.IS_PICKER_READONLY.ToUpper() == "Y"; kdtpFOPUNCH_TIME_OFF.TextBoxReadOnly = SCSHRConfiguration.IS_PICKER_READONLY.ToUpper() == "Y"; #region 綁定上班補卡狀態 if (!string.IsNullOrEmpty(SCSHRConfiguration.FOPUNCH_TYPE)) { DataTable dtSource = new DataTable(); dtSource.Columns.Add(new DataColumn("VALUE", typeof(string))); dtSource.Columns.Add(new DataColumn("TEXT", typeof(string))); DataRow ndr = dtSource.NewRow(); ndr["TEXT"] = "====請選擇===="; ndr["VALUE"] = ""; dtSource.Rows.Add(ndr); foreach (string _type in SCSHRConfiguration.FOPUNCH_TYPE.Split(",")) { string typeName = ""; switch (_type) { case "2": typeName = "刷卡上班"; break; case "0": typeName = "加班上班(前)"; break; case "4": typeName = "加班上班(後)"; break; } //kddlFOPUNCHTYPE.Items.Add(new ListItem(typeName, _type)); DataRow _ndr = dtSource.NewRow(); _ndr["TEXT"] = typeName; _ndr["VALUE"] = _type; dtSource.Rows.Add(_ndr); } kddlFOPUNCHTYPE.DataSource = dtSource; kddlFOPUNCHTYPE.DataTextField = "TEXT"; kddlFOPUNCHTYPE.DataValueField = "VALUE"; kddlFOPUNCHTYPE.DataBind(); kddlFOPUNCHTYPE.BindDataOnly = true; } #endregion 綁定上班補卡狀態 #region 綁定下班補卡狀態 if (!string.IsNullOrEmpty(SCSHRConfiguration.FOPUNCH_OFF_TYPE)) { DataTable dtSource = new DataTable(); dtSource.Columns.Add(new DataColumn("VALUE", typeof(string))); dtSource.Columns.Add(new DataColumn("TEXT", typeof(string))); DataRow ndr = dtSource.NewRow(); ndr["TEXT"] = "====請選擇===="; ndr["VALUE"] = ""; dtSource.Rows.Add(ndr); foreach (string _type in SCSHRConfiguration.FOPUNCH_OFF_TYPE.Split(",")) { string typeName = ""; switch (_type) { case "3": typeName = "刷卡下班"; break; case "1": typeName = "加班下班(前)"; break; case "5": typeName = "加班下班(後)"; break; } //kddlFOPUNCHTYPE_OFF.Items.Add(new ListItem(typeName, _type)); DataRow _ndr = dtSource.NewRow(); _ndr["TEXT"] = typeName; _ndr["VALUE"] = _type; dtSource.Rows.Add(_ndr); } kddlFOPUNCHTYPE_OFF.DataSource = dtSource; kddlFOPUNCHTYPE_OFF.DataTextField = "TEXT"; kddlFOPUNCHTYPE_OFF.DataValueField = "VALUE"; kddlFOPUNCHTYPE_OFF.DataBind(); kddlFOPUNCHTYPE_OFF.BindDataOnly = true; } #endregion 綁定下班補卡狀態 break; case FieldMode.Design: // 表單設計階段 break; case FieldMode.Signin: // 表單簽核 if (taskObj != null && taskObj.CurrentSite != null && taskObj.CurrentSite.SiteCode == "HR") { kddlFOPUNCHTYPE.ViewType = KYTViewType.Input; // 補上班卡狀態 kddlFOPUNCHTYPE_OFF.ViewType = KYTViewType.Input; // 補下班卡狀態 } break; case FieldMode.Print: // 表單列印 case FieldMode.Verify: // Verify case FieldMode.View: // 表單觀看 //kddlFOPUNCHTYPE_SelectedIndexChanged(kddlFOPUNCHTYPE, null); //kddlFOPUNCHTYPE_OFF_SelectedIndexChanged(kddlFOPUNCHTYPE_OFF, null); break; } ktxtSignResult.ViewType = KYTViewType.ReadOnly; } else // 如果網頁POSTBACK { JGlobalLibs.WebUtils.RequestHiddenFields(UpdatePanel1); // 取回HiddenField的值 switch (fieldOptional.FieldMode) // 判斷FieldMode { case FieldMode.Applicant: // 起單或退回申請者 case FieldMode.ReturnApplicant: // 設定Picker是否能輸入 kdtpFOPUNCH_TIME.ViewType = KYTViewType.Input; kdtpFOPUNCH_TIME_OFF.ViewType = KYTViewType.Input; kdtpFOPUNCH_TIME.TextBoxReadOnly = SCSHRConfiguration.IS_PICKER_READONLY.ToUpper() == "Y"; kdtpFOPUNCH_TIME_OFF.TextBoxReadOnly = SCSHRConfiguration.IS_PICKER_READONLY.ToUpper() == "Y"; break; } } } }
/// <summary> /// 尋找任務 /// </summary> /// <returns></returns> private DataTable RefreshgvMain() { // 呼叫 飛騰WS取得班別 SCSServicesProxy service = ConstructorCommonSettings.setSCSSServiceProxDefault(); DataTable dtScource = new DataTable(); // call飛騰帶回來的資料 DataTable dtNew = new DataTable(); // 查詢班別 Exception ex = null; dtScource = service.BOFind("ATT0010500", "*", out ex); if (ex != null) { DebugLog.Log(DebugLog.LogLevel.Error, string.Format(@"UC_KYTI_SCSHR_TRAVEL.getBOFind.service.Error:{0}", ex.Message)); return(dtNew); } dtScource.Columns.Add(new DataColumn("HTYPE", typeof(string))); // 休息日 DataRow ndr = dtScource.NewRow(); ndr["SYS_VIEWID"] = "H"; // 班別代號 ndr["HTYPE"] = "1"; // HTYPE ndr["SYS_NAME"] = "休息日"; // 班別名稱 dtScource.Rows.Add(ndr); // 例假日 ndr = dtScource.NewRow(); ndr["SYS_VIEWID"] = "H2"; // 班別代號 ndr["HTYPE"] = "2"; // HTYPE ndr["SYS_NAME"] = "例假日"; // 班別名稱 dtScource.Rows.Add(ndr); // 變形休息日 ndr = dtScource.NewRow(); ndr["SYS_VIEWID"] = "H3"; // 班別代號 ndr["HTYPE"] = "3"; // HTYPE ndr["SYS_NAME"] = "變形休息日"; // 班別名稱 dtScource.Rows.Add(ndr); // 國定假日 ndr = dtScource.NewRow(); ndr["SYS_VIEWID"] = "H4"; // 班別代號 ndr["HTYPE"] = "4"; // HTYPE ndr["SYS_NAME"] = "國定假日"; // 班別名稱 dtScource.Rows.Add(ndr); // 主表有資料 → 主表Select(filter)查詢 → 給DataRow arrRow → 跑arrRow → 新增DataRow ndrr → 跑主表的Columns // → if(新的dtNew是否有存在主表的columnName) → 不存在(新增主表的ColumnName) → 存在(主表的ColumnName新的ndrr) // → Column塞回新的dtNew → dr塞回DataRow → 查詢的結果ViewSatate、return。 // 無輸入查詢也會查,但就是sql條件為空會查全部 // (1).call飛騰WS取得資料 // (2).存放到dtSource // (3).建立ndr存放帶回來的資料(SYS_VIEWID、SYS_NAME、STARTTIME、ENDTIME) // (4).判斷是否有資料 // (5).在從dtSource Select語法。(第一次進入跳窗則為空,會查所有資料) // (6). if (dtScource.Rows.Count > 0) // 是否有資料 { // 查詢班別代號、班別名稱、上班時間、下班時間 string filter = ""; filter += "SYS_VIEWID LIKE '%" + txtSearch.Text + "%' OR SYS_NAME LIKE '%" + txtSearch.Text + "%' OR STARTTIME LIKE '%" + txtSearch.Text + "%' OR ENDTIME LIKE '%" + txtSearch.Text + "%'"; DataRow[] arrRow = dtScource.Select(filter, "HTYPE ASC"); foreach (DataRow dr in arrRow) { DataRow ndr_New = dtNew.NewRow(); foreach (DataColumn dc in dtScource.Columns) { if (!dtNew.Columns.Contains(dc.ColumnName)) { dtNew.Columns.Add(new DataColumn(dc.ColumnName, dc.DataType)); } if (dc.ColumnName == "HTYPE" && dr[dc.ColumnName].ToString() == "") { ndr_New[dc.ColumnName] = "0"; } else { ndr_New[dc.ColumnName] = dr[dc.ColumnName]; } } dtNew.Rows.Add(ndr_New); } } ViewState[gvMain.ID] = dtNew; return(dtNew); }