Exemple #1
0
        private void WriteUpdate()
        {
            var methodParameters = CodeWriterUtils.GetUpdateMethodParameters(table, codeWriterSettings, false, false);

            methodParameters = CodeWriterUtils.AddEntityParameter(methodParameters, table, "An entity with updated values.");
            classBuilder.AppendLine($"{CodeWriterUtils.GetUpdateMethodSignature(table, codeWriterSettings, methodParameters)};");
        }
        private void WriteUpdate()
        {
            var methodParameters = CodeWriterUtils.GetUpdateMethodParameters(table, codeWriterSettings, false, false);
            var whereClause      = GetWhereClauseFromMethodParameters(methodParameters.ToList());

            WriteUpdateCommon(methodParameters, null, whereClause, GetAllColumnNames(new List <DatabaseTable> {
                table
            }));
        }
Exemple #3
0
        private void WriteUpdateUniqueByCustomer()
        {
            var methodParameters = CodeWriterUtils.GetUpdateMethodParameters(table, codeWriterSettings, true, true);

            if (methodParameters == null || !methodParameters.Any())
            {
                return;
            }

            methodParameters = CodeWriterUtils.AddEntityParameter(methodParameters, table, "An entity with updated values.");
            classBuilder.AppendLine($"{CodeWriterUtils.GetUpdateMethodSignature(table, codeWriterSettings, methodParameters)};");
        }
        private void WriteUpdateUniqueByCustomer()
        {
            var methodParameters = CodeWriterUtils.GetUpdateMethodParameters(table, codeWriterSettings, true, true);

            if (methodParameters == null || !methodParameters.Any())
            {
                return;
            }

            var orgUnitTableAlias = codeWriterSettings.Namer.NameToAcronym(CodeWriterUtils.CustomerAssetOrganizationTableName);
            var fromClause        = $"\\\"{CodeWriterUtils.CustomerAssetOrganizationTableName}\\\" {orgUnitTableAlias}";
            var whereClause       = GetWhereClauseFromMethodParameters(methodParameters.ToList());
            var thisTableAlias    = codeWriterSettings.Namer.NameToAcronym(table.Name);
            var joinOnClause      = $"{thisTableAlias}.\\\"{CodeWriterUtils.CustomerAssetOrganizationIDColumnName}\\\" = {orgUnitTableAlias}.\\\"{CodeWriterUtils.CustomerAssetOrganizationIDColumnName}\\\"";

            whereClause = $"{joinOnClause} AND {whereClause}";
            WriteUpdateCommon(methodParameters, fromClause, whereClause, GetAllColumnNamesByCustomer());
        }