public ICollection<FanPagePost> GetAllFanPagePost(FanPagePost objFPPost)
 {
     ICollection<FanPagePost> iCol = null;
     try
     {
         using (NHibernate.ISession session = SessionFactory.GetNewSession())
         {
             iCol = session.CreateCriteria(typeof(FanPagePost)).List<FanPagePost>();
         }
     }
     catch (Exception ex)
     {
         GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
     }
     return iCol;
 }
        public List<FanPagePost> GetFanPagePostUsingLevelStatusMainPageUrl(FanPagePost objFPPost)
        {
            List<FanPagePost> lstFanPagePost = new List<FanPagePost>();
            try
            {
                using (NHibernate.ISession session = SessionFactory.GetNewSession())
                {

                    // NHibernate.ISQLQuery nHquery = session.CreateSQLQuery("Select FilePath from setting where Module ='" + setting.Module + "'");// and FileType='" + setting.FileType + "'

                    NHibernate.IQuery nIquery = session.CreateQuery("from FanPagePost fpPost where fpPost.Level = :level and fpPost.Status = :status and fpPost.MainPageUrl = :mainPageUrl")
                        .SetParameter("level", objFPPost.Level)
                        .SetParameter("status", objFPPost.Status)
                        .SetParameter("mainPageUrl", objFPPost.MainPageUrl);



                    foreach (FanPagePost item in nIquery.Enumerable<FanPagePost>())
                    {
                        try
                        {
                            lstFanPagePost.Add(item);
                        }
                        catch (Exception ex)
                        {
                            GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                        }
                    }

                }
            }
            catch (Exception ex)
            {
                GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
            }
            return lstFanPagePost;
        }
