public async Task MaintainOrders(Initials Init) { #region 方式一 // 接收新进来的订单 NewOrderRequestHandle(Init); FutureOrderUpdate(Init); PositionUpdate(Init); #endregion #region 方式二 //// 接收新订单 //NewOrderRequestHandle2(Init); //// 处理成交 // CheckIsDeal(Init); //// 处理撤销 // ToCancleOrderUpdate(Init); //// 处理废单 // CheckIsNullOrder(Init); #endregion }
// /// <summary> // /// Returns the string presentation of the object // /// </summary> // /// <returns>String presentation of the object</returns> // public override string ToString() // { // var sb = new StringBuilder(); // sb.Append("class User {\n"); // sb.Append(" Id: ").Append(ContactId).Append("\n"); // sb.Append(" GivenName: ").Append(GivenName).Append("\n"); // sb.Append(" Surname: ").Append(Surname).Append("\n"); // sb.Append(" Active: ").Append(Active).Append("\n"); // sb.Append(" Initials: ").Append(Initials).Append("\n"); // sb.Append(" Email: ").Append(Email).Append("\n"); // sb.Append(" SmUserId: ").Append(SmUserId).Append("\n"); // sb.Append(" Guid: ").Append(AccountId).Append("\n"); // sb.Append(" SmAuthorizationDirectory: ").Append(UserType).Append("\n"); // sb.Append(" UserRoles: ").Append(UserRoles).Append("\n"); // sb.Append("}\n"); // return sb.ToString(); // } // /// <summary> // /// Returns the JSON string presentation of the object // /// </summary> // /// <returns>JSON string presentation of the object</returns> // public string ToJson() // { // return JsonConvert.SerializeObject(this, Formatting.Indented); // } // /// <summary> // /// Returns true if objects are equal // /// </summary> // /// <param name="obj">Object to be compared</param> // /// <returns>Boolean</returns> // public override bool Equals(object obj) // { // if (obj is null) { return false; } // if (ReferenceEquals(this, obj)) { return true; } // return obj.GetType() == GetType() && Equals((User)obj); // } /// <summary> /// Returns true if User instances are equal /// </summary> /// <param name="other">Instance of User to be compared</param> /// <returns>Boolean</returns> public bool Equals(User other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(( ContactId == other.ContactId || ContactId.Equals(other.ContactId) ) && ( GivenName == other.GivenName || GivenName != null && GivenName.Equals(other.GivenName) ) && ( Surname == other.Surname || Surname != null && Surname.Equals(other.Surname) ) && ( Active == other.Active || Active.Equals(other.Active) ) && ( Initials == other.Initials || Initials != null && Initials.Equals(other.Initials) ) && ( Email == other.Email || Email != null && Email.Equals(other.Email) ) && ( SmUserId == other.SmUserId || SmUserId != null && SmUserId.Equals(other.SmUserId) ) && ( AccountId == other.AccountId || AccountId != null && AccountId.Equals(other.AccountId) ) && ( UserType == other.UserType || UserType != null && UserType.Equals(other.UserType) ) && ( UserRoles == other.UserRoles || UserRoles != null && UserRoles.SequenceEqual(other.UserRoles) )); }
public void ExecuteSave() { bl.SetInitials(Initials.ToUpper()); bl.SetExchangeRate(ExchangeRate); Information = "Instillingerne er blevet gemt!"; RaisePropertyChanged("Information"); }
public static void Main() { //var db = SugarTools.GetInstance(); //db.DbFirst.Where("ConfigPars").CreateClassFile(@"D:\workspace\交易接口\总线\FutureTrade\Models", "FutureTrade.Models"); // 初始化 Initials Init = Funs.Init(); //var db = GetInstance(Set.SqlserverconnString, DbType.SqlServer); //Init.db.CodeFirst.InitTables(typeof(RequestClass)); MQServer mq = new MQServer(); //mq.RecoverData(Init); mq.ClientRequestHandle(Init); mq.HeartBeatWorker(Init); //mq.OrderStateWorker(Init); Console.ReadLine(); }
static void Main(string[] args) { // 初始化 Initials Init = Funs.Init(); MQServer mq = new MQServer(); // 恢复数据 mq.Recover(Init); // 维护订单状态 mq.MaintainOrders(Init); DateTime endTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 17, 00, 00); while (true) { if (DateTime.Now > endTime) { Environment.Exit(0); } try { Init.hsPack.Fun10000_heartBeat(Funs.CONFIG.token); //foreach (KeyValuePair<string, UserInfo> kv in Initials.UserDicts) //{ // if(kv.Value.token != null) // { // // 发送心跳 // Init.hsPack.Fun10000_heartBeat(kv.Value.token); // } //} //foreach (KeyValuePair<string, UserInfo> kv in Initials.UserDicts2) //{ // if (kv.Value.token != null) // { // // 发送心跳 // Init.hsPack2.Fun10000_heartBeat(kv.Value.token); // } //} } catch (Exception e) { Console.WriteLine(e.ToString()); } finally { Thread.Sleep(10000); } } //Console.WriteLine(" Press [enter] to exit."); //Console.ReadLine(); }
//overriding ToString() public override string ToString() { if (FirstName == null) { return("[DELETED]".LJ(18)); } return($"{(FirstName + " " + LastName).LJ(18)}{Initials.RJ(4)}{MathAvg.RJ(5)}{SciAvg.RJ(5)}"); }
public override string ToString() { if (FirstName == null) { return("* deleted *".LJ(13)); } return($"{(FirstName + " " + LastName).LJ(13)}: {Initials.RJ(5)} Math Avg: {MathAvg.RJ(5)} Sci Avg: {SciAvg.RJ(5)}"); }
// 初始化 恢复数据 public void RecoverData(Initials Init) { List <RequestClass> dt = Init.db.Ado.SqlQuery <RequestClass>("select a.* from requestclass a inner join (select entrust_no,MAX(id) maxid from OrderFlowVty where entrust_no!='0' group by entrust_no) b on a.id = b.maxid where orderState not in('5','7', '8', '9', 'F', 'E') or (orderState is null AND error_info is null)"); foreach (var request in dt) { MQServer.AlivedOrder.Add(request); } }
public override void Update(GameTime gameTime) { //"Chief, let's see if we can find a way to open this door." - Cortana if (!HasInputScore) { if (TheLastSliceGame.Instance.IsUserLoggedIn() && !HasLoggedOut) { TheLastSliceGame.Instance.GameService.Logout(); HasLoggedOut = true; } if (gameTime.TotalGameTime.TotalMilliseconds > CursorTimerMS.TotalMilliseconds) { ShowCursor = !ShowCursor; CursorTimerMS = TimeSpan.FromMilliseconds(gameTime.TotalGameTime.TotalMilliseconds + 500); } if (!String.IsNullOrEmpty(Initials) && Initials.Count() <= 3 && TheLastSliceGame.InputManager.IsInputPressed(Keys.Back)) { Initials = Initials.Remove(Initials.Length - 1); } if (Initials.Count() < 3) { Vector2 vector = Name.MeasureString(Initials); foreach (Keys key in ValidKeys) { if (TheLastSliceGame.InputManager.IsInputPressed(key)) { Initials += key.ToString(); break; } } } else { if (CustomWinStrings.Count() == 0 && TheLastSliceGame.InputManager.IsInputPressed(Keys.Enter)) { TheLastSliceGame.Instance.GameWinAsync(); HasInputScore = true; } } } else { if (TheLastSliceGame.Instance.IsUserLoggedIn() && !Posted) { TheLastSliceGame.Instance.PostScoreAsync(LastPlayerScore.ToString(), Initials); Posted = true; TheLastSliceGame.Instance.AppInsights.PostScoreSuccess(); } } ArrowLeft.Update(gameTime); ArrowRight.Update(gameTime); Menu.Update(gameTime); }
public override int GetHashCode() { unchecked { var hashCode = Name.GetHashCode(); hashCode = (hashCode * 397) ^ Initials.GetHashCode(); hashCode = (hashCode * 397) ^ Id; return(hashCode); } }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { // credit: http://stackoverflow.com/a/263416/677735 unchecked // Overflow is fine, just wrap { int hash = 41; // Suitable nullity checks hash = hash * 59 + ContactId.GetHashCode(); if (GivenName != null) { hash = hash * 59 + GivenName.GetHashCode(); } if (Surname != null) { hash = hash * 59 + Surname.GetHashCode(); } hash = hash * 59 + Active.GetHashCode(); if (Initials != null) { hash = hash * 59 + Initials.GetHashCode(); } if (Email != null) { hash = hash * 59 + Email.GetHashCode(); } if (SmUserId != null) { hash = hash * 59 + SmUserId.GetHashCode(); } if (AccountId != null) { hash = hash * 59 + AccountId.GetHashCode(); } if (UserType != null) { hash = hash * 59 + UserType.GetHashCode(); } if (UserRoles != null) { hash = hash * 59 + UserRoles.GetHashCode(); } return(hash); } }
public override bool Equals(object obj) { var other = obj as PersonalInfo; return(other != null && ((Initials != null)? Initials.Equals(other.Initials) : (other.Initials == null)) && ((LastNameAtBirth != null)? LastNameAtBirth.Equals(other.LastNameAtBirth) : (other.LastNameAtBirth == null)) && ((LastNameAtBirthPrefix != null)? LastNameAtBirthPrefix.Equals(other.LastNameAtBirthPrefix) : (other.LastNameAtBirthPrefix == null)) && BirthDate.Equals(other.BirthDate)); }
public void Initialize(Vector3Int mapSize) { GameObject space = GameObject.Find("QL_Space"), wall = GameObject.Find("QL_Wall"), goal = GameObject.Find("QL_Goal"); int k = 0; for (int z = mapSize.z - 1; z >= 0; z--) { for (int y = mapSize.y - 1; y >= 0; y--) { for (int x = 0; x < mapSize.x; x++) { space.transform.position = new Vector3(x, mapSize.y - 1 - y, mapSize.z - 1 - z); switch (map[z, y, x]) { case 'G': goal.transform.position = new Vector3(x, y, z); Spaces.Add(Object.Instantiate(space)); Finish = Object.Instantiate(goal); break; case 'W': wall.transform.position = new Vector3(x, y, z); Spaces.Add(Object.Instantiate(space)); Walls.Add(Object.Instantiate(wall)); break; case 'S': Spaces.Add(Object.Instantiate(space)); Initials.Add(k); break; } k++; } } } for (int i = 0; i < Spaces.Count; i++) { Spaces[i].name = "Position " + i; } for (int i = 0; i < Walls.Count; i++) { Walls[i].name = "Walls " + i; } Object.Destroy(space); Object.Destroy(wall); Object.Destroy(goal); }
public override void Draw(SpriteBatch spriteBatch) { TheLastSliceGame.Instance.IsMouseVisible = false; if (CustomWinStrings.Count > 0) { if (TheLastSliceGame.Instance.GameService.IsSuccessStatusCode) { DrawStrings(spriteBatch, CustomWinStrings.ToArray(), YouWin, 150, 40); } else { YouWinString[0] = CustomWinStrings[0].Replace("\"", "") + "#" + TryAgain; Posted = false; Initials = ""; HasInputScore = false; CustomWinStrings = new List <String>(); } } else { DrawStrings(spriteBatch, YouWinString, YouWin, 50, 40); // spriteBatch.DrawString(Text, "Score: " + LastPlayerScore, new Vector2(TheLastSliceGame.GameWidth / 2 - 60, 140), ColorYellow); DrawStrings(spriteBatch, EnterNameString, YouWin, 200, 40); if (!HasInputScore && Initials.Count() >= 3) { ArrowLeft.Draw(spriteBatch); ArrowRight.Draw(spriteBatch); Menu.Draw(spriteBatch); } if (HasInputScore && !TheLastSliceGame.Instance.IsUserLoggedIn()) { DrawStrings(spriteBatch, LoginString, YouWin, 500, 40); } int xPos = TheLastSliceGame.Instance.GameWidth / 2 - 110; for (int i = 0; i < Initials.Count(); i++) { spriteBatch.DrawString(Name, Initials.ElementAt(i).ToString(), new Vector2(xPos, 340), Color.White); if (i < 2) { xPos += 88; } } if (ShowCursor) { spriteBatch.DrawString(Name, "_", new Vector2(xPos, 350), Color.White); } } }
/// 接收新增订单 public void NewOrderRequestHandle(Initials Init) { EventingBasicConsumer consumer = new EventingBasicConsumer(channel2); consumer.Received += (model, ea) => { var body = ea.Body; try { var message = Encoding.UTF8.GetString(body); Console.WriteLine(message); RequestClass request = Newtonsoft.Json.JsonConvert.DeserializeObject <RequestClass>(message); //OrderChangePosition(Init, request.businessType, request.entrust_direction, request.futures_direction, request.entrust_no, request.code, request.entrust_amount); if (request.businessType == "0") { var pl = MQServer.AlivedOrder.Where(o => o.entrust_no == request.entrust_no).FirstOrDefault(); MQServer.AlivedOrder.Where(o => o.entrust_no == request.entrust_no).Take(1); pl.businessType = "0"; pl.clordId = request.clordId; MQServer.AlivedOrder.Add(pl); } else { MQServer.AlivedOrder.Add(request); } } catch (Exception e) { Console.WriteLine(e.ToString()); } finally { AckMsg(); } void AckMsg() { try { channel2.BasicAck(deliveryTag: ea.DeliveryTag, multiple: false); } catch (System.IO.IOException ioex) { AckMsg(); } } }; channel2.BasicConsume(queue: Funs.CONFIG.OrderStateQueueName, autoAck: false, consumer: consumer); } #endregion }
static void Main() { //Question-1 Console.WriteLine("Sum Checker::->"); SumOfNumbers sumOfNumbers = new SumOfNumbers(); Console.WriteLine("Enter First Number"); int num1 = int.Parse(Console.ReadLine()); Console.WriteLine("Enter Second Number"); int num2 = int.Parse(Console.ReadLine()); bool result = sumOfNumbers.SumNum(num1, num2); Console.WriteLine($"Your result is {result}."); //Question-2 Console.WriteLine(); Console.WriteLine("Points Calculator::->"); CalculatePoints calculatePoints = new CalculatePoints(); Console.Write("Enter the number of wins:"); int win = int.Parse(Console.ReadLine()); Console.Write("Enter the number of draws:"); int draw = int.Parse(Console.ReadLine()); Console.Write("Enter the number of loss:"); int loss = int.Parse(Console.ReadLine()); int totalPoints = calculatePoints.Points(win, draw, loss); Console.WriteLine($"The total point of your team is {totalPoints}"); //Question-3 Console.WriteLine(); Console.WriteLine("Read Initials::->"); Initials initials = new Initials(); Console.Write("Enter Your Name::"); string input = Console.ReadLine(); string resultInitials = initials.GetInitials(input); Console.WriteLine($"Your Initials is:: {resultInitials}"); }
static void Main() { //Question-1 Console.WriteLine("check the sum::->"); NumberSum numberSum = new NumberSum(); Console.WriteLine("Enter First Number"); int num1 = int.Parse(Console.ReadLine()); Console.WriteLine("Enter Second Number"); int num2 = int.Parse(Console.ReadLine()); bool result = numberSum.total(num1, num2); Console.WriteLine($"Your result is {result}."); //Question-2 Console.WriteLine(); Console.WriteLine("Calculate the teams point::->"); Calculator calculator = new Calculator(); Console.Write("Enter the number of wins:"); int win = int.Parse(Console.ReadLine()); Console.Write("Enter the number of draws:"); int draw = int.Parse(Console.ReadLine()); Console.Write("Enter the number of loss:"); int loss = int.Parse(Console.ReadLine()); int totalPoints = calculator.Points(win, draw, loss); Console.WriteLine($"The total point of your team is {totalPoints}"); //Question-3 Console.WriteLine(); Console.WriteLine("Enter Initialsd::->"); Initials initials = new Initials(); Console.Write("Enter Your Name::"); string input = Console.ReadLine(); string resultInitials = initials.GetInitials(input); Console.WriteLine($"Your Initials is:: {resultInitials}"); }
static void Main() { //1 Console.WriteLine("Sum Of Both Num :"); ReturnSums returnSums = new ReturnSums(); Console.WriteLine("Enter 1st Num:"); int n1 = int.Parse(Console.ReadLine()); Console.WriteLine("Enter 2nd Num:"); int n2 = int.Parse(Console.ReadLine()); bool total = returnSums.Sums(n1, n2); Console.WriteLine($"Your total is {total}."); //2 Console.WriteLine(); Console.WriteLine("Point:"); TeamPoints teamPoints = new TeamPoints(); Console.Write("Enter the number of wins:"); int win = int.Parse(Console.ReadLine()); Console.Write("Enter the number of draws:"); int draw = int.Parse(Console.ReadLine()); Console.Write("Enter the number of loss:"); int loss = int.Parse(Console.ReadLine()); int Point = teamPoints.Points(win, draw, loss); Console.WriteLine($"The points of team is {Point}"); //3 Console.WriteLine(); Console.WriteLine("Read Initials:"); Initials initials = new Initials(); Console.Write("Enter Your Name:"); string input = Console.ReadLine(); string resultInitials = initials.GetInitials(input); Console.WriteLine($"Your Initials is: {resultInitials}"); }
// 发布订单更新 public static void PublishMsg(RequestClass request, IModel channel, Initials Init) { try { string responsestring = Newtonsoft.Json.JsonConvert.SerializeObject(request); var responseBytes = Encoding.UTF8.GetBytes(responsestring); channel.BasicPublish(exchange: "", routingKey: request.queue_name, basicProperties: null, body: responseBytes); Init.db.Insertable(request).ExecuteCommand(); Console.WriteLine($"状态更新 :{responsestring}"); } catch (Exception e) { Console.WriteLine(e.ToString()); } }
/// <summary> /// Returns true if UserDetailsViewModel instances are equal /// </summary> /// <param name="other">Instance of UserDetailsViewModel to be compared</param> /// <returns>Boolean</returns> public bool Equals(UserDetailsViewModel other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Id == other.Id || Id.Equals(other.Id) ) && ( Active == other.Active || Active.Equals(other.Active) ) && ( GivenName == other.GivenName || GivenName != null && GivenName.Equals(other.GivenName) ) && ( Surname == other.Surname || Surname != null && Surname.Equals(other.Surname) ) && ( Initials == other.Initials || Initials != null && Initials.Equals(other.Initials) ) && ( Email == other.Email || Email != null && Email.Equals(other.Email) ) && ( Permissions == other.Permissions || Permissions != null && Permissions.SequenceEqual(other.Permissions) )); }
// 更新持仓变化 public async Task PositionUpdate(Initials Init) { int interval = int.Parse(Funs.CONFIG.interval); void LongTask() { while (true) { try { foreach (KeyValuePair <string, UserInfo> kv in Initials.UserDicts2) { //if (kv.Value.token != null) //{ FuturepositionQry_Input objFuturepositionQry_Input = new FuturepositionQry_Input(); objFuturepositionQry_Input.in_user_token = Funs.CONFIG.token; //objFuturepositionQry_Input.in_market_no = "7"; //objFuturepositionQry_Input.in_asset_no = kv.Value.asset_no; objFuturepositionQry_Input.in_combi_no = kv.Value.combi_no; //objFuturepositionQry_Input.in_account_code = kv.Value.account_code; var pos = Init.hsPack2.Fun31003_FuturepositionQry(objFuturepositionQry_Input); if (pos.Count > 0) { if (pos[0].out_stock_code != null) { Init.rClient.StringSet(kv.Key, Newtonsoft.Json.JsonConvert.SerializeObject(pos)); } } //} } } catch (Exception e) { Console.WriteLine(e.ToString()); } finally { Thread.Sleep(interval); } } } await Task.Factory.StartNew(() => LongTask(), TaskCreationOptions.LongRunning); }
public void SetDefaultCasing() { if (Initials != null) { Initials = Initials.ToUpper(); } if (FirstName != null) { FirstName = FirstName.ToInvariantTitleCase(); } if (SurnamePrefix != null) { SurnamePrefix = SurnamePrefix.ToLower(); } if (Surname != null) { Surname = Surname.ToInvariantTitleCase(); } }
public void PublishCancle(RequestClass request, IModel channel, Initials Init) { try { string responsestring = Newtonsoft.Json.JsonConvert.SerializeObject(request); var responseBytes = Encoding.UTF8.GetBytes(responsestring); channel.BasicPublish(exchange: "", routingKey: request.queue_name, basicProperties: null, body: responseBytes); Init.db.Insertable(request).ExecuteCommand(); if (request.entrust_no != null && request.entrust_no != "0") { //requestQueues.Add(request); channel.BasicPublish(exchange: "", routingKey: stateQueueName, basicProperties: null, body: responseBytes); } } catch (Exception e) { Console.WriteLine(e.ToString()); } }
public JsonValue ToJson(JsonSerializer serializer) { var json = new JsonObject(); Id.Serialize(json, serializer, "id"); Bio.Serialize(json, serializer, "bio"); FullName.Serialize(json, serializer, "fullName"); Initials.Serialize(json, serializer, "initials"); Username.Serialize(json, serializer, "username"); AvatarSource.Serialize(json, serializer, "avatarSource"); Email.Serialize(json, serializer, "email"); OneTimeMessagesDismissed.Serialize(json, serializer, "oneTimeMessagesDismissed"); if (Prefs != null) { json.Add("prefs/minutesBetweenSummaries", Prefs.MinutesBetweenSummaries); json.Add("prefs/colorBlind", Prefs.ColorBlind); } return(json); }
/// <summary> /// 心跳线程 /// </summary> /// <param name="Init"></param> /// <returns></returns> public async Task HeartBeatWorker(Initials Init) { void LongTask() { while (true) { try { DateTime EndTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 18, 00, 00); if (DateTime.Now > EndTime) { System.Environment.Exit(0); } Init.hsPack.Fun10000_heartBeat(Funs.CONFIG.token); //foreach (KeyValuePair<string,UserInfo> kv in Initials.UserDicts) //{ // if (kv.Value.token != null) // { // // 发送心跳 // Init.hsPack.Fun10000_heartBeat(kv.Value.token); // } //} } catch (Exception e) { Console.WriteLine(e.ToString()); } finally { Thread.Sleep(5000); } } } await Task.Factory.StartNew(() => LongTask(), TaskCreationOptions.LongRunning); }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { // credit: http://stackoverflow.com/a/263416/677735 unchecked // Overflow is fine, just wrap { int hash = 41; // Suitable nullity checks hash = hash * 59 + Id.GetHashCode(); hash = hash * 59 + Active.GetHashCode(); if (GivenName != null) { hash = hash * 59 + GivenName.GetHashCode(); } if (Surname != null) { hash = hash * 59 + Surname.GetHashCode(); } if (Initials != null) { hash = hash * 59 + Initials.GetHashCode(); } if (Email != null) { hash = hash * 59 + Email.GetHashCode(); } if (Permissions != null) { hash = hash * 59 + Permissions.GetHashCode(); } return(hash); } }
private void SearchButton_Click(object sender, RoutedEventArgs e) // Обработка кнопки "Найти" { try { ObservableCollection <Visitor> collection = new ObservableCollection <Visitor>(); Table.ItemsSource = collection; Initials initials = new Initials(SearchPerson.Text); foreach (var visitor in Visitors.visitors) { if (initials.SearchInitials(visitor)) { collection.Add(visitor); } } SearchPersonText.Visibility = Visibility.Collapsed; SearchPerson.Visibility = Visibility.Collapsed; SearchButton.Visibility = Visibility.Collapsed; Cancel.Visibility = Visibility.Collapsed; SearchPersonButton.IsEnabled = true; SearchAllButton.IsEnabled = true; } catch (ArgumentNullException) { } }
/// <summary> /// 初始化 /// </summary> /// <returns></returns> public static Initials Init() { #region 初始化:连接及登录 Login_Output_O32 logOut = null; SqlSugarClient db = SugarTools.GetInstance(); CONFIG = db.Queryable <ConfigPars>().First(); //db.DbFirst.Where("UserInfo").CreateClassFile(@"D:\workspace\交易接口\总线", "FutureServerState"); var UserList = db.Queryable <UserInfo>().ToList(); foreach (UserInfo user in UserList) { Initials.UserDicts.Add(user.combi_no, user); } foreach (UserInfo user in UserList) { Initials.UserDicts2.Add(user.combi_no, user); } HSPack_Syn hsPack = new HSPack_Syn(); // 连接 if (hsPack.InitT2()) { Console.WriteLine("连接成功"); Login(hsPack); } else { Console.WriteLine("连接失败"); } HSPack_Syn hsPack2 = new HSPack_Syn(); // 连接 if (hsPack2.InitT2()) { Console.WriteLine("hs2连接成功"); Login(hsPack2); } else { Console.WriteLine("hs2连接失败"); } #endregion #region redis ConnectionMultiplexer redis = ConnectionMultiplexer.Connect(Funs.CONFIG.redis); IDatabase rClient = redis.GetDatabase(); #endregion Initials Init = new Initials() { logOut = logOut, db = db, hsPack = hsPack, hsPack2 = hsPack2, rClient = rClient, }; return(Init); void Login(HSPack_Syn hs) { Login_Input_O32 objLogin_Input = new Login_Input_O32 { in_operator_no = Funs.CONFIG.operator_no, in_password = Funs.CONFIG.O32Psw, in_station_add = Funs.CONFIG.station_add, in_ip_address = Funs.CONFIG.ip_address, in_mac_address = hsPack.GetMac(true), authorization_id = Funs.CONFIG.authorization_id, app_id = Funs.CONFIG.app_id, authorize_code = Funs.CONFIG.authorize_code, port_id = Funs.CONFIG.port_id, }; logOut = hs.Fun10001_Login_S(objLogin_Input); if (logOut.out_error_no == "0") { Funs.CONFIG.token = logOut.out_user_token; Console.WriteLine($"{Funs.CONFIG.operator_no} 登录成功"); } else { Console.WriteLine($"{Funs.CONFIG.operator_no} {logOut.out_error_info}"); } //foreach (KeyValuePair<string, UserInfo> kv in Initials.UserDicts2) //{ // Login_Input_O32 objLogin_Input = new Login_Input_O32 // { // in_operator_no = kv.Key, // in_password = kv.Value.PASSWORD, // in_station_add = ConfigurationManager.AppSettings["station_add"], // in_ip_address = ConfigurationManager.AppSettings["ip_address"], // in_mac_address = hsPack.GetMac(true), // authorization_id = ConfigurationManager.AppSettings["authorization_id"], // app_id = ConfigurationManager.AppSettings["app_id"], // authorize_code = ConfigurationManager.AppSettings["authorize_code"], // port_id = ConfigurationManager.AppSettings["port_id"], // }; // logOut = hs.Fun10001_Login_S(objLogin_Input); // if (logOut.out_error_no == "0") // { // kv.Value.token = logOut.out_user_token; // Console.WriteLine($"{kv.Key} 登录成功"); // } // else // { // Console.WriteLine($"{kv.Key} {logOut.out_error_info}"); // } //} } }
/// <summary> /// Returns true if User instances are equal /// </summary> /// <param name="other">Instance of User to be compared</param> /// <returns>Boolean</returns> public bool Equals(User other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Id == other.Id || Id.Equals(other.Id) ) && ( GivenName == other.GivenName || GivenName != null && GivenName.Equals(other.GivenName) ) && ( Surname == other.Surname || Surname != null && Surname.Equals(other.Surname) ) && ( Active == other.Active || Active.Equals(other.Active) ) && ( Initials == other.Initials || Initials != null && Initials.Equals(other.Initials) ) && ( Email == other.Email || Email != null && Email.Equals(other.Email) ) && ( SmUserId == other.SmUserId || SmUserId != null && SmUserId.Equals(other.SmUserId) ) && ( Guid == other.Guid || Guid != null && Guid.Equals(other.Guid) ) && ( SmAuthorizationDirectory == other.SmAuthorizationDirectory || SmAuthorizationDirectory != null && SmAuthorizationDirectory.Equals(other.SmAuthorizationDirectory) ) && ( UserRoles == other.UserRoles || UserRoles != null && UserRoles.SequenceEqual(other.UserRoles) )); }
public void Recover(Initials Init) { // 恢复未完成委托流水 RecoverData(Init); }