public DataTable GetModel(TFunction query) { try { return _tFunctionDao.GetModel(query); } catch (Exception ex) { throw new Exception("TFunctionMgr-->GetModel-->" + ex.Message, ex); } }
public DataTable GetModel(TFunction query) { StringBuilder sql = new StringBuilder(); try { sql.AppendFormat(@"SELECT rowid,functionType,functionGroup,functionName,functionCode,iconCls,remark,kuser,kdate,topValue from t_function WHERE 1=1"); if (query.functionCode != string.Empty) { sql.AppendFormat(" AND functionCode='{0}' ", query.functionCode); } if (query.functionName != string.Empty) { sql.AppendFormat(" AND functionName='{0}'",query.functionName); } return _access.getDataTable(sql.ToString()); } catch (Exception ex) { throw new Exception("TFunctionDao-->GetModel-->" + ex.Message, ex); } }
public HttpResponseBase GetfunctionCodeID() { string json = string.Empty; DataTable store = new DataTable(); int rowid = 0; try { TFunction query = new TFunction(); if (!string.IsNullOrEmpty(Request.Params["functionCode"])) { query.functionCode = Request.Params["functionCode"]; } if (!string.IsNullOrEmpty(Request.Params["functionName"])) { query.functionName = Request.Params["functionName"]; } _tFunctonMgr = new TFunctionMgr(mySqlConnectionString); store = _tFunctonMgr.GetModel(query); if (store != null && store.Rows.Count > 0) { rowid = Convert.ToInt32(store.Rows[0][0]); } IsoDateTimeConverter timeConverter = new IsoDateTimeConverter(); timeConverter.DateTimeFormat = "yyyy-MM-dd HH:mm:ss"; json = "{success:true,rowid:" + rowid + "}"; } catch (Exception ex) { Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage(); logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message); logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name; log.Error(logMessage); json = "{success:false}"; } this.Response.Clear(); this.Response.Write(json); this.Response.End(); return this.Response; }