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
foreach (string folder in folders) | |
{ | |
Check1Folder(ref totalFiles, ref totalError, folder); | |
} | |
private void Check1Folder(ref int totalFiles, ref int totalError, string folder) | |
{ | |
string[] files = Directory.GetFiles(folder,"*.txt"); | |
totalFiles += files.Length; | |
foreach (string file in files) |
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
foreach (KeyValuePair<string, string> entry in parameters) | |
{ | |
sc.Parameters.AddWithValue(entry.Key, entry.Value); | |
} |
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; | |
using System.Collections.Generic; | |
using System.Data; | |
using System.Data.SqlClient; | |
using ClosedXML.Excel; | |
using DataEntryDAL; | |
namespace DataEntryDAL.DAO | |
{ | |
public class ReportDAO |
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
@echo OFF | |
REM FOR /F "TOKENS=1-4 DELIMS=/ " %%A IN ('DATE/T') DO SET tg=%%D%%B%%C | |
REM set tg=%date:/=% | |
SET Today=%Date: =0% | |
SET Year=%Today:~-4% | |
SET Month=%Today:~-10,2% | |
SET Day=%Today:~-7,2% | |
SET tg=%Year%%Month%%Day% |
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
/// <summary> | |
/// Determines a text file's encoding by analyzing its byte order mark (BOM). | |
/// Defaults to ASCII when detection of the text file's endianness fails. | |
/// </summary> | |
/// <param name="filename">The text file to analyze.</param> | |
/// <returns>The detected encoding.</returns> | |
public static Encoding GetEncoding(string filename) | |
{ | |
// Read the BOM | |
var bom = new byte[4]; |
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
/// <summary> | |
/// Converting text to image (png). | |
/// </summary> | |
/// <param name="text">text to convert</param> | |
/// <param name="font">Font to use</param> | |
/// <param name="textColor">text color</param> | |
/// <param name="maxWidth">max width of the image</param> | |
/// <param name="path">path to save the image</param> | |
public static void DrawText(String text, Font font, Color textColor,int maxWidth,String path) | |
{ |
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
string[] array = new string[2]; // creates array of length 2, default values | |
string[] array = new string[] { "A", "B" }; // creates populated array of length 2 | |
string[] array = { "A" , "B" }; // creates populated array of length 2 | |
string[] array = new[] { "A", "B" }; // created populated array of length 2 |
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
// You can use an extension method: | |
public static class StringExtension | |
{ | |
public static string GetLast(this string source, int tail_length) | |
{ | |
if(tail_length >= source.Length) | |
return source; | |
return source.Substring(source.Length - tail_length); | |
} |
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
foreach(DataGridViewRow row in yourDataGridView.Rows) | |
{ | |
foreach(DataGridViewCell cell in row.Cells) | |
{ | |
//do operations with cell | |
} | |
} |