示例#1
0
        public bool isEmployeeTag()
        {
            if (_isLocationTag)
            {
                return(false);
            }

            if (_isEmployeeTag == true)
            {
                return(_isEmployeeTag);
            }

            if (_isAssetTag == true)
            {
                return(false);
            }

            if (!Login.OnLineMode)
            {
                using (CEConn localDB = new CEConn())
                {
                    string strSql;
                    strSql   = " select serverKey as ID_Employee from Employees where TagID='" + _TagID + "'";
                    _DataKey = Convert.ToInt32(localDB.getScalerValue(strSql));
                }
            }
            else
            {
                RConnection.RConnection OnConn = new RConnection.RConnection();
                OnConn.Url = Login.webConURL;
                string strSql;
                strSql = " select ID_Employee from Employees where TagID='" + _TagID + "' and Is_Active=1 and Is_Deleted=0";
                String strVal = OnConn.getScalerValue(strSql);
                if (strVal.Trim().Length != 0)
                {
                    _DataKey = Convert.ToInt32(strVal);
                }
                else
                {
                    _DataKey = 0;
                }
                //throw new ApplicationException("Online functionality not implemented yet.");
            }

            if (_DataKey != 0)
            {
                _isEmployeeTag = true;
                return(true);
            }
            else
            {
                //We can assign DataKey here from Asset table.
                _isEmployeeTag = false;
                return(false);
            }
        }
示例#2
0
        public static string getLocationByName(string locName)
        {
            string strSql;

            if (Login.OnLineMode)
            {
                RConnection.RConnection OnConn = new RConnection.RConnection();
                OnConn.Url = Login.webConURL;

                strSql = " select Top 1 isNULL(ID_Location,'') from Locations where   is_deleted=0 and Name = '" + locName + "'";
                return(OnConn.getScalerValue(strSql));
            }
            else
            {
                using (CEConn localDB = new CEConn())
                {
                    strSql = " select ServerKey as ID_Location from Locations where   ServerKey<>0 and Name='" + locName + "'";
                    return(Convert.ToString(localDB.getScalerValue(strSql)));
                }
            }
        }
示例#3
0
        public static string getDispatchLocation()
        {
            string strSql;

            if (Login.OnLineMode)
            {
                RConnection.RConnection OnConn = new RConnection.RConnection();
                OnConn.Url = Login.webConURL;
                strSql     = " Update Locations Set is_deleted=0, is_active=1 Where tagid='0000000000000000000000D' ;";
                strSql     = strSql + " select Top 1 isNULL(ID_Location,'') from Locations where tagid='0000000000000000000000D' and is_deleted=0 and is_active=1";
                return(OnConn.getScalerValue(strSql));
            }
            else
            {
                using (CEConn localDB = new CEConn())
                {
                    strSql = " select ServerKey as ID_Location from Locations where tagid='0000000000000000000000D' and ServerKey<>0 ";
                    return(Convert.ToString(localDB.getScalerValue(strSql)));
                }
            }
        }
示例#4
0
        public bool isLocationTag()
        {
            if (_isEmployeeTag)
            {
                return(false);
            }

            if (_isLocationTag == true)
            {
                return(_isLocationTag);
            }

            if (_isAssetTag == true)
            {
                return(false);
            }

            if (!Login.OnLineMode)
            {
                using (CEConn localDB = new CEConn())
                {
                    string strSql;
                    strSql   = " select serverKey as ID_Location from Locations where TagID='" + _TagID + "'";
                    _DataKey = Convert.ToInt32(localDB.getScalerValue(strSql));
                }
            }
            else
            {
                RConnection.RConnection OnConn = new RConnection.RConnection();
                OnConn.Url = Login.webConURL;
                string strSql;
                try
                {
                    strSql = " select ID_Location from Locations where TagID='" + _TagID + "'";
                    string oStr = OnConn.getScalerValue(strSql);
                    if (oStr.ToString().Length != 0)
                    {
                        _DataKey = Convert.ToInt32(oStr);
                    }
                    else
                    {
                        _DataKey = 0;
                    }
                }
                catch (Exception ex)
                {
                    strSql   = ex.ToString();
                    _DataKey = 0;
                    Logger.LogError(ex.Message);
                }
                //    throw new ApplicationException("Online functionality not implemented yet.");
            }

            if (_DataKey != 0)
            {
                _isLocationTag = true;
                return(true);
            }
            else
            {
                //We can assign DataKey here from Asset table.
                _isLocationTag = false;
                return(false);
            }
        }