Skip to content

Instantly share code, notes, and snippets.

[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);
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Linq.Expressions;
namespace TechTalk.SpecFlow.ObjectConversion
{
public static class ObjectConverterExtensions
{
using System;
using System.Linq;
using TechTalk.JiraRestClient;
namespace JiraClientTest
{
class Program
{
static void Main(string[] args)
{
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;
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);
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>
using DevExpress.Xpo;
namespace DevExpress.Xpo
{
public static class XPDataViewExtensions
{
//
// [usage]
// var view = new XPDataView();
// var selectData = uow.ExecuteQueryWithMetaData(sql);
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+
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
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) =>