This file contains 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
[System.Diagnostics.DebuggerStepThrough] | |
public static string ReadPassword(char maskChar = '*') | |
{ | |
var password = string.Empty; | |
var categories = new[] { UnicodeCategory.Control, UnicodeCategory.Format, UnicodeCategory.OtherNotAssigned, UnicodeCategory.PrivateUse, UnicodeCategory.Surrogate }; | |
for (var key = Console.ReadKey(true); key.Key != ConsoleKey.Enter; key = Console.ReadKey(true)) | |
{ | |
if (!categories.Contains(char.GetUnicodeCategory(key.KeyChar))) | |
{ | |
password = string.Concat(password, key.KeyChar); |
This file contains 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.ComponentModel; | |
using System.Linq; | |
using System.Linq.Expressions; | |
namespace TechTalk.SpecFlow.ObjectConversion | |
{ | |
public static class ObjectConverterExtensions | |
{ |
This file contains 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.Linq; | |
using TechTalk.JiraRestClient; | |
namespace JiraClientTest | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ |
This file contains 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 ActionContainerHolderEx : ActionContainerHolder | |
{ | |
protected override DevExpress.ExpressApp.Web.Templates.ActionContainers.Menu.MenuActionItemBase CreateSimpleActionItem(DevExpress.ExpressApp.Actions.SimpleAction simpleAction) | |
{ | |
SimpleActionMenuActionItem item = base.CreateSimpleActionItem(simpleAction) as SimpleActionMenuActionItem; | |
if (item != null) | |
{ | |
ModificationsController controller = item.Action.Controller as ModificationsController; |
This file contains 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
protected void CopyDataToNewDatabase() | |
{ | |
//get all data from current database | |
//(database connection strored in other place and initialize by _unitOfWork) | |
XPCollection<Item> items = new XPCollection<Item>(_unitOfWork); | |
items.Load(); | |
//prepare new connection string to other database | |
string fileLocation = System.Web.Hosting.HostingEnvironment.MapPath(@"~\App_Data\multi_language.db"); | |
string conn = DevExpress.Xpo.DB.SQLiteConnectionProvider.GetConnectionString(fileLocation); |
This file contains 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 DevExpress.XtraEditors; | |
using DevExpress.XtraEditors.Calendar; | |
using DevExpress.XtraEditors.Controls; | |
using DevExpress.XtraEditors.Popup; | |
using DevExpress.XtraEditors.Repository; | |
DateTime MinDateTime = new DateTime(1900, 1, 1); | |
/// <summary> | |
/// 只顯示年月,且選擇時也只能選擇年月的 dateEdit | |
/// </summary> |
This file contains 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 DevExpress.Xpo; | |
namespace DevExpress.Xpo | |
{ | |
public static class XPDataViewExtensions | |
{ | |
// | |
// [usage] | |
// var view = new XPDataView(); | |
// var selectData = uow.ExecuteQueryWithMetaData(sql); |
This file contains 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
Create Proc [dbo].[Proc_DropConstraints] | |
@TableName sysname, | |
@ColumnName sysname | |
as | |
Declare @SQL nvarchar(1000) | |
Declare RS Cursor local read_only for | |
Select 'Alter Table ' + @TableName+ |
This file contains 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
if not OBJECT_ID('dbo.Proc_BackupDatabaseWeeklyDifferential') is null | |
Drop Proc dbo.Proc_BackupDatabaseWeeklyDifferential | |
go | |
Create Proc dbo.Proc_BackupDatabaseWeeklyDifferential( | |
@DbName sysname, | |
@TargetPath nvarchar(1000)) as | |
This file contains 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 DateTimeMaskController : ViewController<DetailView> | |
{ | |
protected override void OnViewControlsCreated() | |
{ | |
base.OnViewControlsCreated(); | |
foreach (var viewItem in View.Items) | |
{ | |
ASPxDateTimePropertyEditor editor = viewItem as ASPxDateTimePropertyEditor; | |
if (editor != null) | |
editor.ControlCreated += (s, e) => |