//Start private void Button_Click_1(object sender, RoutedEventArgs e) { _clientVM = new ClientInfoViewModel(); _clientVM.Listener = _listener; ListViewClients.DataContext = _clientVM; _listener.ResumeListening(); }
private void Edit(ClientEditModel clientEditModel) { ClientInfoViewModel viewModel = GetClientInfoViewModel(clientEditModel); ClientInfoControl control = new ClientInfoControl(viewModel); Window window = WindowFactory.CreateByContentsSize(control); viewModel.ClientEdited += (s, e) => { ClientEditDTO clientEditDTO = Mapper.Map <ClientEditModel, ClientEditDTO>(e.Client); using (IClientService service = factory.CreateClientService()) { ServiceMessage serviceMessage = service.Update(clientEditDTO); RaiseReceivedMessageEvent(serviceMessage.IsSuccessful, serviceMessage.Message); if (serviceMessage.IsSuccessful) { window.Close(); Notify(); } } }; window.Show(); }
public void StartServer() { //_listener = new AsyncSocketSslListener(@"", "") _listener = new AsyncSocketListener(); _clientVM = (ClientInfoViewModel)ListViewClients.DataContext; _clientVM.Listener = _listener; BindEvents(); _listener.StartListening(13000); }
public void StartServer() { _listener = new AsyncSocketListener(); _clientVM = (ClientInfoViewModel)ListViewClients.DataContext; _clientVM.Listener = _listener; BindEvents(); //new Thread(() => //{ // Thread.CurrentThread.IsBackground = true; //_listener.StartListening("127.0.0.1", 13000); _listener.StartListening("192.168.1.106", 13000); //}).Start(); }
public ActionResult NewClient(ClientInfoViewModel clientInfo, string NewCard) { clientInfo.Price.ConfirmationDate = DateTime.Now; try { _context.Clients.Add(clientInfo.Client); _context.SaveChanges(); var price = _context.PricePerHours.Find(clientInfo.Price.PerHourId); if (!price.Public) { price.ClientId = clientInfo.Client.Id; } clientInfo.Price.ClientId = clientInfo.Client.Id; _context.ClientPrices.Add(clientInfo.Price); _context.SaveChanges(); ClientBalance.Create(clientInfo.Client); _context.clientGoals.Add(new ClientGoal { ClientId = clientInfo.Client.Id, Goal = "" }); _context.SaveChanges(); } catch (Exception exc) { if (exc is DbUpdateException dbUpdate) { ViewBag.Error = "Cannot insert duplicate values fo Home Phone."; } else { ViewBag.Error = exc.Message; } ViewData.Add("Price.PerHourId", new SelectList(_context.PricePerHours.Where(p => p.Public == true).Select( p => new { Id = p.Id, Description = p.Description + " " + p.Price }), "Id", "Description", clientInfo.Price.PerHourId)); ViewBag.Title = "New Client"; ViewBag.Message = "New Client"; return(View("NewClient", clientInfo)); } return(RedirectToAction("Index", "Clients")); }
public ActionResult ClientInfo() { ClientInfoViewModel model = new ClientInfoViewModel(); StringBuilder msg = new StringBuilder(); try { if (!Request.IsAuthenticated) { msg.AppendLine("Request not authenticated"); } var user = this.User; var claimsPrincipal = user as SSC.ClaimsPrincipal; if (claimsPrincipal != null) { SSC.ClaimsIdentity claimsIdentity = claimsPrincipal.Identity as SSC.ClaimsIdentity; if (claimsIdentity != null) { int claimNum = 1; foreach (SSC.Claim claim in claimsIdentity.Claims) { model.ClientInfo.Add(new InfoItem { Name = string.Format("Claim {0}", claimNum), Value = string.Format("Issuer: \"{1}\" {0}OriginalIssuer: \"{2}\" {0}Properties.Count: \"{3}\" {0}Subject: \"{4}\" {0}Type: \"{5}\" {0}ValueType: \"{6}\" {0}Value: \"{7}\" {0}", Environment.NewLine, claim.Issuer, claim.OriginalIssuer, claim.Properties.Count, claim.Subject, claim.Type, claim.ValueType, claim.Value) }); claimNum++; } } } } catch (Exception ex) { ReportException(ex, msg); } model.Message = msg.ToString(); return(View(model)); }
public ActionResult NewClient() { ViewBag.Title = "נייע תלמיד"; ViewBag.Message = "נייע תלמיד"; var client = new ClientInfoViewModel { Client = new Client(), Price = new ClientPrice() }; ViewData.Add("Price.PerHourId", new SelectList(_context.PricePerHours.Where(p => p.Public == true).Select( p => new { Id = p.Id, Description = p.Description + "\t" + p.Price }), "Id", "Description")); return(View(client)); }
public ActionResult EditClient(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var client = new ClientInfoViewModel { Client = _context.Clients.Find(id), Price = _context.ClientPrices.AsEnumerable().LastOrDefault(p => p.ClientId == id) }; if (client == null) { return(HttpNotFound()); } ViewBag.Title = "Edit Client"; ViewBag.Message = "Edit Client"; if (client.Price == null) { ViewData.Add("Price.PerHourId", new SelectList(_context.PricePerHours.Where(p => p.Public == true).Select( p => new { Id = p.Id, Description = p.Description + " " + p.Price }), "Id", "Description")); } else { ViewData.Add("Price.PerHourId", new SelectList(_context.PricePerHours.Where(p => p.Public == true || p.ClientId == id).Select( p => new { Id = p.Id, Description = p.Description + " " + p.Price }), "Id", "Description", client.Price.PerHourId)); } return(View("NewClient", client)); }
public ActionResult EditClient(ClientInfoViewModel clientInfo) { clientInfo.Price.ConfirmationDate = DateTime.Now; if (clientInfo.Price.ClientId == 0) { clientInfo.Price.ClientId = clientInfo.Client.Id; _context.ClientPrices.Add(clientInfo.Price); _context.SaveChanges(); ModelState.SetModelValue("Price.ClientId", new ValueProviderResult(clientInfo.Client.Id, null, CultureInfo.InvariantCulture)); } _context.Entry(clientInfo.Client).State = EntityState.Modified; var clientPrice = _context.ClientPrices.AsEnumerable().LastOrDefault(c => c.ClientId == clientInfo.Client.Id); if (clientPrice.PerHourId != clientInfo.Price.PerHourId) { _context.ClientPrices.Add(clientInfo.Price); } _context.SaveChanges(); return(RedirectToAction("Index", "Clients")); }
//Start private void Button_Click_1(object sender, RoutedEventArgs e) { _clientVM = new ClientInfoViewModel(); _clientVM.Listener = _listener; ListViewClients.DataContext = _clientVM; _listener.ResumeListening(); //if (!_listener.IsServerRunning) //{ // _listener = new AsyncSocketListener(); // _clientVM = new ClientInfoViewModel(); // _clientVM.Listener = _listener; // ListViewClients.DataContext = _clientVM; // BindEvents(); // //new Thread(() => // //{ // // Thread.CurrentThread.IsBackground = true; // _listener.StartListening("127.0.0.1", 13000); // //}).Start(); //} }
public UIElement GetAccountElement() { DataServiceMessage <ClientEditDTO> serviceMessage; using (IClientService service = factory.CreateClientService()) { serviceMessage = service.GetClientInfo(login); RaiseReceivedMessageEvent(serviceMessage); } UIElement element = null; if (serviceMessage.IsSuccessful) { ClientEditModel client = Mapper.Map <ClientEditDTO, ClientEditModel>(serviceMessage.Data); ClientInfoViewModel viewModel = GetClientInfoViewModel(client); ClientInfoControl control = new ClientInfoControl(viewModel); viewModel.ClientEdited += (s, e) => Edit(e.Client); element = control; } else { List <ServiceMessage> messages = new List <ServiceMessage>() { serviceMessage }; ErrorViewModel viewModel = new ErrorViewModel(messages); ErrorControl control = new ErrorControl(viewModel); element = control; } return(element); }
private void ControlViewModelInit() { CameraStatisticsViewModel = new MainWindowStatisticsViewModel(); WaterStatisticsViewModel = new MainWindowStatisticsViewModel(); CameraInfoViewModel = new CameraInfoViewModel(); ClientInfoViewModel = new ClientInfoViewModel(); carAlarmViewModel = new AlarmButtonViewModel(MainWindowViewModel); waterAlarmViewModel = new AlarmButtonViewModel(MainWindowViewModel); fireAlarmViewModel = new AlarmButtonViewModel(MainWindowViewModel); ///初始化车辆报警 carAlarmViewModel.AlarmType = AlarmType.CarAlarm; carAlarmViewModel.AlarmCount = "5"; ///初始化水压报警 waterAlarmViewModel.AlarmType = AlarmType.WaterAlarm; waterAlarmViewModel.AlarmCount = "6"; ///初始化火灾报警 fireAlarmViewModel.AlarmType = AlarmType.FireAlarm; fireAlarmViewModel.AlarmCount = "7"; CameraStatisticsViewModel.Icon = "/ManagementProject;component/ImageSource/Icon/mainwindowicon/摄像机.png"; CameraStatisticsViewModel.Number = "8"; WaterStatisticsViewModel.Icon = "/ManagementProject;component/ImageSource/Icon/mainwindowicon/水压设备.png"; WaterStatisticsViewModel.Number = "5"; }
public ActionResult ClientInfo(ClientInfoViewModel model, List <UploadViewModel> ImageModel) { var result = new CiResult(); var uploadResult = FileUpload(ImageModel); if (!uploadResult.IsSuccess) { result.Message = uploadResult.Message; } else { model.Logo = uploadResult.Data; } //save if (string.IsNullOrEmpty(result.Message)) { result = service.Save(SystemSettingType.ClientInfo, model); } return(Json(result)); }
public ClientInfoControl(ClientInfoViewModel viewModel) { InitializeComponent(); this.DataContext = viewModel; }
public ActionResult ClientInfoReport(ClientInfoViewModel clientInfo) { try { if (!ModelState.IsValid) { return(View(clientInfo)); } var query = _db.ClientInfos.Include(x => x.ServiceInfo).Include(x => x.AgentInfo).Include(x => x.UserServedBy); if (clientInfo.Id != null) { query = query.Where(x => x.Id == clientInfo.Id); } if (clientInfo.BranchId != null) { query = query.Where(x => x.BranchId == clientInfo.BranchId); } if (clientInfo.ServedBy != null) { query = query.Where(x => x.ServedBy == clientInfo.ServedBy); } if (clientInfo.ServiceId != null) { query = query.Where(x => x.ServiceId == clientInfo.ServiceId); } if (clientInfo.AirLineId != null) { query = query.Where(x => x.AirLineId == clientInfo.AirLineId); } if (clientInfo.AgentId != null) { query = query.Where(x => x.AgentId == clientInfo.AgentId); } if (clientInfo.WorkingStatus != null) { query = query.Where(x => x.WorkingStatus == clientInfo.WorkingStatus); } if (clientInfo.InfoStatus != null) { query = query.Where(x => x.InfoStatus == clientInfo.InfoStatus); } if (clientInfo.DeliveryStatus != null) { query = query.Where(x => x.DeliveryStatus == clientInfo.DeliveryStatus); } if (clientInfo.FromDate != null && clientInfo.ToDate != null) { query = query.Where(x => x.EntryDate >= clientInfo.FromDate && x.EntryDate <= clientInfo.ToDate); } else if (clientInfo.FromDate != null && clientInfo.ToDate == null) { query = query.Where(x => x.EntryDate >= clientInfo.FromDate); } else if (clientInfo.FromDate == null && clientInfo.ToDate != null) { query = query.Where(x => x.EntryDate <= clientInfo.ToDate); } var data = query.ToList(); var totalServiceCharge = data.Sum(x => x.ServiceCharge); var totalCost = data.Sum(x => x.Cost); var totalProfit = data.Sum(x => x.Profit); var clientReports = data.Select(x => new { EntryDate = string.Format("{0:dd/MM/yyyy}", x.EntryDate), CID = x.CustomerId, PaxName = x.LastName != null ? string.Format("{0} {1}", x.FirstName, x.LastName) : x.FirstName, Referral = x.Referral ?? "", Service = x.ServiceInfo != null ? x.ServiceInfo.ServiceName : "", Airline = x.AirLineInfo != null ? x.AirLineInfo.AirLineName : "", AirLinePnr = x.AirLinePnr ?? "", x.ServiceCharge, x.Cost, x.Profit, ServedBy = x.UserServedBy.UserName, WorkingStatus = Common.GetDescription(x.WorkingStatus), InfoStatus = Common.GetDescription(x.InfoStatus), DeliveryStatus = Common.GetDescription(x.DeliveryStatus) }).OrderByDescending(x => x.EntryDate).ToList(); return(Json(new { Flag = true, ClientReports = clientReports, ServiceCharge = totalServiceCharge, Cost = totalCost, Profit = totalProfit })); } catch (Exception ex) { return(Json(new { Flag = false, Msg = ex.Message })); } }
internal void SetClientInfoViewModel(ClientInfoViewModel clientInfoViewModel) { this.ClientInfoViewModel = clientInfoViewModel; }