public EmployeesTableCollection FetchAll()
 {
     EmployeesTableCollection coll = new EmployeesTableCollection();
     Query qry = new Query(EmployeesTable.Schema);
     coll.LoadAndCloseReader(qry.ExecuteReader());
     return coll;
 }
        //end append to log

        /// <summary>
        /// derive user details from submitted email address
        /// </summary>
        /// <param name="txtmail"></param>
        /// <returns></returns>
        public static String getuserAccount(string txtmail)
        {
            txtmail = wwi_security.DecryptString(txtmail, "publiship");
            String _account = "";
            Query  _qryb    = new Query(Tables.ContactTable).WHERE("Email", Comparison.Equals, txtmail).AND("Live", Comparison.Equals, true);
            ContactTableCollection _contact = new ContactTableCollection();

            _contact.LoadAndCloseReader(_qryb.ExecuteReader());

            if (_contact.Count != 0)
            {
                _account = (String)_contact[0].ContactName + "#" + (String)_contact[0].Password;
            }
            else
            {
                Query _qry = new Query(Tables.EmployeesTable).WHERE("EmailAddress", Comparison.Equals, txtmail).AND("Live", Comparison.Equals, true);
                EmployeesTableCollection _employ = new EmployeesTableCollection();
                _employ.LoadAndCloseReader(_qry.ExecuteReader());

                if (_employ.Count != 0)
                {
                    _account = (String)_employ[0].Name + "#" + (String)_employ[0].Password;
                }
            }

            return(_account);
        }
Esempio n. 3
0
    protected void bind_formview(string mode)
    {
        //have to use a collection as formview needs to bind to enumerable
        EmployeesTableCollection _tbl = new EmployeesTableCollection();

        if (mode != "Insert")
        {
            int _pid = wwi_func.vint(wwi_security.DecryptString(get_token("pid").ToString(), "publiship"));

            EmployeesTable _ct = new EmployeesTable(_pid);
            _tbl.Add(_ct);

            //store original value for name so we can check against database when saving
            if (this.dxhfOrder.Contains("oldvalue"))
            {
                this.dxhfOrder.Remove("oldvalue");
            }
            this.dxhfOrder.Add("oldvalue", _ct.Name);
        }
        else
        {
            EmployeesTable _ct = new EmployeesTable();
            _tbl.Add(_ct);
        }

        this.fmvEmployee.DataSource = _tbl;
        this.fmvEmployee.DataBind();
    }
Esempio n. 4
0
        //overloaded
        public static int getuserIds(string username, string password, string returnid)
        {
            //should we rquire password encryption here?
            //string txtPassword = wwi_security.DecryptString(password, "publiship");

            int _account = 0;
            Query _qry1 = new Query(Tables.ContactTable).WHERE("ContactName", Comparison.Equals, username).AND("Password", Comparison.Equals, password).AND("Live", Comparison.Equals, true);
            ContactTableCollection _contact = new ContactTableCollection();
            _contact.LoadAndCloseReader(_qry1.ExecuteReader());

            if (_contact.Count != 0)
            {
                _account = returnid == "user"? (int)_contact[0].ContactID : (int)_contact[0].CompanyID;

            }
            else
            {
                Query _qry2 = new Query(Tables.EmployeesTable).WHERE("Name", Comparison.Equals, username).AND("Password", Comparison.Equals, password).AND("Live", Comparison.Equals, true);
                EmployeesTableCollection _employ = new EmployeesTableCollection();
                _employ.LoadAndCloseReader(_qry2.ExecuteReader());

                if (_employ.Count != 0)
                {
                    _account = returnid == "user"? (int)_employ[0].EmployeeID: -1;
                }
            }

            return _account;
        }
