コード例 #1
0
        public ActionResult AjaxStickTime()
        {
            string subjectNo = Request.Params["subjectNo"];

            if (string.IsNullOrEmpty(subjectNo))
            {
                return(Json(new { result = "-1", message = "信息获取错误" }));
            }
            SWfsChannelService   service = new SWfsChannelService();
            SWfsSubjectTopExpand top     = service.SelectSubjectTopBySubjectNo(subjectNo);

            try
            {
                if (top == null)
                {
                    top               = new SWfsSubjectTopExpand();
                    top.SubjectNo     = subjectNo;
                    top.TopCreateTime = DateTime.Now;
                    top.StExpand      = string.Empty;
                    service.InsertSubjectTop(top);
                }
                else
                {
                    top.TopCreateTime = DateTime.Now;
                    service.EditSubjectTop(top);
                }
            }
            catch
            {
                return(Json(new { result = "-1", message = "置顶错误" }));
            }
            return(Json(new { result = "1", message = "该活动已经置顶" }));
        }
コード例 #2
0
        /// <summary>
        /// 上新活动图列表
        /// </summary>
        /// <param name="picName"></param>
        /// <param name="picPosition"></param>
        /// <param name="status"></param>
        /// <param name="startTime"></param>
        /// <param name="endTime"></param>
        /// <param name="channelno"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        public ActionResult NewActivityList(string picName = "", string status = "", string startTime = "", string endTime = "", int pageIndex = 1, int pageSize = 20)
        {
            SWfsChannelService service = new SWfsChannelService();
            int total = 0;

            status = status == "-1" ? "" : status;
            string picPosition = "";
            string endTimeTemp = "";

            if (!string.IsNullOrEmpty(endTime))
            {
                endTimeTemp = DateTime.Parse(endTime).AddDays(1).AddSeconds(-1).ToString("yyyy-MM-dd HH:mm:ss");
            }
            IList <SWfsNewAlterPicInfo> list = service.GetNewAlterPictureList(picName.Trim(), picPosition, status, startTime, endTimeTemp, pageIndex, pageSize, out total);

            if (list != null && list.Count() > 0)
            {
                ViewBag.List = list;
            }
            else
            {
                ViewBag.List = new List <SWfsNewAlterPicInfo>();
            }
            ViewBag.PicName    = picName ?? "";
            ViewBag.Status     = status ?? "";
            ViewBag.StartTime  = startTime ?? "";
            ViewBag.EndTime    = endTime ?? "";
            ViewBag.TotalCount = total;
            ViewBag.PageIndex  = pageIndex;
            ViewBag.PageSize   = pageSize;

            return(View());
        }
コード例 #3
0
        public ActionResult SubjectList(string type, string channel, string spreadStatus = "-1", string promotionType = "0", string status = "-1", string belongsSubjectType = "0", string key = "", string startTime = "", string endTime = "", int pageIndex = 1)
        {
            SWfsChannelService service = new SWfsChannelService();
            int pageSize             = int.Parse(AppSettingManager.AppSettings["ComonListPageNum"].ToString());
            int count                = 0;
            IList <SubjectInfo> list = service.GetSubjectList(type, channel, spreadStatus, promotionType, status, belongsSubjectType, key, startTime, endTime, pageIndex, pageSize, out count);

            ViewBag.SubjectList = list;
            ViewBag.TotalCount  = count;
            ViewBag.CurPage     = pageIndex;
            ViewBag.PageSize    = pageSize;
            ViewBag.Type        = type;
            ViewBag.ChannelNo   = channel;
            ViewBag.Channel     = service.GetChannelByChannelNo(channel);

            #region 增加显示推荐品牌信息--byliulei2014-1-10
            List <SubjectBrand> brandList     = null;
            List <string>       subjectNoList = null;
            if (list != null && list.Count > 0)
            {
                subjectNoList = list.Select(r => r.SubjectNo).ToList();
                brandList     = service.GetSubjectBrandList(subjectNoList);
            }
            ViewBag.SubjectBrand = brandList;
            #endregion
            //增加显示关联专题预热信息
            Dictionary <string, string> dicSPage = new Dictionary <string, string>();
            if (type.Equals("7"))
            {
                dicSPage = service.GetSubjectDicSPage(subjectNoList);
            }
            ViewBag.SubjectSPage = dicSPage;
            return(View());
        }
コード例 #4
0
        public ActionResult Spike(string productNoName = "", string subjectNo = "", string date = "", int pageIndex = 1, int pageSize = 5)
        {
            if (productNoName == "商品名称/商品编号")
            {
                productNoName = "";
            }
            if (subjectNo == "活动编号")
            {
                subjectNo = "";
            }
            DateTime now;

            try
            {
                now = Convert.ToDateTime(date);
            }
            catch (Exception)
            {
                now = DateTime.Now;
            }
            int totalCount             = 0;
            SWfsChannelService service = new SWfsChannelService();
            //Dictionary<DateTime, List<SpikeProductManage>> dic = service.GetSpikeProductList(productNoName, subjectNo, now, pageIndex, pageSize, out totalCount);
            //EP项目用
            Dictionary <DateTime, List <SpikeProductManage> > dic = service.SelectSpikeProductListByTimeAndName(productNoName, subjectNo, now, pageIndex, pageSize, out totalCount);

            ViewBag.pageIndex  = pageIndex;
            ViewBag.pageSize   = pageSize;
            ViewBag.totalCount = totalCount;

            ViewBag.productNoName = productNoName;
            ViewBag.date          = now;
            ViewBag.SubjectNo     = subjectNo;
            return(View(dic));
        }
