Esempio n. 1
0
        /// <summary>
        /// Get departments
        /// </summary>
        /// <param name="pCon"></param>
        /// <returns></returns>
        public IList <Employee> Get(SqlConnection pCon)
        {
            try
            {
                try
                {
                    var _employee = new List <Employee>();
                    using (var _cmd = new SqlCommand("usp_GetDepartment"))
                    {
                        _cmd.CommandType = CommandType.StoredProcedure;
                        _cmd.Connection  = pCon;

                        using (SqlDataReader _rdr = _cmd.ExecuteReader())
                        {
                            try
                            {
                                _employee = ReadToEntity.Map <Employee>(_rdr);
                            }
                            catch (Exception ex) { throw ex; }
                        }
                    }
                    return(_employee);
                }
                catch (Exception ex) { throw ex; }
            }
            catch (Exception ex) { throw ex; }
        }
Esempio n. 2
0
        /// <summary>
        /// Get list of unit of measure
        /// </summary>
        /// <param name="pCon"></param>
        /// <returns></returns>
        public IList <AssetItem> Get(SqlConnection pCon)
        {
            try
            {
                try
                {
                    var _uom = new List <AssetItem>();
                    using (var _cmd = new SqlCommand("usp_GetUOM"))
                    {
                        _cmd.CommandType = CommandType.StoredProcedure;
                        _cmd.Connection  = pCon;

                        using (SqlDataReader _rdr = _cmd.ExecuteReader())
                        {
                            try
                            {
                                _uom = ReadToEntity.Map <AssetItem>(_rdr);
                            }
                            catch (Exception ex) { throw ex; }
                        }
                    }
                    return(_uom);
                }
                catch (Exception ex) { throw ex; }
            }
            catch (Exception ex) { throw ex; }
        }
Esempio n. 3
0
        /// <summary>
        /// Get list of assets items
        /// </summary>
        /// <param name="pAssetGroup"></param>
        /// <param name="pAssetType"></param>
        /// <param name="pCon"></param>
        /// <returns></returns>
        public IList <AssetItem> Get(string pAssetGroup, string pAssetType, SqlConnection pCon)
        {
            try
            {
                var _assetitem = new List <AssetItem>();
                using (var _cmd = new SqlCommand("usp_GetAssetItemByFiltered"))
                {
                    _cmd.CommandType = CommandType.StoredProcedure;
                    _cmd.Parameters.Add("@pAssetGroup", SqlDbType.NVarChar, 100).Value = pAssetGroup;
                    _cmd.Parameters.Add("@pAssetType", SqlDbType.NVarChar, 100).Value  = pAssetType;
                    _cmd.Connection = pCon;

                    using (SqlDataReader _rdr = _cmd.ExecuteReader())
                    {
                        try
                        {
                            _assetitem = ReadToEntity.Map <AssetItem>(_rdr);
                        }
                        catch (Exception ex) { throw ex; }
                    }
                }
                return(_assetitem);
            }
            catch (Exception ex) { throw ex; }
        }
Esempio n. 4
0
        /// <summary>
        /// Get list of the MR assets items
        /// </summary>
        /// <param name="pFrom"></param>
        /// <param name="pTo"></param>
        /// <param name="pCon"></param>
        /// <returns></returns>
        public IList <AssetItem> Get(DateTime pFrom, DateTime pTo, SqlConnection pCon)
        {
            try
            {
                var _mr = new List <AssetItem>();
                using (var _cmd = new SqlCommand("usp_GetMRByDateRange"))
                {
                    _cmd.CommandType = CommandType.StoredProcedure;
                    _cmd.Parameters.Add("@pFDate", SqlDbType.DateTime).Value = pFrom;
                    _cmd.Parameters.Add("@pEdate", SqlDbType.DateTime).Value = pTo;
                    _cmd.Connection = pCon;

                    using (SqlDataReader _rdr = _cmd.ExecuteReader())
                    {
                        try
                        {
                            _mr = ReadToEntity.Map <AssetItem>(_rdr);
                        }
                        catch (Exception ex) { throw ex; }
                    }
                }
                return(_mr);
            }
            catch (Exception ex) { throw ex; }
        }
Esempio n. 5
0
        /// <summary>
        /// Authentication
        /// </summary>
        /// <param name="pEmail"></param>
        /// <param name="pCon"></param>
        /// <returns></returns>
        public Employee Get(string pEmail, SqlConnection pCon)
        {
            try
            {
                Employee _emp = new Employee();
                using (var _cmd = new SqlCommand("usp_Authentication"))
                {
                    _cmd.CommandType = CommandType.StoredProcedure;
                    _cmd.Parameters.Add("@pEmail", SqlDbType.NVarChar, 100).Value = pEmail;
                    _cmd.Connection = pCon;

                    using (SqlDataReader _rdr = _cmd.ExecuteReader())
                        _emp = ReadToEntity.Map <Employee>(_rdr, new Employee());
                }
                return(_emp);
            }
            catch (Exception ex) { throw ex; }
        }
Esempio n. 6
0
        /// <summary>
        /// Get employee
        /// </summary>
        /// <param name="pPosition"></param>
        /// <param name="pDepartment"></param>
        /// <param name="pBusinessUnit"></param>
        /// <param name="pCon"></param>
        /// <returns></returns>
        public IList <Employee> Get(string pDepartment, string pBusinessUnit, SqlConnection pCon)
        {
            try
            {
                var _employee = new List <Employee>();
                using (var _cmd = new SqlCommand("usp_GetEmployeeDesinate"))
                {
                    _cmd.CommandType = CommandType.StoredProcedure;
                    _cmd.Parameters.Add("@pDepartment", SqlDbType.NVarChar, 100).Value   = pDepartment;
                    _cmd.Parameters.Add("@pBusinessUnit", SqlDbType.NVarChar, 100).Value = pBusinessUnit;
                    _cmd.Connection = pCon;

                    using (SqlDataReader _rdr = _cmd.ExecuteReader())
                    {
                        _employee = ReadToEntity.Map <Employee>(_rdr);
                    }
                }
                return(_employee);
            }
            catch (Exception ex) { throw ex; }
        }
Esempio n. 7
0
        /// <summary>
        /// Get list of the MR assets items
        /// </summary>
        /// <param name="pCon"></param>
        /// <param name="pAssetItemId"></param>
        /// <returns></returns>
        public IList <MR> Get(SqlConnection pCon, long pAssetItemId)
        {
            try
            {
                var _mr = new List <MR>();
                using (var _cmd = new SqlCommand("usp_GetMRAssetsItems"))
                {
                    _cmd.CommandType = CommandType.StoredProcedure;
                    _cmd.Parameters.Add("@pAssetItemId", SqlDbType.BigInt).Value = pAssetItemId;
                    _cmd.Connection = pCon;

                    using (SqlDataReader _rdr = _cmd.ExecuteReader())
                    {
                        try
                        {
                            _mr = ReadToEntity.Map <MR>(_rdr);
                        }
                        catch (Exception ex) { throw ex; }
                    }
                }
                return(_mr);
            }
            catch (Exception ex) { throw ex; }
        }