public OknoRezerwacji(MainWindow parent, SeanceData dane) : this() { this.parent = parent; DaneSeansu = dane; TytulLabel.Content = DaneSeansu.Title; DataLabel.Content = DaneSeansu.SeanceDate; SalaLabel.Content = "Sala nr " + DaneSeansu.SalaID; using (ClientServiceClient cs = new ClientServiceClient()) { DaneSali = cs.GetCinemaHall(DaneSeansu.SalaID); } List <int> numeryRzedow = new List <int>(); for (int i = 1; i <= DaneSali.Rows; i++) { numeryRzedow.Add(i); } List <int> numeryMiejsc = new List <int>(); for (int i = 1; i <= DaneSali.Positions; i++) { numeryMiejsc.Add(i); } RządComboBox.ItemsSource = numeryRzedow; MiejsceComboBox.ItemsSource = numeryMiejsc; MiejscaDoZarezerwowania = new ObservableCollection <PositionData>(); Rezerwacje.ItemsSource = MiejscaDoZarezerwowania; }
private void Save_Click(object sender, RoutedEventArgs e) { bool daneOK = true; int count = MiejscaDoZarezerwowania.Count(); int countDistinct = MiejscaDoZarezerwowania.Distinct().Count(); if (count == countDistinct) { try { using (ClientServiceClient cs = new ClientServiceClient()) { List <ReservationPositionModel> res = cs.GetActualCinemaHallState(DaneSeansu.SalaID).ToList(); foreach (PositionData pos in MiejscaDoZarezerwowania) { if (res.Where(x => x.Position == pos.Position && x.Row == pos.Row).FirstOrDefault() == null) { cs.AddReservationSinglePosition(DaneSeansu.SalaID, parent.loggedUser.ClientID, pos.Row, pos.Position); } } } this.Close(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } }
public void ExamWorkstations() { while (true) { Thread.Sleep(2000); foreach (WorkStation station in _currentSessionWorkstations) { var wIp = station.IP; using (ClientServiceClient client = new ClientServiceClient()) { var selectedUser = client.GetUserForWorkstation(_currentExamSessionID, station.WorkStationId); var errorsforuser = client.GetOffenceScreenId(selectedUser); foreach (Student s in _currentSessionStudents) { if (s.Ip == wIp) { s.WrongPageCount = errorsforuser.Length.ToString(); } } } _currentdataGridStudents.Dispatcher.Invoke(() => _currentdataGridStudents.ItemsSource = null); _currentdataGridStudents.Dispatcher.Invoke(() => _currentdataGridStudents.ItemsSource = _currentSessionStudents); } } }
private void Wyszukaj_Click(object sender, RoutedEventArgs e) { using (ClientServiceClient cs = new ClientServiceClient()) { reservations = cs.GetReservations(loggedUser.ClientID).ToList(); List <ReservationData> daneORezewacjach = new List <ReservationData>(); if (RezerwacjeOd.SelectedDate.HasValue && RezerwacjeDo.SelectedDate.HasValue) { if (RezerwacjeOd.SelectedDate.Value > RezerwacjeOd.SelectedDate.Value) { RezerwacjeDo.SelectedDate = RezerwacjeOd.SelectedDate.Value.AddDays(1); } foreach (ReservationModel model in reservations.Where(x => x.ReservationDate > RezerwacjeOd.SelectedDate.Value && x.ReservationDate < RezerwacjeDo.SelectedDate.Value).ToList()) { daneORezewacjach.Add(new ReservationData(model)); } } else { foreach (ReservationModel model in reservations) { daneORezewacjach.Add(new ReservationData(model)); } } RezerwacjeDataGrid.ItemsSource = daneORezewacjach; } }
public OneScreenShotPage() { InitializeComponent(); //using (ClientServiceClient client = new ClientServiceClient()) //{ // screenShotCount = client.GetScreenCountFromDB(); // if (screenShotCount > 0) // { // var bytearray = client.GetScreenByIdFromDB(0); // ImageSourceConverter converter = new ImageSourceConverter(); // imageScreenShot.Source = ToImage(bytearray); // comboboxScreenNumber.SelectedIndex = 0; // } //} using (ClientServiceClient client = new ClientServiceClient()) { screenShotCount = client.GetScreenCountFromDB(); if (screenShotCount > 0) { screenShotCount = client.GetScreenCountFromDB(); } } for (int i = 0; i < screenShotCount; i++) { comboboxScreenNumber.Items.Add(i.ToString()); } }
public User(string username, bool guartOn, bool alarmOn, bool keyOnOff, bool datX, int cellgroup, string catRoom, int floor) { InitializeComponent(); InstanceContext instanceContext = new InstanceContext(new ClientServiceCallback()); _clientService = new ClientServiceClient(instanceContext); RommsL = this.Resources["RoomsDataSource"] as RoomCollection; _keysCollectionL = this.Resources["KeysDataSource"] as KeysCollection; _floorId = floor; //определение сом порта этажа // todo надо переписать под универсальную строку коннекта когда будет создан админ // string conn = @"Data Source=microsoft-pc;Initial Catalog=ALFA;Integrated Security=True"; // SqlConnection sqlComPort = new SqlConnection(conn); // sqlComPort.Open(); // string infoAboutComPort = @"SELECT ComPort FROM Floors // WHERE (FloorName = '" + _floorId + "')"; // SqlCommand sqlinfoAboutComPort = new SqlCommand(infoAboutComPort, sqlComPort); // SqlDataReader rezultat = sqlinfoAboutComPort.ExecuteReader(); // rezultat.Read(); // _yComPort = (string)rezultat["ComPort"]; // rezultat.Close(); // sqlComPort.Close(); // ну согласись, лучше чем верхняя портянка, даже если предположить что ты не знаешь Linq то тут все понятно AlfaEntities alfaEntities = new AlfaEntities(); // todo ошибочно считается что не может быть ситуации когда забит этаж и не указан ком порт, надо обработать это исключение _yComPort = (from floorse in alfaEntities.Floors where floorse.FloorId == _floorId select floorse.ComPort).FirstOrDefault(); }
public bool GenereteListBox(ClientServiceClient client, ListBox allPages, ListBox allgroups, ListBox activegrouppages) { GenerateAcceptablePages(client, allPages); GenerateAcceptablePagesGroups(client, allgroups); GenerateactiveGroupPages(client, activegrouppages, 1); return(true); }
private void listBoxGroups_SelectionChanged(object sender, SelectionChangedEventArgs e) { var selectedgroups = _workstationscontrol._workstationsGroups[0]; if (this.listBoxGroups.SelectedItem != null) { selectedgroups = _workstationscontrol._workstationsGroups.FirstOrDefault(x => x.Name == ((ListBoxItem)this.listBoxGroups.SelectedItem).Content.ToString()); } using (ClientServiceClient client = new ClientServiceClient()) { _workstationscontrol.GenerateactiveGroupworkstations(client, listBoxPagesForGroup, selectedgroups.WorkStationsGroupId); } if (CheckIsPageInGroup()) { this.buttonPagesForGroupAdd.IsEnabled = true; } else { this.buttonPagesForGroupAdd.IsEnabled = false; } if (listBoxGroups.SelectedItem != null && listBoxPages.SelectedItem != null) { this.buttonPagesForGroupAdd.IsEnabled = false; } else { this.buttonPagesForGroupAdd.IsEnabled = true; } }
private static void TestClientProxy() { ClientProxy.ClientServiceClient cp = new ClientServiceClient(); var clientResult = cp.GetClient(GetClientBy.ClientID, 1, null, null, true, true); MonitoringProxy.MonitoringServiceClient mp = new MonitoringServiceClient(); List <RmsReportMonitoringRaw> lRawMessage = new List <RmsReportMonitoringRaw>(); foreach (var mpd in clientResult.ListMonitoringProfileDevices) { var rawMessage = new RmsReportMonitoringRaw(); rawMessage.ClientCode = clientResult.Client.ClientCode; rawMessage.DeviceCode = clientResult.ListDevices.First(d => d.DeviceId == mpd.DeviceId).DeviceCode; if (mpd.MonitoringProfileDeviceId != 16) { rawMessage.Message = "OK"; } else { rawMessage.Message = "DEVICE_NOT_READY"; } rawMessage.MessageDateTime = DateTime.Now; rawMessage.MonitoringProfileDeviceId = mpd.MonitoringProfileDeviceId; lRawMessage.Add(rawMessage); } mp.AddMessages(lRawMessage); }
public bool GenereteListBox(ClientServiceClient client, ListBox allWorkstations, ListBox allgroups, ListBox activegroupworkstations) { GenerateAcceptableworkstations(client, allWorkstations); GenerateAcceptableworkstationsGroups(client, allgroups); GenerateactiveGroupworkstations(client, activegroupworkstations, 1); return(true); }
void SendClientJob(int Steps) { Graphics g = Graphics.FromImage(pbSceneLocal.Image); g.FillRectangle(new SolidBrush(System.Drawing.Color.Black), 0.0F, 0.0F, (float)pbSceneLocal.Image.Width, (float)pbSceneLocal.Image.Height); rect = new System.Drawing.Rectangle(0, 0, 400, 400); localBitmap = new System.Drawing.Bitmap(rect.Width, rect.Height); pbSceneLocal.Image = localBitmap; gr = System.Drawing.Graphics.FromImage(pbSceneLocal.Image); RangeList = new List <RangeOfCalculation>(); Result = new List <ResultRenderRows>(); //создаем клиенты binding.SendTimeout = new TimeSpan(0, 0, 0, 0, Convert.ToInt32(maxPerfCount * 10)); for (int i = 0; i < Clients.ListClients.Count; i++) { EndpointAddress address = new EndpointAddress("http://" + Clients.ListClients [i].IP + ":8734/ClientService/"); clients [i] = new ClientServiceClient(binding, address); clients [i].RayTraceRowsCompleted += MainWindow_RayTraceRowsCompleted; } // Разбиваем задачу на части for (int i = 0; i < rect.Height / Steps; i++) { RangeOfCalculation r = new RangeOfCalculation(i * Steps, i * Steps + Steps, RangeOfCalculation.CurrentState.notComputing); RangeList.Add(r); } countRange = RangeList.Count;//количество диапазонов //запускаем поток, в котором части задачи будут распределяться между клиентами thr = new Thread(new ThreadStart(Computing)); thr.Start(); //запускаем поток в котором будет выполняться отрисовка созданных клиентом кусочков сцены thr1 = new Thread(new ThreadStart(DrawingRows)); thr1.Start(); }
private void RezerwacjeAktywneDataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e) { try { ReservationPositionData pd = (ReservationPositionData)RezerwacjeAktywneDataGrid.SelectedItem; if (pd != null) { using (ClientServiceClient cs = new ClientServiceClient()) { MovieModel q = cs.GetMovie(pd.MovieID); SzczegolyTytulFilmu.Content = q.Title; SzczegolyRezyser.Content = q.Regisseur; SzczegolyRokWydania.Content = q.PublicationDate; SzczegolyOcena.Content = q.Note; SzczegolyZdjecie.DataContext = q.ImageContent; } } else { SzczegolyTytulFilmu.Content = ""; SzczegolyRezyser.Content = ""; SzczegolyRokWydania.Content = ""; SzczegolyOcena.Content = ""; SzczegolyZdjecie.DataContext = null; } } catch (Exception) { } }
private void orderbtn_Click(object sender, EventArgs e) { OrderServiceClient orderSoapClient = new OrderServiceClient(); ItemServiceClient itemSoapClient = new ItemServiceClient(); ClientServiceClient clientSoapClient = new ClientServiceClient(); OrderReference.Client client = new OrderReference.Client(); client.Name = this.nameClienttb.Text; client.PhoneNumber = this.phoneNumbertb.Text; OrderReference.Item item1 = new OrderReference.Item(); item1.NameItem = this.nameItem1tb.Text; item1.Length = Double.Parse(this.length1tb.Text); item1.Width = Double.Parse(this.width1tb.Text); item1.Height = Double.Parse(this.height1tb.Text); item1.Weight = Double.Parse(this.weight1tb.Text); OrderReference.Item item2 = new OrderReference.Item(); item2.NameItem = this.nameItem1tb.Text; item2.Length = Double.Parse(this.length2tb.Text); item2.Width = Double.Parse(this.width2tb.Text); item2.Height = Double.Parse(this.height2tb.Text); item2.Weight = Double.Parse(this.weight2tb.Text); List <OrderReference.Item> items = new List <OrderReference.Item>(); items.Add(item1); items.Add(item2); OrderReference.Order order = new OrderReference.Order(); order.Date = this.datetb.Text; order.Address = this.addresstb.Text; order.Loader = this.loader.Checked; order.Client = client; order.Items = items.ToArray(); List <OrderReference.Order> orders = new List <OrderReference.Order>(); orders.Add(order); client.Orders = orders.ToArray(); item1.Order = order; item2.Order = order; try { //clientSoapClient.AddClient((ClientReference.Client)client); orderSoapClient.AddOrder(order); //itemSoapClient.AddItem((ItemReference.Item) item1); //itemSoapClient.AddItem((ItemReference.Item) item2); } catch (Exception error) { System.Diagnostics.Debug.Write("Error is occur " + error); } }
private ClientDto GetClient(int CAId) { ClientServiceClient client = new ClientServiceClient(); ClientDto clientDto = client.GetById(CAId); client.Close(); return(clientDto); }
private void MenuItemExamSession_Click(object sender, RoutedEventArgs e) { using (ClientServiceClient client = new ClientServiceClient()) { es._examsessioncontrol.GenereteSelects(client, es.comboBoxAcceptablePagesGroup, es.comboBoxWorkstationGroups); } firstFrame.Navigate(es); }
public WorkstatationsPage() { InitializeComponent(); _workstationscontrol = new Control.WorkstationsControl(); using (ClientServiceClient client = new ClientServiceClient()) { _workstationscontrol.GenereteListBox(client, listBoxPages, listBoxGroups, listBoxPagesForGroup); } }
public AcceptablePagesPage() { InitializeComponent(); _pagescontrol = new AcceptablePages.AcceptablePagesControl(); using (ClientServiceClient client = new ClientServiceClient()) { _pagescontrol.GenereteListBox(client, listBoxPages, listBoxGroups, listBoxPagesForGroup); } }
private void buttonGroupDelete_Click(object sender, RoutedEventArgs e) { var selected = _pagescontrol._acceptablePagesGroups.FirstOrDefault(x => x.Name == ((ListBoxItem)this.listBoxGroups.SelectedItem).Content.ToString()); using (ClientServiceClient client = new ClientServiceClient()) { client.DeletePagesGroup(selected); } this.listBoxGroups.Items.Remove(this.listBoxGroups.SelectedItem); }
private void buttonStart_Click(object sender, RoutedEventArgs e) { var selectedpagegroup = _examsessioncontrol._acceptablePagesGroups.FirstOrDefault(x => x.Name == (this.comboBoxAcceptablePagesGroup.SelectedValue.ToString())); var selectedworkgroup = _examsessioncontrol._workstationsGroups.FirstOrDefault(x => x.Name == (this.comboBoxWorkstationGroups.SelectedValue.ToString())); using (ClientServiceClient client = new ClientServiceClient()) { _examsessioncontrol.StartExamSession(client, selectedpagegroup, selectedworkgroup, dataGridStudents); } }
public ExamSessionStartPage() { InitializeComponent(); _examsessioncontrol = new ExamSessionControl(); using (ClientServiceClient client = new ClientServiceClient()) { _examsessioncontrol.GenereteSelects(client, comboBoxAcceptablePagesGroup, comboBoxWorkstationGroups); } }
private void buttonPagesDelete_Click(object sender, RoutedEventArgs e) { var selected = _workstationscontrol._workstations.FirstOrDefault(x => x.IP == ((ListBoxItem)this.listBoxPages.SelectedItem).Content.ToString()); using (ClientServiceClient client = new ClientServiceClient()) { client.DeleteWorkstation(selected); } this.listBoxPages.Items.Remove(this.listBoxPages.SelectedItem); }
private void buttonPagesForGroupAdd_Click(object sender, RoutedEventArgs e) { var selectedgroups = _workstationscontrol._workstationsGroups.FirstOrDefault(x => x.Name == ((ListBoxItem)this.listBoxGroups.SelectedItem).Content.ToString()); var selectedworkstation = _workstationscontrol._workstations.FirstOrDefault(x => x.IP == ((ListBoxItem)this.listBoxPages.SelectedItem).Content.ToString()); using (ClientServiceClient client = new ClientServiceClient()) { client.AddWorkstationForGroup(selectedworkstation, selectedgroups); _workstationscontrol.GenerateactiveGroupworkstations(client, listBoxPagesForGroup, selectedgroups.WorkStationsGroupId); } }
private void buttonGetCurrentScreen_Click(object sender, RoutedEventArgs e) { using (ClientServiceClient client = new ClientServiceClient()) { var current_ip = comboboxScreenNumber.SelectedItem.ToString().Substring(0, comboboxScreenNumber.SelectedItem.ToString().IndexOf("-")); var id = SendCMD(current_ip, "Screen"); var bytearray = client.GetScreenByIdFromDB(Convert.ToInt32(id)); ImageSourceConverter converter = new ImageSourceConverter(); imageScreenShot.Source = ToImage(bytearray); } }
private void buttonPagesForGroupAdd_Click(object sender, RoutedEventArgs e) { var selectedgroups = _pagescontrol._acceptablePagesGroups.FirstOrDefault(x => x.Name == ((ListBoxItem)this.listBoxGroups.SelectedItem).Content.ToString()); var selectedpage = _pagescontrol._acceptablePages.FirstOrDefault(x => x.Url == ((ListBoxItem)this.listBoxPages.SelectedItem).Content.ToString()); using (ClientServiceClient client = new ClientServiceClient()) { client.AddAcceptablePageForGroup(selectedpage, selectedgroups); _pagescontrol.GenerateactiveGroupPages(client, listBoxPagesForGroup, selectedgroups.AcceptablePagesGroupId); } }
private IList <ClientDto> GetClientList() { ClientServiceClient client = new ClientServiceClient(); Query query = new Query(); Criterion crActive = new Criterion("IsActive", true, CriteriaOperator.Equal); query.Add(crActive); EntityDtos <ClientDto> clientDtos = client.FindByQuery(query, false); client.Close(); return(clientDtos.Entities); }
public void Execute(string[] args) { if (args.Length != 5) { throw new ArgumentException(String.Format("Incorrect number of parameters. Usage is: {0}", Usage)); } using (var clientService = new ClientServiceClient()) { clientService.UpdateClientAddress(Int32.Parse(args[0]), args[1], args[2], args[3], args[4]); } }
public void Execute(string[] args) { if (args.Length != 3) { throw new ArgumentException(String.Format("Incorrect number of parameters. Usage is: {0}", Usage)); } using (var clientService = new ClientServiceClient()) { clientService.RegisterClient(args[0], args[1], args[2]); } }
public void GenerateAcceptableworkstationsGroups(ClientServiceClient client, ComboBox allgroups) { allgroups.Items.Clear(); _workstationsGroups.Clear(); foreach (var group in client.GetWorkstationsGroupFromDB()) { _workstationsGroups.Add(group); } foreach (var group in _workstationsGroups) { allgroups.Items.Add(group.Name); } }
public ClientService(string urlWebService) { try { _clientService = new ClientServiceClient(); Initialize(urlWebService); } catch (Exception ex) { _clientService = null; throw new RMSAppException(this, "0500", "ClientService failed. " + ex.Message, ex, false); } }
private void buttonGetLastScreen_Click(object sender, RoutedEventArgs e) { using (ClientServiceClient client = new ClientServiceClient()) { var getScreenInfo = client.GetOffenceScreenInfo(Convert.ToInt32(_currentWorkstationOffense[comboboxOfenceID.SelectedIndex])); var time = getScreenInfo.Substring(0, getScreenInfo.IndexOf('|')); var page = getScreenInfo.Substring(time.Length + 1); var bytearray = client.GetScreenByIdFromDB(Convert.ToInt32(_currentWorkstationOffense[comboboxOfenceID.SelectedIndex])); ImageSourceConverter converter = new ImageSourceConverter(); imageScreenShot.Source = ToImage(bytearray); labelScreenPage.Content = "Odwiedzona domena: " + page; labelScreenTime.Content = "Data zdarzenia: " + time; } }
private Connection() { try { while (Service == null || Service?.State != CommunicationState.Opened) { Thread.Sleep(500); Service = new ClientServiceClient(new InstanceContext(this)); Service.Open(); } } catch (Exception e) { MessageBox.Show(e.Message); } }
public void GenerateactiveGroupworkstations(ClientServiceClient client, ListBox activegroupworkstations, int groupIndex) { activegroupworkstations.Items.Clear(); _activeGroupWorkstations.Clear(); foreach (var workstation in client.GetWorkstationsForGroupFromDB(groupIndex)) { _activeGroupWorkstations.Add(workstation); } foreach (var workstation in _activeGroupWorkstations) { ListBoxItem listitem = new ListBoxItem() { Content = workstation.IP }; activegroupworkstations.Items.Add(listitem); } }
public void GenerateAcceptableworkstationsGroups(ClientServiceClient client, ListBox allgroups) { allgroups.Items.Clear(); _workstationsGroups.Clear(); foreach (var group in client.GetWorkstationsGroupFromDB()) { _workstationsGroups.Add(group); } foreach (var group in _workstationsGroups) { ListBoxItem listitem = new ListBoxItem() { Content = group.Name }; allgroups.Items.Add(listitem); } }
/// <summary> /// Searches for clients that match the search criteria. /// </summary> public ClientSearchItem[] SearchClient(int startRow, int pageSize, string sortBy, string name, string NINo, string partner, string DOB, string postcode, string town, bool forceRefresh) { ClientServiceClient clientService = null; ClientSearchItem[] clients = null; try { if (HttpContext.Current.Session[SessionName.LogonSettings] != null) { if (name == null || name.Trim() == string.Empty) if (NINo == null || NINo == string.Empty) if (partner == null || partner.Trim() == string.Empty) if (DOB == null || DOB.Trim() == string.Empty) if (postcode == null || postcode.Trim() == string.Empty) if (town == null || town.Trim() == string.Empty) throw new Exception("Please enter search criteria"); if (!IsReset) { // LSC - Insert Wildcards - 28/08/2010 if (!string.IsNullOrWhiteSpace(name) && !name.Contains('%')) { name = "%" + name.Trim() + "%"; } Guid _logonId = ((LogonReturnValue)HttpContext.Current.Session[SessionName.LogonSettings]).LogonId; CollectionRequest collectionRequest = new CollectionRequest(); collectionRequest.ForceRefresh = forceRefresh; collectionRequest.StartRow = startRow; collectionRequest.RowCount = pageSize; ClientSearchCriteria criteria = new ClientSearchCriteria(); criteria.Name = name != null ? name.Replace("'", "''") : name; criteria.NINumber = NINo != null ? NINo.Replace("'", "''") : NINo; criteria.OrganisationId = DataConstants.DummyGuid; criteria.MemberId = DataConstants.DummyGuid; criteria.OrderBy = sortBy; Guid partnerId = DataConstants.DummyGuid; if (partner != null && partner != string.Empty) { partnerId = new Guid(partner); } criteria.Partner = partnerId; if (DOB != null && DOB.Length > 0) { criteria.DateOfBirthFrom = Convert.ToDateTime(DOB.Trim()); criteria.DateOfBirthTo = Convert.ToDateTime(DOB.Trim()); } else { criteria.DateOfBirthFrom = null; criteria.DateOfBirthTo = null; } criteria.PostCode = postcode != null ? postcode.Replace("'", "''") : postcode; criteria.Town = town != null ? town.Replace("'", "''") : town; clientService = new ClientServiceClient(); ClientSearchReturnValue returnValue = clientService.ClientSearch(_logonId, collectionRequest, criteria); if (returnValue.Success) { _clientRowCount = returnValue.Clients.TotalRowCount; clients = returnValue.Clients.Rows; } else { if (returnValue.Message == "SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM.") throw new Exception("Date is invalid"); else throw new Exception(returnValue.Message); } } } return clients; } catch (Exception ex) { throw ex; } finally { if (clientService != null) { if (clientService.State != System.ServiceModel.CommunicationState.Faulted) clientService.Close(); } } }
/// <summary> /// Gets the client details. /// </summary> private void GetClientDetails(string matterReference) { ClientServiceClient clientService = null; try { CollectionRequest collectionRequest = new CollectionRequest(); collectionRequest.ForceRefresh = true; ClientSearchCriteria criteria = new ClientSearchCriteria(); criteria.ClientReference = matterReference.Substring(0, 6); clientService = new ClientServiceClient(); ClientSearchReturnValue returnValue = clientService.ClientSearch(_logonSettings.LogonId, collectionRequest, criteria); if (returnValue.Success) { if (returnValue.Clients != null) { Session[SessionName.MemberId] = returnValue.Clients.Rows[0].MemberId; Session[SessionName.OrganisationId] = returnValue.Clients.Rows[0].OrganisationId; Session[SessionName.ClientRef] = returnValue.Clients.Rows[0].ClientReference; Session[SessionName.ClientName] = returnValue.Clients.Rows[0].Name; } } else { throw new Exception(returnValue.Message); } } catch (Exception ex) { throw ex; } finally { if (clientService != null) { if (clientService.State != System.ServiceModel.CommunicationState.Faulted) clientService.Close(); } } }
private void DoLogin(string username, string password) { // Block MSH from loggin into FED because it is too well known // Block rekoop integration user as well as it should only be using web services if (username.Trim().ToLower() == "msh" || username.Trim().ToLower() == "rekoop") { _lblError.Text = "Invalid logon details"; return; } _logonService = new LogonServiceClient(); LogonReturnValue returnValue; returnValue = _logonService.Logon(username, password); if (!returnValue.Success) { _lblError.Text = returnValue.Message; return; } Session[SessionName.LogonName] = username; Session["LogonID"] = returnValue.LogonId; if (null == Session[SessionName.ControlSettings]) PopulateControlPermissions(returnValue.UserType); Session[SessionName.LogonSettings] = returnValue; if (!string.IsNullOrEmpty(returnValue.WebStyleSheet)) { // This session is used for all kind of operation being done on CSS files Session[SessionName.StyleSheet] = returnValue.WebStyleSheet; // This session is used for security purpose // for instance, if user change the CSS contents, then on click of preview button of ChangeStyle.aspx screen // the new temperory CSS file is created and this CSS is set to Session[SessionName.StyleSheet] // and if user wants to cancel the operation, the Session[SessionName.UserStyleSheet] will set to Session[SessionName.StyleSheet] Session[SessionName.UserStyleSheet] = returnValue.WebStyleSheet; } if (returnValue.UserType == 2) { _clientService = new ClientServiceClient(); bool isMember = true; Guid memOrOrgId = Guid.Empty; if (returnValue.MemberId == IRIS.Law.WebApp.App_Code.DataConstants.DummyGuid) { memOrOrgId = returnValue.OrganisationId; isMember = false; } else { memOrOrgId = returnValue.MemberId; } ClientDetailReturnValue _clientReturnValue = _clientService.GetClientDetail(returnValue.LogonId, memOrOrgId, isMember); Session[SessionName.MemberId] = returnValue.MemberId; Session[SessionName.OrganisationId] = returnValue.OrganisationId; Session[SessionName.ClientRef] = _clientReturnValue.ClientReference; Session[SessionName.ClientName] = _clientReturnValue.Name; } if (returnValue.IsFirstTimeLoggedIn && returnValue.UserType != 1) { Response.Redirect("~/Pages/Password/ForceChangePassword.aspx", true); } if (Session["CurrentPage"] != null) { Response.Redirect(Session["CurrentPage"].ToString()); } else { Response.Redirect("Home.aspx", true); } }
public static string ConstructUCN(DateTime dateOfBirth, string forename, string surname) { ClientServiceClient serviceClient = null; string UCN = string.Empty; try { if (HttpContext.Current.Session[SessionName.LogonSettings] != null) { Guid logonId = ((LogonReturnValue)HttpContext.Current.Session[SessionName.LogonSettings]).LogonId; serviceClient = new ClientServiceClient(); ReturnValue returnValue = serviceClient.ConstructUCN(logonId, dateOfBirth, forename, surname); if (returnValue.Success) { UCN = returnValue.Message; } else { throw new Exception(returnValue.Message); } } } catch (Exception ex) { throw ex; } finally { if (serviceClient != null) { if (serviceClient.State != System.ServiceModel.CommunicationState.Faulted) serviceClient.Close(); } } return UCN; }
protected void _imgBtnSearch_Click(object sender, ImageClickEventArgs e) { if (_txtSearch.Text.Trim() == string.Empty) { _txtSearch.Text = AllClients; } ClientServiceClient clientService = null; try { CollectionRequest collectionRequest = new CollectionRequest(); collectionRequest.ForceRefresh = true; ClientSearchCriteria criteria = new ClientSearchCriteria(); if (_txtSearch.Text.Trim() == string.Empty || _txtSearch.Text.Trim() == AllClients) { criteria.Name = string.Empty; } else { criteria.Name = _txtSearch.Text.Trim(); } if (_ddlFeeEarner.SelectedIndex > 0) { criteria.Partner = new Guid(_ddlFeeEarner.SelectedValue); } clientService = new ClientServiceClient(); ClientSearchReturnValue returnValue = clientService.ClientSearch(_logonId, collectionRequest, criteria); _ddlClients.Items.Clear(); _ddlClientMatters.Items.Clear(); if (returnValue.Success) { if (returnValue.Clients.Rows.Length > 0) { foreach (ClientSearchItem client in returnValue.Clients.Rows) { ListItem item = new ListItem(); item.Text = client.ClientReference.Trim() + " - " + client.Name; item.Value = client.MemberId.ToString() + "$" + client.OrganisationId.ToString(); _ddlClients.Items.Add(item); } } else { SuccessEventArgs success = new SuccessEventArgs(); success.Message = "Search is complete. There are no results to display."; OnSearchSuccessful(success); } if (_ddlClients.Items.Count > 0) { _clientRowCount = _ddlClients.Items.Count; Guid memberId = new Guid(GetValueOnIndexFromArray(_ddlClients.SelectedValue, 0)); Guid organisationId = new Guid(GetValueOnIndexFromArray(_ddlClients.SelectedValue, 1)); GetClientMatters(memberId, organisationId); SelectLastMatter(); } } else { ErrorEventArgs error = new ErrorEventArgs(); error.Message = returnValue.Message.Replace("WebClientSearch requires some parameters", "Please select a Fee Earner or use the client search."); OnError(error); } } catch (Exception ex) { ErrorEventArgs error = new ErrorEventArgs(); error.Message = ex.Message; OnError(error); } finally { if (clientService != null) { if (clientService.State != System.ServiceModel.CommunicationState.Faulted) clientService.Close(); } } }
/// <summary> /// Saves the client details(user types 1 and 2). /// </summary> private void SaveClient() { //Perform HO UCN field length validation as it is not checked in the service layer if (_txtHOUCN.Text.Length > 0 && _txtHOUCN.Text.Length < 8) { _lblMessage.CssClass = "errorMessage"; _lblMessage.Text = "All characters have not been entered for the HO UCN"; return; } ClientServiceClient clientService = null; try { SaveAddresses(); clientService = new ClientServiceClient(); IRIS.Law.WebServiceInterfaces.Client.Client client = GetClientDetails(); Person person = GetPersonDetails(); Organisation organisation = GetOrganisationDetails(); ReturnValue returnValue = clientService.UpdateClient(_logonSettings.LogonId, client, person, organisation); if (returnValue.Success) { _lblMessage.CssClass = "successMessage"; _lblMessage.Text = "Edit successful"; //Generate client name label as the details may have changed if (_memberId != DataConstants.DummyGuid) { _lblClientName.Text = CommonFunctions.MakeFullName(_ddlTitle.SelectedItem.Text.Trim(), _txtForenames.Text.Trim(), _txtSurname.Text.Trim()); } else { _lblClientName.Text = _txtOrganisationName.Text.Trim(); } _imgClientArchieved.Visible = _chkArchiveClient.Checked; } else { _lblMessage.CssClass = "errorMessage"; _lblMessage.Text = returnValue.Message; } } catch (System.ServiceModel.EndpointNotFoundException) { _lblMessage.Text = DataConstants.WSEndPointErrorMessage; _lblMessage.CssClass = "errorMessage"; } catch (Exception ex) { _lblMessage.CssClass = "errorMessage"; _lblMessage.Text = ex.Message; } finally { if (clientService != null) { if (clientService.State != System.ServiceModel.CommunicationState.Faulted) clientService.Close(); } } }
/// <summary> /// Saves the addresses. /// </summary> private void SaveAddresses() { ContactServiceClient contactService = null; ClientServiceClient clientService = null; try { CheckForModifiedAddress(); List<string> updatedAddresses = (List<string>)ViewState[UpdatedAddresses]; //Check if any of the addresses have been modified if (updatedAddresses.Count > 0) { contactService = new ContactServiceClient(); List<Address> clientAddresses = (List<Address>)Session[SessionName.ClientAddresses]; foreach (string addressType in updatedAddresses) { foreach (Address address in clientAddresses) { if (address.TypeId.ToString() == addressType) { if (_logonSettings.UserType == (int)DataConstants.UserType.ThirdParty && Request.QueryString["mydetails"] == "true") { address.MemberId = _logonSettings.MemberId; address.OrganisationId = _logonSettings.OrganisationId; } else { address.MemberId = (Guid)Session[SessionName.MemberId]; address.OrganisationId = (Guid)Session[SessionName.OrganisationId]; } AddressReturnValue returnValue = contactService.SaveAddress(_logonSettings.LogonId, address); if (!returnValue.Success) { _lblMessage.CssClass = "errorMessage"; _lblMessage.Text = returnValue.Message; } break; } } } updatedAddresses.Clear(); //Reload the addresses clientService = new ClientServiceClient(); AddressSearchCriteria searchCriteria = new AddressSearchCriteria(); searchCriteria.MemberId = _memberId; searchCriteria.OrganisationId = _organisationId; CollectionRequest collectionRequest = new CollectionRequest(); collectionRequest.ForceRefresh = true; if (Request.QueryString["mydetails"] == "true" && _logonSettings.UserType == (int)DataConstants.UserType.ThirdParty) { AddressSearchReturnValue addressSearchReturnValue = new AddressSearchReturnValue(); ContactServiceClient serviceClient = new ContactServiceClient(); addressSearchReturnValue = serviceClient.GetContactAddresses(_logonSettings.LogonId, collectionRequest, searchCriteria); clientAddresses.Clear(); //Store the addresses in a list so that we can add items if necessary foreach (Address address in addressSearchReturnValue.Addresses.Rows) { clientAddresses.Add(address); } } else { AddressSearchReturnValue addresses = clientService.GetClientAddresses(_logonSettings.LogonId, collectionRequest, searchCriteria); clientAddresses.Clear(); //Store the addresses in a list so that we can add items if necessary foreach (Address address in addresses.Addresses.Rows) { clientAddresses.Add(address); } } if (Request.QueryString["mydetails"] == "true" && _logonSettings.UserType == (int)DataConstants.UserType.ThirdParty) { DisplayContactAddressDetails(); } else { DisplayAddressDetails(); } } } catch (System.ServiceModel.EndpointNotFoundException) { _lblMessage.Text = DataConstants.WSEndPointErrorMessage; _lblMessage.CssClass = "errorMessage"; } catch (Exception ex) { _lblMessage.CssClass = "errorMessage"; _lblMessage.Text = ex.Message; } finally { if (contactService != null) { if (contactService.State != System.ServiceModel.CommunicationState.Faulted) contactService.Close(); } if (clientService != null) { if (clientService.State != System.ServiceModel.CommunicationState.Faulted) clientService.Close(); } } }
/// <summary> /// Sets up the client. /// </summary> private void SetupClient() { //Get the client type _ddlMatterType.Enabled = true; _txtDescription.Enabled = true; _ddlBranch.Enabled = true; _ddlDepartment.Enabled = true; _ddlWorkType.Enabled = true; _ddlFeeEarner.Enabled = true; _ccUFNDate.Enabled = true; _txtHOUCN.Enabled = true; _txtUCN.Enabled = true; ClientServiceClient clientService = null; try { Guid memberId = (Guid)Session[SessionName.MemberId]; Guid organisationId = (Guid)Session[SessionName.OrganisationId]; Guid clientId; bool isMember; if (memberId != DataConstants.DummyGuid) { clientId = memberId; isMember = true; } else { clientId = organisationId; isMember = false; } clientService = new ClientServiceClient(); ClientReturnValue returnValue = clientService.GetClientDefaults(_logonSettings.LogonId, clientId); if (returnValue.Success) { if (returnValue.Client != null) { ViewState[ClientType] = returnValue.Client.TypeId; //Set the default branch for the selected client _ddlBranch.SelectedIndex = -1; if (returnValue.Client.Branch != string.Empty) { foreach (ListItem branch in _ddlBranch.Items) { if (branch.Value != string.Empty && GetBranchValueOnIndex(branch.Value, 0) == returnValue.Client.Branch.Trim()) { branch.Selected = true; break; } } } else { _ddlBranch.SelectedValue = string.Empty; } SetupClientType(returnValue.Client.TypeId); //Display joint candidates if (_chklstClientAssociates.Visible) { GetJointClientCandidates(clientId, isMember); } //Get the matter types based on the client type GetMatterTypes(); SetupUserDefaults(); SetWorkTypeDefaults(); } else { throw new Exception("Unable to load client defaults"); } } else { _ddlMatterType.Enabled = false; _txtDescription.Enabled = false; _ddlBranch.Enabled = false; _ddlDepartment.Enabled = false; _ddlWorkType.Enabled = false; _ddlFeeEarner.Enabled = false; _ccUFNDate.Enabled = false; _txtHOUCN.Enabled = false; _txtUCN.Enabled = false; _txtDescription.Text = string.Empty; _ddlBranch.SelectedValue = string.Empty; _ddlDepartment.Items.Clear(); _ddlWorkType.Items.Clear(); throw new Exception(returnValue.Message.Replace("Client Archived", "Matter can not be added to an archived client")); } } catch (Exception ex) { throw ex; } finally { if (clientService != null) { if (clientService.State != System.ServiceModel.CommunicationState.Faulted) clientService.Close(); } } }
/// <summary> /// Loads the client details. /// </summary> private void LoadAddressDetails() { ClientServiceClient serviceClient = null; try { serviceClient = new ClientServiceClient(); _addressSearchReturnValue = new AddressSearchReturnValue(); CollectionRequest collectionRequest = new CollectionRequest(); AddressSearchCriteria searchCriteria = new AddressSearchCriteria(); searchCriteria.MemberId = _memId; searchCriteria.OrganisationId = _orgId; _addressSearchReturnValue = serviceClient.GetClientAddresses(_logonId, collectionRequest, searchCriteria); if (_addressSearchReturnValue.Success) { GetAddressTypes(); DisplayAddressDetails(); } else { throw new Exception(_addressSearchReturnValue.Message); } } catch (Exception ex) { throw ex; } finally { if (serviceClient != null) { if (serviceClient.State != System.ServiceModel.CommunicationState.Faulted) serviceClient.Close(); } } }
/// <summary> /// Gets the address. /// </summary> /// <param name="memId">The mem id.</param> /// <param name="orgId">The org id.</param> /// <returns></returns> private string GetAddress(Guid memId, Guid orgId) { string addressLine1 = string.Empty; ClientServiceClient clientService = null; try { CollectionRequest collectionRequest = new CollectionRequest(); AddressSearchCriteria criteria = new AddressSearchCriteria(); criteria.MemberId = memId; criteria.OrganisationId = orgId; clientService = new ClientServiceClient(); AddressSearchReturnValue returnValue = clientService.GetClientAddresses(_logonSettings.LogonId, collectionRequest, criteria); if (returnValue.Success) { if (returnValue.Addresses.Rows.Length > 0) { addressLine1 = returnValue.Addresses.Rows[0].Line1; } } else { throw new Exception(returnValue.Message); } } catch (Exception ex) { throw ex; } finally { if (clientService != null) { if (clientService.State != System.ServiceModel.CommunicationState.Faulted) clientService.Close(); } } return addressLine1; }
/// <summary> /// Gets the ratings. /// </summary> private void GetRatings() { ClientServiceClient clientService = null; try { clientService = new ClientServiceClient(); CollectionRequest collectionRequest = new CollectionRequest(); RatingSearchCriteria searchCriteria = new RatingSearchCriteria(); searchCriteria.IncludeArchived = false; RatingSearchReturnValue returnValue = clientService.RatingSearch(_logonSettings.LogonId, collectionRequest, searchCriteria); if (returnValue.Success) { _ddlRating.DataSource = returnValue.Ratings.Rows; _ddlRating.DataTextField = "Description"; _ddlRating.DataValueField = "Id"; _ddlRating.DataBind(); } else { throw new Exception(returnValue.Message); } } catch (Exception ex) { throw ex; } finally { if (clientService != null) { if (clientService.State != System.ServiceModel.CommunicationState.Faulted) clientService.Close(); } } }
/// <summary> /// Loads the client details. /// </summary> private void LoadClient() { ClientServiceClient serviceClient = null; try { if (_logonSettings.UserType == (int)DataConstants.UserType.ThirdParty && Request.QueryString["mydetails"] == "true") { LoadContact(); } else { serviceClient = new ClientServiceClient(); _clientReturnValue = serviceClient.GetClient(_logonSettings.LogonId, _memberId, _organisationId); if (_clientReturnValue.Success) { DisplayData(); } else { throw new Exception(_clientReturnValue.Message); } } } catch (Exception ex) { throw ex; } finally { if (serviceClient != null) { if (serviceClient.State != System.ServiceModel.CommunicationState.Faulted) serviceClient.Close(); } } }
/// <summary> /// /// </summary> /// <param name="isSecondClient"></param> /// <returns></returns> public ConflictCheckStandardReturnValue PerformConflictCheck() { ConflictCheckStandardReturnValue dsConflictCheckFields; ClientServiceClient clientService = new ClientServiceClient(); IRIS.Law.WebServiceInterfaces.Contact.AdditionalAddressElement[] addressElementsFirst; addressElementsFirst = null; if (_additionalAddressDetails != null && _additionalAddressDetails.Length == 10) { //if (!_isSecondClient || _isSecondClient) //{ addressElementsFirst = new AdditionalAddressElement[10]; #region Set First Person's and Second Person's Additional Address Information for (int i = 0; i <= 9; i++) { addressElementsFirst[i] = new AdditionalAddressElement(); switch (i) { case 0: addressElementsFirst[0].ElementText = _additionalAddressDetails[0].ElementText; break; case 1: addressElementsFirst[1].ElementText = _additionalAddressDetails[1].ElementText; break; case 2: addressElementsFirst[2].ElementText = _additionalAddressDetails[2].ElementText; break; case 3: addressElementsFirst[3].ElementText = _additionalAddressDetails[3].ElementText; break; case 4: addressElementsFirst[4].ElementText = _additionalAddressDetails[4].ElementText; break; case 5: addressElementsFirst[5].ElementText = _additionalAddressDetails[5].ElementText; break; case 6: addressElementsFirst[6].ElementText = _additionalAddressDetails[6].ElementText; break; case 7: addressElementsFirst[7].ElementText = _additionalAddressDetails[7].ElementText; break; case 8: addressElementsFirst[8].ElementText = _additionalAddressDetails[8].ElementText; break; case 9: addressElementsFirst[9].ElementText = _additionalAddressDetails[9].ElementText; break; } //} #endregion } } CollectionRequest collectionRequest = new CollectionRequest(); collectionRequest.StartRow = 0; dsConflictCheckFields = clientService.ConflictCheck(_logonSettings.LogonId, collectionRequest, _clientType, _person, _organisation, _address, addressElementsFirst, _logonSettings.ConflictCheckRoles ); return dsConflictCheckFields; }
/// <summary> /// Gets the joint client candidates. /// </summary> private void GetJointClientCandidates(Guid clientId, bool isMember) { //Clear previous items _chklstClientAssociates.Items.Clear(); ClientServiceClient clientService = null; try { CollectionRequest collectionRequest = new CollectionRequest(); JointClientCandidateSearchCriteria criteria = new JointClientCandidateSearchCriteria(); criteria.ClientId = clientId; criteria.IsMember = isMember; clientService = new ClientServiceClient(); JointClientCandidateSearchReturnValue returnValue = clientService.JointClientCandidateSearch(_logonSettings.LogonId, collectionRequest, criteria); if (returnValue.Success) { foreach (JointClientCandidateSearchItem jointClientCandidate in returnValue.JointClientCandidates.Rows) { ListItem item = new ListItem(); item.Text = jointClientCandidate.Name; item.Value = jointClientCandidate.Tag; _chklstClientAssociates.Items.Add(item); } } else { throw new Exception(returnValue.Message); } } catch (Exception ex) { throw ex; } finally { if (clientService != null) { if (clientService.State != System.ServiceModel.CommunicationState.Faulted) clientService.Close(); } } }