예제 #1
0
        public ActionResult _UpdateAdvertisement(Advertisement ins)
        {
            //...ViewData...
            ins.ClientId = Convert.ToInt32(HttpContext.Session["ClientId"]);

            Advertisement ins2 = AdvertisementRep.UpdateAdvertisement(ins);

            //...Notify...
            string regIds = AppRep.GetAllRegIds(ins.ClientId);
            if (!regIds.Equals(""))
            {
                comrep.NewUpdateData(regIds, "CMD_EDITAD", ins2.AdvertisementId.ToString());
            }

            //...Repopulate Grid...
            List<Advertisement> lst = new List<Advertisement>();
            lst = AdvertisementRep.GetListAdvertisement(Convert.ToInt32(HttpContext.Session["ClientId"]));
            return View(new GridModel(lst));
        }
예제 #2
0
        public ActionResult _InsertAdvertisement(Advertisement ins)
        {
            //...Fix...
            ins.ClientId = Convert.ToInt32(HttpContext.Session["ClientId"]);

            //...Insert into Database...
            Advertisement ins2 = AdvertisementRep.InsertAdvertisement(ins);

            //...Notify...
            string regIds = AppRep.GetAllRegIds(ins.ClientId);
            List<string> reg = AppRep.GetAllRegIdsList(ins.ClientId);
            if (!regIds.Equals(""))
            {
                comrep.NewsyncData(regIds, "CMD_NEWAD", reg, ins.ClientId);
            }

            //...Facebook...
            string access_token = FacebookPost.GetAccessToken(ins.ClientId);

            if (!access_token.Equals(""))
            {
                string page_id = FacebookPost.GetPageId(ins.ClientId);
                if (!page_id.Equals(""))
                {
                    FacebookPost.Post(access_token, page_id, "Promotion: " + ins.Body);
                }
            }

            //...Repopulate Grid...
            List<Advertisement> lst = new List<Advertisement>();
            lst = AdvertisementRep.GetListAdvertisement(Convert.ToInt32(HttpContext.Session["ClientId"]));
            return View(new GridModel(lst));
        }