// Событие нажатия на ссылку private void Hyperlink_Click(object sender, RoutedEventArgs e) { Hyperlink hyperlink = (e.OriginalSource as Hyperlink); if (hyperlink.Name == "Company") { if (cbCompany.SelectedItem != null) { CardClient cardClient = cbCompany.SelectedItem as CardClient; string info = String.Format("Название компании: {0}\nСтана: {1}\nОбласть: {2}\nГород: {3}\nКарточа создана: {4}", cardClient.NameCompany, cardClient.City.Area.Country.Name, cardClient.City.Area.Name, cardClient.City.Name, cardClient.CreateCard); MessageService.MetroMessageDialog("Информация о компании", info); } NavigationService.StopLoading(); return; } int id = Convert.ToInt32(hyperlink.Tag); if (id > 0) { Application.Current.Properties.Add("id", id); } else { NavigationService.StopLoading(); } }
private void Awake() { Global.Instance.scene = SceneType.MenuScene;//切换场景变量 Global.Instance.activedSceneManager = this; //尝试获取网络端口 try { cardClient = GameObject.FindGameObjectWithTag(Tags.Networks).GetComponent<CardClient>(); RequestPlayerInfo();//获取角色信息 } catch (Exception ex) { LogsSystem.Instance.Print(ex.ToString()); } //获取功能按键 //StartButton = GameObject.Find("GameStart"); //聊天窗初始化 chatList = GameObject.Find("Chatting/ChattingList").GetComponent<UITextList>(); if (chatList != null) { chatScroll = chatList.scrollBar as UIScrollBar; chatScroll.alpha = 0.01f; } //角色信息获取 coinLabel = GameObject.Find("Economy/Coin/Sprite/Num").GetComponent<UILabel>(); gemLabel = GameObject.Find("Economy/Gem/Sprite/Num").GetComponent<UILabel>(); playerNameLabel = GameObject.Find("Head/Name").GetComponent<UILabel>(); levelLabel = GameObject.Find("Head/Head-bg/Level").GetComponent<UILabel>(); //信息控件获取 //infoPanel = GameObject.Find("Frame/Background/InfoPanel"); cardListGrid = GameObject.Find("Frame/Background/InfoPanel/CardContainer/CardList/Grid"); }
// Событие изменения компании private void cbCompany_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (cbCompany.SelectedItem != null) { CardClient cardClient = cbCompany.SelectedItem as CardClient; tbCompanyID.Text = cardClient.ID.ToString(); if (cardClient.ID != 0) { tbPostPeople.Visibility = cbPostPeople.Visibility = Visibility.Visible; cbPostPeople.ItemsSource = cardClient.People.Select(a => a.PostPeople); cbPeople.ItemsSource = _databasenEtities.People.Where(a => a.ID_CardClient == cardClient.ID).ToArray(); cbPostPeople.SelectedIndex = 0; cbPeople.SelectedIndex = 0; } else { cbPeople.ItemsSource = _databasenEtities.People.ToArray(); tbPostPeople.Visibility = cbPostPeople.Visibility = Visibility.Collapsed; } } else { tbPostPeople.Visibility = cbPostPeople.Visibility = Visibility.Collapsed; } }
// Удаление клиента private async void dgClient_KeyUp(object sender, KeyEventArgs e) { if (e.Key == Key.Delete && dgPeople.SelectedItem != null) { MessageDialogResult dialogResult = await MessageService.MetroMessageDialogQuestion("Подтверждение удаления", "Вы действительно хотите удалить выбранный элемент?"); if (dialogResult == MessageDialogResult.Affirmative) { try { People people = dgPeople.SelectedItem as People; CardClient cardClient = people.CardClient; _databasenEtities.People.Remove(people); if (cardClient.People.Count == 0) { _databasenEtities.CardClient.Remove(cardClient); } await _databasenEtities.SaveChangesAsync(); People thisPeople = gGeneralInfo.DataContext as People; dgPeople.ItemsSource = _databasenEtities.People.Where(a => a.ID_CardClient == thisPeople.ID_CardClient && a.ID != thisPeople.ID).ToArray(); } catch (Exception ex) { MessageService.MetroMessageDialogError(ex.Message); } } } }
// Событие изменения компании private void cbCompany_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (cbCompany.SelectedItem != null) { CardClient cardClient = cbCompany.SelectedItem as CardClient; if (cardClient.ID != 0) { tbPostPeople.Visibility = cbPostPeople.Visibility = Visibility.Visible; cbPostPeople.ItemsSource = cardClient.People.Select(a => a.PostPeople); cbPeople.ItemsSource = _databasenEtities.People.Where(a => a.ID_CardClient == cardClient.ID).ToArray(); cbPostPeople.SelectedIndex = 0; cbPeople.SelectedIndex = 0; } else { List <People> peopleList = new List <People> { new People() }; peopleList.AddRange(_databasenEtities.People.ToArray()); cbPeople.ItemsSource = peopleList; tbPostPeople.Visibility = cbPostPeople.Visibility = Visibility.Collapsed; } } else { tbPostPeople.Visibility = cbPostPeople.Visibility = Visibility.Collapsed; } }
public void GetCard_Should_RaiseExceptionIfTokenSignedByWrongKey() { var jwt = JwtSignedByWrongApiKey(faker.Random.AlphaNumeric(15)); var client = new CardClient(AppSettings.CardsServiceAddress); Assert.ThrowsAsync <ClientException>( async() => await client.GetCardAsync(faker.CardId(), jwt.ToString())); }
void Awake() { GameObject network = GameObject.FindGameObjectWithTag(Tags.Networks); if (network != null) client = network.GetComponent<CardClient>(); else LogsSystem.Instance.Print("请从StartScene开始游戏", LogLevel.ERROR); }
public void PublishCard_Should_RaiseExceptionIfTokenSignedByWrongKey() { var identity = faker.Random.AlphaNumeric(15); var jwt = JwtSignedByWrongApiKey(identity); var client = new CardClient(AppSettings.CardsServiceAddress); Assert.ThrowsAsync <ClientException>( async() => await client.PublishCardAsync(GenerateRawSignedModel(identity), jwt.ToString())); }
public void SearchCard_Should_RaiseExceptionIfTokenSignedByWrongKeyAsync() { var jwt = JwtSignedByWrongApiKey(faker.Random.AlphaNumeric(15)); System.Console.WriteLine("VirgilCardsServiceAddress=" + AppSettings.CardsServiceAddress); var client = new CardClient(AppSettings.CardsServiceAddress); Assert.ThrowsAsync <ClientException>( async() => await client.SearchCardsAsync(faker.Random.AlphaNumeric(20), jwt.ToString())); }
private void Awake() { Global.Instance.scene = SceneType.MenuScene;//切换场景变量 Global.Instance.activedSceneManager = this; //尝试获取网络端口 try { cardClient = GameObject.FindGameObjectWithTag(Tags.Networks).GetComponent<CardClient>(); RequestPlayerInfo();//获取角色信息 } catch (Exception ex) { LogsSystem.Instance.Print(ex.ToString()); } //获取功能按键 //StartButton = GameObject.Find("GameStart"); //聊天窗初始化 chatList = GameObject.Find("Chatting/ChattingList").GetComponent<UITextList>(); if (chatList != null) { chatScroll = chatList.scrollBar as UIScrollBar; chatScroll.alpha = 0.01f; } //角色信息获取 coinLabel = GameObject.Find("Economy/Coin/Sprite/Num").GetComponent<UILabel>(); gemLabel = GameObject.Find("Economy/Gem/Sprite/Num").GetComponent<UILabel>(); playerNameLabel = GameObject.Find("Head/Name").GetComponent<UILabel>(); levelLabel = GameObject.Find("Head/Head-bg/Level").GetComponent<UILabel>(); //信息控件获取 //infoPanel = GameObject.Find("Frame/Background/InfoPanel"); cardListGrid = GameObject.Find("Frame/Background/InfoPanel/CardContainer/CardList/Grid"); //卡片背包面板 cardInventoryPanel = GameObject.Find("CardInventory").GetComponent<UIPanel>(); cardInventoryButtonLowlay = GameObject.Find("CardInventory/Background/Feature/Button-lowlay"); heroInfoUsingList = GameObject.Find("CardInventory/Background/Main/HeroInfo/UsingHeros/Scroll View/Grid").GetComponent<UIGrid>(); heroInfoInvList = GameObject.Find("CardInventory/Background/Main/HeroInfo/InvHeros/Scroll View/Grid").GetComponent<UIGrid>(); //卡片背包标签页 ci_PlayerInfo = GameObject.Find("CardInventory/Background/Main/PlayerInfo"); ci_HeroInfo = GameObject.Find("CardInventory/Background/Main/HeroInfo"); ci_GuideInfo = GameObject.Find("CardInventory/Background/Main/GuideInfo"); ci_InvInfo = GameObject.Find("CardInventory/Background/Main/InvInfo"); //玩家页 pp_PlayerName = GameObject.Find("CardInventory/Background/Main/PlayerInfo/Head/PlayerName").GetComponent<UILabel>(); pp_PlayerLevel = GameObject.Find("CardInventory/Background/Main/PlayerInfo/Head/PlayerLevel").GetComponent<UILabel>(); pp_PlayerCoin = GameObject.Find("CardInventory/Background/Main/PlayerInfo/Head/PlayerCoin").GetComponent<UILabel>(); pp_PlayerGem = GameObject.Find("CardInventory/Background/Main/PlayerInfo/Head/PlayerGem").GetComponent<UILabel>(); pp_HeroGrid = GameObject.Find("CardInventory/Background/Main/PlayerInfo/CardInfo/Heros/Scroll View/Grid").GetComponent<UIGrid>(); pp_ItemGrid = GameObject.Find("CardInventory/Background/Main/PlayerInfo/CardInfo/Items/Scroll View/Grid").GetComponent<UIGrid>(); }
private void Awake() { Global.Instance.scene = SceneType.LoginScene;//切换场景变量 Global.Instance.activedSceneManager = this; GameObject network = GameObject.FindGameObjectWithTag(Tags.Networks); if (network != null) { cardClient = network.GetComponent<CardClient>(); } else { LogsSystem.Instance.Print("请从StartScene开始游戏", LogLevel.ERROR); } gameVersion = GameObject.Find("MainPanel/Version").GetComponent<UILabel>(); }
public void PublishCard_Should_RaiseExceptionIfTokenIdentityDiffersFromModelIdentity() { var jwt = GenerateJwt( faker.Random.AlphaNumeric(15), (PrivateKey)IntegrationHelper.ApiPrivateKey(), AppSettings.ApiPublicKeyId ); var client = new CardClient(AppSettings.CardsServiceAddress); Assert.ThrowsAsync <ClientException>( async() => await client.PublishCardAsync( GenerateRawSignedModel(faker.Random.AlphaNumeric(15)), jwt.ToString()) ); }
private void Awake() { cardClient = GameObject.FindGameObjectWithTag(Tags.Networks).GetComponent<CardClient>(); gameClient = GameClient.Instance; loginHandler = new LoginHandler(); chatHandler = new ChatHandler(); playerInfoHandler = new PlayerInfoHandler(); cardInfoHandler = new CardInfoHandler(); gameDataHandler = new TCPGameDataHandler(); if (cardClient != null) { udpMessageList = cardClient.GetMessageList(); } else { LogsSystem.Instance.Print("UDP数据管理器不存在", LogLevel.ERROR); } if (gameClient != null) { tcpMessageList = gameClient.GetGameDataList(); } else { LogsSystem.Instance.Print("TCP数据管理器不存在", LogLevel.ERROR); } }
static void Main(string[] args) { //Factory pattern ShapeClient.CallFactory(); //Singleton pattern SingletonClient.TestSingleton(); //Adapter pattern AdapterClient.CallAdapter(); //Composite pattern CardClient cardClient = new CardClient(); cardClient.CallComposite(); //Fascade pattern FacadeClient facadeClient = new FacadeClient(); facadeClient.CallFacade(); Console.ReadKey(); }
public ActionResult GetUsedCard(bool used) { long uid = Session["_UserId"] == null ? 0 : long.Parse(Session["_UserId"].ToString()); if (uid <= 0) { return(Redirect("/Card/Index")); } var user = UsersBll.GetInstance().GetAdminSingle(uid); CardSaleSystem.ServiceReference.CardClient client = new CardClient(); client.DoWork(); IList <CardSecretEntity> card = CardSecretBll.GetInstance().GetUsedCard(user.UserCode, used); var act = ActTypeBll.GetInstance().GetActTypeList(); CardSecretEntityExt queryExt = new CardSecretEntityExt(); queryExt.CardSecretEntity = card; queryExt.ActTypeEntity = act; ViewBag.Data = queryExt; ModelState.Clear(); return(PartialView("/Views/Card/Partial/_PartialCardView.cshtml")); }
private void Page_Loaded(object sender, RoutedEventArgs e) { Task.Factory.StartNew(() => { try { People people = _newPeople = new People(); _newCardClient = new CardClient(); _newPhone = new PhonePeople(); _newEmail = new EmailPeople(); _phoneList = new List <PhonePeople>(); _emailList = new List <EmailPeople>(); CardClient cardClient = _newCardClient; Deal[] dealArr = null; TaskBD[] taskBDArr = null; People[] peopleCompanyArr = null; if (!_isNewRecord) { people = _databasenEtities.People.Single(a => a.ID == _ID_Row); cardClient = _databasenEtities.CardClient.Single(a => a.ID == people.ID_CardClient); _phoneList.AddRange(_databasenEtities.PhonePeople.Where((a) => a.ID_People == _ID_Row).ToArray()); _emailList.AddRange(_databasenEtities.EmailPeople.Where((a) => a.ID_People == _ID_Row).ToArray()); dealArr = _databasenEtities.Deal.Where(a => a.People.ID_CardClient == cardClient.ID).ToArray(); taskBDArr = _databasenEtities.TaskBD.Where(a => a.ID_Client == cardClient.ID || a.ID_People == _ID_Row).ToArray(); } PostPeople[] postPeopleArr = _databasenEtities.PostPeople.ToArray(); CardClient[] companyArr = _databasenEtities.CardClient.Where(a => !String.IsNullOrEmpty(a.NameCompany) || a.ID == people.ID_CardClient).OrderBy(a => a.NameCompany).ToArray(); Country[] countryArr = _databasenEtities.Country.OrderBy(a => a.Name).ToArray(); TypePhone[] typePhoneArr = _databasenEtities.TypePhone.OrderBy(a => a.Name).ToArray(); TypeEmail[] typeEmailArr = _databasenEtities.TypeEmail.OrderBy(a => a.Name).ToArray(); if (!_isNewRecord && !String.IsNullOrEmpty(people.CardClient.NameCompany)) { peopleCompanyArr = _databasenEtities.People.Where(a => a.ID_CardClient == people.ID_CardClient && a.ID != people.ID).ToArray(); } Dispatcher.Invoke(() => { gGeneralInfo.DataContext = people; gContactInfo.DataContext = dpCreateCard.DataContext = cardClient; cbPost.ItemsSource = postPeopleArr; List <CardClient> tempCardClient = new List <CardClient>(); if (_isNewRecord || !String.IsNullOrEmpty(cardClient.NameCompany)) { tempCardClient.Add(_newCardClient); } tempCardClient.AddRange(companyArr); cbCompany.ItemsSource = tempCardClient; cbCountry.ItemsSource = countryArr; dgcbTypePhone.ItemsSource = cbTypePhone.ItemsSource = typePhoneArr; dgcbTypeEmail.ItemsSource = cbTypeEmail.ItemsSource = typeEmailArr; gNewPhone.DataContext = _newPhone; gNewEmail.DataContext = _newEmail; dgPhone.ItemsSource = _phoneList.ToArray(); dgEmail.ItemsSource = _emailList.ToArray(); dgPeople.ItemsSource = peopleCompanyArr; cbEntity.IsChecked = String.IsNullOrEmpty(cardClient.NameCompany) ? false : true; if (!_isNewRecord) { dgDeal.ItemsSource = dealArr; dgTask.ItemsSource = taskBDArr; if (!String.IsNullOrEmpty(people.CardClient.NameCompany)) { ePeopleCompany.Visibility = Visibility.Visible; } } gMain.IsEnabled = true; if (_isNewRecord) { dpCreateCard.SelectedDate = DateTime.Now; dpCreateCard.IsEnabled = false; } }); } catch (Exception ex) { MessageService.MetroMessageDialogError(ex.Message); } }); }
// Сохранение карточки private async void bntSaveClient_Click(object sender, RoutedEventArgs e) { try { // Если нужно то, оставляем информацию только ЧС if (cbEntity.IsChecked == false) { (cbCompany.SelectedItem as CardClient).NameCompany = null; (gGeneralInfo.DataContext as People).ID_Post = null; } // Добавление города в карточку if (cbCity.SelectedItem != null) { (cbCompany.SelectedItem as CardClient).ID_City = (cbCity.SelectedItem as City).ID; } // Добавление или закрепление человека за карточкой клиента if (cbCompany.SelectedIndex < 1) { (gGeneralInfo.DataContext as People).ID_CardClient = _databasenEtities.CardClient.Add(_newCardClient).ID; } else if (cbCompany.SelectedItem != null) { (gGeneralInfo.DataContext as People).ID_CardClient = (cbCompany.SelectedItem as CardClient).ID; } // Добавление новой карточки человека if (_isNewRecord) { _ID_Row = _databasenEtities.People.Add(_newPeople).ID; } // Добавление нового телефона for (int i = 0; i < _phoneList.Count; i++) { if (_phoneList[i].ID_People == 0) { _phoneList[i].ID_People = _ID_Row; _databasenEtities.PhonePeople.Add(_phoneList[i]); } } // Добавление нового Email for (int i = 0; i < _emailList.Count; i++) { if (_emailList[i].ID_People == 0) { _emailList[i].ID_People = _ID_Row; _databasenEtities.EmailPeople.Add(_emailList[i]); } } // Удаление телефонов и email _databasenEtities.PhonePeople.RemoveRange(_delPhoneList); _databasenEtities.EmailPeople.RemoveRange(_delEmailList); int resultDB = await _databasenEtities.SaveChangesAsync(); MessageService.MetroMessageDialogResult(resultDB); if (_isNewRecord && resultDB > -1) { cbCountry.SelectedIndex = -1; gContactInfo.DataContext = _newCardClient = new CardClient(); gGeneralInfo.DataContext = _newPeople = new People(); dpCreateCard.SelectedDate = DateTime.Now; dgPhone.ItemsSource = dgEmail.ItemsSource = null; _ID_Row = 0; } } catch (Exception ex) { MessageService.MetroMessageDialogError(ex.Message); } }
public Result GetCard(string cardId) { Result result=new Result(); try { Card card = db.Cards.Find(cardId); if (card == null) { result.obj = "该卡号不存在"; } else { CardClient cc = new CardClient { CardId = cardId, CardCode = card.CardCode, State = card.State, CardType = card.CardType, Remark = card.Remark }; CardUser cu = db.CardUsers.Find(cardId); if(cu!=null) { cc.UserName = cu.UserName; cc.Mobile = cu.Mobile; cc.Ages = cu.Ages; cc.Gender = cu.Gender; } result.success = true; result.obj = cc; } } catch(Exception exp) { result.success = false; result.obj = exp.Message; } return result; }