private void LoadRoleCode40() { var isSuccess = false; var msg = ""; var datas = new List <FlowOrganListModel>(); var viewData = new PunchConfirmModel() { CompID = UserInfo.getUserInfo().CompID, EmpID = UserInfo.getUserInfo().UserID, }; isSuccess = PunchLogInqForOrgan.SelectFlowOrganForAll(viewData, out datas, out msg); if (isSuccess && datas != null && datas.Count > 0) { _AllowFlowOrgan = datas; _AllowFlowOrganView = datas; ddlRoleCode40.DataSource = datas.Where(x => x.RoleCode == "40").Select(x => new { x.OrganID, x.OrganName }).Distinct().ToList(); ddlRoleCode40.DataTextField = "OrganName"; ddlRoleCode40.DataValueField = "OrganID"; ddlRoleCode40.DataBind(); ddlRoleCode40.Items.Insert(0, new ListItem("----請選擇----", "")); } else { _AllowFlowOrgan = new List <FlowOrganListModel>(); resetDDL(ddlRoleCode40); resetDDL(ddlRoleCode30); resetDDL(ddlRoleCode20); resetDDL(ddlRoleCode10); } }
/// <summary> /// SelectOrganForAll /// 打卡查詢--單位 /// 取得行政組織下拉選單 /// </summary> /// <param name="model">畫面model</param> /// <param name="datas">回傳資料</param> /// <param name="msg">回傳訊息</param> /// <returns>bool</returns> public static bool SelectOrganForAll(PunchConfirmModel model, out List <OrganListModel> datas, out string msg) { bool result = false; msg = ""; datas = new List <OrganListModel>(); try { using (var conn = new SqlConnection() { ConnectionString = DbHelper.getConnectionStrings(_eHRMSDB_ITRD).ConnectionString }) { StringBuilder sb = new StringBuilder(); SqlCommand.SelectOrganForAllSql(ref sb); try { datas = conn.Query <OrganListModel>(sb.ToString(), model).ToList(); } catch (Exception) { throw; } } result = true; } catch (Exception ex) { msg = ex.Message; } return(result); }
//-------------------------------------------------------------方法 #region "行政線" private void LoadOrgType() { var isSuccess = false; var msg = ""; var datas = new List <OrganListModel>(); var viewData = new PunchConfirmModel() { CompID = UserInfo.getUserInfo().CompID, EmpID = UserInfo.getUserInfo().UserID, }; isSuccess = PunchLogInqForOrgan.SelectOrganForAll(viewData, out datas, out msg); if (isSuccess && datas != null && datas.Count > 0) { _AllowOrgan = datas; ddlOrgType.DataSource = datas.Select(x => new { x.OrgType, x.OrgTypeName }).Distinct().ToList(); ddlOrgType.DataTextField = "OrgTypeName"; ddlOrgType.DataValueField = "OrgType"; ddlOrgType.DataBind(); ddlOrgType.Items.Insert(0, new ListItem("----請選擇----", "")); } else { _AllowOrgan = new List <OrganListModel>(); resetDDL(ddlOrgType); resetDDL(ddlDeptID); resetDDL(ddlOrganID); } }
//-------------------------------------------------------------主要邏輯區 /// <summary> /// 查詢邏輯 /// </summary> private void DoQuery() { var isSuccess = false; var msg = ""; var orgType = StringIIF(ddlOrganization.SelectedValue); var searchType = StringIIF(ddlSearchType.SelectedValue); var datas = new List <PunchConfirmBean>(); var viewData = new PunchConfirmModel(); viewData.CompID = StringIIF(UserInfo.getUserInfo().CompID); viewData.OrganID = StringIIF(GetOrganWhere()); viewData.FlowOrganID = StringIIF(GetFlowOrganWhere()); viewData.PunchSDate = StringIIF(ucStartDate.ucSelectedDate); viewData.PunchEDate = StringIIF(ucEndDate.ucSelectedDate); viewData.PunchSTime = StringIIF(StartTimeH.SelectedValue + ":" + StartTimeM.SelectedValue); viewData.PunchETime = StringIIF(EndTimeH.SelectedValue + ":" + EndTimeM.SelectedValue); viewData.ConfirmPunchFlag = StringIIF(ddlConfirmPunchFlag.SelectedValue); viewData.ConfirmStatus = StringIIF(ddlConfirmStatus.SelectedValue); viewData.Remedy_AbnormalFlag = StringIIF(ddlRemedy_AbnormalFlag.SelectedValue); viewData.EmpID = StringIIF(txtEmpID.Text); viewData.EmpName = StringIIF(txtEmpName.Text); isSuccess = PunchLogInqForOrgan.SelectPunchConfirmForAll(viewData, orgType, searchType, out datas, out msg); if (isSuccess && datas != null && datas.Count > 0) { viewData.SelectGridDataList = PunchLogInqForOrgan.GridDataFormat(datas); //Format Data } gvMain.DataSource = viewData.SelectGridDataList; gvMain.DataBind(); }
//-------------------------------------------------------------主要邏輯區 /// <summary> /// 查詢邏輯 /// </summary> private void DoQuery() { var isSuccess = false; var msg = ""; var searchType = StringIIF(ddlSearchType.SelectedValue); var datas = new List <PunchConfirmBean>(); var viewData = new PunchConfirmModel() { CompID = StringIIF(UserInfo.getUserInfo().CompID), EmpID = StringIIF(UserInfo.getUserInfo().UserID), PunchSDate = StringIIF(ucStartDate.ucSelectedDate), PunchEDate = StringIIF(ucEndDate.ucSelectedDate), ConfirmPunchFlag = StringIIF(ddlConfirmPunchFlag.SelectedValue), ConfirmStatus = StringIIF(ddlConfirmStatus.SelectedValue), Remedy_AbnormalFlag = StringIIF(ddlRemedy_AbnormalFlag.SelectedValue) }; isSuccess = PunchLogInqForPerson.SelectPunchConfirm(viewData, searchType, out datas, out msg); if (isSuccess && datas != null && datas.Count > 0) { viewData.SelectGridDataList = PunchLogInqForPerson.GridDataFormat(datas); //Format Data } gvMain.DataSource = viewData.SelectGridDataList; gvMain.DataBind(); }
/// <summary> /// 打卡查詢-個人 /// 取得Grid資料 /// </summary> /// <param name="model">畫面model</param> /// <param name="datas">回傳資料</param> /// <param name="msg">回傳訊息</param> /// <returns>bool</returns> public static bool SelectPunchConfirmForAll(PunchConfirmModel model, string orgType, string searchType, out List <PunchConfirmBean> datas, out string msg) { bool result = false; msg = ""; datas = new List <PunchConfirmBean>(); try { using (var conn = new SqlConnection() { ConnectionString = DbHelper.getConnectionStrings(_attendantDBName).ConnectionString }) { PunchConfirmBean dataBean = new PunchConfirmBean() { CompID = model.CompID, EmpID = model.EmpID, EmpNameN = model.EmpName, OrganID = model.OrganID, FlowOrganID = model.FlowOrganID, PunchSDate = model.PunchSDate, PunchEDate = model.PunchEDate, PunchSTime = model.PunchSTime, PunchETime = model.PunchETime, ConfirmPunchFlag = model.ConfirmPunchFlag, ConfirmStatus = model.ConfirmStatus, Remedy_AbnormalFlag = model.Remedy_AbnormalFlag }; StringBuilder sb = new StringBuilder(); SqlCommand.SelectPunchConfirmForAllSql(dataBean, orgType, searchType, ref sb); try { datas = conn.Query <PunchConfirmBean>(sb.ToString(), dataBean).ToList(); } catch (Exception) { throw; } if (datas == null || datas.Count == 0) { throw new Exception("查無資料!"); } } result = true; } catch (Exception ex) { msg = ex.Message; } return(result); }
/// <summary> /// 查詢人員資料 /// </summary> private void QueryEmpInfo(string txtEmp) { var isSuccess = false; var msg = ""; var datas = new PunchConfirmBean(); var viewData = new PunchConfirmModel() { CompID = UserInfo.getUserInfo().CompID, EmpID = txtEmp }; isSuccess = PunchLogInqForOrgan.SelectPerson(viewData, out datas, out msg); if (isSuccess && datas != null) { txtEmpID.Text = datas.EmpID; lblEmpID.Text = datas.EmpNameN; } }
/// <summary> /// SelectPerson /// 打卡查詢--單位 /// 取得公司人員資料 /// </summary> /// <param name="model">畫面model</param> /// <param name="datas">回傳資料</param> /// <param name="msg">回傳訊息</param> /// <returns>bool</returns> public static bool SelectPerson(PunchConfirmModel model, out PunchConfirmBean datas, out string msg) { bool result = false; msg = ""; datas = new PunchConfirmBean(); try { using (var conn = new SqlConnection() { ConnectionString = DbHelper.getConnectionStrings(_eHRMSDB_ITRD).ConnectionString }) { PunchConfirmBean dataBean = new PunchConfirmBean() { CompID = model.CompID, EmpID = model.EmpID }; StringBuilder sb = new StringBuilder(); SqlCommand.SelectPersonSql(ref sb); try { datas = conn.Query <PunchConfirmBean>(sb.ToString(), dataBean).FirstOrDefault(); } catch (Exception) { throw; } if (datas == null) { throw new Exception("查無資料!"); } } result = true; } catch (Exception ex) { msg = ex.Message; } return(result); }