コード例 #5
0
        public ActionResult AjaxDelete(string channelNo)
        {
            SWfsChannelService service = new SWfsChannelService();
            int i = service.DeleteChannel(channelNo);

            if (i >= 0)
            {
                #region 日志信息
                SWfsSubjectService      channelService = new SWfsSubjectService();
                SWfsSubjectOrChannelLog log            = new SWfsSubjectOrChannelLog();
                log.SubjectOrChannelNo = channelNo;
                log.TypeValue          = 1; //1频道
                log.DateOperator       = DateTime.Now;
                log.OperatorContent    = "删除频道";
                log.OperatorUserId     = PresentationHelper.GetPassport().UserName;
                log.OperatorActionType = LogActionType.Delete.GetHashCode();
                channelService.InsertSubjectOrChannelLog(log);
                #endregion

                return(Json(new { result = "1", message = "删除成功!" }));
            }
            else
            {
                return(Json(new { result = "0", message = "删除失败!" }));
            }
        }
コード例 #6
0
        public ActionResult AjaxUpdateStatus(string channelNo, string status)
        {
            SWfsChannelService service = new SWfsChannelService();
            SWfsChannel        channel = service.GetChannelInfo(channelNo);

            channel.Status = Convert.ToInt16(status == "1" ? "0" : "1");
            try
            {
                service.UpdateStatus(channel);

                #region 日志信息
                SWfsSubjectService      channelService = new SWfsSubjectService();
                SWfsSubjectOrChannelLog log            = new SWfsSubjectOrChannelLog();
                log.SubjectOrChannelNo = channelNo;
                log.TypeValue          = 1; //1频道
                log.DateOperator       = DateTime.Now;
                log.OperatorContent    = (status.Equals("1") ? "关闭频道" : "开启频道");
                log.OperatorUserId     = PresentationHelper.GetPassport().UserName;
                log.OperatorActionType = LogActionType.Edit.GetHashCode();
                channelService.InsertSubjectOrChannelLog(log);
                #endregion

                string str = status == "0" ? "开启成功!" : "关闭成功!";
                return(Json(new { result = "1", message = str }));
            }
            catch (Exception ex)
            {
                return(Json(new { result = "0", message = ex.Message }));
            }
        }
コード例 #7
0
        public ActionResult CreateChannel()
        {
            SWfsChannelService service     = new SWfsChannelService();
            string             channelName = Request.Params["ChannelName"];
            SWfsChannel        channel     = service.GetChannelByName(channelName);

            if (channel != null)
            {
                return(Json(new { result = "0", message = "频道名称已存在!" }));
            }
            CommonService cs        = new CommonService();
            string        channelNo = DateTime.Now.ToString("yyyyMMdd");
            string        channelId = cs.GetNextCounterId("ChannelNo").ToString("000");

            channelNo += channelId.Substring(channelId.Length - 3, 3);
            string sordNos = Request.Params["SordNo"];
            short  status  = Convert.ToInt16(Request.Params["Status"]);

            if (!string.IsNullOrEmpty(sordNos))
            {
                SWfsChannelSordRef sordRef    = new SWfsChannelSordRef();
                string[]           sordNoList = sordNos.Split(',');
                foreach (string sordNo in sordNoList)
                {
                    sordRef.SordNo    = sordNo;
                    sordRef.ChannelNo = channelNo;
                    try
                    {
                        service.InsertChannelSordRef(sordRef);
                    }
                    catch (Exception ex)
                    {
                        return(Json(new { result = "0", message = ex.Message }));
                    }
                }
            }
            channel               = new SWfsChannel();
            channel.ChannelNo     = channelNo;
            channel.ChannelName   = channelName;
            channel.Status        = status;
            channel.SiteNo        = 2;
            channel.CreateUserId  = PresentationHelper.GetPassport().UserName;
            channel.DateCreate    = DateTime.Now;
            channel.SortNo        = 0;
            channel.DeleteFlag    = 0;
            channel.Description   = "";
            channel.HtmlContent   = "";
            channel.BackgroundPic = "";
            channel.HolidayMode   = 0;//是否开启假日模式(0:未开启,1:开启)
            try
            {
                service.InsertChannel(channel);
                return(Json(new { result = "1", message = "添加成功!" }, "text/plain", Encoding.UTF8));
            }
            catch (Exception ex)
            {
                return(Json(new { result = "0", message = ex.Message }, "text/plain", Encoding.UTF8));
            }
        }
