Exemple #1
0
        public void DeleteFaq(Faq faq)
        {
            //Cancella la FAQ specificata
            ITransaction tx;

            tx = this.Session_Col.BeginTransaction();
            this.Session_Col.Delete(faq);
            tx.Commit();
        }
Exemple #2
0
        public void AddFaq(Faq Faq)
        {
            ITransaction tx;

            tx = this.Session_Col.BeginTransaction();
            this.Session_Col.Save(Faq);
            tx.Commit();
            //Aggiorna una Faq.
            //Verranno modificati sia i dati relativi alla FAQ
            //che l'associazione con le categorie
        }
Exemple #3
0
        /// <summary>
        /// Utilizzato sia per modificare Domanda/risposta
        /// che per aggiornare la lista di categorie associate.
        /// </summary>
        /// <param name="Faq"></param>
        /// <remarks>
        /// Verificare la struttura in relazione ad nHibernate, Id ed affini...
        /// </remarks>
        public Enum.ErrorCode UpdateFaq(Faq Faq)
        {
            Enum.ErrorCode ErrorCode = Enum.ErrorCode.none;
            if (Faq.onCategories.Count > 0)
            {
                FAQ_Dal.UpdateFaq(Faq);
            }
            else
            {
                ErrorCode = Enum.ErrorCode.NoCategory;
            }

            return(ErrorCode);
        }
Exemple #4
0
        public void DeleteFaq(Int64 FaqID)
        {
            //Cancella la FAQ specificata
            ITransaction tx;

            tx = this.Session_Col.BeginTransaction();
            Faq faq = (from Faq fq
                       in this.Session_Col.Linq <Faq>()
                       where fq.Id == FaqID
                       select fq).First();

            this.Session_Col.Delete(faq);
            tx.Commit();
        }
Exemple #5
0
        public EditFaqModel GetNewFaqModel(Int32 CommunityId)
        {
            EditFaqModel EFM    = new EditFaqModel();
            Faq          NewFaq = new Faq();

            NewFaq.Question     = "";
            NewFaq.Answer       = "";
            NewFaq.CommunityId  = CommunityId;
            NewFaq.onCategories = new List <Category>();
            EFM.Faq             = NewFaq;

            EFM.Category = FAQ_Dal.GetCategoriesList(CommunityId);
            //EFM.Faq = FAQ_Dal.GetFaq(FaqId);
            //EFM.Category = FAQ_Dal.GetCategoriesList(CommunityId);
            return(EFM);
        }
Exemple #6
0
        public Faq CreateFaq(Int32 CommunityId, String Question, String Answer, IList <Int64> CategoriesId)
        {
            Faq newFaq = new Faq();

            newFaq.CommunityId = CommunityId;
            newFaq.Question    = Question;
            newFaq.Answer      = Answer;

            if (CategoriesId.Count > 0)
            {
                newFaq.onCategories = FAQ_Dal.GetCategoriesList(CategoriesId);
            }

            FAQ_Dal.AddFaq(newFaq);
            return(newFaq);
        }
Exemple #7
0
        public Enum.ErrorCode UpdateFaq(Int64 Id, String Question, String Answer)
        {
            Enum.ErrorCode ErrorCode = Enum.ErrorCode.none;

            if ((Question == null) || (Question == "") || (Answer == null) || (Answer == ""))
            {
                ErrorCode = Enum.ErrorCode.NoData;
            }
            else
            {
                Faq Faq = FAQ_Dal.GetFaq(Id);
                Faq.Question = Question;
                Faq.Answer   = Answer;
                FAQ_Dal.UpdateFaq(Faq);
            }

            return(ErrorCode);
        }
Exemple #8
0
        public Enum.ErrorCode UpdateFaq(Int64 Id, String Question, String Answer, IList <Int64> CategoriesId)
        {
            Enum.ErrorCode ErrorCode = Enum.ErrorCode.none;

            if ((Question == null) || (Question == "") || (Answer == null) || (Answer == ""))
            {
                ErrorCode = Enum.ErrorCode.NoData;
            }
            else if (CategoriesId.Count < 1)
            {
                ErrorCode = Enum.ErrorCode.NoCategory;
            }
            else
            {
                Faq Faq = FAQ_Dal.GetFaq(Id);
                Faq.Question     = Question;
                Faq.Answer       = Answer;
                Faq.onCategories = FAQ_Dal.GetCategoriesList(CategoriesId);
                FAQ_Dal.UpdateFaq(Faq);
            }

            return(ErrorCode);
        }
Exemple #9
0
 public void DeleteFaq(Faq faq)
 {
     FAQ_Dal.DeleteFaq(faq);
 }
Exemple #10
0
 public Link(Faq Faq, Category Category)
 {
     this.Id = new IdLink(Faq, Category);
 }
Exemple #11
0
 public IdLink(Faq Faq, Category Category)
 {
     this.Faq      = Faq;
     this.Category = Category;
 }