Esempio n. 5
0
        //end get user account

        /// <summary>
        /// derive user ids as userid#companyid for a valid login
        /// return empty string if login fails
        /// </summary>
        /// <param name="username">name of user</param>
        /// <param name="password">encrypted password</param>
        /// <returns></returns>
        public static String getuserIds(string username, string password)
        {
            //should we rquire password encryption here?
            //string txtPassword = wwi_security.DecryptString(password, "publiship");
            
            String _account = "";
            Query _qry1 = new Query(Tables.ContactTable).WHERE("ContactName", Comparison.Equals, username).AND("Password", Comparison.Equals, password).AND("Live", Comparison.Equals, true);
            ContactTableCollection _contact = new ContactTableCollection();
            _contact.LoadAndCloseReader(_qry1.ExecuteReader());

            if (_contact.Count != 0)
            {
                _account = _contact[0].ContactID.ToString() + "#" + (String)_contact[0].CompanyID.ToString();

            }
            else
            {
                Query _qry2 = new Query(Tables.EmployeesTable).WHERE("Name", Comparison.Equals, username).AND("Password", Comparison.Equals, password).AND("Live", Comparison.Equals, true);
                EmployeesTableCollection _employ = new EmployeesTableCollection();
                _employ.LoadAndCloseReader(_qry2.ExecuteReader());

                if (_employ.Count != 0)
                {
                    _account = _employ[0].EmployeeID.ToString() + "#-1"; //internal users do not have a company id set to -1
                }
            }

            return _account;
        }
Esempio n. 6
0
        //end decrypt string

        /// <summary>
        /// derive user details from submitted email address
        /// </summary>
        /// <param name="txtmail"></param>
        /// <returns></returns>
        public static String getuserAccount(string txtmail)
        {
            txtmail = wwi_security.DecryptString(txtmail, "publiship");  
            String _account = "";
            Query _qryb = new Query(Tables.ContactTable).WHERE("Email", Comparison.Equals, txtmail).AND("Live", Comparison.Equals, true);
            ContactTableCollection _contact = new ContactTableCollection();
            _contact.LoadAndCloseReader(_qryb.ExecuteReader());

            if (_contact.Count != 0)
            {
                _account = (String)_contact[0].ContactName + "#" + (String)_contact[0].Password;

            }
            else
            {
                Query _qry = new Query(Tables.EmployeesTable).WHERE("EmailAddress", Comparison.Equals, txtmail).AND("Live", Comparison.Equals, true);
                EmployeesTableCollection _employ = new EmployeesTableCollection();
                _employ.LoadAndCloseReader(_qry.ExecuteReader());

                if (_employ.Count != 0)
                {
                    _account = (String)_employ[0].Name + "#" + (String)_employ[0].Password;
                }
            }

            return _account;
        }
Esempio n. 7
0
    protected void bind_formview(string mode)
    {
        //have to use a collection as formview needs to bind to enumerable
        EmployeesTableCollection _tbl = new EmployeesTableCollection();
        if (mode != "Insert")
        {
            int _pid = wwi_func.vint(wwi_security.DecryptString(get_token("pid").ToString(), "publiship"));

            EmployeesTable _ct = new EmployeesTable(_pid);
            _tbl.Add(_ct);

            //store original value for name so we can check against database when saving
            if (this.dxhfOrder.Contains("oldvalue")) { this.dxhfOrder.Remove("oldvalue"); }
            this.dxhfOrder.Add("oldvalue", _ct.Name); 
        }
        else
        {
            EmployeesTable _ct = new EmployeesTable();
            _tbl.Add(_ct);

           
        }

        this.fmvEmployee.DataSource = _tbl;
        this.fmvEmployee.DataBind();
    }
 public EmployeesTableCollection FetchByQuery(Query qry)
 {
     EmployeesTableCollection coll = new EmployeesTableCollection();
     coll.LoadAndCloseReader(qry.ExecuteReader()); 
     return coll;
 }
 public EmployeesTableCollection FetchByID(object EmployeeID)
 {
     EmployeesTableCollection coll = new EmployeesTableCollection().Where("EmployeeID", EmployeeID).Load();
     return coll;
 }