Exemple #1
0
    public int SaveChanges(bool IsNewRecord)
    {
        KeywordsDataContext dataContext = new KeywordsDataContext();

        Keywords ObjTable;

        if (IsNewRecord)
        {
            ObjTable = new Keywords();
            dataContext.Keywords.InsertOnSubmit(ObjTable);
        }
        else
        {
            ObjTable = dataContext.Keywords.Single(p => p.Code.Equals(this.Code));
        }
        try
        {
            #region Save changes after checking Access
            ObjTable.Code        = this.Code;
            ObjTable.Name        = Tools.PersianTextCorrection(this.Name);
            ObjTable.EngName     = this.EngName;
            ObjTable.Description = this.Description;

            #endregion

            dataContext.SubmitChanges();
        }
        catch (Exception exp)
        {
        }

        return(ObjTable.Code);
    }
Exemple #2
0
    public void RemoveKeywordByCode(int KeywordCode)
    {
        KeywordsDataContext dc = new KeywordsDataContext();
        var dtlEntityKeywords  = dc.EntityKeywords.Where(n => n.KeywordCode.Equals(KeywordCode));

        dc.EntityKeywords.DeleteAllOnSubmit(dtlEntityKeywords);
        dc.SubmitChanges();
    }
Exemple #3
0
    private int GetKeywordEntity(int _KeywordCode, int _EntityCode, int _HCEntityTypeCode)
    {
        dataContext = new KeywordsDataContext();
        var a = from p in dataContext.EntityKeywords
                where p.KeywordCode == _KeywordCode && p.EntityCode == _EntityCode && p.HCEntityTypeCode == _HCEntityTypeCode
                select p.Code;

        return(a.ToList().Count > 0 ? a.ToList()[0] : 0);
    }
Exemple #4
0
    public int?GetKeywordCode(string Word)
    {
        KeywordsDataContext   dc     = new KeywordsDataContext();
        IQueryable <Keywords> Result = from p in dc.Keywords
                                       where p.Name.Equals(Word)
                                       select p;

        foreach (var item in Result)
        {
            return(item.Code);
        }
        return(null);
    }
Exemple #5
0
    public static bool IsInTitleKeywords(string str)
    {
        KeywordsDataContext dataContext = new KeywordsDataContext();
        var ResultList = from k in dataContext.vTitleKeywords
                         where k.Title.Equals(str)
                         select k;

        if (ResultList.Count() == 0)
        {
            return(false);
        }
        else
        {
            return(true);
        }
    }
 public BaseBOLGarbageWords()
 {
     dataContext = new KeywordsDataContext();
 }
 public BaseBOLSpecialKeywords()
 {
     dataContext = new KeywordsDataContext();
 }
 public BaseBOLEntityKeywords()
 {
     dataContext = new KeywordsDataContext();
 }
Exemple #9
0
 public BaseBOLNewsKeywords(params int[] MCodes)
 {
     MasterCode  = Convert.ToInt32(MCodes[0]);
     dataContext = new KeywordsDataContext();
 }