Beispiel #3
0
        private void PageManagerQuery(DataSet ds, params string[] paramValue)
        {
            try
            {
                if (paramValue.Length > 1)
                {
                    if (paramValue[0] == "Model : FanPageStatusRepository")
                    {
                        try
                        {
                            FanPageStatus objFanPageStatus = new FanPageStatus();

                            if (paramValue[1] == "Function : DeleteUsingMainPageUrl")
                            {
                                objFanPageStatus.MainPageUrl = paramValue[2];

                                objFanPageStatusRepository.DeleteUsingMainPageUrl(objFanPageStatus);
                            }
                        }
                        catch (Exception ex)
                        {
                            GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                        }
                    }
                    if (paramValue[0] == "Model : FanPagePostRepository")
                    {
                        try
                        {
                            FanPagePost objFanPagePost = new FanPagePost();

                            if (paramValue[1] == "Function : Insert")
                            {
                                try
                                {
                                    objFanPagePost.FriendId = paramValue[2];
                                    objFanPagePost.Status = "0";
                                    objFanPagePost.Level = "0";
                                    objFanPagePost.Date = System.DateTime.Now.ToString();
                                    objFanPagePost.MainPageUrl = paramValue[6];

                                    objFanPagePostRepository.Insert(objFanPagePost);
                                }
                                catch (Exception ex)
                                {
                                    GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                                }
                            }
                            if (paramValue[1] == "Function : InsertChasngeLevel")
                            {
                                try
                                {
                                    objFanPagePost.FriendId = paramValue[2];
                                    objFanPagePost.Status = "0";
                                    objFanPagePost.Level = "1";
                                    objFanPagePost.Date = System.DateTime.Now.ToString();
                                    objFanPagePost.MainPageUrl = paramValue[6];

                                    objFanPagePostRepository.InsertChasngeLevel(objFanPagePost);
                                }
                                catch (Exception ex)
                                {
                                    GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                                }
                            }

                            if (paramValue[1] == "Function : UpdateStatusUsingFriendId")
                            {
                                try
                                {
                                    objFanPagePost.FriendId = paramValue[2];
                                    objFanPagePost.Status = "1";


                                    objFanPagePostRepository.UpdateStatusUsingFriendId(objFanPagePost);
                                }
                                catch (Exception ex)
                                {
                                    GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                                }
                            }

                            if (paramValue[1] == "Function : GetFanPagePostUsingLevelStatusMainPageUrl")
                            {

                                try
                                {
                                    objFanPagePost.MainPageUrl = paramValue[2];
                                    objFanPagePost.Status = "0";
                                    objFanPagePost.Level = "0";

                                    List<FanPagePost> lstFPPost = objFanPagePostRepository.GetFanPagePostUsingLevelStatusMainPageUrl(objFanPagePost);

                                    if (lstFPPost.Count > 0)
                                    {
                                        DataTable dt = new DataTable();
                                        dt.Columns.Add("FriendId", typeof(string));

                                        foreach (FanPagePost item in lstFPPost)
                                        {
                                            try
                                            {
                                                dt.Rows.Add(item.FriendId.ToString());
                                            }
                                            catch (Exception ex)
                                            {
                                                GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                                            }
                                        }

                                        ds.Tables.Add(dt);
                                    }
                                }
                                catch (Exception ex)
                                {
                                    GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                                }

                            }

                            if (paramValue[1] == "Function : GetFanPagePostFriendIdMainPageUrlUsingLevelStatusMainPageUrl")
                            {

                                try
                                {
                                    objFanPagePost.MainPageUrl = paramValue[2];
                                    objFanPagePost.Status = "0";
                                    objFanPagePost.Level = "1";

                                    List<FanPagePost> lstFPPost = objFanPagePostRepository.GetFanPagePostUsingLevelStatusMainPageUrl(objFanPagePost);

                                    if (lstFPPost.Count > 0)
                                    {
                                        DataTable dt = new DataTable();
                                        dt.Columns.Add("FriendId", typeof(string));
                                        dt.Columns.Add("MainPageUrl", typeof(string));

                                        foreach (FanPagePost item in lstFPPost)
                                        {
                                            try
                                            {
                                                dt.Rows.Add(item.FriendId.ToString(), item.MainPageUrl);
                                            }
                                            catch (Exception ex)
                                            {
                                                GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                                            }
                                        }

                                        ds.Tables.Add(dt);
                                    }
                                }
                                catch (Exception ex)
                                {
                                    GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                        }
                    }

                    if (paramValue[0] == "Model : EmailRepository")
                    {
                        Email objemail = new Email();
                        try
                        {
                            if (paramValue[1] == "Function : InsertCreatedEmailinEmailDatatbase")
                            {
                                objemail.UserName = paramValue[2];
                                objemail.Password = paramValue[3];
                                objemail.IsUsed = "0";
                                objEmailRepository.Insert(objemail);
                            }
                        }
                        catch (Exception ex)
                        {
                            GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                        }
                    }

                    if (paramValue[0] == "Model : CaptchaSetting")
                    {
                        faceboardpro.Domain.Captcha objcaptcha = new faceboardpro.Domain.Captcha();
                        try
                        {
                            if (paramValue[1] == "Function : InsertCaptchaSettinginCaptchaDatatbase")
                            {
                                objcaptcha.Username = paramValue[2];
                                objcaptcha.Password = paramValue[3];
                                objcaptcha.CaptchaService = paramValue[4];
                                objcaptcha.Status = "True";
                                objCaptchaRepositry.Insert(objcaptcha);

                                objCaptchaRepositry.UpdateCaptchaStatusForOtherService(objcaptcha);
                            }
                            if (paramValue[1] == "Function : UpdateCaptchaSettinginCaptchaDatatbase")
                            {
                                objcaptcha.Username = paramValue[2];
                                objcaptcha.Password = paramValue[3];
                                objcaptcha.CaptchaService = paramValue[4];
                                objcaptcha.Status = "True";

                                objCaptchaRepositry.UpdateCaptchaStatusForOtherService(objcaptcha);
                                objCaptchaRepositry.UpdateCaptchaSetting(objcaptcha);
                            }

                        }
                        catch (Exception ex)
                        {
                            GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                        }
                    }


                    if (paramValue[0] == "Model : FanPageDataRepository")
                    {
                        try
                        {
                            FanPageData objFanPageData = new FanPageData();

                            if (paramValue[1] == "Function : Insert")
                            {
                                try
                                {
                                    objFanPageData.Id = (paramValue[2]);
                                }
                                catch (Exception ex)
                                {
                                    GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                                }
                                try
                                {
                                    objFanPageData.Name = paramValue[3];
                                }
                                catch (Exception ex)
                                {
                                    GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                                }
                                try
                                {
                                    objFanPageData.FirstName = paramValue[4];
                                }
                                catch (Exception ex)
                                {
                                    GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                                }
                                try
                                {
                                    objFanPageData.MiddleName = paramValue[5];
                                }
                                catch (Exception ex)
                                {
                                    GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                                }
                                try
                                {
                                    objFanPageData.LastName = paramValue[6];
                                }
                                catch (Exception ex)
                                {
                                    GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                                }
                                try
                                {
                                    objFanPageData.Link = paramValue[7];
                                }
                                catch (Exception ex)
                                {
                                    GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                                }
                                try
                                {
                                    objFanPageData.Gender = paramValue[8];
                                }
                                catch (Exception ex)
                                {
                                    GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                                }
                                try
                                {
                                    objFanPageData.Locale = paramValue[9];
                                }
                                catch (Exception ex)
                                {
                                    GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                                }
                                try
                                {
                                    objFanPageData.ProfileStatus = paramValue[10];
                                }
                                catch (Exception ex)
                                {
                                    GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                                }
                                try
                                {
                                    objFanPageData.Url = paramValue[11];
                                }
                                catch (Exception ex)
                                {
                                    GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                                }
                                try
                                {
                                    objFanPageData.ShowUser = paramValue[12];
                                }
                                catch (Exception ex)
                                {
                                    GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                                }

                                objFanPageDataRepository.Insert(objFanPageData);
                            }
                        }
                        catch (Exception ex)
                        {
                            GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
            }
        }
 public void Delete(FanPagePost objFPPost)
 {
     try
     {
         using (NHibernate.ISession session = SessionFactory.GetNewSession())
         {
             using (NHibernate.ITransaction transaction = session.BeginTransaction())
             {
                 // session.Delete(acc.UserName);
                 transaction.Commit();
             }
         }
     }
     catch (Exception ex)
     {
         GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
     }
 }
        public void UpdateStatusUsingFriendId(FanPagePost objFPPost)
        {
            try
            {
                lock (lockerUpdateStatusUsingFriendId)
                {
                    using (NHibernate.ISession session = SessionFactory.GetNewSession())
                    {
                        using (NHibernate.ITransaction transaction = session.BeginTransaction())
                        {

                            var query = session.CreateQuery("Update FanPagePost set Status = :status where FriendId= :FriendId");
                            query.SetParameter("status", objFPPost.Status);
                            query.SetParameter("FriendId", objFPPost.FriendId);

                            int res = query.ExecuteUpdate();
                            transaction.Commit();
                        }
                    } 
                }
            }
            catch (Exception ex)
            {
                GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
            }
        }
        public void InsertChasngeLevel(FanPagePost objFPPost)
        {
            try
            {
                lock (lockerInsertChasngeLevel)
                {
                    using (NHibernate.ISession session = SessionFactory.GetNewSession())
                    {
                        using (NHibernate.ITransaction transaction = session.BeginTransaction())
                        {
                            session.Save(objFPPost);

                            transaction.Commit();
                        }
                    } 
                }
            }
            catch (Exception ex)
            {
                GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
            }
        }