//新增 public bool InsSystemCode(SystemCodeInfo info) { Database db = GetDatabase(); StringBuilder sbCmd = new StringBuilder(); sbCmd.AppendLine(" INSERT INTO SystemCode "); sbCmd.AppendLine(" (Type, Value, Text, DisplayOrder, Value2, REMARKS, Maker, Maker_Time, Checker, Checker_Time) "); sbCmd.AppendLine(" Values "); sbCmd.AppendLine(" (@Type, @Value, @Text, @DisplayOrder, @Value2, @REMARKS, @Maker, @Maker_Time, @Checker, @Checker_Time) "); DbCommand dbCommand = db.GetSqlStringCommand(sbCmd.ToString()); #region 指定參數 db.AddInParameter(dbCommand, "@Type", DbType.String, info.Type); db.AddInParameter(dbCommand, "@Value", DbType.String, info.Value); db.AddInParameter(dbCommand, "@Text", DbType.String, info.Text); db.AddInParameter(dbCommand, "@DisplayOrder", DbType.Int16, info.DisplayOrder); db.AddInParameter(dbCommand, "@Value2", DbType.String, info.Value2); db.AddInParameter(dbCommand, "@REMARKS", DbType.String, info.REMARKS); db.AddInParameter(dbCommand, "@Maker", DbType.String, info.Maker); db.AddInParameter(dbCommand, "@Maker_Time", DbType.DateTime, info.Maker_Time); db.AddInParameter(dbCommand, "@Checker", DbType.String, info.Checker); db.AddInParameter(dbCommand, "@Checker_Time", DbType.DateTime, info.Checker_Time); #endregion return(ExecuteNonQuery(db, dbCommand)); }
//更新 public bool UpdSystemCode(SystemCodeInfo info) { Database db = GetDatabase(); StringBuilder sbCmd = new StringBuilder(); sbCmd.AppendLine(" UPDATE SystemCode "); sbCmd.AppendLine(" SET Text = @Text "); sbCmd.AppendLine(" ,DisplayOrder = @DisplayOrder "); sbCmd.AppendLine(" ,Value2 = @Value2 "); sbCmd.AppendLine(" ,REMARKS = @REMARKS "); sbCmd.AppendLine(" ,Maker = @Maker "); sbCmd.AppendLine(" ,Maker_Time = @Maker_Time "); sbCmd.AppendLine(" ,Checker = @Checker "); sbCmd.AppendLine(" ,Checker_Time = @Checker_Time "); sbCmd.AppendLine(" WHERE Type = @Type "); sbCmd.AppendLine(" AND Value = @Value "); DbCommand dbCommand = db.GetSqlStringCommand(sbCmd.ToString()); #region 指定參數 db.AddInParameter(dbCommand, "@Type", DbType.String, info.Type); db.AddInParameter(dbCommand, "@Value", DbType.String, info.Value); db.AddInParameter(dbCommand, "@Text", DbType.String, info.Text); db.AddInParameter(dbCommand, "@DisplayOrder", DbType.Int16, info.DisplayOrder); db.AddInParameter(dbCommand, "@Value2", DbType.String, info.Value2); db.AddInParameter(dbCommand, "@REMARKS", DbType.String, info.REMARKS); db.AddInParameter(dbCommand, "@Maker", DbType.String, info.Maker); db.AddInParameter(dbCommand, "@Maker_Time", DbType.DateTime, info.Maker_Time); db.AddInParameter(dbCommand, "@Checker", DbType.String, info.Maker); db.AddInParameter(dbCommand, "@Checker_Time", DbType.DateTime, info.Maker_Time); #endregion return(ExecuteNonQuery(db, dbCommand)); }
public bool LoadSystemCode(string iType, string iValue, out SystemCodeInfo iInfo) { bool Result = false; Database db = base.GetDatabase(); StringBuilder sbCmd = new StringBuilder(); sbCmd.AppendLine(" select * from SystemCode with (nolock) "); sbCmd.AppendLine(" where Type = @Type "); sbCmd.AppendLine(" and Value = @Value "); DbCommand dbCommand = db.GetSqlStringCommand(sbCmd.ToString()); #region 指定參數 db.AddInParameter(dbCommand, "@Type", DbType.String, iType); db.AddInParameter(dbCommand, "@Value", DbType.String, iValue); #endregion base.ErrFlag = true; DataTable dtTemp = ExecuteDataSet(db, dbCommand).Tables[0]; if (dtTemp.Rows.Count == 0) { Result = false; iInfo = new SystemCodeInfo(); } else { Result = true; iInfo = new SystemCodeInfo(dtTemp.Rows[0]); } return(Result); }
public LicenseService(GlobalFrontendService globalFrontendService) { Argument.IsNotNull(() => globalFrontendService); _globalFrontendService = globalFrontendService; _globalFrontendService.ApplicationState.SystemCode = SystemCodeInfo.getSystemInfo(); }
public static string getSystemInfo() { SystemCodeInfo systemInfo = new SystemCodeInfo(); string output = JsonConvert.SerializeObject(systemInfo); return(Convert.ToBase64String(Encoding.ASCII.GetBytes(output))); }
//刪除 public bool DelSystemCode(SystemCodeInfo info, DbTransaction iTxn = null) { Database db = GetDatabase(); StringBuilder sbCmd = new StringBuilder(); sbCmd.AppendLine(" delete from SystemCode "); sbCmd.AppendLine(" where Type = @Type "); sbCmd.AppendLine(" and Value = @Value "); DbCommand dbCommand = db.GetSqlStringCommand(sbCmd.ToString()); #region 指定參數 db.AddInParameter(dbCommand, "@Type", DbType.String, info.Type); db.AddInParameter(dbCommand, "@Value", DbType.String, info.Value); #endregion return(ExecuteNonQuery(db, dbCommand, iTxn)); }
protected List <SystemCodeInfo> ConvertModelList(List <XtdmModel> sourceList) { if (sourceList == null) { return(null); } List <SystemCodeInfo> list = new List <SystemCodeInfo>(); foreach (XtdmModel model in sourceList) { //调用AutoMapper映射 SystemCodeInfo sysCodeInfo = AutoMapper.Mapper.Map <XtdmModel, SystemCodeInfo>(model); list.Add(sysCodeInfo); } return(list); }