public ActionResult Mobile(MobileModel model) { int pageIndex = model.Page ?? 1; using (EquipmentsEntities data = new EquipmentsEntities()) { model.MobileSearch = (from c in data.TB_Mobile.Where(p => p.KayitDurumu == "Active" && (String.IsNullOrEmpty(model.Users) || p.Name.Contains(model.Users)) && (String.IsNullOrEmpty(model.SerialNumber) || p.SerialNumber.Contains(model.SerialNumber))).OrderByDescending(p => p.ID) select new MobileListModel { Demirbas = c.Demirbas, IMEI = c.IMEI, InvoiceNumber = c.InvoiceNumber, MAC = c.MAC, Name = c.Name, Number = c.Number, OldUser = c.OldUser, Phone = c.Phone, PurchaseDate = c.PurchaseDate, SerialNumber = c.SerialNumber, UserCode = c.UserCode }).ToPagedList(pageIndex, 15); if (Request.IsAjaxRequest()) { return(PartialView("_Mobile", model)); } else { return(View(model)); } } }
public virtual ActionResult SendCode(string value, string code, string action) { var model = new MobileModel { AccountId = Identity.Id, Action = action, Mobile = value }; if (!CodeHelper.ValidateCode(code, CodeName)) { model.Errors = model.Errors ?? new List <ErrorInfo> { new ErrorInfo { Key = "CodeError", Message = "验证码错误" } }; } else { var dto = Ioc.Resolve <IMobileApplicationService>().SendCode(model); model.Result = dto.Result; model.Errors = dto.Errors; } var result = new Dictionary <string, object>(); var rev = model.Result; var mess = model.Errors?.FirstOrDefault()?.Message; mess = mess ?? "发送失败"; result.Add("Status", rev); result.Add("Message", rev ? model.CodeEntity.SendStep.ToString() : mess); return(this.Jsonp(result)); }
public SearchIMEIUi() { InitializeComponent(); mobileModel = new MobileModel(); _mobileModelManager = new MobileModelManager(); messageLabel.Text = ""; }
public bool IsIMEIDuplicate(MobileModel mobileModel) { bool isDuplicate = false; try { commandString = @"SELECT * FROM MobileModels WHERE IMEI ='" + mobileModel.IMEI + "'"; sqlCommand = new SqlCommand(commandString, sqlConnection); sqlConnection.Open(); SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(sqlCommand); dataTable = new DataTable(); sqlDataAdapter.Fill(dataTable); if (dataTable.Rows.Count > 0) { isDuplicate = true; } sqlConnection.Close(); } catch (Exception exception) { //MessageBox.Show(exception.Message); } return(isDuplicate); }
public IActionResult VerifyPIN(AccountLoginModel viewModel, MobileModel mobileModel) { var user = _sysUserService.Queryable().FirstOrDefault(x => x.Email == viewModel.Email); var tfa = new TwoFactorAuthenticator() { DefaultClockDriftTolerance = TimeSpan.FromSeconds(30) }; bool isCorrectPIN = tfa.ValidateTwoFactorPIN($"{CPLConstant.TwoFactorAuthenticationSecretKey}{user.Id}", viewModel.PIN); if (isCorrectPIN) { if (mobileModel.IsMobile) { return(new JsonResult(new { code = EnumResponseStatus.SUCCESS, })); } HttpContext.Session.SetObjectAsJson("CurrentUser", Mapper.Map <SysUserViewModel>(user)); return(RedirectToLocal($"{HttpContext.Request.Scheme}://{HttpContext.Request.Host}{Url.Action("Index", "Home")}")); } if (mobileModel.IsMobile) { return(new JsonResult(new { code = EnumResponseStatus.WARNING, error_message_key = CPLConstant.MobileAppConstant.LoginScreenInvalidPIN })); } return(new JsonResult(new { success = false, message = LangDetailHelper.Get(HttpContext.Session.GetInt32("LangId").Value, "InvalidPIN") })); }
public IActionResult GetHomeScreenData(MobileModel mobileModel) { try { return(new JsonResult( new { code = EnumResponseStatus.SUCCESS, data = new { banners = _getBannersList(), news = _getLatestNewsList(), lotteries = _getLotteriesList(), userinfo = _getUserInfo(mobileModel) } } )); } catch (Exception ex) { return(new JsonResult( new { code = EnumResponseStatus.ERROR, error_message_key = ex.Message } )); } }
private void TimerCounter_Tick(object sender, EventArgs e) { if ((PublicParameters.SimulationTime <= stopSimlationWhen + PublicParameters.MacStartUp)) { Dispatcher.Invoke(() => PublicParameters.SimulationTime += 1, DispatcherPriority.Send); Dispatcher.Invoke(() => Title = "TreeBased Query: " + PublicParameters.SimulationTime.ToString(), DispatcherPriority.Send); } else { TimerCounter.Stop(); RandomSelectSourceNodesTimer.Interval = TimeSpan.FromSeconds(0); RandomSelectSourceNodesTimer.Stop(); //Settings.Default.SinkSpeed = 0; MobileModel.StopSinkMovement(); top_menu.IsEnabled = true; } if (Settings.Default.StopByNumberOfPackets && (PublicParameters.NumberOfDelieveredDataPackets >= Settings.Default.StopByPacketNum)) { TimerCounter.Stop(); RandomSelectSourceNodesTimer.Interval = TimeSpan.FromSeconds(0); RandomSelectSourceNodesTimer.Stop(); //Settings.Default.SinkSpeed = 0; MobileModel.StopSinkMovement(); top_menu.IsEnabled = true; } }
public IActionResult GetPageDetail(MobileModel mobileModel, string pageName) { try { MobileLangMsgDetailViewModel pageDetail = _mobileLangMsgDetailService.Queryable() .Where(x => x.LangId == mobileModel.MobileLangId && x.Name == pageName) .Select(x => Mapper.Map <MobileLangMsgDetailViewModel>(x)).FirstOrDefault(); return(new JsonResult( new { code = EnumResponseStatus.SUCCESS, data = pageDetail } )); } catch (Exception ex) { return(new JsonResult( new { code = EnumResponseStatus.ERROR, error_message_key = ex.Message } )); } }
void InitliazeSinkTimer_Tick(object sender, EventArgs e) { MobileModel.setInitialParameters(); //alreadyInitSink = true; InitliazeSinkTimer.Stop(); mobileModel.startMoving(); sinkMoving = true; }
public ActionResult DeleteConfirmed(int id) { MobileModel mobileModel = db.Models.Find(id); db.Models.Remove(mobileModel); TempData["ModelStatusMessage"] = "Model has been deleted successfully!"; db.SaveChanges(); return(RedirectToAction("Index")); }
/// <summary> /// /// </summary> /// <returns></returns> public virtual ActionResult Index() { var model = new MobileModel { AccountId = Identity.Id }; Ioc.Resolve <IMobileApplicationService>().Load(model); return(GetActionResult(model)); }
//stub, imitates getting data from the database public MobileModel GetPhoneFromDatabase() { var mobileModel = new MobileModel { Brand = "Samsung", Model = "Galaxy S7", Display = 5.5 }; return(mobileModel); }
private MobileModel GetTestPhoneExpected() { var mobileModel = new MobileModel { Brand = "Samsung", Model = "Galaxy S7", Display = 5.5 }; return(mobileModel); }
public void SetPhoneCodeCallBack(MobileMgr mobileMgr, MobileModel mobileModel) { this.HySeleniumMgr.GetPhoneSms = (string phone, string quHao) => { string sms = MobileMgr.GetYzm(mobileMgr.getVcodeAndHoldMobilenum(mobileModel), 6); if (sms.IsNullOrWhiteSpace()) { mobileMgr.cancelSMSRecv(mobileModel.PhoneNumber); } return(sms); }; }
public void RandomDeplayment(int sinkIndex) { PublicParameters.NumberofNodes = myNetWork.Count; int rootNodeId = sinkIndex; PublicParameters.SinkNode = myNetWork[rootNodeId]; NeighborsDiscovery overlappingNodesFinder = new NeighborsDiscovery(myNetWork); overlappingNodesFinder.GetOverlappingForAllNodes(); isCoverageSelected = true; PublicParameters.Density = Density.GetDensity(myNetWork); DisplaySimulationParameters(rootNodeId, "Random"); EngageMacAndRadioProcol(); TopologyConstractor.BuildToplogy(Canvas_SensingFeild, myNetWork); double radius; radius = (PublicParameters.CommunicationRangeRadius * 1.5); double clusterArea = Math.PI * (Math.Pow((radius), 2)); PublicParameters.cellRadius = radius; PublicParameters.myNetwork = myNetWork; if (buildMethod == null) { buildMethod = "center"; } // Tree tree = new Tree(); //tree.startChanging(Tree_Show); CellGroup.getAverageSensors(); ConvexHullRing.setInitialParameters(radius, 10, Canvas_SensingFeild); ConvexHullRing.startRingConstruction(); // RingNodes are all defined MobileModel.passField(Canvas_SensingFeild); networkInitialized = true; SensingFieldArea.GetAreaOfSensingField(); NetworkConstruction constructor = new NetworkConstruction(Canvas_SensingFeild, "center"); MyGraph = Graph.ConvertNodeToVertex(myNetWork); InitMobileSink(); }
// GET: MobileModels/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } MobileModel mobileModel = db.Models.Find(id); if (mobileModel == null) { return(HttpNotFound()); } return(View(mobileModel)); }
public IActionResult DoEditEmail(EditEmailViewModel viewModel, MobileModel mobileModel) { var isEmailExisting = _sysUserService.Queryable().Any(x => x.Email == viewModel.NewEmail && x.IsDeleted == false); if (isEmailExisting) { if (mobileModel.IsMobile) { return(new JsonResult(new { code = EnumResponseStatus.WARNING, name = "new-email", error_message_key = CPLConstant.MobileAppConstant.EditEmailScreenExistingEmail })); } return(new JsonResult(new { success = false, name = "new-email", message = LangDetailHelper.Get(HttpContext.Session.GetInt32("LangId").Value, "ExistingEmail") })); } var user = _sysUserService.Queryable().FirstOrDefault(x => x.Id == HttpContext.Session.GetObjectFromJson <SysUserViewModel>("CurrentUser").Id&& x.IsDeleted == false); if (user != null) { user.Email = viewModel.NewEmail; HttpContext.Session.SetObjectAsJson("CurrentUser", Mapper.Map <SysUserViewModel>(user)); _sysUserService.Update(user); _unitOfWork.SaveChanges(); if (mobileModel.IsMobile) { return(new JsonResult(new { code = EnumResponseStatus.SUCCESS, success_message_key = CPLConstant.MobileAppConstant.EditEmailScreenEmailUpdatedSuccessfully })); } return(new JsonResult(new { success = true, message = LangDetailHelper.Get(HttpContext.Session.GetInt32("LangId").Value, "EmailUpdated") })); } if (mobileModel.IsMobile) { return(new JsonResult(new { code = EnumResponseStatus.WARNING, error_message_key = CPLConstant.MobileAppConstant.EditEmailScreenNonExistingAccount })); } return(new JsonResult(new { success = false, message = LangDetailHelper.Get(HttpContext.Session.GetInt32("LangId").Value, "NonExistingAccount") })); }
private AuthenticationTokenData SaveMobilePhone(MobileModel model) { ApiContext.AuthByClaim(); var user = UserManager.GetUsers(AuthContext.CurrentAccount.ID); model.MobilePhone = SmsManager.SaveMobilePhone(user, model.MobilePhone); MessageService.Send(MessageAction.UserUpdatedMobileNumber, MessageTarget.Create(user.ID), user.DisplayUserName(false, DisplayUserSettingsHelper), model.MobilePhone); return(new AuthenticationTokenData { Sms = true, PhoneNoise = SmsSender.BuildPhoneNoise(model.MobilePhone), Expires = new ApiDateTime(TenantManager, TimeZoneConverter, DateTime.UtcNow.Add(SmsKeyStorage.StoreInterval)) }); }
public IHttpActionResult DeviceRegistration(MobileModel model) { string message = string.Empty; using (var userRepository = new UserRepository()) { var result = userRepository.DeviceRegistration(model.mobileno, out message); if (!string.IsNullOrEmpty(message)) { log.Info(message); } return(Ok(new { result.Status, data = result })); } }
// GET: MobileModels/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } MobileModel mobileModel = db.Models.Find(id); if (mobileModel == null) { return(HttpNotFound()); } ViewBag.BrandId = new SelectList(db.Brands, "BrandId", "BrandName", mobileModel.BrandId); ViewBag.OPSystemId = new SelectList(db.OperatingSystems, "OPSystemId", "OpSystemName", mobileModel.OPSystemId); return(View(mobileModel)); }
public ActionResult Edit([Bind(Include = "MobileModelId,ModelName,BrandId,Price,RAM,StorageCapacity,OPSystemId")] MobileModel mobileModel) { if (ModelState.IsValid) { if (CanUpdateModel(mobileModel)) { db.Entry(mobileModel).State = EntityState.Modified; db.SaveChanges(); TempData["ModelStatusMessage"] = "Model has been updated successfully!"; return(RedirectToAction("Index")); } DisplayModelExistsMessage(mobileModel); } ViewBag.BrandId = new SelectList(db.Brands, "BrandId", "BrandName", mobileModel.BrandId); ViewBag.OPSystemId = new SelectList(db.OperatingSystems, "OPSystemId", "OpSystemName", mobileModel.OPSystemId); return(View(mobileModel)); }
public IActionResult DoEditPassword(EditPasswordViewModel viewModel, MobileModel mobileModel) { var user = _sysUserService.Queryable().FirstOrDefault(x => x.Id == HttpContext.Session.GetObjectFromJson <SysUserViewModel>("CurrentUser").Id&& x.IsDeleted == false); if (user != null) { if (!BCrypt.Net.BCrypt.Verify(viewModel.CurrentPassword, user.Password)) { if (mobileModel.IsMobile) { return(new JsonResult(new { code = EnumResponseStatus.WARNING, error_message_key = CPLConstant.MobileAppConstant.EditPasswordScreenInvalidCurrentPassword })); } return(new JsonResult(new { success = false, name = "current-password", message = LangDetailHelper.Get(HttpContext.Session.GetInt32("LangId").Value, "InvalidCurrentPassword") })); } user.Password = viewModel.NewPassword.ToBCrypt(); HttpContext.Session.SetObjectAsJson("CurrentUser", Mapper.Map <SysUserViewModel>(user)); _sysUserService.Update(user); _unitOfWork.SaveChanges(); if (mobileModel.IsMobile) { return(new JsonResult(new { code = EnumResponseStatus.SUCCESS, success_message_key = CPLConstant.MobileAppConstant.EditPasswordScreenPasswordUpdatedSuccessfully })); } return(new JsonResult(new { success = true, message = LangDetailHelper.Get(HttpContext.Session.GetInt32("LangId").Value, "PasswordUpdated") })); } if (mobileModel.IsMobile) { return(new JsonResult(new { code = EnumResponseStatus.WARNING, error_message_key = CPLConstant.MobileAppConstant.EditPasswordScreenNonExistingAccount })); } return(new JsonResult(new { success = false, message = LangDetailHelper.Get(HttpContext.Session.GetInt32("LangId").Value, "NonExistingAccount") })); }
public IActionResult DoEdit(ProfileViewModel viewModel, MobileModel mobileModel) { var user = _sysUserService.Queryable().FirstOrDefault(x => x.Id == HttpContext.Session.GetObjectFromJson <SysUserViewModel>("CurrentUser").Id&& x.IsDeleted == false); if (user != null) { user.FirstName = viewModel.FirstName; user.LastName = viewModel.LastName; user.Gender = viewModel.Gender; user.DOB = viewModel.DOB; user.Country = viewModel.Country; user.City = viewModel.City; user.StreetAddress = viewModel.StreetAddress; user.Mobile = viewModel.Mobile; HttpContext.Session.SetObjectAsJson("CurrentUser", Mapper.Map <SysUserViewModel>(user)); _sysUserService.Update(user); _unitOfWork.SaveChanges(); if (mobileModel.IsMobile) { return(new JsonResult(new { code = EnumResponseStatus.SUCCESS, success_message_key = CPLConstant.MobileAppConstant.ProfileEditUserScreenUpdatedSuccessfully })); } return(new JsonResult(new { success = true, message = LangDetailHelper.Get(HttpContext.Session.GetInt32("LangId").Value, "PersonalInfoUpdated"), gender = viewModel.Gender == true ? LangDetailHelper.Get(HttpContext.Session.GetInt32("LangId").Value, "Male") : LangDetailHelper.Get(HttpContext.Session.GetInt32("LangId").Value, "Female") })); } if (mobileModel.IsMobile) { return(new JsonResult(new { code = EnumResponseStatus.ERROR, error_message_key = CPLConstant.MobileAppConstant.ProfileEditUserScreenNonExistingAccount })); } return(new JsonResult(new { success = false, message = LangDetailHelper.Get(HttpContext.Session.GetInt32("LangId").Value, "NonExistingAccount") })); }
public async Task <IHttpActionResult> ApproveMobileModel(int id) { MobileModel mobile = await db.MobileModels.FindAsync(id); if (mobile == null) { return(NotFound()); } if (mobile.status == "a") { return(BadRequest("Already approved")); } mobile.status = "a"; await db.SaveChangesAsync(); return(Ok("approved")); }
public IActionResult PostMobileInfo([FromBody] MobileModel mobileModel) { if (mobileModel != null) { var mobileModelDto = new MobileModel { Brand = $"[Stub from Server] {mobileModel.Brand}", Model = $"[Stub from Server] {mobileModel.Model}", Display = mobileModel.Display + 1 }; return(Ok(mobileModelDto)); } else { return(BadRequest()); } }
private bool OneReg() { bool flag; base.GeRegJqm(); FiddlerHandle.AutoWeb.HySeleniumWeiBoRegMgr hySeleniumWeiBoRegMgr = new FiddlerHandle.AutoWeb.HySeleniumWeiBoRegMgr(); FiddlerHandle.AutoWeb.HySeleniumWeiBoRegMgr hySeleniumWeiBoRegMgr1 = hySeleniumWeiBoRegMgr; this.HySeleniumWeiBoRegMgr = hySeleniumWeiBoRegMgr; base.HySeleniumMgr = hySeleniumWeiBoRegMgr1; MobileMgr mobileMgr = new MobileMgr(this.ptType); MobileModel mobileModel = mobileMgr.GetMobilenum(null); base.SetPhoneCodeCallBack(mobileMgr, mobileModel); base.HySeleniumMgr.ClearCach(mobileModel.PhoneNumber); string password = base.CratePasswor(); bool ret = this.HySeleniumWeiBoRegMgr.WeiBoRegHy("", password, mobileModel.PhoneNumber, mobileModel.CountryCode); if (ret) { HyAccount zh = new HyAccount() { UserName = mobileModel.PhoneNumber, UserPass = password, PiHao = XmlConfig <SeleniumConfig> .Current.PiHao, Enable = true, RegType = RegType.Weibo, BeiZhu = "谷歌浏览器自动化操作微博注册" }; zh.SaveModel(mobileModel); DateTime now = TimerX.Now; zh.CreateTime = now; string jqmStr = (string)SelementHelper.ExecJs(base.HySeleniumMgr.WebDriver, "return hyDecode(getCommmonInfo());", Array.Empty <object>()); zh.JiQiMa = jqmStr; zh.UpdateTime = now.AddDays(-1); zh.Save(); flag = ret; } else { XTrace.WriteLine("注册失败"); flag = false; } return(flag); }
public int InsertModel(MobileModel mobileModel) { int isExecuted = 0; try { commandString = @"INSERT INTO MobileModels VALUES ('" + mobileModel.ModelName + "','" + mobileModel.IMEI + "'," + mobileModel.Price.ToString() + ")"; sqlCommand = new SqlCommand(commandString, sqlConnection); sqlConnection.Open(); isExecuted = sqlCommand.ExecuteNonQuery(); sqlConnection.Close(); } catch (Exception exception) { //MessageBox.Show(exception.Message); } return(isExecuted); }
private void button10_Click(object sender, EventArgs e) { MobileModel mb = new MobileModel { PhoneModel = "", Operator = "", IsValid = "0", Name = "新机型", SortId = 999 }; MBList.Add(mb); string s = dataGridView1.CurrentRow.Cells[0].Value.ToString();//获取当前行[0]字段的值 HMIList.Where(m => m.VersionName == s).FirstOrDefault().MobileModel = MBList; dataGridView1.DataSource = HMIList.ToList(); }
public ActionResult Mobile(MobileModel model) { if (ModelState.IsValid) { // Attempt to register the user try { WebSecurity.CreateUserAndAccount(model.UserName, model.Password); WebSecurity.Login(model.UserName, model.Password); return(RedirectToAction("Index", "Home")); } catch (MembershipCreateUserException e) { ModelState.AddModelError("", ErrorCodeToString(e.StatusCode)); } } // If we got this far, something failed, redisplay form return(View(model)); }
/// <summary> /// 得到结果 /// </summary> /// <param name="model"></param> /// <returns></returns> protected virtual ActionResult GetActionResult(MobileModel model) { switch (model.Action) { case "Valid": model.Step = 2; return(View("~/Views/Account/Mobile/Index.cshtml", model)); case "Bind": model.Step = 3; return(View("~/Views/Account/Mobile/Bind.cshtml", model)); case "Finish": model.Step = 4; return(View("~/Views/Account/Mobile/Finish.cshtml", model)); default: return(null); } }
public static MobileModel SMS_Send(IntroductionModel.IntroductionModelShow msg = null, string mobile = null) { HttpWebRequest request; //----三竹----// /* //string postData = ""; string msg_Convert = HttpUtility.UrlEncode(msg.Content, Encoding.GetEncoding("big5")).Replace("+"," "); request = (HttpWebRequest)WebRequest.Create("http://smexpress.mitake.com.tw:7003/SpLmGet?username="******"&password="******"&dstaddr=" + mobile + "&smbody=" + msg_Convert); request.ContentType = "application/x-www-form-urlencoded"; request.Method = "GET"; WebResponse response = request.GetResponse(); Stream stream = response.GetResponseStream(); StreamReader reader = new StreamReader(stream); string text = reader.ReadToEnd(); stream.Close(); MobileModel mm = new MobileModel(); if (text.Contains("statuscode=1")) { mm.isSuccess = true; } db.Connection.Close(); */ //----三竹end----// //---old----// request = (HttpWebRequest)WebRequest.Create("http://sms-get.com/api_send.php?username="******"&password="******"&method=" + Method + "&sms_msg=" + msg.Content + "&phone=" + mobile); // HttpWebRequest class is used to Make a request to a Uniform Resource Identifier (URI). request.ContentType = "application/x-www-form-urlencoded"; // Set the ContentType property of the WebRequest. request.Method = "GET"; WebResponse response = request.GetResponse(); Stream stream = response.GetResponseStream(); StreamReader reader = new StreamReader(stream); string text = reader.ReadToEnd(); MobileModel mm = new MobileModel(); foreach (var p in Json.Decode(text)) { if (p.Key == "stats") mm.isSuccess = p.Value; else if (p.Key == "error_code") mm.error_code = p.Value; else mm.error_msg = p.Value; } return mm; //---old----// }