public ClientSideQuerying() { InitializeComponent(); // Define and bind a live view of expensive non-discontinued products ordered by price. _viewProducts = (from p in _scope.GetItems<Product>() where !p.Discontinued && p.UnitPrice >= 30 orderby p.UnitPrice select new { ProductID = p.ProductID, ProductName = p.ProductName, CategoryID = p.CategoryID, CategoryName = p.Category.CategoryName, SupplierID = p.SupplierID, Supplier = p.Supplier.CompanyName, UnitPrice = p.UnitPrice, QuantityPerUnit = p.QuantityPerUnit, UnitsInStock = p.UnitsInStock, UnitsOnOrder = p.UnitsOnOrder }).AsDynamic(); // AsDynamic() is required for data binding because an anonymous class is used (select new...) dataGrid1.ItemsSource = _viewProducts; // Define a view of seafood products. Filtering is performed on the server. _seafoodProductsView = _scope.GetItems<Product>().AsFiltered(p => p.CategoryID == 8); // Bind the label text to the number of products in the view textBlockCount.SetBinding(TextBlock.TextProperty, new Binding("Value") { Source = _viewProducts.LiveCount() }); }
public static ClientView GetViewModell(Client c) { ClientView cv = new ClientView(); if (c != null) { cv.Email = c.Email; cv.Name = c.Name; cv.PhoneNumber = c.PhoneNumber; cv.Id = c.Id; } return(cv); }
public void RemoveView(ClientView v) { for (int i = 0; i < views.Count; i++) { ObservingClient currentOC = views[i]; if (currentOC.cv == v) { views.Remove(currentOC); currentOC.unsubscribe.Dispose(); } } }
public DataSourcesInCode() { InitializeComponent(); // Bind the category combo box to the category view // and show the products of the first category in the data grid. ClientView <Category> viewCategories = _scope.GetItems <Category>(); comboBox1.DisplayMemberPath = "CategoryName"; comboBox1.ItemsSource = viewCategories; BindGrid(viewCategories.First().CategoryID); }
public IActionResult Create([FromBody] ClientView clientData) { try { var result = _service.Create(clientData); var locationUri = $"{Request.Host}/api/v1/odata/Clients({result.Id})"; return(Created(locationUri, result)); } catch (Exception e) { return(SendErrorResponse(e)); } }
private void GoBack() { if (prevIsMain) { MainMenuView main = new MainMenuView(); main.Show(); } else { ClientView client = new ClientView(); client.Show(); } CloseSelf(); }
public IHttpActionResult DeleteClientView(int id) { ClientView clientView = db.ClientViews.Find(id); if (clientView == null) { return(NotFound()); } db.ClientViews.Remove(clientView); db.SaveChanges(); return(Ok(clientView)); }
public async Task <IActionResult> PostClient([FromBody] ClientView client) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var mapperClient = _mapper.Map <Client>(client); _context.Clients.Create(mapperClient); await _context.Save(); return(Ok(client)); }
private void Delete_BTN_Click(object sender, RoutedEventArgs e) { ClientView selectedClient = Client_LV.SelectedItem as ClientView; if (selectedClient.VisitAmount > 0) { MessageBox.Show("Ошибка!", "Данный клиент не может быть удален, так как имеет записи о посещениях"); } else { DataFrame.Context.Client.Remove(DataFrame.Context.Client.Find(selectedClient.Id)); DataFrame.Context.SaveChanges(); } }
public HttpResponseMessage Get([FromUri] int id) { ClientView temp = clientService.Get(id).ClientFromDomainToView(); if (temp == null) { ModelState.AddModelError("GetClientById", "Клиент с запрашиваемым идентификатором не существует!!!"); HttpResponseMessage resp = Request.CreateErrorResponse(HttpStatusCode.NotFound, ModelState); return(resp); } HttpResponseMessage response = Request.CreateResponse <ClientView>(HttpStatusCode.OK, temp); return(response); }
/// <summary> /// Generate the Client view (smart part). /// </summary> /// <param name="parentWorkspace">Tab workspace.</param> public void Generate(IWorkspace parentWorkspace) { // TabSmartPart _smartPart = new TabSmartPartInfo(); _smartPart.Title = "Client"; _smartPart.ActivateTab = true; _clientView = this.SmartParts.AddNew <ClientView>(); this.Workspaces["DrinksDistributorWorkspace"].Show(_clientView, _smartPart); _clientView.LoadDrinks(); this.Activate(); }
private void ButS(object sender, RoutedEventArgs e) { StreamWriter sw = new StreamWriter("out.txt"); sw.WriteLine("Чек на покупку тура"); sw.WriteLine("___________________"); string fn = ""; int sum = 0, pasN = 0, pasS = 0; StackPanel sp = (StackPanel)ClnInfo.Content; foreach (RadioButton r in sp.Children) { if (r.IsChecked == true) { fn = (string)r.Content; break; } } sw.WriteLine("Клиент: " + fn); ClientView cw = (ClientView)InfoCln.Items[0]; pasN = cw.pasportNum; pasS = cw.pasportSer; sw.WriteLine("Данные клиента: " + " " + "Номер паспорта " + pasN + " " + "Серия паспорта " + pasS); foreach (ClientView c in clientout) { sw.WriteLine("Номер билета: " + c.idTicket); sw.WriteLine("Цена: " + c.priCe); sw.WriteLine("Город: " + c.townName); sw.WriteLine("Дата отъезда: " + c.dateO); sw.WriteLine("Дата приезда: " + c.dateP); } sw.WriteLine("___________________"); sw.WriteLine(" "); sw.WriteLine("Приятного путешествия!"); sw.Close(); try { TE.SaveChanges(); MessageBox.Show("Информация сохранена"); Manager.MainFrame.GoBack(); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } }
public ClientViewModel(ClientView clientView) { this.clientView = clientView; LoadItems(); LinkItems(); //Preproc preproc = new Preproc(); //Sandbox sb = new Sandbox(); //MysqlTest(); //MysqlTest1(); //WebService(); //TestEF6C1C2(); //Events(); Logs(); //SQLiteTest(); }
public HttpResponseMessage Delete([FromUri] int id) { ClientView temp = clientService.Get(id).ClientFromDomainToView(); if (temp == null) { ModelState.AddModelError("DeleteClient", "Не найден клиент для удаления с указанным идентификатором!!!"); HttpResponseMessage resp = Request.CreateErrorResponse(HttpStatusCode.NotFound, ModelState); return(resp); } clientService.Delete(id); HttpResponseMessage response = Request.CreateResponse <string>(HttpStatusCode.OK, "Client is deleted!!"); return(response); }
//public ClientView AddClient(ClientView model, int userId, HttpPostedFileBase image) //{ // var clientToAdd = new Client // { // Name = model.Name, // Date = DateTime.Now, // Email = model.Email, // Id_User = userId, // Phone = model.Phone // }; // //if (image != null) // //{ // // clientToAdd.AvatarMimeType = image.ContentType; // // clientToAdd.Avatar = new byte[image.ContentLength]; // // image.InputStream.Read(clientToAdd.Avatar, 0, image.ContentLength); // //} // //db.AddToClients(clientToAdd); // db.Clients.Add(clientToAdd); // db.SaveChanges(); // return Map_Client_ClientView(clientToAdd); //} public Client AddClient(ClientView model, int userId, HttpPostedFileBase image) { var client = new Client() { Name = "alabanas", Date = DateTime.Now, Email = "asd", Id_User = 2, Phone = "02232" }; db.Clients.Add(client); db.SaveChanges(); return(client); }
public ClientViewModel(ClientView clientView, Client client = null) { this.clientView = clientView; if (client == null) { this.clientView.ClientUserControl.Load(0); } else { this.clientView.ClientUserControl.Load(client.Id); } this.clientView.ValidateB.Click += ValidateB_Click; }
public IActionResult Create([FromBody] ClientView clientData) { try { var result = _service.Create(clientData); var locationUri = $"{Request.Host}/api/v1/odata/Clients({result.Id})"; return(Created(locationUri, result)); } catch (Exception e) { _logger.LogWarning($"Create method with parameters ({JsonConvert.SerializeObject(clientData)});\n {e}"); var errors = ExceptionsChecker.CheckClientsException(e); return(BadRequest(errors)); } }
// Получить определённого клиента public IActionResult EditClient(int?ClientID) { if (ClientID.HasValue) { var Model = WebActions.GetClient(ClientID); IEnumerable <City> CitiesList = WebActions.GetCities().Result; ViewData["Cities"] = new SelectList(CitiesList, "Id", "Name"); return(View("ClientView", Model.Result)); } else { IEnumerable <City> CitiesList = WebActions.GetCities().Result; ViewData["Cities"] = new SelectList(CitiesList, "Id", "Name"); ClientView NewClient = new ClientView(); return(View("ClientView", NewClient)); } }
private void InitView() { serverView = new ServerView() { Name = "服务端" }; clientView = new ClientView() { Name = "客户端", Visibility = Visibility.Hidden }; gridPanel.Children.Add(serverView); gridPanel.Children.Add(clientView); }
public ActionResult AddClient(ClientView newClient) { bool anyUser = _repository.GetClients().Any(p => string.Compare(p.Email, newClient.Email) == 0); if (anyUser) { ModelState.AddModelError("Email", "Пользователь с таким email уже зарегистрирован"); } if (ModelState.IsValid) { var currentClient = (Client)_mapper.Map(newClient, typeof(ClientView), typeof(Client)); this.SaveClient(currentClient); return(RedirectToAction("Index", "Success")); } return(View(newClient)); }
/// <summary> /// Called when [client declared]. /// </summary> /// <param name="pSender">The sender.</param> /// <param name="pClientView">The client view.</param> /// <param name="pClientView2">The second client view.</param> private void OnClientDeclared(Server pSender, ClientView pClientView, ClientView pClientView2) { this.Dispatcher.Invoke(() => { if (pClientView2 != null) { if (this.ClientView.FirstOrDefault(pClient => pClient.Id == pClientView2.Id) != null) { this.ClientView.Remove(pClientView2); } } if (this.ClientView.FirstOrDefault(pClient => pClient.Id == pClientView.Id) == null) { this.ClientView.Add(pClientView); } }); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env) { app.UseDefaultFiles(); var provider = new FileExtensionContentTypeProvider(); // Add new mappings provider.Mappings[".mtl"] = "text/plain"; provider.Mappings[".obj"] = "text/plain"; app.UseStaticFiles(new StaticFileOptions { ContentTypeProvider = provider }); app.UseWebSockets(); app.Use(async(context, next) => { if (context.Request.Path == "/connect_client") { if (context.WebSockets.IsWebSocketRequest) { WebSocket webSocket = await context.WebSockets.AcceptWebSocketAsync(); ClientView cs = new ClientView(webSocket); simulationController.AddView(cs); await cs.StartReceiving(); simulationController.RemoveView(cs); } else { context.Response.StatusCode = 400; } } else { await next(); } }); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } }
public ClientView AddClient(ClientView model, int userId, HttpPostedFileBase image) { var clientToAdd = new Client(); clientToAdd.Name = model.Name; clientToAdd.Date = DateTime.Now; clientToAdd.Email = model.Email; clientToAdd.Id_User = userId; clientToAdd.Phone = model.Phone; //if (image != null) //{ // clientToAdd.AvatarMimeType = image.ContentType; // clientToAdd.Avatar = new byte[image.ContentLength]; // image.InputStream.Read(clientToAdd.Avatar, 0, image.ContentLength); //} db.SaveChanges(); return(Map_Client_ClientView(clientToAdd)); }
public ActionResult RegisterClient(ClientView client) { var workshopRepo = new WorkshopRepository(); var clients = workshopRepo.GetClients(); if (clients is null) { return(NotFound()); } else if (clients.Contains(client)) { return(Ok("Already registered.")); } else { workshopRepo.RegisterClient(client); return(Ok()); } }
private void buttonBrowse_Click(object sender, System.EventArgs e) { OpenFileDialog fdlg = new OpenFileDialog(); fdlg.Title = "C# Inventor Open File Dialog"; fdlg.InitialDirectory = @"c:\program files\autodesk\inventor 2013\samples\models\"; fdlg.Filter = "Inventor files (*.ipt; *.iam; *.idw)|*.ipt;*.iam;*.idw"; fdlg.FilterIndex = 2; fdlg.RestoreDirectory = true; if (fdlg.ShowDialog() == DialogResult.OK) { // get the file name textBoxFileName.Text = fdlg.FileName; m_odocument = m_oserver.Open(textBoxFileName.Text); // if drawing document, get the first sheet and from it the client views collection, then create a client view if (m_odocument.DocumentType == DocumentTypeEnum.kDrawingDocumentObject) { m_odrawingDocument = (Inventor.ApprenticeServerDrawingDocument)m_odocument; m_oview = m_odrawingDocument.Sheets[1].ClientViews.Add(pictureBox1.Handle.ToInt32()); m_ocamera = m_oview.Camera; m_ocamera.Perspective = false; } // if part or assembly get the client views collection from the document, then create a client view else { m_oview = m_odocument.ClientViews.Add(pictureBox1.Handle.ToInt32()); m_ocamera = m_oview.Camera; m_ocamera.ViewOrientationType = ViewOrientationTypeEnum.kIsoTopRightViewOrientation; } m_ocamera.Fit(); m_ocamera.Apply(); m_oview.Update(false); // using the control to display the file axInventorView1.FileName = fdlg.FileName; } }
public void When(ClientRegistered @event) { var accountStatus = repository.Get<AccountStatusLookup>((int)AccountStatusType.Unknown); var clientView = new ClientView { AccountNumber = string.Empty, AccountRecency = 0, AccountStatus = accountStatus, IsDeceased = false, DateOfBirth = @event.IdentityNumber.GetDateOfBirth(), FirstName = @event.ClientName.FirstName, Surname = @event.ClientName.Surname, IdentityNumber = @event.IdentityNumber.Number, PrimaryContactNumber = @event.PrimaryContactNumber.Number }; repository.Add(clientView); }
public JsonResult GetEditAsync(int id) { string mesaj = string.Empty; var clientToEdit = new ClientView(); try { clientToEdit = _clientRepo.GetEditClient(id); } catch (Exception ex) { mesaj = ex.Message; } return(Json(new { Message = mesaj, Html = this.RenderPartialView("Edit", clientToEdit) })); }
private void CheckClients(object sender, RoutedEventArgs e) { if (sender is RadioButton r) { int idClient = -1; List <ClientView> cv = new List <ClientView>(); foreach (clients c in TE.clients) { if (((string)r.Content) == (c.lname + " " + c.fname)) { idClient = c.clientId; break; } } foreach (tickets t in TE.tickets) { if (t.clientId == idClient) { ClientView cn = new ClientView(); cn.idTicket = t.ticketId; cn.pasportNum = TE.clients.Find(idClient).passportId; cn.pasportSer = TE.clients.Find(idClient).passportSer; foreach (tours ts in TE.tours) { if (t.tourId == ts.tourId) { cn.townName = ts.towns.townName; cn.priCe = ts.tourPrice; cn.dateO = ts.dateDeparture; cn.dateP = ts.dateArrive; break; } } cv.Add(cn); } } InfoCln.ItemsSource = cv; clientout = cv; } }
// Получить определённого клиента public static async Task <ClientView> GetClient(int?ClientID) { if (ClientID.HasValue) { using (var http = new HttpClient()) { http.BaseAddress = BaseURI; HttpResponseMessage HTTPResult = await http.GetAsync($"api/Clients/{ClientID}"); HTTPResult.EnsureSuccessStatusCode(); ClientView Result = await HTTPResult.Content.ReadAsAsync <ClientView>(); return(Result); } } else { return(null); } }
public static ClientDomain ClientFromViewToDomain(this ClientView @this) { if (@this != null) { return(new ClientDomain() { ClientId = @this.ClientId, ClientTitle = @this.ClientTitle, ClientMarkJuridical = @this.ClientMarkJuridical, ClientTaxpayNum = @this.ClientTaxpayNum, ClientPhone = @this.ClientPhone, ClientEMail = @this.ClientEMail, AccountsOfClient = @this.AccountsOfClient.Select(_ => _.AccountFromViewToDomain()).ToList() }); } else { return(null); } }
public HttpResponseMessage Update([FromBody] ClientView inst) { if (inst == null) { ModelState.AddModelError("UpdateClient", "Не указаны данные для обновления клиента!!!"); HttpResponseMessage resp = Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState); return(resp); } if (ModelState.IsValid) { clientService.Update(inst.ClientFromViewToDomain()); HttpResponseMessage response = Request.CreateResponse <string>(HttpStatusCode.OK, "Client is updated!!"); return(response); } else { HttpResponseMessage resp = Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState); return(resp); } }
public void OnSizeChanged(object sender, EventArgs e) { _oview = _odocument.ClientViews[1]; if (_oserver != null && _oview != null) { _oview.Update(true); _ocamera = _oview.Camera; if (_previousPoint != null) { } //Point2d opoint = _oserver.TransientGeometry.CreatePoint2d(e.X, e.Y); //_ocamera.ComputeWithMouseInput(_previousPoint, _previousPoint, 0, ViewOperationTypeEnum.kRotateViewOperation); _ocamera.Fit(); _ocamera.Apply(); _oview.Update(false); /*_ocamera = _oview.Camera; * _ocamera.Apply(); * _oview.Update(true);*/ } }
public void JoinExitAuction(object sender, EventArgs evt) { //when client attempts to dis/connect to server view = (ClientView)(((Button)sender).FindForm()); if (!connected) { //if not already connected attempt connection //get supplied IP Address and Port number from view string tempServerIP = view.getServerIP(), tempPort = view.getServerPortNumber(); if (tempServerIP != "" && tempPort != "") { try { //if not null attempt to parse this.serverIP = IPAddress.Parse(tempServerIP); this.portNumber = Int16.Parse(tempPort); this.connectToServer(); } catch (FormatException fe) { //if parse fails tell user MessageBox.Show("Please enter correct text for all fields."); return; } } else { //tell user to add data to all fiels MessageBox.Show("Please enter text for all fields."); return; } } else if (connected) { //or if already connected discconect from server this.disconnectFromServer(); } }
public void Start() { _control = new ClientControl(); _model = new ClientModel(); _view = new ClientView(); }