Exemplo n.º 1
0
        private bool LoadFromUserContext()
        {
            UserContext user = UserContext.Current;

            if (user != null)
            {
                _tzi = TimeZoneInfo.FindSystemTimeZoneById(user.TimeZoneId);
                _tf  = user.TimeFormat;
                _df  = user.DateFormat;
                UserAuth auth = user["UserAuth"] as UserAuth;
                if (auth != null)
                {
                    this._tk       = auth._tk;
                    this._ui       = auth._ui;
                    this._di       = auth._di;
                    this._oi       = auth._oi;
                    this._ii       = auth._ii;
                    this._cf       = auth._cf;
                    this._em       = auth._em;
                    this._pm       = auth._pm;
                    this._lo       = auth._lo;
                    this._dn       = auth._dn;
                    this._fn       = auth._fn;
                    this._ln       = auth._ln;
                    this._sg       = auth._sg;
                    this._ps       = auth._ps;
                    this._fr       = auth._fr;
                    this._tt       = auth._tt;
                    this._st       = auth._st;
                    this._si       = auth._si;
                    this._sr       = auth._sr;
                    this._sn       = auth._sn;
                    this._role     = auth._role;
                    this._gf       = auth._gf;
                    this._password = auth._password;

                    return(true);
                }
            }

            return(false);
        }
Exemplo n.º 2
0
        private bool LoadFromUserContext()
        {
            UserContext user = UserContext.Current;
            if (user != null)
            {
                _tzi = TimeZoneInfo.FindSystemTimeZoneById(user.TimeZoneId);
                _tf = user.TimeFormat;
                _df = user.DateFormat;
                UserAuth auth = user["UserAuth"] as UserAuth;
                if (auth != null)
                {
                    this._tk = auth._tk;
                    this._ui = auth._ui;
                    this._di = auth._di;
                    this._oi = auth._oi;
                    this._ii = auth._ii;
                    this._cf = auth._cf;
                    this._em = auth._em;
                    this._pm = auth._pm;
                    this._lo = auth._lo;
                    this._dn = auth._dn;
                    this._fn = auth._fn;
                    this._ln = auth._ln;
                    this._sg = auth._sg;
                    this._ps = auth._ps;
                    this._fr = auth._fr;
                    this._tt = auth._tt;
                    this._st = auth._st;
                    this._si = auth._si;
                    this._sr = auth._sr;
                    this._sn = auth._sn;
                    this._role = auth._role;
                    this._gf = auth._gf;
                    this._password = auth._password;

                    return true;
                }
            }

            return false;
        }
