Пример #1
0
        public SWfsChannel GetChannelByName(string name)
        {
            IList <SWfsChannel> list    = DapperUtil.Query <SWfsChannel>("ComBeziWfs_SWfsChannel_SelectChannelList", null).ToList();
            SWfsChannel         channel = list.Where(c => c.ChannelName == name).FirstOrDefault();

            return(channel);
        }
Пример #2
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 }));
            }
        }
Пример #3
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));
            }
        }
Пример #4
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));
            }
        }
Пример #5
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));
        }
Пример #6
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 = "更改假日模式成功!" }));
        }
Пример #7
0
 public bool UpdateStatus(SWfsChannel channel)
 {
     return(DapperUtil.UpdatePartialColumns <SWfsChannel>(new { ChannelNo = channel.ChannelNo, Status = channel.Status }));
 }
Пример #8
0
 public int InsertChannel(SWfsChannel channel)
 {
     return(DapperUtil.Insert <SWfsChannel>(channel, false));
 }
Пример #9
0
 public bool UpdateChannelHoliDay(SWfsChannel channel)
 {
     return(DapperUtil.UpdatePartialColumns <SWfsChannel>(new { ChannelNo = channel.ChannelNo, HolidayMode = channel.HolidayMode }));
 }