Beispiel #1
0
    protected void btnLogin_Click(object sender, EventArgs e)
    {
        // string user = txtUsername.Text;
           // string pw = txtPassword.Text;

           tbl_user user = new tbl_user();
           BLLLogin blllogin = new BLLLogin();
           user.user_tiwtter = txtUsername.Text;
           user.user_password = txtPassword.Text;

            try{
            blllogin.getUser(user);
            lblFeedback.Text = "succes";

            System.Web.HttpContext.Current.Session["twitter"] = txtUsername.Text;
            System.Web.HttpContext.Current.Session["password"] = txtPassword.Text;
            Response.Redirect("Profiles.aspx");

            }

            catch (Exception)
            {
                lblFeedback.Text = "Please try again";
            }
    }
 public static MvcLogin GetMVCEntity(BLLLogin login)
 {
     return(new MvcLogin()
     {
         Id = login.Id,
         Mail = login.Mail,
         Password = login.Password,
         Login = login.Login,
         Roles = login.Roles,
     });
 }
Beispiel #3
0
        static void Main(string[] args)
        {
            Accountimg_system_of_knowledgeEntities f = new Accountimg_system_of_knowledgeEntities();
            UnitOfWork   uow = new UnitOfWork(f);
            LoginService b   = new LoginService(uow);
            BLLLogin     a   = new BLLLogin()
            {
                Login    = "******",
                Password = "******",
                Mail     = "mail",
            };

            b.Create(a);
        }
        public static BLLLogin GetBLLEntity(RegisterModel prog)
        {
            BLLLogin result = new BLLLogin
            {
                Id       = prog.Id,
                Mail     = prog.Mail,
                Login    = prog.Login,
                Password = prog.Password,
                Roles    = new List <string>()
                {
                    "User"
                }
            };

            return(result);
        }
Beispiel #5
0
 protected void _btInicioSesion_Click(object sender, EventArgs e)
 {
     if (_txUsuario.Text != "" && _txContrasenia.Text != "")
     {
         dt = new DataTable();
         dt = BLLLogin.permisos(1, _txUsuario.Text, _txContrasenia.Text);
         //   MLogin objLogin = null;
         if (dt.Rows.Count > 0)
         {
             objBLLLogin = new BLLLogin();
             Session["atributos_usuario"] = objBLLLogin.atributosUsuario(Convert.ToInt32(dt.Rows[0]["id_usuario"].ToString()));
             Session["permisos_forma"]    = dt;
             Response.Redirect(ResolveUrl("~/" + "Default.aspx"));
         }
     }
 }
 public static DALLogin GetDALEntity(BLLLogin bllEntity)
 {
     if (bllEntity == null)
     {
         throw new ArgumentNullException();
     }
     return(new DALLogin()
     {
         Id = bllEntity.Id,
         Login = bllEntity.Login,
         Mail = bllEntity.Mail,
         Password = bllEntity.Password,
         IdProgrammer = bllEntity.IdProgrammer,
         IdRole = bllEntity.IdRole,
         Roles = bllEntity.Roles,
     });
 }
Beispiel #7
0
        public void Create(BLLLogin prog)
        {
            DALLogin dallog = LoginMapper.GetDALEntity(prog);

            if (!IsEmailEnabled(dallog.Mail))
            {
                throw new Exception("User with such email is exists!");
            }
            if (!IsLoginEnabled(dallog.Login))
            {
                throw new Exception("User with such login is exists!");
            }
            uow.Logins.Create(dallog);
            uow.Programmers.Create(new DALProgrammer()
            {
                Id = dallog.Id
            });
            uow.Commit();
        }
Beispiel #8
0
 public void UpDate(BLLLogin prog)
 {
     uow.Logins.UpDate(LoginMapper.GetDALEntity(prog));
     uow.Commit();
 }
