Esempio n. 1
0
    /// <summary>
    /// Le solcita al servicio de sesion logearse con los datos de los campos
    /// </summary>
    public void ButtonLogIn()
    {
        try
        {
            SessionServiceClient clienteSesion = SessionCliente.clienteDeSesion.servicioDeSesion;
            if (CamposDeLogeoValidos())
            {
                SessionCliente.clienteDeSesion.ReiniciarServicio();
                CuentaModel            cuentaIniciarSesion    = RecuperarDatosDeLogin();
                EnumEstadoInicioSesion estadoDeInicioDeSesion = clienteSesion.IniciarSesion(cuentaIniciarSesion);
                switch (estadoDeInicioDeSesion)
                {
                case EnumEstadoInicioSesion.Correcto:
                    Debug.Log("Credenciales Validas, ingreso exitoso.");
                    InicioDeSesionCorrecto(cuentaIniciarSesion);
                    break;

                case EnumEstadoInicioSesion.CredencialesInvalidas:
                    Debug.Log("Credenciales Invalidas, ingrese una validas porfavor.");
                    PanelException.SetActive(true);
                    PanelException.GetComponentInChildren <Text>().text = "Credenciales Invalidas, ingrese una validas porfavor";
                    break;

                case EnumEstadoInicioSesion.CuentaYaLogeada:
                    Debug.Log("La cuenta ya se encuentra logeada.");
                    PanelException.SetActive(true);
                    PanelException.GetComponentInChildren <Text>().text = "La cuenta ya se encuentra logeada.";
                    break;

                case EnumEstadoInicioSesion.ErrorBD:
                    Debug.Log("Error en Base de Datos.");
                    PanelException.SetActive(true);
                    PanelException.GetComponentInChildren <Text>().text = "Surgio un Error, porfavor intente más tarde";
                    break;

                case EnumEstadoInicioSesion.CuentaNoVerificada:
                    Debug.Log("Cuenta No Verificada.");
                    PanelException.SetActive(true);
                    PanelException.GetComponentInChildren <Text>().text = "Su cuenta no está verificada aun, porfavor verifiquela.";
                    CuentaNoVerificada(cuentaIniciarSesion);
                    break;
                }
            }
        }catch (SocketException ex)
        {
            Debug.Log("Conexion al servidor no valida." + ex);
            PanelException.SetActive(true);
            PanelException.GetComponentInChildren <Text>().text = "Conexion al servidor no valida";
        }
    }
        public void Validate(string username, string password, string domain)
        {
            // TODO maybe not hardcode this
            // TODO use securestring
            using (var client = new SessionServiceClient("WSHttpBinding_ISessionService"))
            {
                client.ClientCredentials.UserName.UserName = string.Format(@"{0}\{1}", domain, username);
                client.ClientCredentials.UserName.Password = password;

                var parameters = new CreateSessionParams()
                {
                    LanguageCode = "EN"
                };

                client.CreateSession(parameters);
            }
        }
Esempio n. 3
0
        public MainPageViewModel()
        {
            try
            {                                

                this.IsChangeAccount = Visibility.Collapsed.ToString();
                
                this.userClient = new TLUSERClient();
                
                this.userClient.UpdateTLUSERCompleted += new EventHandler<UpdateTLUSERCompletedEventArgs>(changePassCompleted);                

                sessionClient = new SessionServiceClient();
                sessionClient.SetSessionCompleted += new EventHandler<SetSessionCompletedEventArgs>(setSessionCompleted);

                this.currentCulture = new ChangeCulture(this);
                this.currentUser = CurrentSystemLogin.CurrentUser;
                this.BranchId = this.currentUser.TLSUBBRID;
                this.RoleName = this.currentUser.RoleName;
                this.UserName = this.currentUser.TLNANME;
                

                DispatcherTimer time = new DispatcherTimer();
                time.Interval = TimeSpan.FromSeconds(1);
                time.Tick += new EventHandler(oneSecond);
                this.CurrentDate = DateTime.Now.ToShortDateString();
                this.CurrentTime = DateTime.Now.ToString("hh:mm:ss tt");
                time.Start();

                //DOI MAT KHAU NEU DANG NHAP LAN DAU TIEN
                //if (CurrentSystemLogin.CurrentUser.ISFIRSTTIME.Equals("1"))
                //{
                //    this.ChangePassShow();
                //    this.IsCancelVisi = Visibility.Collapsed.ToString();
                //    this.IsFirstTimeLogin = Visibility.Visible.ToString();
                //    this.OnPropertyChanged("IsCancelVisi");
                //    this.OnPropertyChanged("IsFirstTimeLogin");
                //}
            }
            catch (Exception ex)
            {
                MessageBox.Show("MainPageViewModel " + ex.Message);
            }
        }        
