/// <summary> /// 取得異常時間、提醒訊息 /// </summary> /// <returns></returns> private bool getPunchPara(out ParaModel paraData, out MsgParaModel paraMsgData) { bool result = false; var msg = ""; paraData = new ParaModel(); paraMsgData = new MsgParaModel(); var datas = new PunchParaBean(); var viewData = new PunchParaModel() { CompID = UserInfo.getUserInfo().CompID, }; result = Punch.GetPunchPara(viewData, out datas, out msg); if (result && datas != null) { paraData = Punch.paraFormat(datas.Para); paraMsgData = Punch.paraMsgFormat(datas.MsgPara); } else { throw new Exception("".Equals(msg) ? "查無資料" : msg); } return(result); }
/// <summary> /// 取得DB資料 /// 異常時間、提醒訊息Json字串 /// </summary> /// <param name="model">畫面model</param> /// <param name="datas">回傳資料</param> /// <param name="msg">回傳訊息</param> /// <returns>bool</returns> public static bool GetPunchPara(PunchParaModel model, out PunchParaBean datas, out string msg) { bool result = false; msg = ""; datas = new PunchParaBean(); try { using (var conn = new SqlConnection() { ConnectionString = DbHelper.getConnectionStrings(_attendantDBName).ConnectionString }) { PunchParaBean dataBean = new PunchParaBean() { CompID = model.CompID, }; StringBuilder sb = new StringBuilder(); SqlCommand.SelectPunchParaSql(ref sb); try { datas = conn.Query <PunchParaBean>(sb.ToString(), dataBean).FirstOrDefault(); } catch (Exception) { throw; } if (datas == null) { throw new Exception("查無資料!"); } } result = true; } catch (Exception ex) { msg = ex.Message; } return(result); }