コード例 #8
0
        public ActionResult EditChannel()
        {
            SWfsChannelService service     = new SWfsChannelService();
            CommonService      cs          = new CommonService();
            SWfsChannel        channel     = new SWfsChannel();
            string             channelName = Request.Params["ChannelName"];
            string             channelNo   = Request.Params["ChannelNo"];

            channel = service.GetChannelInfo(channelNo);
            if (service.GetChannelByName(channelName) != null && channelName != channel.ChannelName)
            {
                return(Json(new { result = "0", message = "频道名称已存在!" }));
            }
            string sordNos = Request.Params["SordNo"];
            short  status  = Convert.ToInt16(Request.Params["Status"]);

            if (!string.IsNullOrEmpty(sordNos))
            {
                int isDelete = service.DeleteChannelSordRef(channelNo);
                if (isDelete >= 0)
                {
                    SWfsChannelSordRef sordRef    = new SWfsChannelSordRef();
                    string[]           sordNoList = sordNos.Split(',');
                    foreach (string sordNo in sordNoList)
                    {
                        sordRef.SordNo    = sordNo;
                        sordRef.ChannelNo = channelNo;
                        try
                        {
                            service.InsertChannelSordRef(sordRef);
                        }
                        catch (Exception ex)
                        {
                            return(Json(new { result = "0", message = ex.Message }));
                        }
                    }
                }
            }
            channel.ChannelNo   = channelNo;
            channel.ChannelName = channelName;
            channel.Status      = status;
            try
            {
                bool flag = service.UpdateChannel(channel);
                if (flag)
                {
                    return(Json(new { result = "1", message = "修改成功!" }, "text/plain", Encoding.UTF8));
                }
                else
                {
                    return(Json(new { result = "0", message = "修改失败!" }, "text/plain", Encoding.UTF8));
                }
            }
            catch (Exception ex)
            {
                return(Json(new { result = "0", message = ex.Message }, "text/plain", Encoding.UTF8));
            }
        }
コード例 #9
0
        public ActionResult Create(string channelNO)
        {
            SWfsChannelService channelService = new SWfsChannelService();
            List <SWfsChannel> channellist    = channelService.GetChannelAllList();

            ViewBag.ChannelList = channellist;
            ViewBag.ChannelNo   = channelNO;
            return(View());
        }
コード例 #10
0
        public ActionResult Edit(string ID)
        {
            SWfsMobileAdService mobileAd       = new SWfsMobileAdService();
            SWfsMobileAd        model          = mobileAd.GetMobileAdInfo(Convert.ToInt32(ID));
            SWfsChannelService  channelService = new SWfsChannelService();
            List <SWfsChannel>  channellist    = channelService.GetChannelAllList();

            ViewBag.ChannelList = channellist;
            ViewBag.ShowType    = model.ShowType;
            return(View(model));
        }
コード例 #11
0
        public ActionResult UpdateChannelSubjectType()
        {
            SWfsChannelService service = new SWfsChannelService();
            int    currType            = Convert.ToInt32(Request.Params["CurrentType"]);
            string subjectNoFalse      = Request.Params["subjectNoFalse"];
            string subjectNoTrue       = Request.Params["subjectNoTrue"];
            string channelNo           = Request.Params["currChannel"];

            string[] subjectNoTrues = subjectNoTrue.TrimEnd(',').Split(',');//勾选的
            foreach (string item in subjectNoTrues)
            {
                if (!string.IsNullOrEmpty(item))
                {
                    IList <SWfsSubjectLableType> list = service.GetSubjectLableTypeList(currType, channelNo, item);
                    if (list == null || list.Count == 0)  //执行写入操作
                    {
                        SWfsSubjectLableType labletype = new SWfsSubjectLableType();
                        labletype.ChannelNo = channelNo;
                        labletype.SubjectNo = item;
                        labletype.Type      = currType;

                        try
                        {
                            service.InsertSubjectLabelType(labletype);
                        }
                        catch (Exception ex)
                        {
                            return(Json(new { result = "0", message = ex.Message }));
                        }
                    }
                }
            }
            string[] subjectNoFalses = subjectNoFalse.TrimEnd(',').Split(',');//没勾选的
            foreach (string item in subjectNoFalses)
            {
                if (!string.IsNullOrEmpty(item))
                {
                    IList <SWfsSubjectLableType> list = service.GetSubjectLableTypeList(currType, channelNo, item);
                    if (list != null && list.Count > 0)  //执行删除操作
                    {
                        try
                        {
                            service.DeleteSubjectLableType(currType, channelNo, item);
                            //return Json(new { result = "1", message = "保存成功" });
                        }
                        catch (Exception ex)
                        {
                            return(Json(new { result = "0", message = ex.Message }));
                        }
                    }
                }
            }
            return(Json(new { result = "1", message = "保存成功" }));
        }
コード例 #12
0
        /// <summary>
        /// 编辑活动图
        /// </summary>
        /// <returns></returns>
        public ActionResult NewActivityEdit()
        {
            SWfsChannelService service = new SWfsChannelService();
            int picid = Convert.ToInt32(Request.QueryString["id"]);
            SWfsNewAlterPicInfo model = service.GetNewAlterPicInfoById(picid);

            if (null == model)
            {
                model = new SWfsNewAlterPicInfo();
            }
            return(View(model));
        }