Esempio n. 4
0
        public MainPageViewModel()
        {
            try
            {
                this.IsChangeAccount = Visibility.Collapsed.ToString();

                this.userClient = new TLUSERClient();

                this.userClient.UpdateTLUSERCompleted += new EventHandler <UpdateTLUSERCompletedEventArgs>(changePassCompleted);

                sessionClient = new SessionServiceClient();
                sessionClient.SetSessionCompleted += new EventHandler <SetSessionCompletedEventArgs>(setSessionCompleted);

                this.currentCulture = new ChangeCulture(this);
                this.currentUser    = CurrentSystemLogin.CurrentUser;
                this.BranchId       = this.currentUser.TLSUBBRID;
                this.RoleName       = this.currentUser.RoleName;
                this.UserName       = this.currentUser.TLNANME;


                DispatcherTimer time = new DispatcherTimer();
                time.Interval    = TimeSpan.FromSeconds(1);
                time.Tick       += new EventHandler(oneSecond);
                this.CurrentDate = DateTime.Now.ToShortDateString();
                this.CurrentTime = DateTime.Now.ToString("hh:mm:ss tt");
                time.Start();

                //DOI MAT KHAU NEU DANG NHAP LAN DAU TIEN
                //if (CurrentSystemLogin.CurrentUser.ISFIRSTTIME.Equals("1"))
                //{
                //    this.ChangePassShow();
                //    this.IsCancelVisi = Visibility.Collapsed.ToString();
                //    this.IsFirstTimeLogin = Visibility.Visible.ToString();
                //    this.OnPropertyChanged("IsCancelVisi");
                //    this.OnPropertyChanged("IsFirstTimeLogin");
                //}
            }
            catch (Exception ex)
            {
                MessageBox.Show("MainPageViewModel " + ex.Message);
            }
        }
        /// <summary>
        /// przykładowa metoda dodania łódki. Wywoluje metody wcf dla sprawdzenia poprawnosci ich działania
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAddBoat_Click(object sender, RoutedEventArgs e)
        {
            // var client=new BoatServiceClient();
              //  BaseResponse response=client.AddBoat(new BoatRequest {Name = "Marina", Model = "Gjj6790"});
              var client=new SessionServiceClient();
            AddSessionResponse response =
                client.AddSession(new AddSessionRequest
                {
                    StartDate =DateTime.ParseExact("2009-05-08 14:40:52,531", "yyyy-MM-dd HH:mm:ss,fff",
                            System.Globalization.CultureInfo.InvariantCulture),StopDate = DateTime.Now, IdBoat =new Guid("1608fc44-abb7-e511-82af-acb57d99b460")
                });
            Txb.Text = response.IsSuccess.ToString();
              //  Guid g = response.Id;
              //  BaseResponse response1 = client.DeleteBoat(new DeleteBoatRequest {Id=g});
            if (response.ErrorMessage!=string.Empty)
            Txb.Text += response.ErrorMessage;
            Txb.Text += response.IsSuccess.ToString();

            client.Close();
        }
Esempio n. 6
0
        // Declare public variable to hold the param value
        // public static string UserID = string.Empty;
        public App()
        {
            //StreamReader reader = new StreamReader("LISTKEYTRANSACTION.txt");
            //string key = "";
            //while (!reader.EndOfStream)
            //{
            //    key = reader.ReadLine();

            //}

            sessionClient = new SessionServiceClient();
            sessionClient.GetSessionCompleted += new EventHandler <GetSessionCompletedEventArgs>(getSessionCompleted);
            sessionClient.GetSessionAsync(CurrentSystemLogin.SessionKeys);

            this.Startup            += this.Application_Startup;
            this.Exit               += this.Application_Exit;
            this.UnhandledException += this.Application_UnhandledException;

            InitializeComponent();
        }
