예제 #1
0
 public LoginServer(CLogin config)
     : base("Login", config.Port)
 {
     this.AutoRegister = config.AutoRegister;
     this.RequestPin   = config.RequestPin;
     this.RequestPic   = config.RequestPic;
 }
예제 #2
0
 public JsonResult LoginUser(CLogin model)
 {
     SmManager.LoginAdm        loginAdm = new SmManager.LoginAdm();
     SmManager.SmManagerClient cl       = new SmManager.SmManagerClient();
     loginAdm.AnvID = model.AnvID;
     loginAdm.pwd   = model.pwd;
     try
     {
         loginAdm = cl.GLogin(loginAdm);
     }
     catch (Exception ex)
     {
         loginAdm.ErrMessage = "can not reach loginadmin. Message : " + ex.Message;
     }
     if (loginAdm.ErrMessage == "")
     {
         Session["AnvID"]       = loginAdm.AnvID;
         Session["reparator"]   = loginAdm.reparator;
         Session["ident"]       = loginAdm.ident;
         Session["accessLevel"] = loginAdm.gasketLevel;
     }
     return(Json(new
     {
         errorMessage = loginAdm.ErrMessage,
     }, JsonRequestBehavior.AllowGet));
 }
예제 #3
0
        public async Task <IActionResult> Login(CLogin login)
        {
            var user = await _userManager.FindByNameAsync(login.UserName);

            if (user != null && await _userManager.CheckPasswordAsync(user, login.Password))
            {
                //get role assigned to the user
                var role = await _userManager.GetRolesAsync(user);

                IdentityOptions _options        = new IdentityOptions();
                var             tokenDescripter = new SecurityTokenDescriptor
                {
                    Subject = new ClaimsIdentity(new Claim[]
                    {
                        new Claim("UserID", user.Id.ToString()),
                        new Claim(_options.ClaimsIdentity.RoleClaimType, role.FirstOrDefault())
                    }),
                    Expires            = DateTime.UtcNow.AddDays(1),
                    SigningCredentials = new SigningCredentials(new SymmetricSecurityKey(Encoding.UTF8.GetBytes(_appSettings.JWT_Secret)), SecurityAlgorithms.HmacSha256Signature)
                };
                var tokenHandler  = new JwtSecurityTokenHandler();
                var securityToken = tokenHandler.CreateToken(tokenDescripter);
                var token         = tokenHandler.WriteToken(securityToken);
                return(Ok(new { token }));
            }
            else
            {
                return(BadRequest(new { message = "使用者名稱或密碼錯誤" }));
            }
        }
예제 #4
0
        private void VerificarContrasena()
        {
            CLogin  login = new CLogin();
            DataSet oDS   = new DataSet();

            oDS = login.RecuperarDatosAdminLogin(TxtUsuario.Text, TxtContraseña.Text);

            if (oDS != null)
            {
                if (oDS.Tables[0].Rows.Count == 0)
                {
                    INTENTOS--;
                    Fallidos++;
                    MessageBox.Show("El Usuario o Contraseña es incorrecta\n Nro de Intentos restantes [" + INTENTOS.ToString() + "]");
                    if (INTENTOS == 0)
                    {
                        MessageBox.Show("realizo [" + Fallidos.ToString() + "] intentos fallidos.. Se cerrara la pantalla de LOGIN..");
                        this.Close();
                    }
                }
                else
                {
                    string        Nomb = oDS.Tables[0].Rows[0]["Nombre"].ToString();
                    string        pass = oDS.Tables[0].Rows[0]["Contrasena"].ToString();
                    MenuPrincipal main = new MenuPrincipal();
                    //Program.frm.Hide();
                    main.ShowDialog();
                }
            }
            else
            {
                MessageBox.Show("Error..");
            }
        }