Exemplo n.º 3
0
        public void Load(DataRow companyRow, string loginEmail)
        {
            int _userId = 0;
            DataRow _row = null;
            this.IsOk = false;
            string message = null;

            if (!ValidateLoginInCompany(companyRow, OrgID, loginEmail, out _userId, out _row, out message))
            {
                this._errMessage = message;
                return;
            }

            int _did = (int)companyRow["company_id"];
            this.strGDName = companyRow["company_name"].ToString();
            this._strGDGuid = companyRow["company_guid"].ToString();

            this._strUId = _userId.ToString();
            this._strDId = _did.ToString();
            this.strEmail = loginEmail;
            this.strGFName = _row["FirstName"].ToString();
            this.strGLName = _row["LastName"].ToString();
            this._password = _row["Password"].ToString();
            if (!_row.IsNull("tintTicketTimer")) this.tintTicketTimer = (byte)_row["tintTicketTimer"];
            else this.tintTicketTimer = (byte)_row["tintDTicketTimer"];
            if (!_row.IsNull("configPartialSetup")) this.IsConfigPartialSetup = (bool)_row["configPartialSetup"];
            this._strGSpGrp = _row["SupGroupId"].ToString();
            this._strGFrame = "0";
            switch ((int)_row["UserType_Id"])
            {
                case 1:
                    this.strGPerm = ",usr";
                    _role = UserRole.StandardUser;
                    break;
                case 2:
                    this.strGPerm = ",tch";
                    _role = UserRole.Technician;
                    break;
                case 3:
                    this.strGPerm = ",tch,adm";
                    _role = UserRole.Administrator;
                    break;
                case 4:
                    this.strGPerm = ",que";
                    _role = UserRole.StandardUser;
                    break;
                case 5:
                    this.strGPerm = ",usr";
                    _role = UserRole.StandardUser;
                    int _utype = 0;
                    int _sutype = 0;
                    int _suid = 0;
                    string _surlocid = string.Empty;
                    string _surlocname = string.Empty;
                    string _sudomain = string.Empty;
                    int _res = Data.Logins.SelectSuperUserInfo(OrgID, _did, _userId, ref _utype, ref _sutype, ref _suid, ref _surlocid, ref _surlocname, ref _sudomain);
                    if (_res >= 0 && _sutype != 0 && _suid != 0)
                    {
                        this.strGPerm += ",susr";
                        _role = UserRole.SuperUser;
                        this._strGSUserType = _sutype.ToString();
                        this._strGSUserId = _suid.ToString();
                        this.vchGSUserDomain = _sudomain;
                        this.strGSUserRootLocationId = _surlocid;
                        this.strGSUserRootLocationName = _surlocname;
                    }
                    break;
            }
            if (!_row.IsNull("btGlobalFilterEnabled") && (bool)_row["btGlobalFilterEnabled"]) this.strGFilter = ",gf";
            if (!_row.IsNull("btLimitToAssignedTkts") && (bool)_row["btLimitToAssignedTkts"]) this.strGFilter += ",tkt";
            if (this.strGFilter.IndexOf(",gf") >= 0 && this.strGFilter.IndexOf(",tkt") >= 0 && !_row.IsNull("btDisabledReports") && (bool)_row["btDisabledReports"]) this.strGFilter += ",rpt";
            this.IsOk = true;
            Micajah.Common.Dal.OrganizationDataSet.UserRow _usrRow = Micajah.Common.Bll.Providers.UserProvider.GetUserRow(loginEmail);
            if (_usrRow != null)
            {
                string timeZoneId = (_usrRow.IsTimeZoneIdNull() ? null : _usrRow.TimeZoneId);
                int? timeFormat = (_usrRow.IsTimeFormatNull() ? null : new int?(_usrRow.TimeFormat));
                int? dateFormat = (_usrRow.IsDateFormatNull() ? null : new int?(_usrRow.DateFormat));

                if (string.IsNullOrEmpty(timeZoneId) || (!timeFormat.HasValue) || (!dateFormat.HasValue))
                {
                    Micajah.Common.Bll.Instance inst = Micajah.Common.Bll.Providers.InstanceProvider.GetInstance(this.InstanceID, this.OrgID);
                    if (inst != null)
                    {
                        if (string.IsNullOrEmpty(timeZoneId))
                            timeZoneId = inst.TimeZoneId;

                        if (!timeFormat.HasValue)
                            timeFormat = inst.TimeFormat;

                        if (!dateFormat.HasValue)
                            dateFormat = inst.DateFormat;
                    }
                }

                if (string.IsNullOrEmpty(timeZoneId))
                    timeZoneId = "Eastern Standard Time";

                if (!timeFormat.HasValue)
                    timeFormat = 0;

                if (!dateFormat.HasValue)
                    dateFormat = 0;

                _tzi = TimeZoneInfo.FindSystemTimeZoneById(timeZoneId);
                _tf = timeFormat.Value;
                _df = dateFormat.Value;
            }
        }
