public IEnumerable <MasterNewsType> GetNewsType()
 {
     try
     {
         return(SqlData.dataContext.Query <MasterNewsType>("GetAllNewsType", null, commandType: CommandType.StoredProcedure));
     }
     catch (Exception ex)
     {
         CLoggerDataAccess.WriteLog(ProjectSource.DataAccessLayer, ELogLevel.ERROR, "ERROR ocurred in  Masters Operation  while calling GetNewsType Action, Ex.: " + ex.Message);
     }
     return(null);
 }
示例#2
0
 public bool ExpireToken(string Token)
 {
     try
     {
         DynamicParameters objParameters = new DynamicParameters();
         objParameters.Add("@p_Token", Token);
         objParameters.Add("@p_Username", "");
         return(SqlData.dataContext.Execute("TokenBucket_Save_Expire", objParameters, commandType: CommandType.StoredProcedure) > 0);
     }
     catch (Exception ex)
     {
         CLoggerDataAccess.WriteLog(ProjectSource.DataAccessLayer, ELogLevel.ERROR, "ERROR ocurred in Token Operation  while calling ExpireToken Action, Ex.: " + ex.Message);
     }
     return(false);
 }
示例#3
0
 public UserInfo GetUserInfo(UserInfo objParm)
 {
     try
     {
         DynamicParameters objParameter = new DynamicParameters();
         objParameter.Add("p_UserID", objParm.UserID);
         objParameter.Add("p_Username", objParm.Username);
         return(SqlData.dataContext.QueryFirst <UserInfo>("GetUserInfo", objParameter, commandType: CommandType.StoredProcedure));
     }
     catch (Exception ex)
     {
         CLoggerDataAccess.WriteLog(ProjectSource.DataAccessLayer, ELogLevel.ERROR, "ERROR ocurred in User Data Access while calling GetUserInfo Action, Ex.: " + ex.Message);
     }
     return(null);
 }
示例#4
0
        public DBResponse UpdateUserPassword(UserInfo objUserInfo)
        {
            DynamicParameters objParameter = new DynamicParameters();

            try
            {
                objParameter.Add("@p_Username", objUserInfo.Username);
                objParameter.Add("@p_Password", objUserInfo.Password);
                return(SqlData.dataContext.QueryFirst <DBResponse>("USERENTITY_SAVE_CAHNGEPASSWORD", objParameter, commandType: CommandType.StoredProcedure));
            }
            catch (Exception ex)
            {
                CLoggerDataAccess.WriteLog(ProjectSource.DataAccessLayer, ELogLevel.ERROR, "ERROR ocurred in  User Operation  while calling UpdateUserPassword Action, Ex.: " + ex.Message);
            }
            return(null);
        }
示例#5
0
        public TokenBucket GetToken(string Token)
        {
            DynamicParameters objParameters = new DynamicParameters();

            try
            {
                objParameters.Add("@p_Token", Token);
                objParameters.Add("@p_UserName", "");
                return(SqlData.dataContext.QueryFirst <TokenBucket>("TOKENBUCKET_READ", objParameters, commandType: CommandType.StoredProcedure));
            }
            catch (Exception ex)
            {
                CLoggerDataAccess.WriteLog(ProjectSource.DataAccessLayer, ELogLevel.ERROR, "ERROR ocurred in Token Operation  while calling GetToken Action, Ex.: " + ex.Message);
            }
            return(null);
        }
示例#6
0
        public IEnumerable <NewsHeadline> SearchNews(int PageNo, string Keyword)
        {
            try
            {
                DynamicParameters objParameter = new DynamicParameters();
                objParameter.Add("p_Keyword", Keyword);
                objParameter.Add("p_PageNo", PageNo);

                return(SqlData.dataContext.Query <NewsHeadline>("SearchNews", objParameter, commandType: CommandType.StoredProcedure));
            }
            catch (Exception ex)
            {
                CLoggerDataAccess.WriteLog(ProjectSource.DataAccessLayer, ELogLevel.ERROR, "ERROR ocurred in News Data Access  while calling SearchNews Action, Ex.: " + ex.Message);
            }
            return(null);
        }
