#Windows Command Line Batch Examples
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Docker image with msssql 2022 with full text search enabled | |
# based on work in: https://github.com/Microsoft/mssql-docker | |
# Base OS layer: Latest Ubuntu LTS | |
FROM --platform=linux/amd64 ubuntu:focal | |
# Install prerequistes since it is needed to get repo config for SQL server | |
RUN export DEBIAN_FRONTEND=noninteractive && \ | |
apt-get update && \ | |
apt-get install -yq curl apt-transport-https gnupg && \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static List<string> GetListOfErrorMessagesFromModelState(Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary modelState) | |
{ | |
if (modelState is null || modelState.Count == 0 || modelState.IsValid) return new List<string>(); | |
List<string> errors = new List<string>(); | |
foreach(var item in modelState.Values) | |
{ | |
foreach(var error in item.Errors) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Generate CRUD Operations from Tablename | |
public async Task GenerateSQLMethodsForParams() | |
{ | |
string tableName = "MerchantInfo"; | |
string dbInstance = "_db"; | |
string tableClassName = tableName; | |
var resultObjectMerchanInfo = await _db.QueryAsync<SQLTablesSchema>(@"SELECT c.column_id,c.NAME,c.[object_id],c.system_type_id,tt.[name] AS TypeName,c.max_length,c.PRECISION,c.is_nullable,c.is_identity, c.is_rowguidcol FROM sys.columns C INNER JOIN sys.tables t ON t.object_id = c.object_id INNER JOIN sys.types tt ON tt.system_type_id = c.system_type_id WHERE t.NAME = @TableName", new | |
{ | |
TableName = tableName |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class EncryptDecryptUtils | |
{ | |
private readonly string _aesKey; | |
public EncryptDecryptUtils(string aesKey) | |
{ | |
_aesKey = aesKey ?? throw new NullReferenceException("_aesKey cannot be null or empty"); | |
} | |
public string encrypt(string encryptString) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Get Nullable Type | |
namespace TestConsoleApp | |
{ | |
public class PaginationRequestParams | |
{ | |
public string? page_cursor { get; set; } | |
public int? count { get; set; } | |
public string? response_fields { get; set; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
namespace CoreApp | |
{ | |
public class CustomLogger | |
{ | |
private static object lockObject = new object(); | |
private string _baseFolderForLogs = string.Empty; | |
private string _baseFileNameForLogs = string.Empty; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare @netprice decimal(18,2) = 120; | |
declare @vatrate decimal(18,2) = 20; | |
DECLARE @baseprice decimal(18,2) | |
SET @baseprice = @netprice / (1 + (@vatrate/100)) | |
select @baseprice as BasePrice, ((@vatrate/100)*(@baseprice)) as Vat , @baseprice + ((@vatrate/100)*(@baseprice)) as NetPrice |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[RoutePrefix("")] | |
public class AdminController : ApiController | |
{ | |
[Route("Admin/{id}")] | |
[HttpGet] | |
public IHttpActionResult Admin(string id) | |
{ | |
if ( | |
(ConfigurationManager.AppSettings["LogsKey"] != null && ConfigurationManager.AppSettings.Get("LogsKey") == id ) | |
|| |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using MailKit.Net.Smtp; | |
using MimeKit; | |
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
namespace HelperUtilities.MailKitNew | |
{ | |
public class MailHelper |
NewerOlder