public object hospLogin(Login_Form_Body form) { if (!string.IsNullOrWhiteSpace(form.hosp_id)) { string sql = "SELECT * FROM " + DB_TABLE_NAME.DB_MC_HOSP_INFO + " WHERE HOSP_KEY LIKE @HOSP_KEY "; Dapper.DynamicParameters dp = new Dapper.DynamicParameters(); dp.Add("HOSP_KEY", form.hosp_id + "%"); List <DB_MC_HOSP_INFO> pList = DBLink.DBA.getSqlDataTable <DB_MC_HOSP_INFO>(sql, dp); if (pList.Count == 0) { this.throwHttpResponseException("查無此事件資料!!"); } return(new { Result = true, token = JwtAuthActionFilterAttribute.EncodeToken(new PAYLOAD() { hosp_id = pList[0].HOSP_KEY, site_id = "", site_desc = "", user_name = this.userinfo.user_name, user_id = this.userinfo.user_id, }) }); } else { this.throwHttpResponseException("請輸入資料!!"); } this.throwHttpResponseException("請輸入資料!!"); return(false); }
public object SiteLogin(Login_Form_Body form) { if (!string.IsNullOrWhiteSpace(form.site_id)) { List <DB_MC_SITE_INFO> pList = _model.getMC_SITE_INFO(form.site_id); if (pList.Count == 0) { this.throwHttpResponseException("查無此事件資料!!"); } return(new { Result = true, token = JwtAuthActionFilterAttribute.EncodeToken(new PAYLOAD() { hosp_id = form.hosp_id, site_id = form.site_id, site_desc = pList[0].SITE_DESC, user_name = this.userinfo.user_name, user_id = this.userinfo.user_id, }) }); } else { this.throwHttpResponseException("請輸入資料!!"); } this.throwHttpResponseException("請輸入資料!!"); return(false); }
public object Login(Login_Form_Body form) { if (!string.IsNullOrWhiteSpace(form.site_id) || !string.IsNullOrWhiteSpace(form.hosp_id)) { if (!string.IsNullOrWhiteSpace(form.site_id)) { if (_model.getMC_SITE_INFO(form.site_id).Count == 0) { if (!string.IsNullOrWhiteSpace(form.LATITUDE) && !string.IsNullOrWhiteSpace(form.LONGITUDE)) { List <DB_MC_SITE_INFO> pList = new List <DB_MC_SITE_INFO>(); pList.Add(new DB_MC_SITE_INFO() { SITE_ID = form.site_id, CREATE_DATE = Function_Library.getDateNowString(DATE_FORMAT.yyyy_MM_dd_HHmmss), CREATE_ID = this.userinfo.user_id, CREATE_NAME = this.userinfo.user_name, MODIFY_DATE = Function_Library.getDateNowString(DATE_FORMAT.yyyy_MM_dd_HHmmss), MODIFY_ID = this.userinfo.user_id, MODIFY_NAME = this.userinfo.user_name, DATASTATUS = "1", LATITUDE = form.LATITUDE, LONGITUDE = form.LONGITUDE, }); this.DBLink.DBA.DBExecInsert <DB_MC_SITE_INFO>(pList); if (this.DBLink.DBA.hasLastError) { this.throwHttpResponseException("程式發生錯誤,請洽資訊人員!"); Com.Mayaminer.LogTool.SaveLogMessage(this.DBLink.DBA.lastError, "Login", this.csName); } } else { this.throwHttpResponseException("查無經緯度資料無法填寫資料!!"); } } } return(new { Result = true, token = JwtAuthActionFilterAttribute.EncodeToken(new PAYLOAD() { hosp_id = form.hosp_id, site_id = form.site_id, user_name = this.userinfo.user_name, user_id = this.userinfo.user_id, }) }); } else { this.throwHttpResponseException("請輸入資料!!"); } this.throwHttpResponseException("請輸入資料!!"); return(false); }