예제 #5
0
파일: ModuleLogin.cs 프로젝트: e2wugui/zeze
        public override int ProcessCLogin(CLogin protocol)
        {
            Session session = Session.Get(protocol);

            SLogin result = new SLogin();

            result.Argument.RoleId = protocol.Argument.RoleId;

            BAccount account = _taccount.Get(session.Account);

            if (null == account)
            {
                result.ResultCode = 1;
                session.SendResponse(result);
                return(Zeze.Transaction.Procedure.LogicError);
            }
            account.LastLoginRoleId = protocol.Argument.RoleId;
            BRoleData role = _trole.Get(protocol.Argument.RoleId);

            if (null == role)
            {
                result.ResultCode = 2;
                session.SendResponse(result);
                return(Zeze.Transaction.Procedure.LogicError);
            }

            BOnline online = _tonline.GetOrAdd(protocol.Argument.RoleId);

            online.RoleId       = protocol.Argument.RoleId; // 对于同一个 session,允许重复登录 role,直接覆盖
            online.SessionId    = session.SessionId;
            session.LoginRoleId = protocol.Argument.RoleId;
            session.SendResponse(result);
            return(Zeze.Transaction.Procedure.Success);
        }
예제 #6
0
        private void btnRegister_Click(object sender, EventArgs e)
        {
            _login = new CLogin(txtBoxEmail.Text, txtBoxPwd.Text);
            var frmUser = new User(_login);

            frmUser.ShowDialog();
        }
예제 #7
0
    // clique no botão de login
    protected void btnLogin_Click(object sender, EventArgs e)
    {
        // verifica se digitou informações
        if (this.txtUser.Value.Equals(String.Empty) || this.txtPass.Value.Equals(String.Empty))
        {
            base.alert("Digite nome de usuário e senha!");
        }
        else
        {
            // instancia um objeto de login
            CLogin login = new CLogin();

            // tenta executar login
            if (!login.doLogin(this.txtUser.Value, this.txtPass.Value))
            {
                // senha errada
                this.ClientScript.RegisterStartupScript(this.GetType(), "wrongPass",
                    "<script type=\"text/javascript\" language=\"javascript\">wrongPass('" + this.txtUser.Value + "');</script>");
            }
            else
            {
                // senha correta
                this.ClientScript.RegisterStartupScript(this.GetType(), "rightPass",
                    "<script type=\"text/javascript\" language=\"javascript\">rightPass();</script>");

                // acrescenta login à sessão
                Session.Add("login", login);

            }

        }
    }
예제 #8
0
파일: CUserRepo.cs 프로젝트: hermy991/mono
        public List <string> uGetUser(CLogin vLogin)
        {
            CAuth tmpAuth = new CAuth();

            List <string> UserPassList = new List <string>();

            var UserPass = dbSGPP.Users.Where(c => c.Name.Equals(vLogin.UserName)).FirstOrDefault();

            if (UserPass == null)
            {
                UserPassList.Add("Usuario Invalido");

                return(UserPassList);
            }
            else
            {
                uIsUserAccess(UserPass.User_ID, vLogin.Pass);
                tmpAuth.AuthId   = UserPass.User_ID;
                tmpAuth.AuthName = UserPass.Name;

                string tmpUser = UserPass.Name;
                UserPassList.Add(UserPass.Name);
                UserPassList.Add(UserPass.User_ID.ToString());

                return(UserPassList);
            }
        }
예제 #9
0
        [AllowAnonymous]    //是人皆可進
        public ActionResult LoginIndex()
        {
            CLogin c = new CLogin();

            c.txtRememberMe = "記住我";
            return(View(c));
        }
예제 #10
0
        public int addLogin(CLogin l)
        {
            string sql = @"INSERT INTO login (login1,senha) VALUES ('" + l.login + "', '" + l.senha + "')";

            SqlCommand comando = new SqlCommand(sql, ConnectionFactory.CreatConnection());

            return(comando.ExecuteNonQuery());
        }
예제 #11
0
 private void txtBoxEmail_Leave(object sender, EventArgs e)
 {
     if (!CLogin.IsEmailValid(txtBoxEmail.Text))
     {
         MessageBox.Show("Ungültige EMail-Adresse!", "Fehler", MessageBoxButtons.OK, MessageBoxIcon.Stop);
         txtBoxEmail.Focus();
         txtBoxEmail.SelectAll();
     }
 }