Exemplo n.º 4
0
        public void Load(DataRow companyRow, string loginEmail)
        {
            int     _userId = 0;
            DataRow _row    = null;

            this.IsOk = false;
            string message = null;

            if (!ValidateLoginInCompany(companyRow, OrgID, loginEmail, out _userId, out _row, out message))
            {
                this._errMessage = message;
                return;
            }

            int _did = (int)companyRow["company_id"];

            this.strGDName  = companyRow["company_name"].ToString();
            this._strGDGuid = companyRow["company_guid"].ToString();

            this._strUId   = _userId.ToString();
            this._strDId   = _did.ToString();
            this.strEmail  = loginEmail;
            this.strGFName = _row["FirstName"].ToString();
            this.strGLName = _row["LastName"].ToString();
            this._password = _row["Password"].ToString();
            if (!_row.IsNull("tintTicketTimer"))
            {
                this.tintTicketTimer = (byte)_row["tintTicketTimer"];
            }
            else
            {
                this.tintTicketTimer = (byte)_row["tintDTicketTimer"];
            }
            if (!_row.IsNull("configPartialSetup"))
            {
                this.IsConfigPartialSetup = (bool)_row["configPartialSetup"];
            }
            this._strGSpGrp = _row["SupGroupId"].ToString();
            this._strGFrame = "0";
            switch ((int)_row["UserType_Id"])
            {
            case 1:
                this.strGPerm = ",usr";
                _role         = UserRole.StandardUser;
                break;

            case 2:
                this.strGPerm = ",tch";
                _role         = UserRole.Technician;
                break;

            case 3:
                this.strGPerm = ",tch,adm";
                _role         = UserRole.Administrator;
                break;

            case 4:
                this.strGPerm = ",que";
                _role         = UserRole.StandardUser;
                break;

            case 5:
                this.strGPerm = ",usr";
                _role         = UserRole.StandardUser;
                int    _utype      = 0;
                int    _sutype     = 0;
                int    _suid       = 0;
                string _surlocid   = string.Empty;
                string _surlocname = string.Empty;
                string _sudomain   = string.Empty;
                int    _res        = Data.Logins.SelectSuperUserInfo(OrgID, _did, _userId, ref _utype, ref _sutype, ref _suid, ref _surlocid, ref _surlocname, ref _sudomain);
                if (_res >= 0 && _sutype != 0 && _suid != 0)
                {
                    this.strGPerm                 += ",susr";
                    _role                          = UserRole.SuperUser;
                    this._strGSUserType            = _sutype.ToString();
                    this._strGSUserId              = _suid.ToString();
                    this.vchGSUserDomain           = _sudomain;
                    this.strGSUserRootLocationId   = _surlocid;
                    this.strGSUserRootLocationName = _surlocname;
                }
                break;
            }
            if (!_row.IsNull("btGlobalFilterEnabled") && (bool)_row["btGlobalFilterEnabled"])
            {
                this.strGFilter = ",gf";
            }
            if (!_row.IsNull("btLimitToAssignedTkts") && (bool)_row["btLimitToAssignedTkts"])
            {
                this.strGFilter += ",tkt";
            }
            if (this.strGFilter.IndexOf(",gf") >= 0 && this.strGFilter.IndexOf(",tkt") >= 0 && !_row.IsNull("btDisabledReports") && (bool)_row["btDisabledReports"])
            {
                this.strGFilter += ",rpt";
            }
            this.IsOk = true;
            Micajah.Common.Dal.OrganizationDataSet.UserRow _usrRow = Micajah.Common.Bll.Providers.UserProvider.GetUserRow(loginEmail);
            if (_usrRow != null)
            {
                string timeZoneId = (_usrRow.IsTimeZoneIdNull() ? null : _usrRow.TimeZoneId);
                int?   timeFormat = (_usrRow.IsTimeFormatNull() ? null : new int?(_usrRow.TimeFormat));
                int?   dateFormat = (_usrRow.IsDateFormatNull() ? null : new int?(_usrRow.DateFormat));

                if (string.IsNullOrEmpty(timeZoneId) || (!timeFormat.HasValue) || (!dateFormat.HasValue))
                {
                    Micajah.Common.Bll.Instance inst = Micajah.Common.Bll.Providers.InstanceProvider.GetInstance(this.InstanceID, this.OrgID);
                    if (inst != null)
                    {
                        if (string.IsNullOrEmpty(timeZoneId))
                        {
                            timeZoneId = inst.TimeZoneId;
                        }

                        if (!timeFormat.HasValue)
                        {
                            timeFormat = inst.TimeFormat;
                        }

                        if (!dateFormat.HasValue)
                        {
                            dateFormat = inst.DateFormat;
                        }
                    }
                }

                if (string.IsNullOrEmpty(timeZoneId))
                {
                    timeZoneId = "Eastern Standard Time";
                }

                if (!timeFormat.HasValue)
                {
                    timeFormat = 0;
                }

                if (!dateFormat.HasValue)
                {
                    dateFormat = 0;
                }

                _tzi = TimeZoneInfo.FindSystemTimeZoneById(timeZoneId);
                _tf  = timeFormat.Value;
                _df  = dateFormat.Value;
            }
        }