Exemplo n.º 1
0
        public ActionResult zhili()
        {
            // admin_add('治理', '/Manage/zhili?factorysation=' + factorysation + "&signal=" + signal + "&createtime=" + createtime, '1000', '650')

            string factorysation       = Request.QueryString["factorysation"].ToString();
            string signal              = Request.QueryString["signal"].ToString();
            Sys_CauseSuggestionBll Bll = new Sys_CauseSuggestionBll();
            string content             = "";
            var    list = Bll.GetCauseSuggestionListByContent(signal, factorysation, ref content);

            ViewBag.CauseContent = content;
            return(View(list));
        }
Exemplo n.º 2
0
        public ActionResult CauseAdd()
        {
            Sys_CauseSuggestionBll bll = new Sys_CauseSuggestionBll();

            List <Sys_CauseSuggestion> list = bll.GetList();

            Sys_CauseSuggestion model = new Sys_CauseSuggestion();

            if (Request.QueryString["id"] != null)
            {
                model = bll.GetModel(int.Parse(Request.QueryString["id"]));
            }

            ViewBag.list = list;
            return(View(model));
        }
        public Dictionary <string, object> CauseDel()
        {
            Sys_CauseSuggestionBll bll = new Sys_CauseSuggestionBll();
            var causeid = HttpContext.Current.Request.Form["causeid"].ToString();
            List <Sys_CauseSuggestion> list = bll.GetModelList(causeid, 1);
            StringBuilder sb = new StringBuilder();

            foreach (var item in list)
            {
                if (item.ParentId > 0)
                {
                    bll.CauseDel(item.CauseId);
                }
                else
                {
                    if (bll.GetModelList(item.CauseId.ToString(), 2).Count > 0)
                    {
                        sb.Append(item.CauseId.ToString());
                    }
                    else
                    {
                        bll.CauseDel(item.CauseId);
                    }
                }
            }
            if (sb.ToString() == "")
            {
                return(new Dictionary <string, object>
                {
                    { "code", "1" }
                });
            }
            else
            {
                return(new Dictionary <string, object>
                {
                    { "code", "0" },
                    { "msg", "编号为" + sb.ToString() + "的数据不能删除若要删除请先删除此数据关联的原因" }
                });
            }
        }
        public Dictionary <string, object> CauseAdd(Sys_CauseSuggestion model)

        {
            Sys_CauseSuggestionBll bll = new Sys_CauseSuggestionBll();

            if (model.CauseId > 0)
            {
                var model1 = bll.GetModel(model.CauseId);
                model1.CauseContent   = model.CauseContent;
                model1.RelatedContent = model.RelatedContent;
                model1.ParentId       = model.ParentId;

                if (model.SuggestionContent == null)
                {
                    model1.SuggestionContent = "";
                }
                else
                {
                    model1.SuggestionContent = model.SuggestionContent;
                }


                if (model.ParentId == 0)
                {
                    model1.Code = "." + model.CauseId.ToString() + ".";
                }
                else
                {
                    model1.Code = "." + model.ParentId + "." + model.CauseId.ToString() + ".";
                }
                if (bll.Sys_CauseSuggestionEdit(model1) > 0)
                {
                    return(new Dictionary <string, object>
                    {
                        { "code", "1" }
                    });
                }
                else
                {
                    return(new Dictionary <string, object>
                    {
                        { "code", "0" }
                    });
                }
            }
            else
            {
                model.CreateTime     = DateTime.Now;
                model.CreateUserId   = ManageProvider.Provider.Current().UserId;
                model.CreateUserName = ManageProvider.Provider.Current().Account;
                if (model.SuggestionContent == null)
                {
                    model.SuggestionContent = "";
                }
                if (model.RelatedContent == null)
                {
                    model.RelatedContent = "";
                }
                model.CauseCode = "";

                model.Sort = 0;
                if (bll.CauseAdd(model) > 0)
                {
                    return(new Dictionary <string, object>
                    {
                        { "code", "1" }
                    });
                }
                else
                {
                    return(new Dictionary <string, object>
                    {
                        { "code", "0" }
                    });
                }
            }
        }