Esempio n. 1
0
        public DCUser2 AuthenticateUser(string sessionid, string username, string pwd, string pwdattempts)
        {
            UserBiz     m_ubiz = new UserBiz();
            User2Detail dtuser = null;
            DCUser2     dcusr  = null;
            GroupBiz    m_gbiz = new GroupBiz();

            try
            {
                dtuser = m_ubiz.AuthenticateUser(CryptoUtils.DecryptTripleDES(username), CryptoUtils.DecryptTripleDES(pwd),
                                                 GMConvert.GetInt16(CryptoUtils.DecryptTripleDES(pwdattempts)));
                if (dtuser != null && dtuser.LastLogon.HasValue)
                {
                    dtuser.Permissions = new List <int>();
                    List <Int32> groups = m_ubiz.GetGroups(dtuser.ID);
                    foreach (int group in groups)
                    {
                        dtuser.Permissions.AddRange(m_gbiz.GetPermissions(group));
                    }

                    dcusr = new DCUser2();
                    GMReflectionUtils.Copy(dtuser, dcusr);
                    SetCache(sessionid, dcusr);
                }
            }
            catch (Exception exp)
            {
                throw exp;
            }
            finally { m_ubiz.Dispose(); m_gbiz.Dispose(); }
            return(dcusr);
        }
Esempio n. 2
0
        public void Get(DCUser2 dcusr)
        {
            GroupBiz gbiz = new GroupBiz();

            try
            {
                GMUtilities.GMReflectionUtils.Copy(m_biz.Get(dcusr.ID), dcusr);
                dcusr.DSUNSelected   = gbiz.Get();
                dcusr.DSTypeID       = m_optbiz.GetEmployeeTypes(GetCache(dcusr.SessionID).ID);
                dcusr.DSDepartmentID = m_optbiz.GetDeparmentTypes();
                if (dcusr.ID.HasValue)
                {
                    dcusr.DSSelected = GMUtilities.DataUtils.DetachSelection(dcusr.DSUNSelected, m_biz.GetGroups(dcusr.ID));
                }
            }
            catch (Exception exp) { throw exp; }
            finally { gbiz.Dispose(); }
        }