示例#1
0
 public static bool ExistRecord(string resourceId, ResourceType type)
 {
     try
     {
         ISelectDataSourceFace query = new SelectSQL(TableName.ResourceRecord);
         query.DataBaseAlias = Const.LogConnection;
         query.AddWhere("ResourceId", resourceId.Trim());
         query.AddWhere("ResourceType", (int)type);
         return(query.ExecuteCount() > 0);
     }
     catch (Exception ex)
     {
         Logger.Error(ex);
         return(true);
     }
 }
示例#2
0
 public static bool DailyFetched(ResourceType type)
 {
     try
     {
         ISelectDataSourceFace query = new SelectSQL(TableName.FetchRecord);
         query.DataBaseAlias = Const.LogConnection;
         query.AddWhere("ResourceType", (int)type);
         query.AddWhere("TimeStamp", Comparison.GreaterThan, DateTime.Now.Date);
         return(query.ExecuteCount() > 0);
     }
     catch (Exception ex)
     {
         Logger.Error(ex);
         return(true);
     }
 }
示例#3
0
        public static List <Recomment> GetToUploadList()
        {
            List <Recomment> list = new List <Recomment>();

            try
            {
                ISelectDataSourceFace query = new SelectSQL(TableName.Recomment);
                query.DataBaseAlias = Const.LogConnection;
                query.AddWhere("ImageStatus", ImageStatus.Local);
                DataSet ds = query.ExecuteDataSet();
                if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
                {
                    list.AddRange(from DataRow dr in ds.Tables[0].Rows
                                  select new Recomment()
                    {
                        BlogId    = SafeValueHelper.ToInt32(dr["BlogId"]),
                        Category  = (RecommentCategory)SafeValueHelper.ToInt32(dr["Category"]),
                        CoverName = SafeValueHelper.ToString(dr["CoverName"]),
                        Id        = SafeValueHelper.ToInt32(dr["Id"]),
                        Title     = SafeValueHelper.ToString(dr["Title"]),
                    });
                }
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
            }
            return(list);
        }
示例#4
0
        public static List <ImageUrl> GetToUploadList()
        {
            List <ImageUrl> list = new List <ImageUrl>();

            try
            {
                ISelectDataSourceFace query = new SelectSQL(TableName.ImageUrl);
                query.DataBaseAlias = Const.LogConnection;
                query.AddWhere("ImageStatus", ImageStatus.Local);
                DataSet ds = query.ExecuteDataSet();
                if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
                {
                    list.AddRange(from DataRow dr in ds.Tables[0].Rows
                                  select new ImageUrl()
                    {
                        BlogId = SafeValueHelper.ToInt32(dr["BlogId"]),
                        Url    = SafeValueHelper.ToString(dr["Url"]),
                        Id     = SafeValueHelper.ToInt32(dr["Id"])
                    });
                }
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
            }
            return(list);
        }
示例#5
0
 public static int ExistContinutedRecord(string resourceId, ResourceType type)
 {
     try
     {
         ISelectDataSourceFace query = new SelectSQL(TableName.ResourceRecord);
         query.DataBaseAlias = Const.LogConnection;
         query.SelectColumn("BlogId");
         query.AddWhere("ResourceId", resourceId.Trim());
         query.AddWhere("ResourceType", (int)type);
         query.AddWhere("Continued", true);
         return(SafeValueHelper.ToInt32(query.ExecuteScalar()));
     }
     catch (Exception ex)
     {
         Logger.Error(ex);
         return(0);
     }
 }
示例#6
0
 private static DataSet GetAccountDataSet()
 {
     try
     {
         ISelectDataSourceFace query = new SelectSQL("UploadAccount");
         query.DataBaseAlias = "LogConnection";
         query.AddWhere("Enabled", true);
         return(query.ExecuteDataSet());
     }
     catch (Exception ex)
     {
         Logger.Error(ex);
         return(null);
     }
 }
示例#7
0
 public static bool ExistLocalImage(Recomment image)
 {
     try
     {
         ISelectDataSourceFace query = new SelectSQL(TableName.Recomment);
         query.DataBaseAlias = Const.LogConnection;
         query.AddWhere("CoverName", image.CoverName);
         return(query.ExecuteCount() > 0);
     }
     catch (Exception ex)
     {
         Logger.Error(ex);
         return(false);
     }
 }
示例#8
0
 public static int GetFetchId(ResourceType type)
 {
     try
     {
         ISelectDataSourceFace query = new SelectSQL(TableName.FetchRecord);
         query.DataBaseAlias = Const.LogConnection;
         query.SelectColumn("Id");
         query.AddWhere("ResourceType", (int)type);
         query.AddOrderBy("Id", Sort.Descending);
         query.Top = 1;
         return(SafeValueHelper.ToInt32(query.ExecuteScalar()));
     }
     catch (Exception ex)
     {
         Logger.Error(ex);
         return(0);
     }
 }