コード例 #13
0
        public ActionResult Edit(string channelNo)
        {
            SWfsChannelService         channel            = new SWfsChannelService();
            SWfsSubjectService         service            = new SWfsSubjectService();
            SWfsChannel                model              = channel.GetChannelInfo(channelNo);
            IList <SWfsChannelSordRef> channelSordRefList = channel.GetSordByChannelNo(channelNo);

            ViewBag.ChannelSordRefList = channelSordRefList;
            IList <SWfsChannelSord> channelSordList = service.GetChannelSordList(2);

            ViewBag.ChannelSordList = channelSordList;
            return(View(model));
        }
コード例 #14
0
        public ActionResult Index(int pageIndex = 1)
        {
            int pageSize = Convert.ToInt32(AppSettingManager.AppSettings["ComonListPageNum"]);
            SWfsChannelService service = new SWfsChannelService();
            int count = 0;
            IList <SWfsChannel> list = service.GetList(pageIndex, pageSize, out count);

            ViewBag.List          = list;
            ViewBag.Count         = count;
            ViewBag.CurrPageIndex = pageIndex;
            ViewBag.pageSize      = pageSize;
            return(View());
        }
コード例 #15
0
        public ActionResult SpikeProduct()
        {   //act=edit&Id=1
            string Id  = Request.QueryString["Id"];
            string act = Request.QueryString["act"];
            SWfsSubjectSpikeProductManage model = null;

            if (!string.IsNullOrEmpty(Id) && !string.IsNullOrEmpty(act) && act.Equals("edit"))
            {
                SWfsChannelService channelService = new SWfsChannelService();
                model = channelService.GetSWfsSubjectSpikeProductManage(Id);
            }
            return(View(model));
        }
コード例 #16
0
        public ActionResult AjaxChannelSort(string chennelNo, string sortNo)
        {
            SWfsChannelService service = new SWfsChannelService();
            bool flag = service.UpdateSort(chennelNo, Convert.ToInt32(sortNo));

            if (flag)
            {
                return(Json(new { result = 1, message = "保存成功!" }));
            }
            else
            {
                return(Json(new { result = 0, message = "保存失败!" }));
            }
        }
コード例 #17
0
        /// <summary>
        /// 上新品牌列表
        /// </summary>
        /// <returns></returns>
        public ActionResult NewBrandList()
        {
            SWfsChannelService       service = new SWfsChannelService();
            IList <SWfsNewBrandInfo> list    = service.GetAllNewBrandsList();

            if (list != null && list.Count() > 0)
            {
                ViewBag.List = list;
            }
            else
            {
                ViewBag.List = new List <SWfsNewBrandInfo>();
            }
            return(View());
        }
コード例 #18
0
        /// <summary>
        /// 置顶操作
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult SetTopOneSortNewBrand(string Id, string WeekDays)
        {
            try
            {
                SWfsChannelService service = new SWfsChannelService();
                service.SetTopOneSortNewBrand(Id, WeekDays);
                return(Json(new { result = "success", message = "操作成功" }));
            }
            catch (Exception e)
            {
                return(Json(new { result = "error", message = e.ToString() }));

                throw;
            }
        }
コード例 #19
0
        public ActionResult AjaxSaveHoliDay(string channelNO, string holidayMode)
        {
            SWfsChannelService service       = new SWfsChannelService();
            SWfsChannel        channel       = service.GetChannelByChannelNo(channelNO);
            string             isholidayMode = holidayMode == "checked" ? "1" : "0";

            channel.HolidayMode = Convert.ToInt16(isholidayMode);
            try
            {
                service.UpdateChannelHoliDay(channel);
            }
            catch (Exception ex)
            {
                return(Json(new { result = "0", message = "更改假日模式失败!" }));
            }
            return(Json(new { result = "1", message = "更改假日模式成功!" }));
        }
コード例 #20
0
        /// <summary>
        /// 更新活动状态以及删除操作
        /// </summary>
        /// <param name="id">活动图id</param>
        /// <param name="act"></param>
        /// <param name="value"></param>
        /// <returns></returns>
        public ActionResult Manage(string id, string act, int value = 1)
        {
            SWfsChannelService service = new SWfsChannelService();

            switch (act.ToLower())
            {
            case "show":    //活动状态更新:0关闭;1开启
                service.Update(id, value);
                return(Redirect("/shangpin/newshelf/NewActivityList"));

            case "del":
                service.Del(id);    //删除该活动图
                return(Redirect("/shangpin/newshelf/NewActivityList"));

            default:
                break;
            }
            return(View());
        }
コード例 #21
0
        public ActionResult DelNewBrand(string act, string id, string week)
        {
            SWfsChannelService service = new SWfsChannelService();

            switch (act.ToLower())
            {
            case "delall":    //删除该日期下的所有上新品牌
                service.DelAllBrandByWeek(id);
                return(Redirect("/shangpin/newshelf/NewBrandList"));

            case "delweek":    //删除该日期下某一上新品牌
                service.DelBrandById(id);
                return(Redirect("/shangpin/newshelf/NewBrandManage?weekOfDays=" + week + ""));

            default:
                break;
            }
            return(View());
        }