Beispiel #9
0
        private void btnAceptar_Click(object sender, EventArgs e)
        {
            // Debe validar los datos requeridos
            IBLLSysUserRolDTO _BLLUser  = new BLLSysUserRolDTO();
            IBLLLogin         _BLLLogin = new BLLLogin();

            epError.Clear();

            try
            {
                if (string.IsNullOrEmpty(this.txtUsuario.Text))
                {
                    epError.SetError(txtUsuario, "Usuario requerido");
                    this.txtUsuario.Focus();
                    return;
                }
                if (string.IsNullOrEmpty(this.txtContrasena.Text))
                {
                    epError.SetError(txtContrasena, "Contraseá requerida");
                    this.txtContrasena.Focus();
                    return;
                }


                Settings.Default.Login    = "******";
                Settings.Default.Password = "******";

                _BLLLogin.Login(Settings.Default.Login,
                                Settings.Default.Password);



                foreach (var item in _BLLUser.GetSysUserByFilter(this.txtUsuario.Text))
                {
                    if (item.Login == this.txtUsuario.Text && item.Password == this.txtContrasena.Text)
                    {
                        // Log de errores
                        _MyLogControlEventos.InfoFormat("Entró a la aplicación");
                        Settings.Default.User = txtUsuario.Text.Trim();
                        this.DialogResult     = DialogResult.OK;
                    }
                }
            }
            catch (Exception er)
            {
                StringBuilder msg = new StringBuilder();
                msg.AppendFormat("Message        {0}\n", er.Message);
                msg.AppendFormat("Source         {0}\n", er.Source);
                msg.AppendFormat("InnerException {0}\n", er.InnerException);
                msg.AppendFormat("StackTrace     {0}\n", er.StackTrace);
                msg.AppendFormat("TargetSite     {0}\n", er.TargetSite);
                msg.AppendFormat("Usuario        {0}\n", Settings.Default.Login);

                _MyLogControlEventos.ErrorFormat("Error {0}", msg.ToString());


                // Incrementar el contador
                contador++;

                // Si el mensaje es "Error de inicio de sesión del usuario" es un error de usuario inválido
                if (er.Message.Trim().Contains("Error de inicio de sesión del usuario") == true || er.Message.Trim().Contains("Login failed") == true)
                {
                    MessageBox.Show("Usuario inválido, intento No " + contador, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    // otro Error
                    MessageBox.Show("Error ->" + er.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }

                // Si el contador es 3 cierre la aplicación
                if (contador == 3)
                {
                    // se devuelve Cancel
                    this.DialogResult = DialogResult.Cancel;
                    Application.Exit();
                }
            }
        }
    private void fnLogin(string lUserEmail)
    {
        //Session.Clear();
        Session["refreshtoken"]   = gs_refreshtoekn;
        Session["accesstoken"]    = gs_accesstoken;
        Session["sRequestId"]     = null;
        Session["sEditRequestId"] = null;
        string strAbsoluteUri = Page.Request.Url.AbsoluteUri.ToString().Replace("loginokta.aspx", "login.aspx");

        strAbsoluteUri = ConfigurationManager.AppSettings["IDP_BaseURL"] + "/accounts/logout/";

        Session["sAbsoluteUrl"] = strAbsoluteUri;
        Session["strTheme"]     = "";
        string strTheme = "";

        if (Request.QueryString["comp"] != null)
        {
            strCompany = Request.QueryString["comp"];
            Session["sAgentCompany"] = strCompany;
            if (strCompany == "924065660726315")
            {
                Session["sDivCode"] = "01";
                strTheme            = "css/" + GetStyleName(strCompany);
            }
            else if (strCompany == "675558760549078")
            {
                Session["sDivCode"] = "02";
                strTheme            = "css/style-style3.css";
            }
            else
            {
                Session["sDivCode"] = "0";
                strTheme            = "css/" + GetStyleName(strCompany);
            }
        }
        else
        {
            strCompany = "924065660726315"; // Default company
            Session["sAgentCompany"] = strCompany;
            Session["sDivCode"]      = "01";
            strTheme = "css/" + GetStyleName(strCompany);
        }
        Session["strTheme"] = strTheme;


        if (Session["sobjResParam"] == null)
        {
            ReservationParameters objResParam = new ReservationParameters();
            objResParam.AbsoluteUrl  = strAbsoluteUri;
            objResParam.AgentCompany = strCompany;
            objResParam.DivCode      = (string)Session["sDivCode"];
            objResParam.CssTheme     = strTheme;
            Session["sobjResParam"]  = objResParam;
        }
        else
        {
            ReservationParameters objResParam = new ReservationParameters();
            objResParam              = (ReservationParameters)Session["sobjResParam"];
            objResParam.AbsoluteUrl  = strAbsoluteUri;
            objResParam.AgentCompany = strCompany;
            objResParam.DivCode      = (string)Session["sDivCode"];
            objResParam.CssTheme     = strTheme;
            Session["sobjResParam"]  = objResParam;
        }

        //LoadLoginPageFields();
        string lUserName;

        lUserName = objclsUtilities.ExecuteQueryReturnStringValue("select top 1 webusername from agentmast (nolock) where isnull(webapprove,0)=1 and webemail='" + lUserEmail + "'");
        string lShortName;

        lShortName = objclsUtilities.ExecuteQueryReturnStringValue("select top 1 ShortName from agentmast (nolock) where isnull(webapprove,0)=1 and webemail='" + lUserEmail + "'");
        if (lUserName == null)
        {
            Response.Write("The account is not authorized to login");
            return;
        }
        if (lUserName.Trim() == "")
        {
            Response.Write("The account is not authorized to login");
            return;
        }
        //string lPassword;
        //lPassword = objclsUtilities.ExecuteQueryReturnStringValue("select dbo.pwddecript(userpwd) from usermaster where usercode='" + lUserName + "'");
        //if (1==2) { //(lPassword == null) {
        //    Response.Write("The username is incorrect.");
        //}
        //else
        //{
        BLLLogin objBLLLogin = new BLLLogin();

        objBLLLogin.UserName  = lUserName;
        objBLLLogin.ShortName = lShortName;
        String LoginIp = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];

        objBLLLogin.LoginType = "MAIN";
        objBLLLogin.IpAddress = LoginIp;
        objBLLLogin.DivCode   = (String)Session["sDivCode"];
        DataTable dtValidate;

        dtValidate = objBLLLogin.ValidateUserWithoutPassword();


        if (dtValidate.Rows.Count > 0)
        {
            Session.Add("GlobalUserName", lUserName);
            //Session.Add("Userpwd", txtPassword.Text.Trim);
            Session.Add("changeyear", DateTime.Now.Year.ToString());
            Session.Add("sLoginType", "Agent");

            Session.Add("sAgentCode", dtValidate.Rows[0]["agentcode"].ToString());
            Session.Add("sCurrencyCode", dtValidate.Rows[0]["currcode"].ToString());
            Session.Add("sCountryCode", dtValidate.Rows[0]["ctrycode"].ToString());
            Session["sLang"] = "en-us";

            GetReservationParamValues();


            ReservationParameters objResParam = new ReservationParameters();
            if (Session["sobjResParam"] != null)
            {
                objResParam = (ReservationParameters)Session["sobjResParam"];
            }
            objResParam.LoginIp = LoginIp;
            String strIpLocation = ""; // GeionName = strIpLocation;
            objResParam.AgentCode           = dtValidate.Rows[0]["agentcode"].ToString();
            objResParam.LoginIpLocationName = strIpLocation;
            objResParam.LoginType           = "Agent";


            BLLHotelSearch objBLLHotelSearch = new BLLHotelSearch();
            objResParam.Cumulative = objBLLHotelSearch.FindBookingEnginRateType(dtValidate.Rows[0]["agentcode"].ToString()).ToString();
            objResParam.WhiteLabel = objBLLHotelSearch.FindWhiteLabel(dtValidate.Rows[0]["agentcode"].ToString()).ToString();
            if (dtValidate.Rows[0]["logintype"].ToString() == "subuser")
            {
                objResParam.SubUserCode = dtValidate.Rows[0]["agentsubcode"].ToString();
                objResParam.IsSubUser   = "******";
            }
            else
            {
                objResParam.SubUserCode = "";
                objResParam.IsSubUser   = "******";
            }

            Session["sobjResParam"] = objResParam;
            FormsAuthentication.SetAuthCookie(lUserName, false);
            Session["IDPLOginType"] = "Agent";
            Response.Redirect("Home.aspx", false);
        }
        else
        {
            Response.Write("The account is not authorized to login");
        }
        //}
    }