public PhoneData Query(string number, PhoneData data, Dictionary <PhoneData, string> values) { PhoneData left = data; string uri = string.Format(URI, number, Key); byte[] bytes = HttpClient.GetData(uri); string json = Encoding.UTF8.GetString(bytes); JToken token = JsonConvert.DeserializeObject(json) as JToken; string resultcode = token["resultcode"].ToString(); if (resultcode != "200") { string reason = token["reason"].ToString(); logger.ErrorFormat("调用聚合API失败, resultcode = {0}, reason = {1}", resultcode, reason); return(left); } if (data.HasFlag(PhoneData.City)) { values[PhoneData.City] = token["result"]["city"].ToString(); left &= ~PhoneData.City; } if (data.HasFlag(PhoneData.CurrentISP)) { values[PhoneData.CurrentISP] = token["result"]["company"].ToString(); left &= ~PhoneData.CurrentISP; } return(left); }
static void Main(string[] args) { PhoneData db = new PhoneData(); using (db) { // Create Objects (Phones) Phone phone1 = new Phone("Samsung", 500, "Android", "/images/android.png", "/images/s20.jpg"); Phone phone2 = new Phone("iPhone 12", 600, "IOS", "/images/apple.png", "/images/iphone11.png"); Console.WriteLine("Creating Phones"); // Add Phones to Database db.Phones.Add(phone1); db.Phones.Add(phone2); Console.WriteLine("Adding Phones To Database"); // Save the Datebase db.SaveChanges(); Console.WriteLine("Saved To Database"); Console.WriteLine("Press Enter To Continue"); Console.ReadLine(); } }
private string TravelComment(List <int> Selects) { string str = ""; foreach (var v in Selects) { var info = _info.FriendCircleRuleInfo.friendCircleTalkInfos.Find((m) => { return(m.TalkId == v); }); var strTemp = ""; if (info.ReplyFromNpcId < 5) { strTemp = "<color=#d0a4d9>" + PhoneData.GetNpcNameById(info.ReplyFromNpcId) + "</color>"; } else { strTemp = "<color=#d0a4d9>" + info.ReplyFromNpcName + "</color>"; } if (info.ReplyToNpcId >= 5) { strTemp += I18NManager.Get("Friend_Hint4"); strTemp += "<color=#d0a4d9>" + info.ReplyToNpcName + "</color>"; } else if (info.ReplyToNpcId >= 0) { strTemp += I18NManager.Get("Friend_Hint4"); strTemp += "<color=#d0a4d9>" + PhoneData.GetNpcNameById(info.ReplyToNpcId) + "</color>"; } str += (strTemp + ":" + info.Content + "\n"); } return(str); }
public static string GetHeadPath(int NpcId) { string path = ""; switch (NpcId) { //case 0: // path = "Head/PlayerHead/PlayerHead"; // break; //case 1: // path = "Head/1005"; // break; //case 2: // path = "Head/2008"; // break; //case 3: // path = "Head/3108"; // break; //case 4: // path = "Head/4103"; // break; default: path = PhoneData.GetHeadPath(NpcId); break; } return(path); }
static void Main(string[] args) { PhoneData db = new PhoneData(); using (db) { Phone p1 = new Phone() { Name = "Samsung s20", Price = 500, Operating_System = "Android", OS_Image = "images/android.png", Phone_Image = "images/s20.png" }; Phone p2 = new Phone() { Name = "iPhone 11", Price = 600, Operating_System = "IOS", OS_Image = "images/apple.png", Phone_Image = "images/iphone11.png" }; db.Phones.Add(p1); db.Phones.Add(p2); Console.WriteLine("Added Phones to Database"); db.SaveChanges(); Console.WriteLine("Saved to Database"); } }
private void updateData(PhoneData data) { Application.Current.Dispatcher.Invoke(() => { mts.PData = data; }); }
public void SetData(SmsTalkInfo data, bool isPlayed = false) { if (transform.Find("LeftHeadIcon/Image").GetComponent <RawImage>().texture == null) { string headPath = PhoneData.GetHeadPath(data.NpcId); transform.Find("LeftHeadIcon/Image").GetComponent <RawImage>().texture = ResourceManager.Load <Texture>(headPath, ModuleConfig.MODULE_PHONE); } _data = data; if (data.MusicID == "0" || data.MusicID == "") { _msg.text = data.TalkContent; _playVoice.gameObject.SetActive(false); _msg.gameObject.SetActive(true); _redPoint.SetActive(false); _isVoice = false; _transBtn.gameObject.SetActive(false); } else { _isVoice = true; _playVoice.gameObject.SetActive(true); _msg.gameObject.SetActive(false); _redPoint.SetActive(!isPlayed); _transBtn.gameObject.SetActive(true); _voiceLenth.text = data.MusicLen.ToString() + "\""; } //_data.IsPlayed AjustSize(); }
public Phone Read(string number) { Dictionary <PhoneData, string> values = new Dictionary <PhoneData, string>(); PhoneData toQuery = PhoneData.City | PhoneData.CurrentISP | PhoneData.OrignalISP | PhoneData.IsVirtual | PhoneData.Transfered; foreach (IPhoneAPIClient client in this.phoneClients) { try { toQuery = client.Query(number, toQuery, values); // 全部的数据都查询完了 if (toQuery == 0) { break; } } catch (Exception ex) { logger.Error("查询手机卡数据异常", ex); } } return(new Phone() { Number = number, City = values.GetValue(PhoneData.City, string.Empty), CurrentISP = values.GetValue(PhoneData.CurrentISP, string.Empty), OriginalISP = values.GetValue(PhoneData.OrignalISP, string.Empty), Transfered = values.GetValue(PhoneData.Transfered, string.Empty) == "true", IsVirtual = values.GetValue(PhoneData.IsVirtual, false) }); }
public PhoneData Query(string number, PhoneData data, Dictionary <PhoneData, string> values) { PhoneData left = data; List <KeyValuePair <string, string> > headers = new List <KeyValuePair <string, string> >(); headers.Add(new KeyValuePair <string, string>("Authorization", string.Format("APPCODE {0}", APPCode))); headers.Add(new KeyValuePair <string, string>("X-Ca-Nonce", Guid.NewGuid().ToString())); string uri = string.Format(URI, number); byte[] bytes = HttpClient.GetData(uri, headers); string json = Encoding.UTF8.GetString(bytes); JToken token = JsonConvert.DeserializeObject(json) as JToken; bool success = token["success"].Value <bool>(); int code = token["code"].Value <int>(); if (!success || code != 0) { logger.ErrorFormat("访问阿里云服务失败, code = {0}, success = {1}", code, success); return(left); } if (data.HasFlag(PhoneData.CurrentISP)) { JToken[] tokens = token["data"]["data"].ToArray(); if (tokens.Length == 0) { logger.InfoFormat("阿里云返回空手机号信息"); return(left); } string state = tokens[0]["state"].Value <string>(); if (state == "4") { // 该号码没有转网记录 values[PhoneData.CurrentISP] = string.Empty; } else { if (state == "1") { values[PhoneData.CurrentISP] = "移动"; } else if (state == "2") { values[PhoneData.CurrentISP] = "联通"; } else if (state == "3") { values[PhoneData.CurrentISP] = "电信"; } } left &= ~PhoneData.CurrentISP; } return(left); }
// GET: PhoneDetails/Delete/5 public ActionResult Delete(PhoneData detailsToEdit) { var d = obj.PhoneDatas.Where(x => x.id == detailsToEdit.id).FirstOrDefault(); obj.PhoneDatas.Remove(d); obj.SaveChanges(); return(RedirectToAction("PhoneList")); }
public CardRateSenderToReceiverInformation(PhoneData beneficiaryPhone, decimal rate, decimal amount) { this.BeneficiaryPhone = beneficiaryPhone; this.SwiftCode = new CardBranchSwiftCode().SwiftCode; this.CurrencyConversion = "/ACC/YJHMS"; this.Rate = rate; this.Amount = amount; }
static void Main(string[] args) { var pd = new PhoneData(); string output; output = pd.Lookup("15168236518").ToString(); Console.WriteLine(output); Console.WriteLine("Hello World!"); }
public void SetData(SmsTalkInfo data) { string headPath = PhoneData.GetHeadPath(data.NpcId); Debug.LogError("SmsDetailMyItem SetData " + data.MusicID + " Headpath " + headPath); transform.Find("LeftHeadIcon/Image").GetComponent <RawImage>().texture = ResourceManager.Load <Texture>(headPath, ModuleConfig.MODULE_PHONE); _data = data; transform.Find("Msg/MsgText").GetComponent <Text>().text = _data.TalkContent; AjustSize(); }
public ActionResult Create([Bind(Exclude = "Id")] PhoneData data) { if (!ModelState.IsValid) { return(View()); } obj.PhoneDatas.Add(data); obj.SaveChanges(); return(RedirectToAction("PhoneList")); }
private Phone CreateCompanyPhone(int companyId, PhoneData phoneData, DbTransaction dbTran) { var phone = _phoneFactory.Create(companyId, phoneData.CountryCode, phoneData.Code, phoneData.Number, phoneData.AdditionalNumber, phoneData.Description); phone = _repository.SetPhone(phone, isActual: true, dbTran); return(phone); }
public ActionResult AddPhoneNumber(PhoneData phoneNumber) { phoneNumber.UserId = User != null?User.Identity.GetUserId() : ""; _phoneSaveService.SavePhone(phoneNumber); if (Request != null && Request.IsAjaxRequest()) { return(PartialView("AddPhoneNumber", _phoneQueryService.GetPhones())); } return(RedirectToAction("Index", "Profile")); }
public ActionResult Edit(PhoneData detailsToEdit) { var orignalRecord = (from m in obj.PhoneDatas where m.id == detailsToEdit.id select m).First(); if (!ModelState.IsValid) { return(View(orignalRecord)); } obj.Entry(orignalRecord).CurrentValues.SetValues(detailsToEdit); obj.SaveChanges(); return(RedirectToAction("PhoneList")); }
private bool NeedCreateStringPhone(PhoneData phoneData, IEnumerable <StringPhone> stringPhones) { return(!stringPhones .GetActualItems() .Any( sp => sp.CountryCode == phoneData.CountryCode && sp.Code == phoneData.Code && sp.Number == phoneData.Number && sp.Description == phoneData.Description && sp.AdditionalNumber == phoneData.AdditionalNumber && sp.OrderBy == phoneData.OrderBy)); }
protected internal virtual PhoneData ConstructPhoneData(string phoneNumber) { var response = this.SearchProApi(phoneNumber); var notes = new List <string>(); var lineType = LineType.Other; var doNotCall = false; string carrier = null; int? reputationLevel = null; var isPrepaid = false; if (!response.IsFailure) { var phone = response.Results.FirstOrDefault(); if (phone != null) { lineType = phone.LineType.GetValueOrDefault(LineType.Other); doNotCall = phone.DoNotCall.GetValueOrDefault(false); carrier = phone.Carrier; reputationLevel = phone.Reputation == null ? (int?)null : phone.Reputation.Level; isPrepaid = phone.IsPrepaid ?? false; } } if (lineType != LineType.Other) { notes.Add(lineType.ToString()); } if (doNotCall) { notes.Add("Do Not Call Registered"); } if (!string.IsNullOrWhiteSpace(carrier)) { notes.Add(carrier); } var call = new PhoneData() { CallTime = DateTime.Now, PhoneNumber = phoneNumber, PrioritizationNotes = notes, LineType = lineType, DoNotCall = doNotCall, Carrier = carrier, ReputationLevel = reputationLevel, IsPrepaid = isPrepaid, }; return(call); }
private Phone GetCompanyPhone(int companyId, PhoneData phoneData) { var phone = _context.Phones .FirstOrDefault( cph => cph.CompanyId == companyId && cph.CountryCode == phoneData.CountryCode && cph.Code == phoneData.Code && cph.Number == phoneData.Number && cph.AdditionalNumber == phoneData.AdditionalNumber && cph.Description == phoneData.Description && cph.IsActual == true); return(phone); }
private StringPhone CreateStringPhone(int stringId, int companyId, PhoneData phonesData, DbTransaction dbTran) { var phone = GetCompanyPhone(companyId, phonesData); if (phone == null) { phone = CreateCompanyPhone(companyId, phonesData, dbTran); } var stringPhone = _stringPhoneFactory.Create(stringId, phone, phonesData.OrderBy); _repository.SetStringPhone(stringPhone, isActual: true, dbTran); return(stringPhone); }
public IActionResult Update(int id, PhoneData payload) { var upPhone = _context.Phones.Find(id); if (upPhone == null) { return(NotFound()); } upPhone.DDD = payload.DDD; upPhone.PhoneNumber = payload.PhoneNumber; _context.Phones.Update(upPhone); _context.SaveChanges(); return(NoContent()); }
public ActionResult Edit(int id, int PhoneType,int ShortAddress) { var phone = new Phone(); var constituentId = Convert.ToInt32(Session["constituentId"]); TryUpdateModel(phone); phone.Type = new PhoneType {Id = PhoneType}; phone.Constituent = new Constituent {Id = constituentId}; phone.Address = new ShortAddress() {Id = ShortAddress}; mapper = new AutoDataContractMapper(); var phoneData = new PhoneData(); mapper.Map(phone, phoneData); HttpHelper.Put(string.Format(serviceBaseUri+"/Phones/{0}",id), phoneData); return PartialView(new GridModel(GetPhones())); }
private void ShowList() { for (int i = 0; i < _container.childCount; i++) { Destroy(_container.GetChild(i).gameObject); } var weiboprefab = GetPrefab("Phone/Prefabs/Item/WeiboItem"); var commentPrefab = GetPrefab("Phone/Prefabs/Item/WeiboCommentItem"); var linePrefab = GetPrefab("Phone/Prefabs/Item/WeiboLineItem"); foreach (var v in _data) { if (!v.IsPublish) { continue; } var item = Instantiate(weiboprefab) as GameObject; item.transform.SetParent(_container, false); //item.transform.localScale = Vector3.one; item.GetComponent <WeiboItem>().SetData(v); foreach (var v1 in v.WeiboRuleInfo.weiboTalkInfos) { var citem = Instantiate(commentPrefab) as GameObject; citem.transform.SetParent(_container, false); // citem.transform.localScale = Vector3.one; var strTemp = ""; if (v1.ReplyFromNpcId < 5) { strTemp = "<color=#d0a4d9>" + PhoneData.GetNpcNameById(v1.ReplyFromNpcId) + "</color>"; } else { strTemp = "<color=#d0a4d9>" + v1.ReplyFromNpcName + "</color>"; } citem.GetComponent <WeiboCommentItem>().SetData(strTemp, v1.Content); } item = Instantiate(linePrefab) as GameObject; item.transform.SetParent(_container, false); } }
public static void WithCharging(ChargingData chargingData) { transaction.charging = new ChargingData(); transaction.charging.clientBirthday = chargingData.clientBirthday; transaction.charging.clientCode = chargingData.clientCode; transaction.charging.clientDocument = chargingData.clientDocument; transaction.charging.clientDocumentTwo = chargingData.clientDocumentTwo; transaction.charging.clientEmail = chargingData.clientEmail; transaction.charging.clientName = chargingData.clientName; transaction.charging.clientSex = chargingData.clientSex; transaction.charging.clientType = chargingData.clientType; if (chargingData.clientChargingAdress != null) { transaction.charging.clientChargingAdress = new AddressData(); transaction.charging.clientChargingAdress.city = chargingData.clientChargingAdress.city; transaction.charging.clientChargingAdress.complement = chargingData.clientChargingAdress.complement; transaction.charging.clientChargingAdress.country = chargingData.clientChargingAdress.country; transaction.charging.clientChargingAdress.district = chargingData.clientChargingAdress.district; transaction.charging.clientChargingAdress.number = chargingData.clientChargingAdress.number; transaction.charging.clientChargingAdress.state = chargingData.clientChargingAdress.state; transaction.charging.clientChargingAdress.street = chargingData.clientChargingAdress.street; transaction.charging.clientChargingAdress.zipCode = chargingData.clientChargingAdress.zipCode; } if (chargingData.clientChargingPhone != null && chargingData.clientChargingPhone.Count > 0) { List <PhoneData> newPhones = new List <PhoneData>(); foreach (var phone in chargingData.clientChargingPhone) { PhoneData newPhone = new PhoneData(); newPhone.ddd = phone.ddd; newPhone.ddi = phone.ddi; newPhone.phone = phone.phone; newPhone.phoneType = phone.phoneType; newPhones.Add(newPhone); } transaction.charging.clientChargingPhone = newPhones; } }
public void SetData(MySmsOrCallVo vo) { AudioManager.Instance.PlayEffect("sms_tips", 1); Debug.Log("SetData"); transform.Find("LeftHeadIcon/Image").GetComponent <RawImage>().texture = ResourceManager.Load <Texture>(PhoneData.GetHeadPath(vo.NpcId), null, true); _vo = vo; //string showStr = ""; //if (vo.FirstTalkInfo.TalkContent.Length >) transform.Find("ReadBtn/Text").GetComponent <Text>().text = vo.FirstTalkInfo.TalkContent; transform.Find("NpcName").GetComponent <Text>().text = vo.Sender; transform.Find("ReadBtn").GetComponent <Button>().onClick.AddListener(() => { Debug.Log("ReadBtn ...."); if (CacheManager.isGuideSmsBySceneId(vo.SceneId)) { ModuleManager.Instance.EnterModule(ModuleConfig.MODULE_PHONE, true, false, vo ); Close(); return; } CacheManager.ClickItem(vo.NpcId, () => { ModuleManager.Instance.EnterModule(ModuleConfig.MODULE_PHONE, true, false, vo ); Close(); }, () => { ModuleManager.Instance.EnterModule(ModuleConfig.MODULE_PHONE, true, false, vo ); Close(); }); //ModuleManager.Instance.EnterModule(ModuleConfig.MODULE_PHONE, // true, false, vo // ); //Close(); }); }
public static void InitData() { VersionData = new VersionData(); ConfigModel = new ConfigModel(); PlayerModel = new PlayerModel(); CardModel = new CardModel(); PropModel = new PropModel(); NpcModel = new NpcModel(); PhoneData = new PhoneData(); FavorabilityMainModel = new FavorabilityMainModel(); DiaryElementModel = new DiaryElementModel(); ActivityModel = new ActivityModel(); PayModel = new PayModel(); RandomEventModel = new RandomEventModel(); NoticeData = new NoticeData(); LevelModel = new LevelModel(); AppointmentData = new AppointmentModel(); TrainingRoomModel = new TrainingRoomModel(); MissionModel = new MissionModel(); CapsuleLevelModel = new CapsuleLevelModel(); }
/// <summary>Gets the business sector of a phone number.</summary> /// <param name="phoneData">The phone data with its number.</param> /// <returns>Phone data with its correponding business sector.</returns> public PhoneData GetSectorByPhoneNumber(PhoneCoreData phoneCoreData) { var phoneResult = new PhoneData { Prefix = phoneCoreData.Prefix, Number = phoneCoreData.Number }; // Service invocation var serviceInvoker = new ServiceInvoker(_externalUrl); var result = serviceInvoker.GetRequest(phoneCoreData.Number); if (result.Result?.IsSuccessStatusCode == true) { phoneResult.Sector = JsonConvert.DeserializeObject <PhoneData>(result.Result.ContentResult)?.Sector; } else { phoneResult.Sector = null; } return(phoneResult); }
public Dictionary <int, PhoneData> GetPhoneData() { Dictionary <int, PhoneData> phoneDataList = new Dictionary <int, PhoneData>(); string path = Application.streamingAssetsPath + "/Config/Phone.csv"; List <string> data = ReadCSV(path); //Debug.Log(data[0]); for (int i = 1; i < data.Count; i++) { string[] str = data[i].Split(','); PhoneData phoneData = new PhoneData(); phoneData.ID = int.Parse(str[0]); phoneData.Num = str[1]; phoneData.PreStage = new List <string>(str[2].Split('|')); phoneData.Stage = int.Parse(str[3]); phoneDataList.Add(phoneData.ID, phoneData); } return(phoneDataList); }
public static void WithDelivery(DeliveryData deliveryData) { transaction.delivery = new DeliveryData(); transaction.delivery.birthday = deliveryData.birthday; transaction.delivery.document = deliveryData.document; transaction.delivery.documentTwo = deliveryData.documentTwo; transaction.delivery.mail = deliveryData.mail; transaction.delivery.name = deliveryData.name; transaction.delivery.sex = deliveryData.sex; if (deliveryData.deliveryAddress != null) { transaction.delivery.deliveryAddress = new AddressData(); transaction.delivery.deliveryAddress.city = deliveryData.deliveryAddress.city; transaction.delivery.deliveryAddress.complement = deliveryData.deliveryAddress.complement; transaction.delivery.deliveryAddress.country = deliveryData.deliveryAddress.country; transaction.delivery.deliveryAddress.district = deliveryData.deliveryAddress.district; transaction.delivery.deliveryAddress.number = deliveryData.deliveryAddress.number; transaction.delivery.deliveryAddress.state = deliveryData.deliveryAddress.state; transaction.delivery.deliveryAddress.street = deliveryData.deliveryAddress.street; } if (deliveryData.deliveryPhone != null && deliveryData.deliveryPhone.Count > 0) { List <PhoneData> newPhoneList = new List <PhoneData>(); foreach (var phone in deliveryData.deliveryPhone) { PhoneData newPhone = new PhoneData(); newPhone.ddd = phone.ddd; newPhone.ddi = phone.ddi; newPhone.phone = phone.phone; newPhone.phoneType = phone.phoneType; newPhoneList.Add(newPhone); } transaction.delivery.deliveryPhone = newPhoneList; } }
public IActionResult CreateNumberRequest([FromBody] PhoneData payload) { if (ModelState.IsValid) { if (payload.IsExisting(_context)) { return(BadRequest("Number already exists")); } else { payload.SaveNumber(_context); if (payload.SaveNumber(_context) == true) { _context.SaveChanges(); string valor = PhoneService.GenerateRandomNumber(); var client = new Client(creds: new Nexmo.Api.Request.Credentials { ApiKey = "446f0ce7", ApiSecret = "km4BNlHHwAQQlpwq" }); var results = client.SMS.Send(request: new SMS.SMSRequest { from = "NewZapp", to = "55" + payload.DDD + payload.PhoneNumber, text = "NewZapp: Authorization Code:" + valor }); return(new CreatedAtRouteResult("createdNumber", new { id = payload.PhoneID }, payload)); //Criando um nova rota, para que quando houver a atualização desejada seremos redirecionados para esta nova rota } } } return(BadRequest(ModelState)); }