コード例 #22
0
        public JsonResult EditeListSortValue()
        {
            try
            {
                SWfsChannelService sercive = new SWfsChannelService();
                if (string.IsNullOrEmpty(Request.Form["idList"]))
                {
                    return(Json(new { status = 1, message = "品牌编号不存在" }, JsonRequestBehavior.AllowGet));
                }
                string[] idList   = Request.Form["idList"].TrimEnd(',').Split(',');
                string[] sortList = Request.Form["sortList"].TrimEnd(',').Split(',');
                int      sort     = 1;//标识多次置顶不点击保存按钮重复排序值
                for (int i = 0; i < idList.Length; i++)
                {
                    int temp = Convert.ToInt32(sortList[i]);

                    if (Convert.ToInt32(sortList[0]) <= 0) //若第一个值的排序<=0,则将其赋值为1;
                    {
                        temp = 1;
                    }
                    if (i != 0 && Convert.ToInt32(sortList[0]) <= 0)
                    {
                        if (Convert.ToInt32(sortList[i]) == Convert.ToInt32(sortList[0]))
                        {
                            temp = sort + 1;
                            sort++;
                        }
                        else
                        {
                            temp = Convert.ToInt32(sortList[i]) + sort;//若第一个值的排序<=0,则将其赋值为1;
                        }
                    }
                    sercive.EditeBrandSortValue(Convert.ToInt32(idList[i].ToString()), temp);
                }
                EnyimMemcachedClient.Instance.Remove(Request.Form["memcache_key"].ToString());
                return(Json(new { status = 0, message = "修改成功" }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                return(Json(new { status = 1, message = "修改失败" + ex.Message }, JsonRequestBehavior.AllowGet));
            }
        }
コード例 #23
0
        public ActionResult FeaturedEventAdd(string act, string fId = "", string channelNo = "", string channelName = "")
        {
            SWfsSubjectFeaturedEvents model = new SWfsSubjectFeaturedEvents();

            ViewBag.Act = act;
            SWfsChannelService service = new SWfsChannelService();

            //修改
            if (!string.IsNullOrEmpty(act) && !string.IsNullOrEmpty(fId.ToString()) && act == "edit")
            {
                model = service.GetFeatureEventInfo(Convert.ToInt32(fId));
            }
            //删除
            if (!string.IsNullOrEmpty(act) && !string.IsNullOrEmpty(fId.ToString()) && act.Equals("del"))
            {
                service.DeleteFeatureEventById(Convert.ToInt32(fId));
                return(Redirect("/outlet/channel/FeaturedEventsList?channel=" + channelNo + "&channelName=" + channelName));
            }
            return(View(model));
        }
コード例 #24
0
        public ActionResult FeaturedEventsList(string type = "4", string channel = "0", string channelName = "", string key = "", string startTime = "", string endTime = "", int pageIndex = 1)
        {
            SWfsChannelService service = new SWfsChannelService();
            int pageSize = int.Parse(AppSettingManager.AppSettings["ComonListPageNum"].ToString());
            int count    = 0;
            IList <ChannelFeaturedEventsInfo> list = service.GetChannelFeaturedEventsList(channel, key.Trim(), startTime.Trim(), endTime.Trim(), pageIndex, pageSize, out count);

            if (list != null && list.Count() > 0)
            {
                int id = list[0].ID;
                ViewBag.FeaturedList = list;
                ViewBag.TotalCount   = count;
                ViewBag.CurPage      = pageIndex;
                ViewBag.PageSize     = pageSize;
            }
            ViewBag.Type        = type;
            ViewBag.ChannelNo   = channel;
            ViewBag.ChannelName = channelName;
            ViewBag.Channel     = service.GetChannelByChannelNo(channel);

            return(View());
        }
コード例 #25
0
        public ActionResult NewBrandManage(string weekOfDays = "", string keyWord = "", string startTime = "", string endTime = "")
        {
            SWfsChannelService       service = new SWfsChannelService();
            IList <SWfsNewBrandInfo> list    = new List <SWfsNewBrandInfo>();
            string endTimeTemp = "";

            if (!string.IsNullOrEmpty(endTime))
            {
                endTimeTemp = DateTime.Parse(endTime).AddDays(1).AddSeconds(-1).ToString("yyyy-MM-dd HH:mm:ss");
            }
            //根据不同条件获取上新品牌信息
            IList <SWfsNewBrandInfo> brandList = service.GetNewBrandListByWeekDays(weekOfDays, keyWord.Trim(), startTime, endTimeTemp);

            if (brandList == null)
            {
                brandList = new List <SWfsNewBrandInfo>();
            }
            ViewBag.List      = brandList;
            ViewBag.Week      = weekOfDays;
            ViewBag.KeyWord   = keyWord;
            ViewBag.StartTime = startTime;
            ViewBag.EndTime   = endTime;
            return(View());
        }
コード例 #26
0
        public ActionResult NewActivityCreateManage()
        {
            SWfsChannelService service = new SWfsChannelService();

            #region 获取参数信息
            string   brandNo       = Request.Form["BrandNo"].Trim();                  //品牌编号
            string   picName       = Request.Params["PicName"].Trim();                //图片名称
            string   pcPicture     = "";                                              //主站图片
            string   pcUrl         = Request.Params["NewPicFileUrlPC"].Trim();        //主站图片链接地址
            string   mobilePicture = "";                                              //移动端图片
            string   mobileUrl     = Request.Params["NewPicFileUrlMobile"].Trim();    //移动端图片链接地址
            int      mobilePicType = Convert.ToInt32(Request.Params["PicType"]);      //移动端图片类型
            short    status        = Convert.ToInt16(Request.Params["Status"]);       //活动图状态
            DateTime startTime     = Convert.ToDateTime(Request.Params["DateBegin"]); //开始时间
            #endregion
            #region 验证图片
            //网站端图片
            if (null != Request.Files["NewPicFilePC"] && Request.Files["NewPicFilePC"].ContentLength > 0)
            {
                CommonService commonService       = new CommonService();
                Dictionary <string, string> rsPic = commonService.PostImg(Request.Files["NewPicFilePC"], "width:770,Height:320,Length:500");
                if (rsPic.Keys.Contains("error"))
                {
                    return(Json(new { result = "error", message = rsPic["error"] }));
                }
                if (rsPic.Keys.Contains("success"))
                {
                    pcPicture = rsPic["success"];
                }
            }
            //移动端图片
            if (null != Request.Files["NewPicFileMobile"] && Request.Files["NewPicFileMobile"].ContentLength > 0)
            {
                CommonService commonService = new CommonService();
                string        imgSize       = "width:0,Height:0,Length:0";
                if (mobilePicType == 1)
                {
                    imgSize = "width:393,Height:759,Length:0";//长图
                }
                else if (mobilePicType == 2)
                {
                    imgSize = "width:640,Height:426,Length:0";//宽图
                }
                Dictionary <string, string> rsMobilePic = commonService.PostImg(Request.Files["NewPicFileMobile"], imgSize);
                if (rsMobilePic.Keys.Contains("error"))
                {
                    return(Json(new { result = "error", message = rsMobilePic["error"] }));
                }
                if (rsMobilePic.Keys.Contains("success"))
                {
                    mobilePicture = rsMobilePic["success"];
                }
            }
            #endregion
            #region 验证品牌
            BrandInfo brandInfo = service.GetBrandInfoById(brandNo);
            if (brandInfo == null)
            {
                return(Json(new { result = "error", message = "对不起,该品牌不存在,请重新选择。" }));
            }
            #endregion

            /*List<SWfsNewAlterPicInfo> newAlterPicList = service.GetNewAlterPicInfoByNo(brandNo, startTime.ToString("yyyy-MM-dd"));
             * if (newAlterPicList != null && newAlterPicList.Count() > 0)
             * {
             *  return Json(new { result = "error", message = "对不起,同一个品牌在同一天不能出现两次。" });
             * }*/

            SWfsNewAlterPicture model = new SWfsNewAlterPicture();
            model.PictureName          = picName;
            model.Position             = 0;
            model.BrandNo              = brandNo;
            model.PcPictureNo          = pcPicture;
            model.PcPictureLinkUrl     = pcUrl;
            model.MobilePictureNo      = mobilePicture;
            model.MobilePictureLinkUrl = mobileUrl;
            model.MobilePictureType    = mobilePicType;
            model.Status         = status;
            model.DataStatus     = 0;
            model.BeginDate      = startTime;
            model.DateCreate     = DateTime.Now;
            model.OperatorUserId = PresentationHelper.GetPassport().UserName;

            try
            {
                service.Insert(model);
                return(Json(new { result = "success", message = "添加成功。" }));
            }
            catch (Exception ex)
            {
                return(Json(new { result = "error", message = ex.Message }));
            }
        }
コード例 #27
0
        public JsonResult AddYRPage()
        {
            string subjectNo = Request.Form["subjectNo"];
            string pageId    = Request.Form["pageId"];
            string flag      = Request.Form["flag"]; //1关联,0取消

            if (string.IsNullOrEmpty(subjectNo))
            {
                return(Json(new { rs = "0", msg = "活动编号不能为空" }));
            }
            if (flag.Equals("1") && string.IsNullOrEmpty(pageId))
            {
                return(Json(new { rs = "0", msg = "请选择关联的预热页面" }));
            }
            SWfsChannelService   service = new SWfsChannelService();
            SWfsSubjectTopExpand model   = service.SelectSubjectTopBySubjectNo(subjectNo);

            if (flag.Equals("0")) //取消
            {
                if (model == null)
                {
                    return(Json(new { rs = "1", msg = "取消成功" }));
                }
                else
                {
                    model.StExpand = "0";
                    service.EditSubjectTop(model);
                    return(Json(new { rs = "1", msg = "取消成功" }));
                }
            }
            else //关联
            {
                if (null != model) //更新
                {
                    try
                    {
                        model.StExpand = pageId;
                        service.EditSubjectTop(model);
                        return(Json(new { rs = "1", msg = "关联成功" }));
                    }
                    catch (Exception e)
                    {
                        return(Json(new { rs = "0", msg = e.Message }));
                    }
                }
                else //写入
                {
                    try
                    {
                        model = new SWfsSubjectTopExpand();
                        model.TopCreateTime = new DateTime(1900, 1, 1);//关联静态页,默认时间最小,置顶后按置顶时间先后显示
                        model.SubjectNo     = subjectNo;
                        model.StExpand      = pageId;
                        service.InsertSubjectTop(model);
                        return(Json(new { rs = "1", msg = "关联成功" }));
                    }
                    catch (Exception e)
                    {
                        return(Json(new { rs = "0", msg = e.Message }));
                    }
                }
            }
        }
コード例 #28
0
        public ActionResult FeaturedEventAdd()
        {
            CommonService               commonService = new CommonService();
            SWfsChannelService          service       = new SWfsChannelService();
            Dictionary <string, string> rsPic         = new Dictionary <string, string>();
            DateTime showDate  = Convert.ToDateTime(Request.Params["showDate"]);
            int      location  = Convert.ToInt32(Request.Params["loc"]);
            string   subjectNo = Request.Params["subjectNo"];
            string   channelNo = Request.Form["ChannelNo"];

            if (subjectNo.IndexOf(',') > 0)
            {
                subjectNo = subjectNo.Substring(0, subjectNo.IndexOf(','));
            }
            string spreadPicture = "";
            //判断是修改还是写入
            int ID = 0;

            if (Request.Form["ID"] != null)
            {
                ID = int.Parse(Request.Form["ID"]);
            }
            #region 写入前数据验证
            //根据活动位置和时间获取频道主推活动信息列表
            List <SWfsSubjectFeaturedEvents> sfeList = service.GetFeatureEventsByDateShow(channelNo, showDate, location);

            //获取一条活动信息
            SubjectInfo subjectInfo = service.GetSubjectInfoBySubjectNo(subjectNo);

            if (subjectInfo != null)
            {
                if (subjectInfo.Status == 0)
                {
                    return(Json(new { rs = "error", message = "该活动已关闭。" }));
                }
                if (subjectInfo.Status == 2)
                {
                    return(Json(new { rs = "error", message = "该活动未开启。" }));
                }
                if (subjectInfo.IsAudited != 1)
                {
                    return(Json(new { rs = "error", message = "该活动未审核完成。" }));
                }
                if (subjectInfo.DateEnd < DateTime.Now)
                {
                    return(Json(new { rs = "error", message = "该活动已经结束。" }));
                }
            }
            else
            {
                return(Json(new { rs = "error", message = "该活动不存在。" }));
            }
            #endregion


            //修改
            if (ID > 0)
            {
                SWfsSubjectFeaturedEvents model = service.GetFeatureEventInfo(ID);
                if (model.Location != location || model.DateShow != showDate)
                {
                    if (sfeList != null && sfeList.Count > 0)
                    {
                        return(Json(new { rs = "error", message = "同位置同时间不可创建大于两场含两场的主推。" }));
                    }
                }
                model.DateShow  = showDate;
                model.Location  = location;
                model.SubjectNo = subjectNo;
                #region   图片
                if (Request.Files["AdPicFile"] == null)
                {
                    if (!string.IsNullOrEmpty(model.SpreadPicture))
                    {
                        spreadPicture = Request.Params["hidAdPicUp"].ToString();//获取隐藏域中的值
                    }
                    else
                    {
                        return(Json(new { rs = "error", message = "请上传图片!" }));
                    }
                }
                else
                {
                    string picSize = AppSettingManager.AppSettings["ChannelFeAdPic"].ToString();
                    string picType = AppSettingManager.AppSettings["ChannelFeAdPicType"].ToString();
                    rsPic = commonService.PostImg(Request.Files["AdPicFile"], picSize, picType);
                    if (rsPic.Keys.Contains("error"))
                    {
                        return(Json(new { rs = "error", message = rsPic["error"] }));
                    }
                    if (rsPic.Keys.Contains("success"))
                    {
                        spreadPicture = rsPic["success"];
                    }
                }
                #endregion
                model.SpreadPicture = spreadPicture;
                try
                {
                    service.Update(model);
                    return(Json(new { rs = "ok", message = "修改成功。" }, "text/plain", Encoding.UTF8));
                }
                catch (Exception ex)
                {
                    return(Json(new { rs = "error", message = ex.Message }, "text/plain", Encoding.UTF8));
                }
            }
            else//添加
            {
                if (sfeList != null && sfeList.Count > 0)
                {
                    return(Json(new { rs = "error", message = "同位置同时间不可创建大于两场含两场的主推。" }));
                }
                #region   图片
                if (null != Request.Files["AdPicFile"] && Request.Files["AdPicFile"].ContentLength > 0)
                {
                    string picSize = AppSettingManager.AppSettings["ChannelFeAdPic"].ToString();
                    string picType = AppSettingManager.AppSettings["ChannelFeAdPicType"].ToString();
                    rsPic = new CommonService().PostImg(Request.Files["AdPicFile"], picSize, picType);
                    if (rsPic.Keys.Contains("error"))
                    {
                        return(Json(new { rs = "error", message = rsPic["error"] }));
                    }
                    if (rsPic.Keys.Contains("success"))
                    {
                        spreadPicture = rsPic["success"];
                    }
                }
                else
                {
                    return(Json(new { rs = "error", message = "请选择图片后上传!" }));
                }
                #endregion
                SWfsSubjectFeaturedEvents model = new SWfsSubjectFeaturedEvents()
                {
                    ChannelNo     = string.IsNullOrEmpty(channelNo) ? "" : channelNo,
                    SubjectNo     = subjectNo,
                    DateShow      = showDate,
                    Type          = 1,
                    Location      = location,
                    SpreadPicture = spreadPicture,
                    DateCreate    = DateTime.Now,
                    CreateUserId  = PresentationHelper.GetPassport().UserName
                };
                try
                {
                    service.Insert(model);
                    return(Json(new { rs = "ok", message = "添加成功。" }, "text/plain", Encoding.UTF8));
                }
                catch (Exception ex)
                {
                    return(Json(new { rs = "error", message = ex.Message }, "text/plain", Encoding.UTF8));
                }
            }
        }
コード例 #29
0
        public ActionResult AddNewBrandManage()
        {
            SWfsChannelService service = new SWfsChannelService();
            string             brandNo = Request.Form["BrandNo"].Trim();//品牌编号

            if (string.IsNullOrEmpty(brandNo))
            {
                return(Json("请选择品牌"));
            }
            int weekofdays = Convert.ToInt32(Request.Params["week"]);//获取日期
            SWfsNewBrandManage newBrandInfo = service.GetNewBrandInfoByBrandNo(brandNo);

            if (newBrandInfo != null)
            {
                if (newBrandInfo.WeekDays == weekofdays)
                {
                    return(Json("该品牌已经存在该池子中了。"));
                }
                else
                {
                    return(Json("该品牌已经存在第" + newBrandInfo.WeekDays + "个池子中了。"));
                }
            }
            int BrandIsShow = service.GetIsBrandNOAccordingConditions(brandNo);

            if (BrandIsShow == 0)
            {
                return(Json("该品牌不符合展示条件。"));
            }
            IList <SWfsNewBrandInfo> list = service.GetAllNewBrandsList();//获取所有的上新品牌

            if (null == list)
            {
                list = new List <SWfsNewBrandInfo>();
            }
            int sort = 0;

            list = list.Where(a => a.WeekDays == weekofdays).ToList();
            if (list != null && list.Count() > 0)
            {
                //获取该池子中品牌的排序最大值,然后在此基础上加1
                sort = list.Select(a => a.Sort).Max() + 1;
            }
            else
            {
                sort = 1;
            }
            #region 操作实体
            SWfsNewBrandManage nbm = new SWfsNewBrandManage();
            nbm.BrandNo        = brandNo;
            nbm.WeekDays       = weekofdays;
            nbm.Sort           = sort;
            nbm.OperatorUserId = PresentationHelper.GetPassport().UserName;
            nbm.DateCreate     = DateTime.Now;
            #endregion
            try
            {
                service.AddNewBrand(nbm);//添加操作
                return(Json(1));
            }
            catch (Exception ex)
            {
                return(Json(ex.Message));
            }
        }
コード例 #30
0
        public ActionResult AddSpikeProduct(SWfsSubjectSpikeProductManage model)
        {
            //if (string.IsNullOrWhiteSpace(model.ProductNo))
            //{
            //    return Json(new { reslut = false, msg = "请选择秒杀商品" });
            //}
            //if (model.ShowTime == null)
            //{
            //    return Json(new { reslut = false, msg = "请选择展示日期" });
            //}
            //增加逻辑判断,如果存在同一时段的秒杀商品,则不能添加成功
            SWfsChannelService service = new SWfsChannelService();
            string             tmpMsg  = string.Empty;

            if (service.IsValidSpikeProduct(model.ShowTime, model.ID, out tmpMsg))
            {
                return(Json(new { reslut = false, msg = tmpMsg }));
            }
            if (null != Request.Files["ShowProductPicFileNo"] && Request.Files["ShowProductPicFileNo"].ContentLength > 0)
            {
                CommonService commonService       = new CommonService();
                Dictionary <string, string> rsPic = commonService.PostImg(Request.Files["ShowProductPicFileNo"], "width:300,Height:620,Length:150");
                if (rsPic.Keys.Contains("error"))
                {
                    return(Json(new { reslut = false, msg = rsPic["error"] }));
                }
                if (rsPic.Keys.Contains("success"))
                {
                    model.ShowProductPicFileNo = rsPic["success"];
                }
            }
            else
            {
                if (!model.ID.Equals(0)) //修改没有上传图片 则
                {
                    model.ShowProductPicFileNo = Request.Form["ESPPicFileNo"];
                }
                else
                {
                    return(Json(new { reslut = false, msg = "请上传展示图片" }));
                }
            }
            model.Status = (short)1; //暂时没用上,备用始终为1
            if (model.ID.Equals(0))  //新增
            {
                model.DateCreate   = DateTime.Now;
                model.CreateUserId = PresentationHelper.GetPassport().UserName;
                try
                {
                    service.AddSWfsSubjectSpikeProduct(model);
                    return(Json(new { reslut = true, msg = "添加成功" }));
                }
                catch (Exception)
                {
                    return(Json(new { reslut = false, msg = "添加失败" }));
                }
            }
            else //修改
            {
                if (string.IsNullOrWhiteSpace(model.ProductNo))
                {
                    model.Type = 1;
                }
                else
                {
                    model.Type = 0;
                }
                try
                {
                    service.UpdateSWfsSubjectSpikeProduct(model);
                    return(Json(new { reslut = true, msg = "修改成功" }));
                }
                catch (Exception)
                {
                    return(Json(new { reslut = false, msg = "修改失败" }));
                }
            }
        }