示例#7
0
 public IEnumerable <NewsHeadline> GetNewsHeadlines(NewsParam objNewsParam)
 {
     try
     {
         DynamicParameters objParameter = new DynamicParameters();
         objParameter.Add("p_NewsTypeID", objNewsParam.NewsTypeID);
         objParameter.Add("p_SectionID", objNewsParam.SectionID);
         objParameter.Add("p_OnlyVideo", objNewsParam.OnlyVideo);
         objParameter.Add("p_PageNo", objNewsParam.PageNo);
         return(SqlData.dataContext.Query <NewsHeadline>("GetNewsHeadlines", objParameter, commandType: CommandType.StoredProcedure));
     }
     catch (Exception ex)
     {
         CLoggerDataAccess.WriteLog(ProjectSource.DataAccessLayer, ELogLevel.ERROR, "ERROR ocurred in News Data Access  while calling GetNewsHeadlines Action, Ex.: " + ex.Message);
     }
     return(null);
 }
        public DBResponse SaveContact(ContactEntity objComment)
        {
            DynamicParameters objParameter = new DynamicParameters();

            try
            {
                objParameter.Add("p_Name", objComment.Name);
                objParameter.Add("p_Email", objComment.Email);
                objParameter.Add("p_Message", objComment.Message);
                return(SqlData.dataContext.QueryFirstOrDefault <DBResponse>("SaveContact", objParameter, commandType: CommandType.StoredProcedure));
            }
            catch (Exception ex)
            {
                CLoggerDataAccess.WriteLog(ProjectSource.DataAccessLayer, ELogLevel.ERROR, "ERROR ocurred in  Comment Data Access  while calling SaveComment Action, Ex.: " + ex.Message);
            }
            return(new DBResponse());
        }
示例#9
0
        public bool GenerateToken(TokenBucket obj)
        {
            DynamicParameters objParameters = new DynamicParameters();

            try
            {
                objParameters.Add("@P_Token", obj.Token);
                objParameters.Add("@P_Username", obj.Username);
                objParameters.Add("@P_ValidFrom", obj.ValidFrom);
                objParameters.Add("@P_ValidTo", obj.ValidTo);
                return(SqlData.dataContext.Execute("TokenBucket_Save_Generate", objParameters, commandType: CommandType.StoredProcedure) > 0);
            }
            catch (Exception ex)
            {
                CLoggerDataAccess.WriteLog(ProjectSource.DataAccessLayer, ELogLevel.ERROR, "ERROR ocurred in Token Operation  while calling GenerateToken Action, Ex.: " + ex.Message);
            }
            return(false);
        }
        public MasterTemplate GetTemplate(string TemplateCode)
        {
            MasterTemplate    objMasterTemplate = new MasterTemplate();
            DynamicParameters objParameter      = new DynamicParameters();

            try
            {
                objParameter.Add("@p_ID", 0);
                objParameter.Add("@p_ACCESSIBLE", "");
                objParameter.Add("@P_TemplateCode", TemplateCode);
                objMasterTemplate = SqlData.dataContext.QueryFirst <MasterTemplate>("MailTemplates_Read", objParameter, commandType: CommandType.StoredProcedure);
            }
            catch (Exception ex)
            {
                CLoggerDataAccess.WriteLog(ProjectSource.DataAccessLayer, ELogLevel.ERROR, "ERROR ocurred in  MailTemplate Operation  while calling GetMailTemplate Action, Ex.: " + ex.Message);
            }
            return(objMasterTemplate);
        }
示例#11
0
        public NewsHeader GetNewsDetail(long NewsID, string Group = "Full")
        {
            try
            {
                DynamicParameters objParameter = new DynamicParameters();
                objParameter.Add("p_NewsID", NewsID);
                objParameter.Add("p_Group", Group);
                var        result = SqlData.dataContext.QueryMultiple("GetNewsDetails", objParameter, commandType: CommandType.StoredProcedure);
                NewsHeader obj    = result.ReadSingle <NewsHeader>();

                if (obj.NewsID > 0)
                {
                    obj.objNewsContent = result.ReadFirstOrDefault <NewsContent>();
                }

                if (obj.NewsID > 0)
                {
                    obj.objNewsImage = result.ReadFirstOrDefault <NewsImage>();
                }

                if (obj.NewsID > 0)
                {
                    obj.objNewsVideo = result.ReadFirstOrDefault <NewsVideo>();
                }

                //  if (obj.NewsID > 0 && Group == "Full")
                //    obj.objUserInfo = result.ReadFirstOrDefault<UserInfo>();

                return(obj);
            }
            catch (Exception ex)
            {
                throw ex;
                CLoggerDataAccess.WriteLog(ProjectSource.DataAccessLayer, ELogLevel.ERROR, "ERROR ocurred in News Data Access while calling GetNewsDetail Action, Ex.: " + ex.Message);
            }
            return(null);
        }