예제 #12
0
 void Awake()
 {
     m_instance = this;
     MessageBox.Init();
     Debug.Log(this.name);
     if (!connected)
     {
         if (PlayerPrefs.HasKey(HOST) && PlayerPrefs.HasKey(PORT))
         {
             string host = PlayerPrefs.GetString(HOST);
             short  port = (short)PlayerPrefs.GetInt(PORT);
             connected = MyNetwork.Connect(host, port);
             if (!connected)
             {
                 MessageBox.Show(string.Format("connect to {0}:{1} fail", host, port));
             }
         }
     }
     if (!connected)
     {
         string host = this.address;
         short  port = this.port;
         connected = MyNetwork.Connect(host, port);
         if (!connected)
         {
             MessageBox.Show(string.Format("connect to {0}:{1} fail", host, port));
         }
     }
     if (gameScene)
     {
         if (connected)
         {
             // for debug only ...
             CLogin login = new CLogin();
             login.user     = "******";
             login.password = "******";
             // Send(login);
         }
         SceneManager.sceneLoaded += RecvSceneLoaded;
     }
     if (connected && heartBeatTimer == null)
     {
         heartBeatTimer          = new Timer();
         heartBeatTimer.Interval = 3000;
         heartBeatTimer.Elapsed += delegate
         {
             CHeartBeat msg = new CHeartBeat();
             Send(msg);
         };
         heartBeatTimer.Start();
     }
 }
예제 #13
0
 public void startBrowser()
 {
     driver = new ChromeDriver(AppDomain.CurrentDomain.BaseDirectory);
     driver.Manage().Window.FullScreen();
     pgLogin        = new CLogin(driver);
     pgBring        = new CNyBring(driver);
     pgCBrevetikett = new CBrevetikett(driver);
     pgNyNord       = new CNyPostNord(driver);
     wmrBring       = new WithMultipleReceiver(driver);
     rCProject_Recources.buildURL = "https://app.proteria.com/ProTeria.Auth/Account/Login";
     rCProject_Recources.userName = "******";
     rCProject_Recources.password = "******";
 }
예제 #14
0
        public IActionResult Index([Bind] CLogin c)
        {
            int res = db.LoginCheck(c);

            if (res == 1)
            {
                TempData["msg"] = "歡迎登入";
            }
            else
            {
                TempData["msg"] = "帳號或密碼錯誤,請重來";
            }
            return(View());
        }
예제 #15
0
        public ActionResult Login(CLogin vData, string returnUrl)
        {
            CUserRepo tmpUserRep = new CUserRepo();

            var tmpResult = tmpUserRep.uGetUser(vData);

            if (tmpResult.Count == 2)
            {
                Session["LogedUserFullname"] = tmpResult[0];
                Session["LogedUserId"]       = tmpResult[1];
                return(RedirectToAction("Index", "Home"));
            }
            ViewBag.ErrorUser = tmpResult[0];
            return(View(vData));
        }
예제 #16
0
        private void btnOk2_Click(object sender, EventArgs e)
        {
            CLogin c = new CLogin();

            c.login = text_login2.Text;
            c.senha = text_senha2.Text;
            BancoLogin b = new BancoLogin();

            b.addLogin(c);

            DialogResult resposta = MessageBox.Show("Login cadastrado com sucesso", "Atenção", MessageBoxButtons.OK);
            Login        l        = new Login();

            l.ShowDialog();
        }