Esempio n. 7
0
        public ToolHeaderViewModel()
        {
            try
            {
                this.IsChangeAccount = Visibility.Collapsed.ToString();

                this.userClient = new TLUSERClient();

                this.userClient.UpdateTLUSERCompleted += new EventHandler <UpdateTLUSERCompletedEventArgs>(changePassCompleted);



                sessionClient = new SessionServiceClient();
                sessionClient.SetSessionCompleted += new EventHandler <SetSessionCompletedEventArgs>(setSessionCompleted);

                this.currentCulture = new ChangeCulture(this);
                this.currentUser    = CurrentSystemLogin.CurrentUser;
                this.BranchId       = this.currentUser.TLSUBBRID;
                this.RoleName       = this.currentUser.RoleName;
                this.UserName       = this.currentUser.TLNANME;

                ////DOI MAT KHAU NEU DANG NHAP LAN DAU TIEN
                //if (CurrentSystemLogin.CurrentUser.ISFIRSTTIME.Equals("1"))
                //{
                //    this.ChangePassShow();
                //    this.IsCancelVisi = Visibility.Collapsed.ToString();
                //    this.IsFirstTimeLogin = Visibility.Visible.ToString();
                //    this.OnPropertyChanged("IsCancelVisi");
                //    this.OnPropertyChanged("IsFirstTimeLogin");
                //}

                this.TimeLogin = CommonResource.lblTimeLogin + " " + appSettings["TimeLogin"].ToString();

                Messenger.Default.Register <bool>(this, ReciveClosePopup);
            }
            catch (Exception ex)
            {
                MessageBox.Show("ToolHeaderViewModel() " + ex.Message);
            }
        }
        /// <summary>
        /// przykładowa metoda dodania łódki. Wywoluje metody wcf dla sprawdzenia poprawnosci ich działania
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAddBoat_Click(object sender, RoutedEventArgs e)
        {
            // var client=new BoatServiceClient();
            //  BaseResponse response=client.AddBoat(new BoatRequest {Name = "Marina", Model = "Gjj6790"});
            var client = new SessionServiceClient();
            AddSessionResponse response =
                client.AddSession(new AddSessionRequest
            {
                StartDate = DateTime.ParseExact("2009-05-08 14:40:52,531", "yyyy-MM-dd HH:mm:ss,fff",
                                                System.Globalization.CultureInfo.InvariantCulture), StopDate = DateTime.Now, IdBoat = new Guid("1608fc44-abb7-e511-82af-acb57d99b460")
            });

            Txb.Text = response.IsSuccess.ToString();
            //  Guid g = response.Id;
            //  BaseResponse response1 = client.DeleteBoat(new DeleteBoatRequest {Id=g});
            if (response.ErrorMessage != string.Empty)
            {
                Txb.Text += response.ErrorMessage;
            }
            Txb.Text += response.IsSuccess.ToString();

            client.Close();
        }
Esempio n. 9
0
        public LoginSystemViewModel()
        {
            this.userClient = new TLUSERClient();
            sessionClient   = new SessionServiceClient();

            this.login = new LoginComman(this);
            ActionMenuButton.actionControl = new ActionMenuViewModel();
            ActionMenuButton.actionControl.SetEnterAction(login);

            string culture = IsolatedStorageSettings.ApplicationSettings["currentCulture"].ToString();

            if (culture.Equals("vi-VN"))
            {
                this.IsCheckedVN = true;
            }
            else
            {
                this.IsCheckedEL = true;
            }
            this.isCheckedVN = true;
            this.listUnit    = new List <ItemData>()
            {
                new ItemData()
                {
                    Id = "0", Name = SystemRoleResource.lblBachViet
                }
            };

            this.listClass = new List <ItemData>()
            {
                new ItemData()
                {
                    Id = "0", Name = "NVNH LOP 1"
                },
                new ItemData()
                {
                    Id = "1", Name = "NVNH LOP 2"
                },
                new ItemData()
                {
                    Id = "2", Name = "NVNH LOP 3"
                },
                new ItemData()
                {
                    Id = "3", Name = "NVNH LOP 4"
                },
                new ItemData()
                {
                    Id = "4", Name = "NVNH LOP 5"
                },
            };

            this.CurrentUnit  = "0";
            this.CurrentClass = "0";

            this.CaptchaItem = new CaptChaControl();

            this.userName            = "";
            this.IsChangePassVisible = Visibility.Visible.ToString();
            this.IsGetCodeVisible    = Visibility.Collapsed.ToString();
            this.OnPropertyChanged("IsChangePassVisible");
            this.OnPropertyChanged("IsGetCodeVisible");
            //this.userClient.CheckUserLoginCompleted += new EventHandler<CheckUserLoginCompletedEventArgs>(loginCompleted);
            //this.tillMasterClient.GetByTopTILMASTERCompleted += new EventHandler<GetByTopTILMASTERCompletedEventArgs>(getByTopTILMASTERCompleted);
            this.userClient.CheckLoginCompleted += new EventHandler <CheckLoginCompletedEventArgs>(userLoginCompleted);

            sessionClient.SetSessionCompleted         += new EventHandler <SetSessionCompletedEventArgs>(setSessionCompleted);
            this.userClient.SendCodeTLUSERCompleted   += new EventHandler <SendCodeTLUSERCompletedEventArgs>(sendCodeCompleted);
            this.userClient.ChangePassTLUSERCompleted += new EventHandler <ChangePassTLUSERCompletedEventArgs>(changePassCompleted);
            this.userClient.LoginADCompleted          += new EventHandler <LoginADCompletedEventArgs>(checkLoginADCompleted);
        }
Esempio n. 10
0
 /// <summary>
 /// Iniciliza el servicio de sesion
 /// </summary>
 private void InicializarServicioDeSesion()
 {
     servicioDeSesion = new SessionServiceClient(new InstanceContext(this),
                                                 new NetTcpBinding(SecurityMode.Transport),
                                                 new EndpointAddress("net.tcp://" + direccionIpDelServidor + ":7972/SessionService"));
 }