コード例 #1
0
ファイル: ChannelController.cs.cs プロジェクト: demon28/DMS
        public ActionResult Add(VchannelModel vModel)
        {
            Tdms_Channel datdms = new Tdms_Channel();

            if (!datdms.SelectByPK(vModel.TreeNodeId))
            {
                return(FailResult("没有该条记录!" + datdms.PromptInfo.MessageStack));
            }
            try
            {
                Channel channel = new Channel();
                channel.ChannelName = vModel.ChannelName;
                channel.FatherId    = vModel.TreeNodeId;
                channel.Status      = vModel.Status;
                channel.Remarks     = vModel.Remarks;
                if (!channel.Add())
                {
                    return(FailResult(channel.PromptInfo.MessageStack));
                }
                return(SuccessResult());
            }
            catch (Exception ex)
            {
                return(FailResult("添加栏目信息:" + ex.Message));
            }
        }
コード例 #2
0
ファイル: ChannelController.cs.cs プロジェクト: demon28/DMS
        public ActionResult Delete(int ChannelId)
        {
            Tdms_Channel dachannel = new Tdms_Channel();

            if (!dachannel.SelectByPK(ChannelId))
            {
                return(FailResult("此记录已不存在"));
            }
            ViewBag.ChannelId = ChannelId;
            return(View());
        }
コード例 #3
0
        /// <summary>
        /// 禁用和启用
        /// </summary>
        /// <param name="channelId">栏目编号</param>
        /// <param name="status">状态</param>
        /// <returns></returns>
        public bool Operate(int channelId, string status)
        {
            Tdms_Channel daChannel = new Tdms_Channel();

            if (!daChannel.SelectByPK(channelId))
            {
                Alert("查询失败" + daChannel.PromptInfo.MessageStack);
                return(false);
            }
            if (status == "Open")
            {
                if (daChannel.Status == ChannelStatus.禁用)
                {
                    daChannel.Status = ChannelStatus.启用;
                    if (!daChannel.Update())
                    {
                        Alert("启用失败" + daChannel.PromptInfo.MessageStack);
                        return(false);
                    }
                }
                else
                {
                    return(false);
                }
            }
            if (status == "Close")
            {
                if (daChannel.Status == ChannelStatus.启用)
                {
                    daChannel.Status = ChannelStatus.禁用;
                    if (!daChannel.Update())
                    {
                        Alert("禁用失败" + daChannel.PromptInfo.MessageStack);
                        return(false);
                    }
                }
                else
                {
                    return(false);
                }
            }
            return(true);
        }