protected void Button1_Click(object sender, EventArgs e)
        {
            try
            {
                //BusinessLayer Logclass --> LoginSign(); method execute
                Logclass lc = new Logclass();

                lc.UserName = username.Text.ToString(); //user name
                lc.Password = password.Text.ToString(); //password

                int c;
                c = lc.LoginSign();
                if (c == 1)
                {
                    val = "Login Sucssess";
                }
                else
                {
                    val = "Login fail";
                }
            }
            catch (Exception)
            {
                throw;
            }

            //  Label1;//Frogot password
        }
        /*signin button to call business layer logclass*/
        private void Signin_Click(object sender, EventArgs e)
        {
            //  check();

            try
            {
                //BusinessLayer Logclass --> LoginSign(); method execute
                Logclass obj = new Logclass();
                obj.Password = loginpassword.Text;
                obj.UserName = loginemil.Text;
                c            = obj.LoginSign();
                if (c == 1)
                {
                    MessageBox.Show("--Login Success--");
                    this.Hide();
                    // open to show dashboard== work form
                    WorkForm workformobj = new WorkForm();
                    workformobj.Show();
                }
                else
                {
                    MessageBox.Show("--Login Failed--");
                    this.Hide();
                    new Login().Show();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                Console.WriteLine(ex.Message);
            }
        }
        protected virtual void Dispose(bool disposing)
        {
            if (disposing)
            {
                // free managed resources AnotherResource

                if (_LogClass != null)
                {
                    _LogClass.Dispose();
                    _LogClass = null;
                }

                //if (managedResource != null)
                //{
                //    managedResource.Dispose();
                //    managedResource = null;
                //}
            }
            // free native resources if there are any.
            if (nativeResource != IntPtr.Zero)
            {
                Marshal.FreeHGlobal(nativeResource);
                nativeResource = IntPtr.Zero;
            }
        }
        //reset butoon  Business layer Logclass methods call
        private void XuiSuperButton1_Click(object sender, EventArgs e)
        {
            try
            {
                Logclass obj = new Logclass
                {
                    Comfrimpassword = cpasswordtxt.Text,
                    UserName        = usernametxt.Text,
                    Password        = passwordtxt.Text
                };

                if (obj.LoginResetPassword() == 1)
                {
                    MessageBox.Show("---Password Reset Now---");
                    this.Hide();
                    new Login().Show();
                }
                else
                {
                    MessageBox.Show("--- erro in you  username or password ---");
                    this.Hide();
                    new ResetForm().Show();
                }
            }catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Пример #5
0
 public vmElector()
     : base(new wpfElector())
 {
     initWindow     = new RelayCommand(param => MyInitWindow());
     cmdSalir_Click = new RelayCommand(param => MyCmdSalir_Click(), param => CommandCan);
     cmdFind_Click  = new RelayCommand(param => MyCmdFind_Click(), param => CanFind);
     _LogClass      = new Logclass();
 }
Пример #6
0
        //ObservableCollection
        public vmLotInit()
            : base(new wpfLotInit())
        {
            initWindow       = new RelayCommand(param => MyInitWindow(), null);
            cmdSalir_Click   = new RelayCommand(param => MyCmdSalir_Click(), param => CommandCan);
            cmdReverse_Click = new RelayCommand(param => MyCmdReverse_Click(), param => CanCmdReverse);

            _LogClass = new Logclass();
            cbLots    = new ObservableCollection <string>();
        }
Пример #7
0
 public vmLotAuth()
     : base(new wpfLotAuth())
 {
     initWindow          = new RelayCommand(param => MyInitWindow());
     cmdSalir_Click      = new RelayCommand(param => MyCmdSalir_Click());
     cmdAddLot_Click     = new RelayCommand(param => MyCmdAddLot_Click(), param => CanAddLot);
     cmdAddTodoLot_Click = new RelayCommand(param => MyCmdAddTodoLot_Click());
     cmdRefresh_Click    = new RelayCommand(param => MycmdRefresh_Click());
     _LogClass           = new Logclass();
     cbLots = new ObservableCollection <string>();
 }
        protected void regbtn_Click(object sender, EventArgs e)
        {
            //object creat login class
            Login loginformobj = new Login();



            try
            {
                //value passs to business layer Logclass variable to
                Logclass obj = new Logclass();
                //check if same password input or not
                if (pas.Text == cpass.Text)
                {
                    obj.Password        = pas.Text;
                    obj.UserName        = em.Text;
                    obj.Comfrimpassword = cpass.Text;

                    //  ExecuteNonQuery() if worked return value=truee return value=0

                    if (obj.Loginsignup() == 1)
                    {
                        em.Text    = "";
                        pas.Text   = "";
                        cpass.Text = "";

                        //  Console.WriteLine("---INSERTED DATA---");
                    }
                    else
                    {
                        em.Text    = "";
                        pas.Text   = "";
                        cpass.Text = "";
                    }
                }
                else
                {
                    em.Text    = "";
                    pas.Text   = "";
                    cpass.Text = "";
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #9
0
        private void xuiSuperButton1_Click(object sender, EventArgs e)
        {
            try
            {
                //value passs to business layer Logclass variable to
                Logclass obj = new Logclass();
                //check if same password input or not
                if (passwordtxt.Text == cpasswordtxt.Text)
                {
                    obj.Password        = passwordtxt.Text;
                    obj.UserName        = usernametxt.Text;
                    obj.Comfrimpassword = cpasswordtxt.Text;

                    //  ExecuteNonQuery() if worked return value=truee return value=0

                    if (obj.Loginsignup() == 1)
                    {
                        MessageBox.Show("---SignUp completed---");
                        this.Hide();
                        //open login page
                        loginformobj.Show();


                        //  Console.WriteLine("---INSERTED DATA---");
                    }
                    else
                    {
                        MessageBox.Show("---EXECUTE ERROR---");
                        // Console.WriteLine("---EXECUTE ERROR---");
                    }
                }
                else
                {
                    MessageBox.Show("--- your passwords not same ---");
                    this.Hide();
                    new Signup().Show();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("---ERROR IN SQL CONNECTION---" + '\n' + ex);

                // Console.WriteLine("---ERROR IN SQL CONNECTION---");
                //    Console.WriteLine(ex);
            }
        }
Пример #10
0
        public vmMantNotarios() : base(new wpfMantNotarios())
        {
            initWindow      = new RelayCommand(param => MyInitWindow());
            cmdSalir_Click  = new RelayCommand(param => MyCmdSalir_Click(), param => CanSalir);
            cmdAdd_Click    = new RelayCommand(param => MyCmdAdd_Click());
            cmdCancel_Click = new RelayCommand(param => MyCmdCancel_Click());
            cmdEdit_Click   = new RelayCommand(param => MyCmdEdit_Click());
            cmdSave_Click   = new RelayCommand(param => MyCmdSave_Click(), param => CanSave);
            cmdDelete_Click = new RelayCommand(param => MyCmdDelete_Click());
            cmdFind_Click   = new RelayCommand(param => MyCmdFind_Click(), param => CanFind);

            cmdFindAspirante_Click = new RelayCommand(param => MyCmdFindAspirante_Click(), param => CanFindAspirante);

            cbAspirante = new ObservableCollection <Candidatos>();
            cbNotario   = new ObservableCollection <Notarios>();

            _LogClass = new Logclass();
        }
Пример #11
0
        public vmMantCriterios()
            : base(new wpfMantCriterios())
        {
            initWindow         = new RelayCommand(param => MyInitWindow());
            cmdSalir_Click     = new RelayCommand(param => MyCmdSalir_Click(), param => CanSalir);
            cmdActualize_Click = new RelayCommand(param => MyCmdActualize_Click(), param => CanActualize);
            cmdEditar_Click    = new RelayCommand(param => MyCmdEditar_Click(), param => CanEditar);
            cmdCancel_Click    = new RelayCommand(param => MyCmdCancel_Click(), param => CanCancel);

            Checked          = new RelayCommand(param => MyChecked(param));
            UnChecked        = new RelayCommand(param => MyUnChecked(param));
            CheckedWarning   = new RelayCommand(param => MyCheckedWarning(param));
            UnCheckedWarning = new RelayCommand(param => MyUnCheckedWarning(param));

            _LogClass    = new Logclass();
            _Criterios   = new List <Criterios>();
            chk          = new ObservableCollection <Criterios>();
            Background_0 = new ObservableCollection <Brush>();
        }
Пример #12
0
        private void MyOnInitWindow()
        {
            String yy = System.DateTime.Now.ToString("yyyy");

            Title = String.Format("CEE Sistema de Validación de Endosos " + yy + " Version {0}", AssemblyVersion);
            Dia   = DateTime.Now.ToString("MMM/dd/yyyy");
            Hora  = DateTime.Now.ToString("hh:mm:ss tt");

            //DispatcherTimer timer = new DispatcherTimer(new TimeSpan(0, 0, 1), DispatcherPriority.Normal, delegate
            //    {
            //        Hora = DateTime.Now.ToString("hh:mm:ss tt");
            //    },this.View.Dispatcher);
            //  DispatcherTimer setup

            DispatcherTimer dispatcherTimer = new System.Windows.Threading.DispatcherTimer();

            dispatcherTimer.Tick    += new EventHandler(MyDispatcherTimer_Tick);
            dispatcherTimer.Interval = new TimeSpan(0, 0, 1);
            dispatcherTimer.Start();

            Logclass myLogClass = new Logclass();

            try
            {
                myLogClass.LogName          = "Applica";
                myLogClass.MessageFile      = string.Empty;
                myLogClass.SourceName       = "MainVM";
                myLogClass.CategoryCount    = 0;
                myLogClass.DisplayNameMsgId = 256;
                myLogClass.CreateEvent();

                myLogClass.MYEventLog.WriteEntry("APP Start:" + Dia + " " + Hora, EventLogEntryType.Information);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "Error-MyOnInitWindow", MessageBoxButton.OK, MessageBoxImage.Error);
                throw new Exception("Error en el EventLog " + ex.ToString());
            }

            try
            {
                {//Get values from register
                    try { _SqlServer = jolcode.Registry.read(_REGPATH, "DBServer"); }
                    catch
                    {
                        _SqlServer = string.Empty;
                        jolcode.Registry.write(_REGPATH, "DBServer", string.Empty);
                    }

                    try { _Username = jolcode.Registry.read(_REGPATH, "DBUser"); }
                    catch
                    {
                        _Username = string.Empty;
                        jolcode.Registry.write(_REGPATH, "DBUser", string.Empty);
                    }

                    try { _Password = jolcode.Registry.read(_REGPATH, "DBPass"); }
                    catch
                    {
                        _Password = string.Empty;
                        jolcode.Registry.write(_REGPATH, "DBPass", string.Empty);
                    }

                    try { _Database = jolcode.Registry.read(_REGPATH, "DBName"); }
                    catch
                    {
                        _Database = string.Empty;
                        jolcode.Registry.write(_REGPATH, "DBName", string.Empty);
                    }

                    try { _MastSvr = jolcode.Registry.read(_REGPATH, "MastSvr"); }
                    catch
                    {
                        _MastSvr = string.Empty;
                        jolcode.Registry.write(_REGPATH, "MastSvr", string.Empty);
                    }

                    try { _MastUsr = jolcode.Registry.read(_REGPATH, "MastUsr"); }
                    catch
                    {
                        _MastUsr = string.Empty;
                        jolcode.Registry.write(_REGPATH, "MastUsr", string.Empty);
                    }

                    try { _MastPass = jolcode.Registry.read(_REGPATH, "MastPass"); }
                    catch
                    {
                        _MastPass = string.Empty;
                        jolcode.Registry.write(_REGPATH, "MastPass", string.Empty);
                    }

                    try { _MastDB = jolcode.Registry.read(_REGPATH, "MastDB"); }
                    catch
                    {
                        _MastDB = string.Empty;
                        jolcode.Registry.write(_REGPATH, "MastDB", string.Empty);
                    }

                    try { _ImageSvr = jolcode.Registry.read(_REGPATH, "ImageSvr"); }
                    catch
                    {
                        _ImageSvr = string.Empty;
                        jolcode.Registry.write(_REGPATH, "ImageSvr", string.Empty);
                    }

                    try { _ImageUsr = jolcode.Registry.read(_REGPATH, "ImageUsr"); }
                    catch
                    {
                        _ImageUsr = string.Empty;
                        jolcode.Registry.write(_REGPATH, "ImageUsr", string.Empty);
                    }

                    try { _ImagePass = jolcode.Registry.read(_REGPATH, "ImagePass"); }
                    catch
                    {
                        _ImagePass = string.Empty;
                        jolcode.Registry.write(_REGPATH, "ImagePass", string.Empty);
                    }

                    try { _ImageDB = jolcode.Registry.read(_REGPATH, "ImageDB"); }
                    catch
                    {
                        _ImageDB = string.Empty;
                        jolcode.Registry.write(_REGPATH, "ImageDB", string.Empty);
                    }

                    try { _RadicacionesSvr = jolcode.Registry.read(_REGPATH, "RadicacionesSvr"); }
                    catch
                    {
                        _RadicacionesSvr = string.Empty;
                        jolcode.Registry.write(_REGPATH, "RadicacionesSvr", string.Empty);
                    }

                    try { _RadicacionesUsr = jolcode.Registry.read(_REGPATH, "RadicacionesUsr"); }
                    catch
                    {
                        _RadicacionesUsr = string.Empty;
                        jolcode.Registry.write(_REGPATH, "RadicacionesUsr", string.Empty);
                    }

                    try { _RadicacionesPass = jolcode.Registry.read(_REGPATH, "RadicacionesPass"); }
                    catch
                    {
                        _RadicacionesPass = string.Empty;
                        jolcode.Registry.write(_REGPATH, "RadicacionesPass", string.Empty);
                    }

                    try { _RadicacionesDB = jolcode.Registry.read(_REGPATH, "RadicacionesDB"); }
                    catch
                    {
                        _RadicacionesDB = string.Empty;
                        jolcode.Registry.write(_REGPATH, "RadicacionesDB", string.Empty);
                    }

                    try { _PDFPath = jolcode.Registry.read(_REGPATH, "ImagePathNew"); }
                    catch
                    {
                        _PDFPath = string.Empty;
                        jolcode.Registry.write(_REGPATH, "ImagePathNew", string.Empty);
                    }
                }

                //if ((_SqlServer == "") || (_Username == "") || (_Database == "") || (_Password == "") || (_MastSvr == "") || (_MastUsr == "") || (_MastDB == "") || (_MastPass == "") ||
                //    (_ImageSvr == "") || (_ImageUsr == "") || (_ImageDB == "") || (_ImagePass == "") ||  (_ImgPath == "") || (_ValiSvr == "") || (_ValiUsr == "") || (_ValiDB == "") ||
                //    (_ValiPass == ""))

                if ((_SqlServer.Trim().Length == 0) ||
                    (_Username.Trim().Length == 0) ||
                    (_Database.Trim().Length == 0) ||
                    (_Password.Trim().Length == 0) ||
                    (_MastSvr.Trim().Length == 0) ||
                    (_MastUsr.Trim().Length == 0) ||
                    (_MastDB.Trim().Length == 0) ||
                    (_MastPass.Trim().Length == 0) ||
                    (_ImageSvr.Trim().Length == 0) ||
                    (_ImageUsr.Trim().Length == 0) ||
                    (_ImageDB.Trim().Length == 0) ||
                    (_ImagePass.Trim().Length == 0) ||
                    (_PDFPath.Trim().Length == 0) ||
                    (_RadicacionesSvr.Trim().Length == 0) ||
                    (_RadicacionesUsr.Trim().Length == 0) ||
                    (_RadicacionesDB.Trim().Length == 0) ||
                    (_RadicacionesPass.Trim().Length == 0))
                {
                    using (vmMantDB frmMantDB = new vmMantDB(_REGPATH))
                    {
                        frmMantDB.sqlServer = _SqlServer;
                        frmMantDB.userName  = _Username;
                        frmMantDB.password  = _Password;
                        frmMantDB.database  = _Database;

                        frmMantDB.mastSvr  = _MastSvr;
                        frmMantDB.mastUsr  = _MastUsr;
                        frmMantDB.mastPass = _MastPass;
                        frmMantDB.mastDB   = _MastDB;

                        frmMantDB.imageSvr  = _ImageSvr;
                        frmMantDB.imageUsr  = _ImageUsr;
                        frmMantDB.imagePass = _ImagePass;
                        frmMantDB.imageDB   = _ImageDB;

                        frmMantDB.RadicacionesSvr  = _RadicacionesSvr;
                        frmMantDB.RadicacionesUsr  = _RadicacionesUsr;
                        frmMantDB.RadicacionesPass = _RadicacionesPass;
                        frmMantDB.RadicacionesDB   = _RadicacionesDB;

                        frmMantDB.imgPath = _PDFPath;

                        frmMantDB.View.Owner = this.View as Window;

                        frmMantDB.OnShow();

                        _SqlServer = frmMantDB.sqlServer;
                        _Username  = frmMantDB.userName;
                        _Password  = PasswordHash.Encrypt1(frmMantDB.password);
                        _Database  = frmMantDB.database;

                        _MastSvr  = frmMantDB.mastSvr;
                        _MastUsr  = frmMantDB.mastUsr;
                        _MastPass = PasswordHash.Encrypt1(frmMantDB.mastPass);
                        _MastDB   = frmMantDB.mastDB;

                        _ImageSvr  = frmMantDB.imageSvr;
                        _ImageUsr  = frmMantDB.imageUsr;
                        _ImagePass = PasswordHash.Encrypt1(frmMantDB.imagePass);
                        _ImageDB   = frmMantDB.imageDB;

                        _RadicacionesSvr  = frmMantDB.RadicacionesSvr;
                        _RadicacionesUsr  = frmMantDB.RadicacionesUsr;
                        _RadicacionesPass = PasswordHash.Encrypt1(frmMantDB.RadicacionesPass);
                        _RadicacionesDB   = frmMantDB.RadicacionesDB;

                        _PDFPath = frmMantDB.imgPath;
                    } // end using
                }     //End IF
                mnuChangePassword_IsEnabled          = false;
                mnuLogout_IsEnabled                  = false;
                mnuLogin_IsEnabled                   = true;
                mnuVerElector_IsEnabled              = false;
                mnuInformeEndosos_IsEnabled          = false;
                mnuRecibirLotes_IsEnabled            = false;
                mnuAutoRizarLotes_IsEnabled          = false;
                mnuProcesarLotes_IsEnabled           = false;
                mnuCorregirEndosos_IsEnabled         = false;
                mnuRevLote_IsEnabled                 = false;
                mnuAreas_IsEnabled                   = false;
                mnuPartidos_IsEnabled                = false;
                mnuNotarios_IsEnabled                = false;
                mnuValidaciones_IsEnabled            = false;
                mnuUsuarios_IsEnabled                = false;
                mnuBaseDeDatos_IsEnabled             = false;
                mnuInicializarLotes_IsEnabled        = false;
                mnuVerEndosos_IsEnabled              = false;
                mnuInformeEndosos_IsEnabled          = false;
                mnuReydi_IsEnabled                   = false;
                mnuInformeDuplicados_IsEnable        = false;
                mnuduplicadopornumelectoral_IsEnable = false;

                _DBEndososCnnStr      = string.Concat("Persist Security Info=False;Data Source=", _SqlServer, ";Initial Catalog=", _Database, ";User ID=", _Username, ";Password="******"Persist Security Info=False;Data Source=", _MastSvr, ";Initial Catalog=", _MastDB, ";User ID=", _MastUsr, ";Password="******"Persist Security Info=False;Data Source=", _ImageSvr, ";Initial Catalog=", _ImageDB, ";User ID=", _ImageUsr, ";Password="******"Persist Security Info=False;Data Source=", _RadicacionesSvr, ";Initial Catalog=", _RadicacionesDB, ";User ID=", _RadicacionesUsr, ";Password="******"MyOnInitWindow", MessageBoxButton.OK, MessageBoxImage.Error);
                    this.View.Close();
                }
                else
                {
                    MessageBox.Show(ex.ToString(), "MyOnInitWindow", MessageBoxButton.OK, MessageBoxImage.Error);
                }
                try
                {
                    myLogClass.MYEventLog.WriteEntry(ex.ToString(), EventLogEntryType.Error, 9000);
                }
                catch { }
            }
        }