public static PagedList <BlackList> GetListByPageForMac(int page, ValueView vv) { PagerQuery pq = new PagerQuery(); pq.CurrentPage = page; pq.PageSize = 10; // int StartRowNumber = (page - 1) * pq.PageSize; if (!string.IsNullOrEmpty(vv.Value)) { pq.RecordCount = DAL.PagedListDAL <BlackList> .GetRecordCount(string.Format(@"select count(0) from BG_BanMacList where Mac = '{0}'", vv.Value), sqlconnectionString); pq.Sql = string.Format(@"select * from BG_BanMacList where Mac = '{2}'order by CreateTime limit {0}, {1}", pq.StartRowNumber, pq.PageSize, vv.Value); } else { pq.RecordCount = DAL.PagedListDAL <BlackList> .GetRecordCount(@"select count(0) from BG_BanMacList", sqlconnectionString); pq.Sql = string.Format(@"select * from BG_BanMacList order by CreateTime limit {0}, {1}", pq.StartRowNumber, pq.PageSize); } PagedList <BlackList> obj = new PagedList <BlackList>(DAL.PagedListDAL <BlackList> .GetListByPage(pq, sqlconnectionString), pq.CurrentPage, pq.PageSize, pq.RecordCount); return(obj); }
private int CreateEmptyProject() { var projectName = new ValueView <string>($"[1/4] {":drum:".Emoji()} Project Name:").WithDefault(Directory.GetCurrentDirectory().Split('/').Last()).Read(); var version = new ValueView <string>($"[2/4] {":boom:".Emoji()} Project Version:").WithDefault("0.0.0").Read(); var desc = new ValueView <string>($"[3/4] {":balloon:".Emoji()} Project Description:").WithDefault("").Read(); var author = new ValueView <string>($"[4/4] {":skull:".Emoji()} Project Author:").WithDefault("").Read(); var dir = Directory.GetCurrentDirectory(); var proj = new AncientProjectFile { name = projectName, version = version, author = author }; proj.scripts.Add($"start", "echo 1"); File.WriteAllText($"{Path.Combine(dir, $"{projectName}.rune.json")}", JsonConvert.SerializeObject(proj, Formatting.Indented)); return(0); }
public static ValueView <T> WithDefault <T>(this ValueView <T> @this, T def) { @this.AutocompleteDefaultValue = false; @this.AcceptDefaultValue = true; @this.DefaultValue = def; return(@this); }
public AddPersonView() { firstNameView = new StringView("First Name:"); lastNameView = new StringView("Last Name:"); birthdayView = new ValueView <DateTime>("Birthday:"); phoneNumberView = new StringView("Phone Number:"); heightView = new FloatView("Height (in meters)"); preferedBeveragesRead = new StringListView("Prefered Beverages:"); }
/// <summary> /// The QuickRead static method is used to read values from the console. /// </summary> private static void RunExample() { string firstName = ValueView <string> .QuickRead("First Name:"); string lastName = ValueView <string> .QuickRead("Last Name:"); // Display th read values. CustomConsole.WriteLine(); CustomConsole.WriteLine("Hi, {0} {1}!", firstName, lastName); }
private static void Measure(Action action) { Stopwatch stopwatch = Stopwatch.StartNew(); action(); stopwatch.Stop(); Console.WriteLine(); ValueView <string> .QuickWrite("Elapsed Time:", stopwatch.Elapsed.ToString()); }
public ActionResult MemberManagementListForStopIP(ValueView model, Dictionary <string, string> queryvalues) //封IMEI { // int page = queryvalues.ContainsKey("page") ? Convert.ToInt32(queryvalues["page"]) : 10; int _page = queryvalues.ContainsKey("page") ? Convert.ToInt32(queryvalues["page"]) : 1; // string userID = queryvalues.ContainsKey("Value") ? queryvalues["Value"] : ""; //用户ID // string type = queryvalues.ContainsKey("type") ? queryvalues["type"] : ""; //用户ID // ViewData["title"] = "IP"; //(CurrentPage - 1) * PageSize model.DataList = MemberCenterBLL.GetListByPageFor(_page, model); return(View(model)); }
public void Execute() { StringView.QuickWrite("First Name:", "John"); StringView.QuickWrite("Last Name:", "Doe"); Int32View.QuickWrite("Age:", 25); // or ValueView <string> .QuickWrite("First Name:", "John"); ValueView <string> .QuickWrite("Last Name:", "Doe"); ValueView <int> .QuickWrite("Age:", 25); }
/// <summary> /// This example creates instances for each input value and sets different label colors. /// Each instance reads a different type of value (string, int, DateTime, float) /// </summary> private static void RunExample() { // Create the input controls ValueView <int> ageView = new ValueView <int>("Age:"); ageView.Label.ForegroundColor = ConsoleColor.DarkGreen; // Read values using the input controls int age = ageView.Read(); // Display th read values. CustomConsole.WriteLine(); CustomConsole.WriteLine("You are {0} years old.", age); }
public static PagedList <LoginRepeat> GetRepeatByPage(ValueView vv) { PagerQuery pq = new PagerQuery(); pq.CurrentPage = vv.Page; pq.PageSize = 5; pq.RecordCount = DAL.PagedListDAL <LoginRepeat> .GetRecordCount(string.Format(@"select count(1) from(select ip from " + database1 + @".V_LoginRecord where LoginTime >= '{0}' and LoginTime < '{1}' group by ip ,date(LoginTime) having count(distinct userid) > 3 ) t", vv.StartDate, vv.ExpirationDate), sqlconnectionString); pq.Sql = string.Format(@"select ip as IP ,count(distinct userid) as Account ,date(LoginTime) as LoginTime ,group_concat(distinct userid separator '_') as UserID from " + database1 + @".V_LoginRecord where LoginTime >= '{3}' and LoginTime < '{4}' group by ip ,date(LoginTime) having count(distinct userid) > 3 order by 3 ,2 desc limit {0}, {1}", pq.StartRowNumber, pq.PageSize, vv.Value, vv.StartDate, vv.ExpirationDate); PagedList <LoginRepeat> obj = new PagedList <LoginRepeat>(DAL.PagedListDAL <LoginRepeat> .GetListByPage(pq, sqlconnectionString), pq.CurrentPage, pq.PageSize, pq.RecordCount); return(obj); }
private static void RunExample() { ValueView <int> numberView = new ValueView <int>("Number ({0}):"); numberView.AcceptDefaultValue = true; numberView.DefaultValue = 42; CustomConsole.WriteLine("Just hit enter. The default value, 42, is returned by the ValueView control."); CustomConsole.WriteLine(); int number = numberView.Read(); CustomConsole.WriteLine(); CustomConsole.WriteLine("You selected {0}.", number); }
public ActionResult MemberManagementListForStopIMEI(ValueView model, Dictionary <string, string> queryvalues) //封IMEI { // int page = queryvalues.ContainsKey("page") ? Convert.ToInt32(queryvalues["page"]) : 10; int _page = queryvalues.ContainsKey("page") ? Convert.ToInt32(queryvalues["page"]) : 1; // string userID = queryvalues.ContainsKey("Value") ? queryvalues["Value"] : ""; //用户ID // string type = queryvalues.ContainsKey("type") ? queryvalues["type"] : ""; //用户ID //if (!string.IsNullOrEmpty(userID)) //{ // PagedList<Role> mm = MemberCenterBLL.GetAllListByPage(page, userID); // return PartialView("MemberManagementList", mm); //} // ViewData["title"] = "黑名单"; model.DataList = MemberCenterBLL.GetListByPageForMac(_page, model); return(View(model)); }
/// <summary> /// This example creates instances for each input value and sets different label colors. /// Each instance reads a different type of value (string, int, DateTime, float) /// </summary> private static void RunExample() { // Create the input controls ValueView <string> firstNameView = new ValueView <string>("First Name:"); firstNameView.Label.ForegroundColor = ConsoleColor.Cyan; ValueView <string> lastNameView = new ValueView <string>("Last Name:"); lastNameView.Label.ForegroundColor = ConsoleColor.Cyan; // Read values using the input controls string firstName = firstNameView.Read(); string lastName = lastNameView.Read(); // Display the read values. CustomConsole.WriteLine(); CustomConsole.WriteLine("Hi, {0} {1}!", firstName, lastName); }
public HangManGame(IWordList wordList) { // DATA allTheWords = wordList; currentWord = new Word(allTheWords.PickRandomWord()); hangingMan = new HangingMan(); incorrectGuesses = new HashSet <string>(); // CONTROLS incorrectGuessesControl = new IncorrectGuessesControl(); currentWordControl = new CurrentWordControl(); currentWordControl.ChangeDisplayedWord(currentWord.GetWord()); nextGuessControl = new ValueView <char>("Enter your next guess: ") { TypeConversionErrorMessage = "Please enter only a single letter." }; hangManControl = new HangManControl(hangingMan); gameOverScreen = new GameOverScreen(); }
public static PagedList <RedisterIP> GetListByPage(int page, ValueView model, string StartDate, string ExpirationDate) { PagerQuery pq = new PagerQuery(); pq.CurrentPage = page; pq.PageSize = 10; if (string.IsNullOrWhiteSpace(model.Value)) { pq.RecordCount = DAL.PagedListDAL <RedisterIP> .GetRecordCount(string.Format(@"select count(0) from BG_RedisterIP"), sqlconnectionString); pq.Sql = string.Format(@"select * from BG_RedisterIP order by ModifyTime desc limit {0}, {1}", pq.StartRowNumber, pq.PageSize); } else { pq.RecordCount = DAL.PagedListDAL <RedisterIP> .GetRecordCount(string.Format(@"select count(0) from BG_RedisterIP where IP = '{0}'", model.Value), sqlconnectionString); pq.Sql = string.Format(@"select * from BG_RedisterIP where IP = '{2}' order by ModifyTime desc limit {0}, {1}", pq.StartRowNumber, pq.PageSize, model.Value); } PagedList <RedisterIP> obj = new PagedList <RedisterIP>(DAL.PagedListDAL <RedisterIP> .GetListByPage(pq, sqlconnectionString), pq.CurrentPage, pq.PageSize, pq.RecordCount); return(obj); }
private void ChangePrompter() { ValueView <string> valueView = new ValueView <string>("New Prompter Text:"); prompter.Text = valueView.Read(); }
public static PagedList <LoginRecord> GetListByPage(int page, ValueView vv) { PagerQuery pq = new PagerQuery(); pq.CurrentPage = page; pq.PageSize = 10; if (vv.Type == seachType.IP登陆玩家) { pq.RecordCount = DAL.PagedListDAL <LoginRecord> .GetRecordCount(string.Format(@"select count(1) from(select ip from " + database1 + @".V_LoginRecord where LoginTime >= '{0}' and LoginTime < '{1}' group by ip ,date(LoginTime) having count(distinct userid) > 3 ) t", vv.StartDate, vv.ExpirationDate), sqlconnectionString); pq.Sql = string.Format( @"select ip as IP ,count(distinct userid) as Acc ,date(LoginTime) as LoginTime ,group_concat(distinct userid separator '_') as UserIDS ,-1 Flag from " + database1 + @".V_LoginRecord where LoginTime >= '{3}' and LoginTime < '{4}' group by ip ,date(LoginTime) having count(distinct userid) > 3 order by LoginTime ,Acc desc limit {0}, {1}" , pq.StartRowNumber, pq.PageSize, vv.Value, vv.StartDate, vv.ExpirationDate); } else if (!string.IsNullOrEmpty(vv.Value)) { switch (vv.Type) { case seachType.NULL: pq.RecordCount = DAL.PagedListDAL <LoginRecord> .GetRecordCount(string.Format(@"select count(0) from V_LoginRecord where UserID = '{0}' and LoginTime between '{1}' and '{2}'", vv.Value.Trim(), vv.StartDate, vv.ExpirationDate), sqlconnectionString); pq.Sql = string.Format( @"select a.*,b.CreateIP from (select * from V_LoginRecord where UserID = '{2}' and LoginTime between '{3}' and '{4}' order by V_LoginRecord.LoginTime desc limit {0}, {1} ) a join Role b on a.userid = b.id" , pq.StartRowNumber, pq.PageSize, vv.Value.Trim(), vv.StartDate, vv.ExpirationDate); break; case seachType.IP地址: pq.RecordCount = DAL.PagedListDAL <LoginRecord> .GetRecordCount(string.Format(@"select count(0) from V_LoginRecord where IP = '{0}' and LoginTime between '{1}' and '{2}'", vv.Value.Trim(), vv.StartDate, vv.ExpirationDate), sqlconnectionString); pq.Sql = string.Format( @"select a.*,b.CreateIP from (select * from V_LoginRecord where IP = '{2}' and LoginTime between '{3}' and '{4}' order by V_LoginRecord.LoginTime desc limit {0}, {1} ) a join Role b on a.userid = b.id" , pq.StartRowNumber, pq.PageSize, vv.Value.Trim(), vv.StartDate, vv.ExpirationDate); break; case seachType.Mac地址: pq.RecordCount = DAL.PagedListDAL <LoginRecord> .GetRecordCount(string.Format(@"select count(0) from V_LoginRecord where Mac = '{0}' and LoginTime between '{1}' and '{2}'", vv.Value.Trim(), vv.StartDate, vv.ExpirationDate), sqlconnectionString); pq.Sql = string.Format( @"select a.*,b.CreateIP from (select * from V_LoginRecord where Mac = '{2}' and LoginTime between '{3}' and '{4}' order by V_LoginRecord.LoginTime desc limit {0}, {1} ) a join Role b on a.userid = b.id" , pq.StartRowNumber, pq.PageSize, vv.Value.Trim(), vv.StartDate, vv.ExpirationDate); break; case seachType.会员账号: pq.RecordCount = DAL.PagedListDAL <LoginRecord> .GetRecordCount(string.Format(@"select count(0) from V_LoginRecord a join Role b on a.UserID = b.ID and b.Account = '{0}' where LoginTime between '{1}' and '{2}'", vv.Value.Trim(), vv.StartDate, vv.ExpirationDate), sqlconnectionString); pq.Sql = string.Format( @"select a.* ,b.CreateIP from V_LoginRecord a join Role b on a.UserID = b.ID and b.Account = '{2}' where a.LoginTime between '{3}' and '{4}' order by a.LoginTime desc limit {0}, {1}" , pq.StartRowNumber, pq.PageSize, vv.Value.Trim(), vv.StartDate, vv.ExpirationDate); break; case seachType.会员昵称: pq.RecordCount = DAL.PagedListDAL <LoginRecord> .GetRecordCount(string.Format(@"select count(0) from V_LoginRecord where NickName = '{0}' and LoginTime between '{1}' and '{2}'", vv.Value.Trim(), vv.StartDate, vv.ExpirationDate), sqlconnectionString); pq.Sql = string.Format( @"select a.*,b.CreateIP from (select * from V_LoginRecord where NickName = '{2}' and LoginTime between '{3}' and '{4}' order by V_LoginRecord.LoginTime desc limit {0}, {1} ) a join Role b on a.userid = b.id" , pq.StartRowNumber, pq.PageSize, vv.Value.Trim(), vv.StartDate, vv.ExpirationDate); break; default: break; } } else { pq.RecordCount = DAL.PagedListDAL <LoginRecord> .GetRecordCount(string.Format(@"select count(0) from V_LoginRecord where LoginTime between '{0}' and '{1}'", vv.StartDate, vv.ExpirationDate), sqlconnectionString); pq.Sql = string.Format( @"select a.*,b.CreateIP from (select * from V_LoginRecord where LoginTime between '{2}' and '{3}' order by LoginTime desc limit {0}, {1} ) a join Role b on a.userid = b.id" , pq.StartRowNumber, pq.PageSize, vv.StartDate, vv.ExpirationDate); } //if (string.IsNullOrWhiteSpace(vv.Value)) //{ // pq.RecordCount = DAL.PagedListDAL<LoginRecord>.GetRecordCount(string.Format(@"select count(0) from V_LoginRecord where LoginTime between '{1}' and '{2}'", vv.Value, vv.StartDate, vv.ExpirationDate), sqlconnectionString); // pq.Sql = string.Format(@"select b.* from(select IP from V_LoginRecord group by IP having count(IP) > 1)a join V_LoginRecord b on a.IP = b.IP where LoginTime between '{3}' and '{4}' order by a.IP desc,LoginTime desc limit {0}, {1}", pq.StartRowNumber, pq.PageSize, vv.Value, vv.StartDate, vv.ExpirationDate); //} //select b.* from(select ip from V_LoginRecord group by IP having count(ip) > 1)a join V_LoginRecord b on a.ip = b.IP order by a.IP desc; //pq.Sql = string.Concat(pq.Sql, " order by IP desc"); PagedList <LoginRecord> obj = new PagedList <LoginRecord>(DAL.PagedListDAL <LoginRecord> .GetListByPage(pq, sqlconnectionString), pq.CurrentPage, pq.PageSize, pq.RecordCount); return(obj); }
public ConsoleReadPage(string caption) { input = new ValueView <string>(caption); input.CursorPositionChanged = OnCursorPositionChanged; }
public object Display() { List <string> values = new List <string>(); questions.ForEach(input => { Type type = input.ItemType; if (string.IsNullOrEmpty(input.ValidationErrorMessage)) { input.ValidationErrorMessage = "Input is not in correct format"; } switch (type.Name) { case "Int32": var valueViewInt = new ValueView <int>(input.Question); valueViewInt.CursorPositionChanged = OnCursorPositionChanged; valueViewInt.Label.ForegroundColor = captionColor; valueViewInt.TypeConversionErrorMessage = input.ValidationErrorMessage; valueViewInt.CustomParser = delegate(string inputValue) { if (int.TryParse(inputValue, out int result)) { if (input.Validator != null) { if (!input.Validator(inputValue)) { if (!string.IsNullOrEmpty(input.ValidationErrorMessage)) { throw new Exception(input.ValidationErrorMessage); } } } } else { throw new Exception(input.ValidationErrorMessage); } return(result); }; values.Add(valueViewInt.Read().ToString()); break; case "String": var valueViewString = new ValueView <string>(input.Question); valueViewString.CursorPositionChanged = OnCursorPositionChanged; valueViewString.Label.ForegroundColor = captionColor; valueViewString.TypeConversionErrorMessage = input.ValidationErrorMessage; valueViewString.CustomParser = delegate(string inputValue) { if (!string.IsNullOrEmpty(inputValue)) { if (input.Validator != null) { if (!input.Validator(inputValue)) { if (!string.IsNullOrEmpty(input.ValidationErrorMessage)) { throw new Exception(input.ValidationErrorMessage); } } } } else { throw new Exception(input.ValidationErrorMessage); } return(inputValue); }; values.Add(valueViewString.Read().ToString()); break; } }); return(values); }
public static PagedList <BlackList> GetListByPageFor(int page, ValueView vv) { return(DAL.MemberCenterDAL.GetListByPageFor(page, vv)); }