コード例 #1
0
 private void ConstructObject(IDataReader dr_, enContent enContent_)
 {
     enContent_.ID          = Convert.ToInt32(dr_["ID"]);
     enContent_.Type        = Convert.ToInt32(dr_["Type"]);
     enContent_.Description = dr_["Description"].ToString();
     enContent_.InsertedOn  = Convert.ToDateTime(dr_["InsertedOn"]);
     enContent_.ModifiedOn  = DBNull.Value == dr_["ModifiedOn"] ? (DateTime?)null : Convert.ToDateTime(dr_["ModifiedOn"]);
 }
コード例 #2
0
        public List <enContent> ReadAll()
        {
            var listOfContents = new List <enContent>();

            using (IDataReader idr = base.Read(null, null))
            {
                while (idr.Read())
                {
                    var objENContent = new enContent();
                    ConstructObject(idr, objENContent);
                    listOfContents.Add(objENContent);
                    _enContent.IsGetSuccess = true;
                }
            }
            return(listOfContents);
        }
コード例 #3
0
        public JsonResult GetDescription(int typeID)
        {
            var objENContent = new enContent()
            {
                Type = typeID
            };
            var objBLContent = new blContent(objENContent);

            try
            {
                objBLContent.Read();
            }
            catch (Exception ex)
            {
            }
            return(Json(objENContent, JsonRequestBehavior.AllowGet));
        }
コード例 #4
0
        public ActionResult Create(enContent enContent_)
        {
            var objENContent = new enContent()
            {
                Type = enContent_.Type
            };
            var objBLContent = new blContent(objENContent);

            try
            {
                objBLContent.Read();
            }
            catch (Exception ex)
            {
            }

            if (objENContent.ID > 0)
            {
                objBLContent          = new blContent(enContent_);
                enContent_.ID         = objENContent.ID;
                enContent_.InsertedOn = objENContent.InsertedOn;
                try
                {
                    objBLContent.Update();
                }
                catch (Exception ex)
                {
                }
            }

            else
            {
                objBLContent = new blContent(enContent_);
                try
                {
                    objBLContent.Create();
                }
                catch (Exception ex)
                {
                }
            }

            ViewBag.typeID = enContent_.Type;
            return(View());
        }
コード例 #5
0
 public blContent(enContent enContent_)
 {
     this._enContent = enContent_;
 }
コード例 #6
0
 public dlContent(enContent enContent_)
     : base("Content")
 {
     this._enContent = enContent_;
 }
コード例 #7
0
        public ActionResult TermsAndConditions()
        {
            var objENContent = new enContent()
            {
                Type = (int)ContentType.TermAndCondition
            };
            var objBLContent = new blContent(objENContent);

            try
            {
                objBLContent.Read();
            }
            catch (Exception ex)
            {
                Log.Error("Hangout.UI.Content.TermsAndConditions() Error while Read() Content");
            }

            //Advertisement Panel
            var objENAdvertisement = new enAdvertisement()
            {
                Content_ID = (int)ContentType.TermAndCondition
            };
            var objBLAdvertisement = new blAdvertisement(objENAdvertisement);
            List <enAdvertisement> listOfAdvertisements = new List <enAdvertisement>();

            try
            {
                listOfAdvertisements = objBLAdvertisement.ReadAll();
            }
            catch (Exception ex)
            {
                Log.Error("Hangout.UI.Content.About() Error while Read() Advertisement  Exception:- " + ex.ToString());
            }

            List <enAdvertisement> leftAdvPanel  = new List <enAdvertisement>();
            List <enAdvertisement> rightAdvPanel = new List <enAdvertisement>();

            foreach (var item in listOfAdvertisements.FindAll(x => x.Position == (int)PagePosition.LEFT))
            {
                if (item.Date_To <= DateTime.Now && item.Date_From >= DateTime.Now)
                {
                    if (item.Time_To <= DateTime.Now.TimeOfDay && item.Time_From >= DateTime.Now.TimeOfDay)
                    {
                        leftAdvPanel.Add(item);
                    }
                }
            }

            foreach (var item in listOfAdvertisements.FindAll(x => x.Position == (int)PagePosition.RIGHT))
            {
                if (item.Date_To <= DateTime.Now && item.Date_From >= DateTime.Now)
                {
                    if (item.Time_To <= DateTime.Now.TimeOfDay && item.Time_From >= DateTime.Now.TimeOfDay)
                    {
                        rightAdvPanel.Add(item);
                    }
                }
            }

            if (leftAdvPanel.Count > 0)
            {
                ViewBag.LeftAdvPanel = leftAdvPanel.FirstOrDefault();
            }
            if (rightAdvPanel.Count > 0)
            {
                ViewBag.RightAdvPanel = rightAdvPanel.FirstOrDefault();
            }
            return(View(objENContent));
        }