本文整理汇总了C#中Helper类的典型用法代码示例。如果您正苦于以下问题:C# Helper类的具体用法?C# Helper怎么用?C# Helper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Helper类属于命名空间,在下文中一共展示了Helper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
static void Main(string[] args)
{
var helper = new Helper();
helper.Validate(args);
var model = helper.UnfurlNodes(helper.ParseXml());
model.WriteValues();
}
示例2: InitializeAllRoles
public void InitializeAllRoles()
{
var roleList = new List<string>()
{
"Admin","Customer","Supplier","Sales"
};
if (roleList != null)
{
var helper = new Helper();
foreach (var item in roleList)
{
string titleCaseRole = helper.ConvertToTitleCase(item.ToLowerInvariant());
var searchResult = (from role in db.Roles
where role.Name == titleCaseRole
select role).FirstOrDefault();
if (searchResult == null)
{
db.Roles.Add(new IdentityRole()
{
Name = titleCaseRole
});
db.SaveChanges();
}
}
}
}
示例3: ProviderController
public ProviderController(Helper helper, JsonSerializer json, CoreConverter converter, ProductController productController)
{
_h = helper;
_j = json;
_c = converter;
_p = productController;
}
示例4: Main
static void Main(string[] args)
{
var help = new Helper();
var list = help.GetConnections();
#region 生成模板
//foreach (var item in list)
//{
// help.GenerateFetchStatement(help.GetDatabaseSheme(item));
// help.GenerateFetchStatementWithNolock(help.GetDatabaseSheme(item));
//}
#endregion
#region 生成实体类
var help2 = new EntityHelper();
int c = 0;
foreach (var item in list)
{
help2.GenerateFile(help2.GetSheme(item, ConfigurationManager.AppSettings["ns"].Split('|')[c]), ConfigurationManager.AppSettings["fn"].Split('|')[c]);
c++;
}
#endregion
Console.WriteLine("生成完毕!");
Console.Read();
}
示例5: InsertTestData
public void InsertTestData()
{
Helper helper = new Helper();
User dil = new User();
dil.UserName = "Dil";
dil.Password = helper.EncryptPassword(dil.UserName+"123");
dil.Role = "Admin";
String v1 = helper.GenerageVerificationCode(4);
dil.VerificationCode = v1;
User laxman = new User();
laxman.UserName = "Laxman";
laxman.Password = helper.EncryptPassword(laxman.UserName+"123");
laxman.Role = "Staff";
String v2 = helper.GenerageVerificationCode(4);
laxman.VerificationCode = v2;
List<User> users = new List<User>();
users.Add(dil);
users.Add(laxman);
using (var db = new GPAEntities())
{
db.Users.AddRange(users);
db.SaveChanges();
}
}
示例6: ErrorLog
public ErrorLog(Exception ex, HttpContext context)
{
this.oHelper = new Helper();
this.mContext = context;
this.mException = ex;
this.ReportError();
}
示例7: GetModel
public Sys_Template GetModel(int Id)
{
Sys_Template entity = new Sys_Template();
entity.Id = Id;
Sys_Template model = new Helper().Find(entity);
return model;
}
示例8: Add
public Helper Add(string helperName, string typeDescription) {
Helper newItem = new Helper();
newItem.Name = helperName;
newItem.Type = typeDescription;
this.Add(newItem);
return newItem;
}
示例9: Main
static void Main ()
{
AppDomainSetup setup = new AppDomainSetup ();
setup.ApplicationBase = AppDomain.CurrentDomain.BaseDirectory;
setup.ApplicationName = "test";
AppDomain newDomain = AppDomain.CreateDomain ("test",
AppDomain.CurrentDomain.Evidence, setup);
StringCollection probePaths = new StringCollection ();
probePaths.Add (Path.Combine (AppDomain.CurrentDomain.BaseDirectory, "lib"));
// create an instance of our custom Assembly Resolver in the target domain.
newDomain.CreateInstanceFrom (Assembly.GetExecutingAssembly ().CodeBase,
typeof (AssemblyResolveHandler).FullName,
false,
BindingFlags.Public | BindingFlags.Instance,
null,
new object[] { probePaths },
CultureInfo.InvariantCulture,
null,
AppDomain.CurrentDomain.Evidence);
Helper helper = new Helper ();
newDomain.DoCallBack (new CrossAppDomainDelegate (helper.Test));
}
示例10: Main
/// <summary>
/// Entry point for the program
/// </summary>
/// <param name="args">list of commandline arguments</param>
private static void Main(string[] args)
{
Helper _helper = new Helper();
Console.WriteLine();
Console.WriteLine("===========OUTPUT==========");
Console.WriteLine();
//Get the second argument that holds the file/Directory
var fileORDirectory = args[1];
if (File.Exists(fileORDirectory))
{
// The path is a file
_helper.ProcessFile(fileORDirectory);
}
else if (Directory.Exists(fileORDirectory))
{
// The path is a directory
_helper.ProcessDirectory(fileORDirectory);
}
else
{
Console.WriteLine("{0} is not a valid file or directory.", fileORDirectory);
Console.ReadKey();
}
Console.ReadKey();
}
示例11: MakeDlPage
private async Task<string[]> MakeDlPage(string url) {
HtmlHandler ht = new HtmlHandler();
Helper hlp = new Helper();
await ht.DownloadHtml(url);
//Get RELEASE INFO
var temp = ht.GetNodeByAttr(ht.HtmlDoc,"li","class","release");
string releaseInfo = temp.InnerText.Replace("Release info:","").Trim()??"";
releaseInfo = hlp.FormatTxt(releaseInfo);
//Get Img Src
temp = ht.GetNodeByAttr(ht.HtmlDoc,"img","alt","Poster");
string Imgs = "";
try {
Imgs=ht.GetAttr(temp,"src") ?? "";
}
catch(Exception) { }
//Get Owner
temp = ht.GetNodeByAttr(ht.HtmlDoc,"li","class","author");
temp = ht.GetNodeByType(temp,"a")??null;
string owner = temp.InnerText.Trim()??"";
owner = hlp.FormatTxt(owner);
//Get Details
temp = ht.GetNodeByAttr(ht.HtmlDoc,"div","id","details");
string details = temp.InnerText.Replace("Subtitle details:","").Trim()??"";
details = hlp.FormatTxt(details);
//Get Downloadlink
temp = ht.GetNodeByAttr(ht.HtmlDoc,"a","id","downloadButton");
string dlUrl = ht.GetAttr(temp,"href")??"";
return new string []{Imgs,releaseInfo,owner,details,dlUrl};
}
示例12: Run
public override void Run()
{
// This is a sample worker implementation. Replace with your logic.
Trace.WriteLine("WorkerRole1 entry point called", "Information");
// Disables EntityFramework Code First checks
Database.SetInitializer<ConvictsContext>(null);
while (true)
{
try
{
Helper h = new Helper();
h.CalculateConvictTotals();
h.getDonorNames();
h.getPaymentRecords();
h.SanitiseDatabaseQuotes();
h.getConvictURLS();
h.getTeamURLS();
h.CalculateTeamTotals();
h.addTeamCodeToPaymentRecords();
Thread.Sleep(60000); //5 minutes
}
catch (Exception ex)
{
Console.Write(ex.Message.ToString());
//throw;
}
System.Threading.Thread.Sleep(1000 * 60);
}
}
示例13: GetModel
public Sys_Dept GetModel(int Id)
{
Sys_Dept entity = new Sys_Dept();
entity.Id = Id;
Sys_Dept model = new Helper().Find(entity);
return model;
}
示例14: Init
public void Init(Helper help, Character chr)
{
try
{
_character = chr;
_helper = help;
listView1.ItemsSource = _character.Attacks;
listView2.ItemsSource = _character.Effects;
listView3.ItemsSource = _character.KnownSpells;
listView4.ItemsSource = _character.AvailableCastings;
listView6.ItemsSource = _character.Spells.Where(f => f.IsCasted == false).OrderByDescending(k => k.Definition.Level);
listView7.ItemsSource = _character.Skills;
comboBox2.ItemsSource = _character.AvailableCastings;
comboBox1.ItemsSource = SpellEditWindow.Types;
comboBox4.ItemsSource = Rules.SkillsDefinition;
comboBox4.DisplayMemberPath = "Name";
ContentGrid.DataContext = _character;
textBox18.Text = _helper.CurrentTime.Date.AddDays(-7).ToString();
if (_character.ImagePath != null)
{
image1.Source = new BitmapImage(new Uri(AppDomain.CurrentDomain.BaseDirectory + "\\Images\\" + _character.ImagePath));
}
}
catch (Exception exc)
{
MessageBox.Show("Inicjalizacja się nie powiodła:" + exc.ToString());
}
}
示例15: OnNavigatedTo
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
{
string latest_updatex = IsolatedSettingsHelper.GetValue<string>("latest_update");
string latest_update_channelx = IsolatedSettingsHelper.GetValue<string>("latest_update_channel");
string latest_update_timex = IsolatedSettingsHelper.GetValue<string>("latest_update_time");
Helper helper = new Helper();
if (latest_updatex != null)
{
if (latest_updatex.Count() > 0)
latest_update.Text = latest_updatex + "\n" + latest_update_channelx.Remove(0, 1);
}
if (latest_update_timex == "" || latest_update_timex == null)
{
//do nothing.
}
else
{
DateTime date = Convert.ToDateTime(latest_update_timex);
latest_update_time.Text = helper.CalculateShareTime(date) + " ago.";
}
}