public static long UpdateReleaseNote(Guid?releaseNoteId, Guid?versionId, string reference, int?type, string title, string remarks, bool?isPublic, int?sequence, bool?updateTaskFields) { long result; BuildQuery qb = new BuildQuery(ConfigurationManager.ConnectionStrings["DefaultConnection"].ToString()); qb.SetInParam("@ReleaseNoteId", releaseNoteId, SqlDbType.UniqueIdentifier); qb.SetInParam("@VersionId", versionId, SqlDbType.UniqueIdentifier); qb.SetInParam("@Reference", reference, SqlDbType.NVarChar); qb.SetInParam("@Type", type, SqlDbType.Int); qb.SetInParam("@Title", title, SqlDbType.NVarChar); qb.SetInParam("@Remarks", remarks, SqlDbType.NVarChar); qb.SetInParam("@IsPublic", isPublic, SqlDbType.Bit); qb.SetInParam("@Sequence", sequence, SqlDbType.Int); qb.SetInParam("@UpdateTaskFields", updateTaskFields, SqlDbType.Bit); result = qb.ExecuteNonQuery("spUpdateReleaseNote"); return(result); }
public static DataSet GetComponents(string projectId, string componentId) { DataSet ds = null; BuildQuery qb = new BuildQuery(ConfigurationManager.ConnectionStrings["DefaultConnection"].ToString()); if (!string.IsNullOrWhiteSpace(projectId)) { qb.SetInParam("@ProjectId", Guid.Parse(projectId), SqlDbType.UniqueIdentifier); } if (!string.IsNullOrWhiteSpace(componentId)) { qb.SetInParam("@ComponentId", Guid.Parse(componentId), SqlDbType.UniqueIdentifier); } ds = qb.ExecuteDataset("spGetComponents"); return(ds); }
public static long InsertVersionDetail(Guid?versionId, string reference, string fileChanges, string dBChanges, string description, string changedBy, DateTime?changedOn, int qAStatus, Guid?createdBy) { long result; BuildQuery qb = new BuildQuery(ConfigurationManager.ConnectionStrings["DefaultConnection"].ToString()); qb.SetInParam("@VersionId", versionId, SqlDbType.UniqueIdentifier); qb.SetInParam("@Reference", reference, SqlDbType.NVarChar); qb.SetInParam("@FileChanges", fileChanges, SqlDbType.NVarChar); qb.SetInParam("@DBChanges", dBChanges, SqlDbType.NVarChar); qb.SetInParam("@Description", description, SqlDbType.NVarChar); qb.SetInParam("@ChangedBy", changedBy, SqlDbType.NVarChar); qb.SetInParam("@ChangedOn", changedOn, SqlDbType.DateTime); qb.SetInParam("@QAStatus", qAStatus, SqlDbType.Int); qb.SetInParam("@CreatedBy", createdBy, SqlDbType.UniqueIdentifier); result = qb.ExecuteNonQuery("spInsertDetailVersionData"); return(result); }
public static long UpdateTaxSavingReceipt(Guid?taxSavingId, Guid?employeeId, int?financialYear, int?taxSavingType, int?recurringFrequency, DateTime?savingDate, string accountNumber, float?amount, string remarks, int eligibleCount) { BuildQuery qb = new BuildQuery(ConfigurationManager.ConnectionStrings["DefaultConnection"].ToString()); qb.SetInParam("@TaxSavingId", taxSavingId, SqlDbType.UniqueIdentifier); qb.SetInParam("@EmployeeId", employeeId, SqlDbType.UniqueIdentifier); qb.SetInParam("@FinancialYear", financialYear, SqlDbType.Int); qb.SetInParam("@TaxSavingType", taxSavingType, SqlDbType.Int); qb.SetInParam("@RecurringFrequency", recurringFrequency, SqlDbType.Int); qb.SetInParam("@SavingDate", savingDate, SqlDbType.DateTime); qb.SetInParam("@AccountNumber", accountNumber, SqlDbType.NVarChar); qb.SetInParam("@Amount", amount, SqlDbType.Decimal); qb.SetInParam("@Remarks", remarks, SqlDbType.NVarChar); qb.SetInParam("@EligibleCount", eligibleCount, SqlDbType.Int); var result = qb.ExecuteNonQuery("spUpdateTaxSavingReceipt"); return(result); }
public static long UpdateHoliday(HolidayModel holiday) { try { long result; BuildQuery qb = new BuildQuery(ConfigurationManager.ConnectionStrings["DefaultConnection"].ToString()); qb.ClearParameters(); qb.SetInParam("@HolidayDate", holiday.HolidayDate, SqlDbType.DateTime); qb.SetInParam("@Name", holiday.Name, SqlDbType.NVarChar); qb.SetInParam("@Remarks", holiday.Remark, SqlDbType.NVarChar); result = qb.ExecuteNonQuery("spUpdateHoliday", CommandType.StoredProcedure); return(result); } catch (Exception ex) { throw ex; } }
//public static int Update(TaskListModel task) //{ // int retStatus = 0; // BuildQuery qb = new BuildQuery(ConfigurationManager.ConnectionStrings["DefaultConnection"].ToString()); // qb.SetInParam("@TaskId", task.TaskId, SqlDbType.UniqueIdentifier); // qb.SetInParam("@Summary", task.Summary, SqlDbType.NVarChar); // qb.SetInParam("@TaskType", task.TaskType, SqlDbType.Int); // qb.SetInParam("@Status", task.StatusId, SqlDbType.Int); // qb.SetInParam("@PriorityType", task.PriorityType, SqlDbType.Int); // qb.SetInParam("@ResolutionType", task.ResolutionType, SqlDbType.Int); // qb.SetInParam("@Assignee", task.Assignee, SqlDbType.NVarChar); // qb.SetInParam("@Reporter", task.Reporter, SqlDbType.NVarChar); // qb.SetInParam("@ComponentId", task.ComponentId, SqlDbType.UniqueIdentifier); // qb.SetInParam("@DueDate", task.DueDate, SqlDbType.DateTime); // qb.SetInParam("@OriginalEstimate", task.OriginalEstimate, SqlDbType.Int); // qb.SetInParam("@TimeSpent", task.TimeSpent, SqlDbType.Int); // qb.SetInParam("@RemainingEstimate", task.RemainingEstimate, SqlDbType.Int); // qb.SetInParam("@Description", task.Description, SqlDbType.NVarChar); // qb.SetInParam("@Area", task.Area, SqlDbType.NVarChar); // qb.SetInParam("@ModifiedBy", task.ModifiedBy, SqlDbType.UniqueIdentifier); // retStatus = Convert.ToInt32(qb.ExecuteNonQuery("spUpdateTask")); // return retStatus; //} public static int Insert(TaskListModel task) { int retStatus = 0; BuildQuery qb = new BuildQuery(ConfigurationManager.ConnectionStrings["DefaultConnection"].ToString()); qb.SetInParam("@ProjectId", task.ProjectId, SqlDbType.UniqueIdentifier); qb.SetInParam("@Summary", task.Summary, SqlDbType.NVarChar); qb.SetInParam("@TaskType", task.TaskType, SqlDbType.Int); qb.SetInParam("@Status", task.StatusId, SqlDbType.Int); qb.SetInParam("@PriorityType", task.PriorityType, SqlDbType.Int); qb.SetInParam("@ResolutionType", task.ResolutionType, SqlDbType.Int); qb.SetInParam("@Assignee", task.Assignee, SqlDbType.NVarChar); qb.SetInParam("@Reporter", task.Reporter, SqlDbType.NVarChar); qb.SetInParam("@ComponentId", task.ComponentId, SqlDbType.UniqueIdentifier); qb.SetInParam("@DueDate", task.DueDate, SqlDbType.DateTime); qb.SetInParam("@OriginalEstimate", task.OriginalEstimate, SqlDbType.Int); qb.SetInParam("@TimeSpent", task.TimeSpent, SqlDbType.Int); qb.SetInParam("@RemainingEstimate", task.RemainingEstimate, SqlDbType.Int); qb.SetInParam("@Description", task.Description, SqlDbType.NVarChar); qb.SetInParam("@Area", task.Area, SqlDbType.NVarChar); qb.SetInParam("@CreatedBy", task.CreatedBy, SqlDbType.UniqueIdentifier); retStatus = Convert.ToInt32(qb.ExecuteNonQuery("spInsertTask")); return(retStatus); }
public static long CreateEmployee(Employees employeeDetails) { BuildQuery qb = new BuildQuery(ConfigurationManager.ConnectionStrings["DefaultConnection"].ToString()); qb.ClearParameters(); qb.SetInParam("@FirstName ", employeeDetails.FirstName, SqlDbType.NVarChar); qb.SetInParam("@MiddleName", employeeDetails.MiddleName, SqlDbType.NVarChar); qb.SetInParam("@LastName", employeeDetails.LastName, SqlDbType.NVarChar); qb.SetInParam("@Designation", employeeDetails.Designation, SqlDbType.NVarChar); qb.SetInParam("@Gender", employeeDetails.Gender, SqlDbType.NVarChar); qb.SetInParam("@DateOfBirth", employeeDetails.DateOfBirth, SqlDbType.DateTime); qb.SetInParam("@Anniversary", "1901-01-01", SqlDbType.DateTime); qb.SetInParam("@Remarks", employeeDetails.Remarks, SqlDbType.NVarChar); qb.SetInParam("@DateOfJoining", employeeDetails.DateOfJoining, SqlDbType.DateTime); qb.SetInParam("@DateOfRelieving", employeeDetails.DateOfRelieving, SqlDbType.DateTime); qb.SetInParam("@PanNo", employeeDetails.PanNo, SqlDbType.NVarChar); qb.SetInParam("@FatherName", employeeDetails.FatherName, SqlDbType.NVarChar); qb.SetInParam("@EmployeeType", employeeDetails.EmployeeType, SqlDbType.NVarChar); qb.SetInParam("@BankDetail", employeeDetails.BankDetail, SqlDbType.NVarChar); qb.SetInParam("@OrignalDateOfBirth", employeeDetails.OrignalDateOfBirth, SqlDbType.DateTime); var result = qb.ExecuteNonQuery("spInsertEmployee"); return(result); }
public static int Main(string[] args) { Console.WriteLine("Started"); var app = new CommandLineApplication(); var groupByType = GroupByType.Concern; app.HelpOption(); var operationType = app.Option( "-ot|--operationType <TYPE>", "Can either be [command] or [query]", CommandOptionType.SingleValue); var concern = app.Option( "-c|--concern <NAME>", "Name of the concern", CommandOptionType.SingleValue); var operation = app.Option( "-o|--operation <NAME>", "Name of the operation", CommandOptionType.SingleValue); var groupBy = app.Option( "-g|--groupBy <TYPE>", "Group domain objects by [C] for concerns or [O] for operations, defaults to concerns", CommandOptionType.SingleValue); app.OnExecute(() => { if (!operationType.HasValue()) { LogUtility.Error("Invalid operation type parameter: must specify [c] for command or [q] for query"); return(0); } if (!concern.HasValue()) { LogUtility.Error("Invalid concern parameter: concern must be specified"); return(0); } if (!operation.HasValue()) { LogUtility.Error("Invalid operation parameter: operation must be specified"); return(0); } if (groupBy.HasValue()) { groupByType = (groupBy.Value().ToLower()) switch { "c" => GroupByType.Concern, "o" => GroupByType.Operation, _ => GroupByType.Concern }; } var operationTypeBuilderResult = OperationTypeResolver.Resolve(operationType.Value()); if (operationTypeBuilderResult == OperationType.UNSUPPORTED) { LogUtility.Error("Invalid operation type parameter: must specify [c] for command or [q] for query"); return(0); } BuildResponse.Build(concern.Value(), operation.Value(), groupByType); switch (operationTypeBuilderResult) { case OperationType.COMMAND: BuildCommand.Build(concern.Value(), operation.Value(), groupByType); break; case OperationType.QUERY: BuildQuery.Build(concern.Value(), operation.Value(), groupByType); break; case OperationType.UNSUPPORTED: LogUtility.Error("Invalid operation type parameter: must specify [c] for command or [q] for query"); break; default: LogUtility.Error("Invalid operation type parameter: must specify [c] for command or [q] for query"); break; } ; BuildHandler.Build(concern.Value(), operation.Value(), operationTypeBuilderResult, groupByType); return(0); }); return(app.Execute(args)); }
private static int RunScaffolding(string[] args) { var app = new CommandLineApplication { Name = "Scaffolding CLI", Description = "A CQRS and Mediator scaffolding CLI", AllowArgumentSeparator = true, }; app.HelpOption(true); //Top level command which can split into two directions app.Command("new", configCmd => { configCmd.OnExecute(() => { Console.WriteLine("Scaffold a new solution or extend the domain"); configCmd.ShowHelp(); return(1); }); //Split 1: sln configCmd.Command("sln", setCmd => { setCmd.Description = "Scaffold a new solution including the API, Logic, DB, Unit and Integration test projects"; var nameArgument = setCmd.Option("-n| --name <NAME>", "Name of the solution", CommandOptionType.SingleValue).IsRequired(); setCmd.OnExecute(() => { var path = Directory.GetCurrentDirectory(); BuilderSolution.Build(nameArgument.Value()); BuildStartup.Build($"{path}/API"); BuildCorsExtension.Build($"{path}/API/Extensions"); BuildHealthCheckExtensions.Build($"{path}/API/Extensions"); BuildDatabaseServiceCollectionExtensions.Build($"{path}/DB/Configuration"); BuildLogicServiceCollectionExtensions.Build($"{path}/Logic/Configuration"); Console.WriteLine(ExecuteCommandUtility.Run($"echo [92mDONE[0m")); }); }); //Split 2: domain configCmd.Command("domain", setCmd => { setCmd.Description = "Extent the domain with new handlers"; var operationType = setCmd.Option( "-ot|--operationType <TYPE>", "Can either be [command] or [query]", CommandOptionType.SingleValue) .IsRequired(false, "Must specify an operation type: Can either be [command] or [query] i.e -ot|--operationType <TYPE>"); var concern = setCmd.Option( "-c|--concern <NAME>", "Name of the concern", CommandOptionType.SingleValue) .IsRequired(false, "Name of the concern: -c|--concern <NAME>"); var operation = setCmd.Option( "-o|--operation <NAME>", "Name of the operation", CommandOptionType.SingleValue) .IsRequired(false, "Name of the operation: -o|--operation <NAME>"); var groupBy = setCmd.Option( "-g|--groupBy <TYPE>", "Group domain objects by [C] for concerns or [O] for operations, defaults to concerns", CommandOptionType.SingleValue); setCmd.OnExecute(() => { var groupByType = GroupByType.Concern; if (groupBy.HasValue()) { groupByType = (groupBy.Value()?.ToLower()) switch { "c" => GroupByType.Concern, "o" => GroupByType.Operation, _ => GroupByType.Concern }; } var operationTypeBuilderResult = OperationTypeResolver.Resolve(operationType.Value()); if (operationTypeBuilderResult == OperationType.UNSUPPORTED) { LogUtility.Error("Invalid operation type parameter: must specify [c] for command or [q] for query"); return(0); } BuildResponse.Build(concern.Value(), operation.Value(), groupByType); switch (operationTypeBuilderResult) { case OperationType.COMMAND: BuildCommand.Build(concern.Value(), operation.Value(), groupByType); break; case OperationType.QUERY: BuildQuery.Build(concern.Value(), operation.Value(), groupByType); break; case OperationType.UNSUPPORTED: LogUtility.Error( "Invalid operation type parameter: must specify [c] for command or [q] for query"); break; default: LogUtility.Error( "Invalid operation type parameter: must specify [c] for command or [q] for query"); break; } ; BuildHandler.Build(concern.Value(), operation.Value(), operationTypeBuilderResult, groupByType); return(0); });