예제 #1
0
        /// <summary>
        /// Appends criteria to existing file contents
        /// </summary>
        /// <param name="existingContents"></param>
        /// <param name="transactionParams"></param>
        /// <param name="includeReferenceNumber"></param>
        /// <returns></returns>
        public string Append(string existingContents, IEnumerable <BaseParams> transactionParams, bool includeReferenceNumber)
        {
            ParamsList list = DeserializeFromString(existingContents);

            list.AddRange(transactionParams);
            return(SerializeToString(list, includeReferenceNumber));
        }
예제 #2
0
        public override string Update(TInfo info)
        {
            var param = GetParameter(info);

            #region 如果主键有值,则取消修改主键的SQL

            var indexHaveValue = Map.GetModelInfo().Key != null && Map.GetModelInfo().Key.GetValue(info, null) != null;
            if (indexHaveValue)
            {
                param.RemoveAll(o => o.ParameterName.IsEquals(dbProvider.ParamsPrefix + Map.IndexName));
            }

            #endregion

            if (param.Count == 0)
            {
                return(string.Empty);
            }

            // 要更新的表
            var sql = new StringBuilder();
            sql.AppendFormat("UPDATE {0} SET ", TableName);

            // 要更新的字段
            foreach (var parm in param)
            {
                sql.AppendFormat("{0} = {1} ,", dbProvider.CreateTableAegis(parm.ParameterName.Substring(1)),
                                 parm.ParameterName);
            }

            ParamsList.AddRange(param);

            return(sql.ToString().DelEndOf(",") + WhereString + ";");
        }