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 class Constants | |
| { | |
| public const string DefaultUserName = "DEFAULT_USER"; | |
| // MB | |
| public const int MaxFileSize = 250; | |
| // ms | |
| public const int DbTimeout = 10000; | |
| public const int CookieExpireTime = 1000; | |
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
| // helper classes | |
| public interface IRequest { } | |
| public class RequestInfo | |
| { | |
| public string CreateBy { get; set; } | |
| public string UpdateBy { get; set; } | |
| public DateTime CreateDate { get; set; } | |
| public DateTime UpdateDate { 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
| /// <summary> | |
| /// The 'Handler' abstract class or interface | |
| /// </summary> | |
| public abstract class BaseHandler | |
| { | |
| protected BaseHandler successor; | |
| public void SetSuccessor(BaseHandler successor) | |
| { | |
| this.successor = successor; | |
| } |
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 class FtpTestHelper | |
| { | |
| public static bool TestConnect(string ftpRequestUrl, string ftpUserName, string ftpPassword) | |
| { | |
| bool rv = false; | |
| if (!TestUri(ftpRequestUrl)) | |
| return false; | |
| FtpWebRequest request = (FtpWebRequest)FtpWebRequest.Create(new Uri(ftpRequestUrl)); | |
| request.Credentials = new NetworkCredential(ftpUserName, ftpRequestUrl); |
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 class ZipHelper | |
| { | |
| public readonly static string ZipPassword = ConfigurationManager.AppSettings["ZipPassword"].ToString(); | |
| public static bool Zip(string filePath,string TargetDirectory) | |
| { | |
| if (File.Exists(filePath)) | |
| throw new ApplicationException(""); | |
| if (Directory.Exists(TargetDirectory)) | |
| throw new ApplicationException(""); |
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 interface IFileProcessor | |
| { | |
| void Process(string targetFile, string zippedFile); | |
| void UndoProcess(string zippedFile, string targetFile, string fileName); | |
| } | |
| public class FileProcessor | |
| :IFileProcessor | |
| { | |
| private string dummyFilePath = FileProcessorConstants.DummyFilePath; |
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 Task | |
| { | |
| // Action based :D | |
| public Action Action { get; set; } | |
| public int? AbsoluteMinute { get; set; } | |
| public int? AbsoluteHour { get; set; } | |
| public int? SlidingMinute { get; set; } | |
| public int? SlidingHour { 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
| class Program | |
| { | |
| static void Main(string[] args) | |
| { | |
| var m = new ScheduledTaskManager(); | |
| //m.AddAbsoluteTask(Testit, 42); | |
| //m.AddAbsoluteTask(Testit, 9, 24); | |
| m.AddSlidingTask(Testit, 1); |
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
| // Contract | |
| public interface IScheduledTaskManager | |
| { | |
| void AddAbsoluteTask(Action task, int absoluteMinute); | |
| void AddAbsoluteTask(Action task, int absoluteHour, int absoluteMinute); | |
| void AddSlidingTask(Action task, int slidingMinute); | |
| void AddSlidingTask(Action task, int slidingHour, int slidingMinute); | |
| } | |
| // Main Class |
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 Microsoft.Web.Administration; | |
| // C:\Windows\System32\inetsrv\Microsoft.Web.Administration.dll | |
| public class AppPoolController | |
| { | |
| // Singleton Class | |
| private static AppPoolController _current = null; | |
| private static object _lockObj = new object(); | |
| public static AppPoolController Current | |
| { |