예제 #17
0
파일: LoginForm.cs 프로젝트: Jusharra/RMS
        private void ProcessLogin()
        {
            try
            {
                CCommonConstants objCommonConstant = ConfigManager.GetConfig <CCommonConstants>();

                CDalConfig objDalConstant = ConfigManager.GetConfig <CDalConfig>();

                CUserManager tempUserManager = new CUserManager();
                CLogin       objLogin        = new CLogin();
                CUserInfo    objUserInfo     = new CUserInfo();

                //objUserInfo.UserName = UserLabel.Text.Trim();

                //objUserInfo.Password = LoginTextBox.Text.Trim();


                objLogin = (RmsRemote.CLogin)Activator.GetObject(typeof(RmsRemote.CLogin), objCommonConstant.RemoteURL);

                CResult objResult = objLogin.ProcessAdminLogin(objUserInfo);

                if (objResult.IsSuccess && objResult.Data != null)
                {
                    CUserLogin objUserLogin = (CUserLogin)objResult.Data;

                    objCommonConstant.UserInfo = objUserLogin.UserInfo;

                    objDalConstant.ConnectionString = objUserLogin.ConnectionStr;
                    RMSGlobal.LogInUserName         = objCommonConstant.UserInfo.UserName;

                    objCommonConstant.DBConnection = objUserLogin.ConnectionStr;

                    RMSAdminMdiForm objParent = new RMSAdminMdiForm();  //Previous
                    objParent.Show();
                    this.Hide();
                }
                else
                {
                    //g_ErrorLabel.Show();
                }
            }
            catch (Exception exp)
            {
                MessageBox.Show(exp.Message, RMSGlobal.MessageBoxTitle,
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #18
0
        public string Login(string email, string password)
        {
            WriteInfo("Opening Facebook and navigating to 'https://m.facebook.com' ...");

            CLogin login = new CLogin(chrome, email, password);

            login.PerformSequence();

            SequenceResult_t loginResult = login.GetResult();

            if (!loginResult.bSuccess)
            {
                return((string)loginResult.oSequenceData);
            }

            return(null);
        }
예제 #19
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            //To Do
            //User Login prüfen

            _login = new CLogin(txtBoxEmail.Text, txtBoxPwd.Text);

            if (_login.IsValid())
            {
                var frmVerwaltung = new KonferenzUebersicht();
                frmVerwaltung.WindowState = FormWindowState.Maximized;
                frmVerwaltung.ShowDialog();
            }
            else
            {
                MessageBox.Show("Login fehlgeschlagen!\nBitte überprüfen Sie Ihre Login-Daten.", "Fehler", MessageBoxButtons.OK, MessageBoxIcon.Stop);
            }
        }
예제 #20
0
        public CLogin Result([FromForm] string username, [FromForm] string userpass)
        {
            Mlogin mlogin = new Mlogin
            {
                //这个信息只能在controller里获取,model里不能获取
                UserIP    = Request.HttpContext.Connection.RemoteIpAddress.ToString(),
                UserAgent = Request.Headers["User-Agent"].ToString()
            };
            MD5 md5 = MD5.Create();

            //PMStaticModels.UserModels.PMUser.UserSysID
            userpass += username;
            string userPass = "";

            byte[] s = md5.ComputeHash(Encoding.UTF8.GetBytes(userpass.Trim()));
            for (int i = 0; i < s.Length; i++)
            {
                // 将得到的字符串使用十六进制类型格式。格式后的字符是小写的字母,如果使用大写(X)则格式后的字符是大写字符
                userPass += s[i].ToString("X");
            }
            CLogin cLogin = mlogin.ForceOut(username, userPass);

            if (cLogin.LoginState == 1)
            {
                Response.Cookies.Append("EmpID", PmUser.EmpID.ToString(), new CookieOptions()
                {
                    IsEssential = true
                });
                Response.Cookies.Append("UserGuid", PmUser.UserGuid, new CookieOptions()
                {
                    IsEssential = true
                });
                if (PmUser.IsAdmin == true)
                {
                    Response.Cookies.Append("MD5", PublicFunc.GetMd5("ADMIN" + Guid.NewGuid().ToString()), new CookieOptions()
                    {
                        IsEssential = true
                    });
                }
            }
            PublicFunc.WriteUserLog(PmUser.EmpID.ToString(), mlogin.UserIP, "强制登出", "用户选择强制登出", mlogin.UserAgent);
            return(cLogin);
        }
예제 #21
0
 public ActionResult Login(CLogin c)
 {
     if (c.account == "admin" && c.password == "admin")
     {
         return(RedirectToAction("SearchAccountRole", "Account"));
     }
     //用戶登入通過驗證
     if (ValidateLogin(c.account, c.password))
     {
         //執行將用戶登入到網站並授予存取權
         LoginProcess(c.account, strRole, false);
         return(RedirectToAction("Index", "Home"));
     }
     else
     {
         ModelState.AddModelError("validatemsg_fAccount", "輸入的帳號或密碼錯誤,請重來");
     }
     return(View());
 }
예제 #22
0
파일: Program.cs 프로젝트: Jusharra/RMS
        private static void Init()
        {
            ConfigManager.Init();
            ConfigManager.ReloadConfig();
            CCommonConstants oTempConstant = ConfigManager.GetConfig <CCommonConstants>();

            CDalConfig oTempDal = ConfigManager.GetConfig <CDalConfig>();

            CLogin oLogin = new CLogin();

            oLogin = (RmsRemote.CLogin)Activator.GetObject(typeof(RmsRemote.CLogin), oTempConstant.RemoteURL);

            CResult oResult = oLogin.GetInitialDBStr();

            if (oResult.IsSuccess && oResult.Data != null)
            {
                DataSet dsRecords = new DataSet();
                String  oTempStr  = (String)oResult.Data;
                oTempConstant.DBConnection         = oTempStr;
                RMSGlobal.m_serverConnectionString = oTempConstant.DBConnection;

                CReportManager objReportMgnr = new CReportManager();
                CResult        objFoodType   = objReportMgnr.GetFoodTypesRecords();
                dsRecords         = (DataSet)objFoodType.Data;
                m_foodTypeRecords = dsRecords.Tables[0];

                objFoodType       = objReportMgnr.GetFoodCategoryRecords();
                dsRecords         = (DataSet)objFoodType.Data;
                m_categoryRecords = dsRecords.Tables[0];

                objFoodType       = objReportMgnr.GetFoodItemRecords();
                dsRecords         = (DataSet)objFoodType.Data;
                m_foodItemRecords = dsRecords.Tables[0];

                objFoodType            = objReportMgnr.GetSelectionofItemsRecords();
                dsRecords              = (DataSet)objFoodType.Data;
                m_selectionItemRecords = dsRecords.Tables[0];

                //m_initDataSet.Relations.Add("category1_to_category2",
                //      m_foodTypeRecords.Columns["cat1_id"],
                //      m_categoryRecords.Columns["cat1_id"], false);
            }
        }
예제 #23
0
        private void OnRecvLogin(IChannel channel, Message message)
        {
            CLogin request = message as CLogin;
            string scene   = "Level1";

            // read from database
            ConnectDB connect  = new ConnectDB();
            int       playerID = connect.LogIn(request.user, request.password);

            if (playerID == 0)
            {
                ClientTipInfo(channel, "Wrong UserName or Passwd!");
                return;
            }
            if (OnlinePlayers.ContainsKey(request.user))
            {
                ClientTipInfo(channel, "user has logged in!");
                return;
            }

            SPlayerEnter response = new SPlayerEnter()
            {
                user  = request.user,
                token = request.user,
                scene = scene
            };

            channel.Send(response);

            Player player = new Player(channel)
            {
                scene = scene
            };
            DEntity dentity = World.Instance.EntityData["Ellen"];

            player.FromDEntity(dentity);
            player.forClone = false;
            connect.GetPlayerAttri(playerID, player);
            Console.WriteLine("user: {0} login", player.user);

            // DOTO: Add xyz from db
        }
예제 #24
0
        public string uInserAuth(CLogin vLogin)
        {
            string message = "";

            using (var tmpContext = new SGPPEntities())
            {
                var rowafect = tmpContext.Database.ExecuteSqlCommand(
                    "UC.ChangeUserPassword @PrmUserId= " + vLogin.UserId + ", @PrmPass = "******", ,@PrmModifierUserId =" + vLogin.CreateById);

                if (rowafect > 0)
                {
                    message = "Usuario Correcto";
                }
                else
                {
                    message = "Usuario Incorrecto";
                }
                return(message);
            }
        }
예제 #25
0
        public ActionResult Login(CLogin p)
        {
            string code = Session[CDictionary.SK_AUTHTUCATION_CODE] as string;

            if (!p.txtCode.Equals(code))
            {
                ViewBag.CODE = code;
                return(View());
            }
            int       fId  = Convert.ToInt32(p.txtAccount);
            tCustomer cust = (new dbDemoEntities()).tCustomer.FirstOrDefault(t => t.fId == fId && t.fPassword.Equals(p.txtPassword));

            if (cust == null)
            {
                return(View());
            }

            Session[CDictionary.SK_LOGEDIN_CUSTOMER] = cust;
            return(RedirectToAction("Home"));
        }
예제 #26
0
        public ActionResult Index(CLogin cLogin)
        {
            string code = Session[CDitionay.SK_LogedIn_Authority] as string;

            if (!code.Equals(cLogin.txtAuthority))
            {
                ViewBag.code = code;
                return(View());
            }
            string  message = "";
            tMember t       = db.tMember.FirstOrDefault(x => x.fUserName == cLogin.txtAccount && x.fPassword.Equals(cLogin.txtPassword));

            if (t != null)
            {
                Session[CDitionay.USER_Account] = t.fUserName;
                return(RedirectToAction("Index", "Order"));
            }
            message         = "Not Valid";
            ViewBag.message = message;
            return(View());
        }
예제 #27
0
        public ActionResult LoginIndex(CLogin user)
        {
            if (user.txtEmail == "admin" && user.txtPassword == "admin")
            {
                return(RedirectToAction("Home", "後台Home"));
            }
            string ValidateStr = membersService.LoginCheck(user.txtEmail, user.txtPassword);

            if (string.IsNullOrEmpty(ValidateStr))
            {
                tMember target = (new dbJoutaEntities()).tMember
                                 .FirstOrDefault(a => a.f會員電子郵件 == user.txtEmail && a.f會員密碼 == user.txtPassword);
                Session["member"] = target;
                return(RedirectToAction("Home", "Home"));
            }
            else
            {
                ModelState.AddModelError("txtPassword", "密碼輸入錯誤");
                return(View());
            }
        }
예제 #28
0
    public void OnLoginClicked()
    {
        string username = m_usernameInput.text;
        string password = m_passwordInput.text;

        if (!CheckNameAndPassword(username, password, password))
        {
            return;
        }

        bool   save  = true;
        CLogin login = new CLogin();

        login.user     = username;
        login.password = MD5(password);
        if (save)
        {
            PlayerPrefs.SetString(USERNAME, username);
            PlayerPrefs.SetString(PASSWORD, password);
        }
        Client.Instance.Send(login);
    }
예제 #29
0
파일: OnRecvLogin.cs 프로젝트: yc322/MMORPG
        private void OnRecvLogin(IChannel channel, Message message)
        {
            CLogin       request  = message as CLogin;
            SPlayerEnter response = new SPlayerEnter();
            string       scene    = "Level1";

            response.user  = request.user;
            response.token = request.user;
            response.scene = scene;
            channel.Send(response);

            Player player = new Player(channel);

            player.scene = scene;
            // TODO read from database
            DEntity dentity = World.Instance.EntityData["Ellen"];

            player.FromDEntity(dentity);
            player.forClone = false;
            //ClientTipInfo(channel, "TODO: get player's attribute from database");
            // player will be added to scene when receive client's CEnterSceneDone message
        }
예제 #30
0
 void Awake()
 {
     m_instance = this;
     MessageBox.Init();
     if (!connected)
     {
         if (PlayerPrefs.HasKey(HOST) && PlayerPrefs.HasKey(PORT))
         {
             string host = PlayerPrefs.GetString(HOST);
             short  port = (short)PlayerPrefs.GetInt(PORT);
             connected = MyNetwork.Connect(host, port);
             if (!connected)
             {
                 MessageBox.Show(string.Format("connect to {0}:{1} fail", host, port));
             }
         }
     }
     if (!connected)
     {
         string host = this.address;
         short  port = this.port;
         connected = MyNetwork.Connect(host, port);
         if (!connected)
         {
             MessageBox.Show(string.Format("connect to {0}:{1} fail", host, port));
         }
     }
     if (gameScene)
     {
         if (connected)
         {
             // for debug only ...
             CLogin login = new CLogin();
             //Send(login);
         }
         SceneManager.sceneLoaded += RecvSceneLoaded;
     }
 }
예제 #31
0
파일: Login.cs 프로젝트: rasec569/CarteraSI
        private void buttonInicio_Click(object sender, EventArgs e)
        {
            try
            { if ((textUser.Text == "") && (textPass.Text == ""))
              {
                  MessageBox.Show("Los campos estan vacios");
              }
              else if ((textUser.Text == "") || (textPass.Text == ""))
              {
                  if (textUser.Text == "")
                  {
                      MessageBox.Show("EL campo Usuario esta vacio");
                  }
                  else
                  {
                      MessageBox.Show("EL campo Contraseña esta vacio");
                  }
              }
              else
              {
                  CLogin    L  = new CLogin();
                  DataTable dt = L.ValidaUser(textUser.Text, textPass.Text);

                  if ((textUser.Text == dt.Rows[0]["Nom_Usuario"].ToString()) && (textPass.Text == dt.Rows[0]["Contraseña"].ToString()))
                  //if ((textUser.Text == "admin") && (textPass.Text == "123"))
                  {
                      this.Hide();
                      Principal P = new Principal(dt);
                      P.Show();
                  }
              } }
            catch
            {
                MessageBox.Show("Los datos son incorrectos", "Observación", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }