Exemple #1
0
        public DataTable listaRegistro_Param(ref Ent_ttccol300 ParametrosIn, ref string strError)
        {
            method = MethodBase.GetCurrentMethod();

            paramList = new Dictionary <string, object>();
            paramList.Add("p1", ParametrosIn.user);

            strSentencia = recursos.readStatement(method.ReflectedType.Name, method.Name, ref owner, ref env, tabla, paramList);

            try
            {
                consulta = DAL.BaseDAL.BaseDal.EjecutarCons("Text", strSentencia, ref parametersOut, null, true);
                if (consulta.Rows.Count < 1)
                {
                    strError = "-1";
                }
                return(consulta);
            }
            catch (Exception ex)
            {
                //Comentado CChaverra 11052017
                strError = "Error when querying data [ttccol300]. Try again or contact your administrator";
                strError = ex.InnerException != null ?
                           ex.Message + " (" + ex.InnerException + ")" :
                           ex.Message;
                throw ex;
            }
        }
Exemple #2
0
        private List <Ent_ParametrosDAL> AdicionaParametrosComunes(Ent_ttccol300 parametros, bool blnUsarPRetorno = false)
        {
            method = MethodBase.GetCurrentMethod();
            string strError = string.Empty;
            List <Ent_ParametrosDAL> parameterCollection = new List <Ent_ParametrosDAL>();

            try
            {
                Ent_ParametrosDAL.AgregaParametro(ref parameterCollection, ":T$USER", DbType.String, parametros.user);
                Ent_ParametrosDAL.AgregaParametro(ref parameterCollection, ":T$NAMA", DbType.String, parametros.nama);
                Ent_ParametrosDAL.AgregaParametro(ref parameterCollection, ":T$PASS", DbType.String, parametros.pass);
                //Ent_ParametrosDAL.AgregaParametro(ref parameterCollection, ":T$UFIN", DbType.String, parametros.ufin);
                Ent_ParametrosDAL.AgregaParametro(ref parameterCollection, ":T$REFCNTD", DbType.Int32, parametros.refcntd);
                Ent_ParametrosDAL.AgregaParametro(ref parameterCollection, ":T$REFCNTU", DbType.Int32, parametros.refcntu);
                Ent_ParametrosDAL.AgregaParametro(ref parameterCollection, ":T$ROLE", DbType.Int32, parametros.refcntu);
                Ent_ParametrosDAL.AgregaParametro(ref parameterCollection, ":T$SHIF", DbType.Int32, parametros.refcntu);

                if (blnUsarPRetorno)
                {
                    Ent_ParametrosDAL pDal = new Ent_ParametrosDAL();
                    pDal.Name         = "@p_Int_Resultado";
                    pDal.Type         = DbType.Int32;
                    pDal.ParDirection = ParameterDirection.Output;
                    parameterCollection.Add(pDal);
                }
            }
            catch (Exception ex)
            {
                strError = "Error when creating parameters [301]. Try again or contact your administrator \n";
                log.escribirError(strError + Console.Out.NewLine + ex.Message, stackTrace.GetFrame(1).GetMethod().Name, method.Name, method.ReflectedType.Name);
            }
            return(parameterCollection);
        }
Exemple #3
0
        protected void btnVerificate_Click(object sender, EventArgs e)
        {
            if (UserName.Text.Trim() == String.Empty)
            {
                lblErrorMessage1.Text = _idioma == "INGLES" ? "UserName is required" : "el usuario es requerido";;
                return;
            }
            obj       = new Ent_ttccol300();
            obj.user  = UserName.Text.Trim().ToUpperInvariant();
            resultado = _idalttcol300.listaRegistro_Param(ref obj, ref strError);
            if (resultado.Rows.Count < 1 && !string.IsNullOrEmpty(UserName.Text))
            {
                LblUserNameDontExist.Visible = true;
                return;
            }
            else
            {
                UserName.Text = resultado.Rows[0]["userN"].ToString().Trim().ToUpperInvariant();
                LblUserNameDontExist.Visible         = false;
                UserName.Enabled                     = false;
                btnValidate.Visible                  = false;
                btnGeneratePassword.Visible          = true;
                LblUserNameExist.Visible             = true;
                LblUserNameExist.Text                = resultado.Rows[0]["Nombre"].ToString();
                LblUserNameExist.Attributes["style"] = "font-weight:bold;border:solid 1px;font-size:20px";

                return;
            }
        }
Exemple #4
0
        protected void LoginButton_Command(object sender, CommandEventArgs e)
        {
            obj = new Ent_ttccol300();
            List <Ent_ttccol300> parameterCollection = new List <Ent_ttccol300>();

            strError = string.Empty;
            switch (e.CommandName)
            {
            case "Login":
                LoginUser.UserName = LoginUser.UserName.Trim().ToUpperInvariant();
                obj.user           = LoginUser.UserName.Trim();
                obj.pass           = LoginUser.Password.Trim();
                resultado          = idal.listaRegistro_Param(ref obj, ref strError);
                break;

            case "Submit":

                if ((String)e.CommandArgument == "")
                {
                    // Message.Text += ".";
                }
                break;

            default:

                // The command name is not recognized. Display an error message.
                lblErrorMsg.Text = "Command name not recogized. Login Failure";
                break;
            }
            if (resultado.Rows.Count < 1)
            {
                lblErrorMsg.Text = "Invalid User. Please Try Again.";
                return;
            }
            else
            {
                if (resultado.Rows[0]["pswd"].ToString() != obj.pass)
                {
                    lblErrorMsg.Text = "Invalid Password, try again.";
                    return;
                }
            }

            obj.nama    = resultado.Rows[0]["Nombre"].ToString();
            obj.refcntd = 0;
            obj.refcntu = 0;
            parameterCollection.Add(obj);
            //int retorno = idal.actualizarRegistro(ref parameterCollection, ref strError);

            if (!string.IsNullOrEmpty(strError))
            {
                lblErrorMsg.Text = strError;
                return;
            }

            Session["user"]     = obj.user.Trim();
            Session["username"] = resultado.Rows[0]["Nombre"].ToString();
            Session["logok"]    = "OKYes";
        }
Exemple #5
0
 protected void btnForgotPass_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(TxtUserForgotPass.Text))
     {
         obj      = new Ent_ttccol300();
         obj.user = TxtUserForgotPass.Text;
         string strError1 = String.Empty;
         _idalttcol300.RecordarContraseña(obj, ref strError1);
     }
 }
Exemple #6
0
        public void RecordarContraseña(Ent_ttccol300 ParametrosIn, ref string strError)
        {
            method = MethodBase.GetCurrentMethod();

            paramList = new Dictionary <string, object>();
            paramList.Add("p1", ParametrosIn.user);

            strSentencia = recursos.readStatement(method.ReflectedType.Name, method.Name, ref owner, ref env, tabla, paramList);

            try
            {
                consulta = DAL.BaseDAL.BaseDal.EjecutarCons("Text", strSentencia, ref parametersOut, null, true);
                if (consulta.Rows.Count < 1)
                {
                    strError = "-1";
                }

                Ent_ttccol300 obj = new Ent_ttccol300();
                SendMailService.SendMailService SendMail = IntanciaServicionSendMail();

                foreach (DataRow item in consulta.Rows)
                {
                    obj.pass = item["pswd"].ToString();
                    obj.nama = item["Nombre"].ToString();
                    obj.user = item["userN"].ToString();
                    obj.ufin = item["UFIN"].ToString();
                    obj.role = Convert.ToInt32(item["role"]);
                    obj.shif = item["shif"].ToString();
                }

                SendMailService.Models.Email Email = new SendMailService.Models.Email();
                Email.Body = "Name: " + obj.nama + "User: "******"Password: "******"*****@*****.**"
                });
                Email.To      = LstTo;
                Email.Subject = "Password recovery : " + obj.user;

                SendMail.SendEmails(Email);

                //SendMail.SendEmails();
            }
            catch (Exception ex)
            {
                //Comentado CChaverra 11052017
                strError = "Error when querying data [ttccol300]. Try again or contact your administrator";
                strError = ex.InnerException != null ?
                           ex.Message + " (" + ex.InnerException + ")" :
                           ex.Message;
                throw ex;
            }
        }
 public void  RecordarContraseña(Ent_ttccol300 obj, ref string strError)
 {
     try
     {
         dal.RecordarContraseña(obj, ref strError);
     }
     catch (Exception ex)
     {
         throw new Exception(ex.InnerException.ToString());
     }
 }
        public DataTable listaRegistro_Param(ref Ent_ttccol300 ParametrosIn, ref string strError)
        {
            //int retorno = -1;
            DataTable retorno;

            try
            {
                retorno = dal.listaRegistro_Param(ref ParametrosIn, ref strError);
                return(retorno);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.InnerException.ToString());
            }
        }
Exemple #9
0
        private static bool ConsulrarExistenciaUsuario(Ent_ttccol300 ttccol300)
        {
            bool      ExisteUsuario = false;
            string    StrError      = string.Empty;
            DataTable ListaUsuarios = Ittccol300.listaRegistro_Param(ref ttccol300, ref StrError);

            if (ListaUsuarios.Rows.Count > 0)
            {
                ExisteUsuario = true;
            }
            else
            {
                ExisteUsuario = false;
            };
            return(ExisteUsuario);
        }
Exemple #10
0
        protected void LoginButton_Command(object sender, CommandEventArgs e)
        {
            if (txNavigator.Text == "EDG")
            {
                Session["navigator"] = "EDG";
            }
            else
            {
                Session["navigator"] = "";
            }
            obj = new Ent_ttccol300();
            List <Ent_ttccol300> parameterCollection = new List <Ent_ttccol300>();

            strError = string.Empty;
            switch (e.CommandName)
            {
            case "Login":
                UserName.Text = UserName.Text.Trim().ToUpperInvariant();
                obj.user      = UserName.Text.Trim();
                obj.pass      = Password.Text.Trim();
                resultado     = _idalttcol300.listaRegistro_Param(ref obj, ref strError);
                break;

            case "Submit":

                if ((String)e.CommandArgument == "")
                {
                }
                break;

            default:
                lblErrorMsg.Text = CommandnamenotrecogizedLoginFailure;
                break;
            }


            if (resultado.Rows.Count < 1 && !string.IsNullOrEmpty(Password.Text))
            {
                lblErrorMsg.Text   = mensajes("user");
                LblErrorLogin.Text = Incorrectuserorpassword;
                return;
            }
            else
            {
                string barCode         = UserName.Text;
                var    fechaCambioPass = Convert.ToDateTime(resultado.Rows[0]["UFIN"].ToString());
                var    dateDiff        = (DateTime.Now - fechaCambioPass).Days;

                if (dateDiff >= Convert.ToInt32(ConfigurationManager.AppSettings["tiempoCambioContrasena"].ToString()))
                {
                    divLogin.Visible          = false;
                    divChangePassword.Visible = true;
                    return;
                }
                string OldEncrypted = Utils.encodePassword(obj.pass);
                if (resultado.Rows[0]["pswd"].ToString() != Utils.EncryptStringToBytes_Aes(obj.pass))
                {
                    if (resultado.Rows[0]["pswd"].ToString() != obj.pass)
                    {
                        if (resultado.Rows[0]["pswd"].ToString() != OldEncrypted)
                        {
                            lblErrorMsg.Text   = mensajes("password");
                            LblErrorLogin.Text = "Incorrect user or password.";
                            return;
                        }
                    }
                }
            }

            obj.nama    = resultado.Rows[0]["Nombre"].ToString();
            obj.refcntd = 0;
            obj.refcntu = 0;
            parameterCollection.Add(obj);
            //int retorno = idal.actualizarRegistro(ref parameterCollection, ref strError);

            if (!string.IsNullOrEmpty(strError))
            {
                lblErrorMsg.Text = strError;
                return;
            }

            var user = obj.user.Trim();

            Session["user"]        = user;
            Session["username"]    = resultado.Rows[0]["Nombre"].ToString();
            Session["logok"]       = "OKYes";
            Session["dateSession"] = DateTime.Now.ToShortDateString().ToString();
            Session["psw"]         = resultado.Rows[0]["pswd"].ToString().Trim();
            Session["role"]        = resultado.Rows[0]["role"].ToString().Trim();
            Session["shif"]        = resultado.Rows[0]["shif"].ToString().Trim();


            foreach (var _session in Session)
            {
                Console.WriteLine(_session);
            }
            Response.Redirect(ConfigurationManager.AppSettings["UrlBase"] + "/WebPages/Login/whMenuI.aspx");
        }
Exemple #11
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            obj = new Ent_ttccol300();
            List <Ent_ttccol300> parameterCollection = new List <Ent_ttccol300>();

            strError = string.Empty;

            if (validarDatos())
            {
                obj.user = txtUserName.Text.ToUpperInvariant().Trim();
                obj.pass = txtPassword.Text.Trim();
                try
                {
                    resultado = idal.listaRegistro_Param(ref obj, ref strError);
                }
                catch
                {
                    MessageBox.Show(strError, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }
            else
            {
                MessageBox.Show(strError, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (resultado.Rows.Count < 1)
            {
                MessageBox.Show("Usuario no valido. Intente de nuevo.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            else if (resultado.Rows[0]["pswd"].ToString() != obj.pass)
            {
                MessageBox.Show("Contraseña no válida, intente de nuevo.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            obj.nama    = resultado.Rows[0]["Nombre"].ToString();
            obj.refcntd = 0;
            obj.refcntu = 0;
            parameterCollection.Add(obj);

            //int retorno = idal.actualizarRegistro(ref parameterCollection, ref strError);

            //if (!string.IsNullOrEmpty(strError))
            //{
            //    MessageBox.Show(strError, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            //    return;
            //}

            usuario.User     = obj.user.Trim();
            usuario.UserName = resultado.Rows[0]["Nombre"].ToString();
            usuario.logok    = "OKYes";
            try
            {
                frmLoadShopLogix form = new frmLoadShopLogix(usuario, this);
                this.Visible = false;
                form.ShowDialog();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
        }