예제 #1
0
        public ActionResult DeleteImg(int id, string imgurl)
        {
            try
            {
                Moduls model = ModulsBLL.SingleModel.GetModel(id);
                if (model != null && model.ImgUrl != null)
                {
                    if (model.ImgUrl.IndexOf(imgurl + ",") > -1)
                    {
                        model.ImgUrl = model.ImgUrl.Replace(imgurl + ",", "");
                    }
                    else
                    {
                        model.ImgUrl = model.ImgUrl.Replace(imgurl, "");
                    }

                    if (ModulsBLL.SingleModel.Update(model, "ImgUrl"))
                    {
                        return(Json(new { Success = true, Msg = "删除成功" }, JsonRequestBehavior.AllowGet));
                    }
                }

                return(Json(new { Success = false, Msg = "删除失败" }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception)
            {
                return(Json(new { Success = false, Msg = "删除失败" }, JsonRequestBehavior.AllowGet));
            }
        }
예제 #2
0
        public JsonResult Delete(int id)
        {
            var result = new JsonResultModel {
                ResultState = Moduls.DeleteModul(id) > 0
            };

            return(Json(result));
        }
예제 #3
0
        public JsonResult Deletes(int [] ids)
        {
            var result = new JsonResultModel {
                ResultState = Moduls.DeleteModuls(ids) > 0
            };

            return(Json(result));
        }
예제 #4
0
        public JsonResult GetOrderNumber(int pid, int?id)
        {
            var result = new JsonResultModel <int> {
                ResultState = true, Body = Moduls.GetOrderNumber(pid, id)
            };

            return(Json(result));
        }
예제 #5
0
        public ActionResult ModulSelect(int?id, int?pid)
        {
            var moduls = Moduls.ModulInfosToTreeVModels(Moduls.GetAllModul(id));

            //选中
            //Moduls.SelectTreeNode(moduls, pid);
            ViewBag.SelectedId = pid;
            return(View(moduls));
        }
예제 #6
0
        /// <summary>
        /// 检测用户信息
        /// </summary>
        /// <param name="filterContext"></param>
        protected override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            //检测登陆状态
            var userInfo = Users.GetCurrentLoginUserInfo();

            //log
#pragma warning disable 4014
            AddActionLogAsync(filterContext, userInfo);
#pragma warning restore 4014
            if (userInfo == null)
            {
                Users.LogOut();//无法得到用户信息就登出清空原有cookie再次登陆
                filterContext.Result = AutoResult("登陆失败请重新登陆!", false, Url.Action("index", "login")); return;
            }
            CurrentUserInfo = userInfo;
            //用户角色
            var roleInfo = Roles.GetRoleInfo(CurrentUserInfo.RoleId);
            if (roleInfo == null)
            {
                filterContext.Result = AutoResult("角色不存在!", false);
                return;
            }
            //所有权限
            CurrentUserModuls = roleInfo.IsSuper ? Moduls.GetAllModul() : Moduls.GetIsShowDisplayListByRoleId(CurrentUserInfo.RoleId);
            //装载全局数据
            InitViewData(CurrentUserModuls, CurrentUserInfo);
            //校验权限 排除无需校验权限请求
            if (IsRoleAuthorizeIgnore(filterContext.Controller, filterContext.ActionDescriptor))
            {
                return;
            }
            //超级角色
            if (roleInfo.IsSuper)
            {
                return;
            }
            //开始校验 权限
            if (CurrentUserInfo == null && !roleInfo.IsSuper)
            {
                filterContext.Result = AutoResult("无任何权限!", false);
                return;
            }

            string actionName     = filterContext.RouteData.GetRequiredString("action");
            string controllerName = filterContext.RouteData.GetRequiredString("controller");
            if (
                !CurrentUserModuls.Any(
                    n =>
                    !string.IsNullOrEmpty(n.Controller) &&
                    !string.IsNullOrEmpty(n.Action) &&
                    n.Controller.ToLower() == controllerName.ToLower() &&
                    n.Action.ToLower() == actionName.ToLower()
                    ))
            {
                filterContext.Result = AutoResult("您没有权限!", false);
            }
        }
예제 #7
0
        public ActionResult Edit(int id)
        {
            var model = Moduls.ModulInfoToVModel(Moduls.GetModulInfo(id));

            if (model.PId != 0)
            {
                model.PName = Moduls.GetModulInfo(model.PId).ModulName;
            }

            return(View(model));
        }
예제 #8
0
        public ActionResult AllocationModul(int id)
        {
            //查询已有模块 在前端进行默认选中
            int[] mIds = RoleModuls.GetMIds(id);
            ViewBag.SelectedIds = JsonConvert.SerializeObject(mIds.Select(n => "tree_node_" + n).ToList());
            //查询资源树
            var moduls = Moduls.ModulInfosToTreeVModels(Moduls.GetAllModul(id));

            ViewBag.RId = id;
            return(View(moduls));
        }
예제 #9
0
        public ActionResult Index(int?page)
        {
            int pageIndex = page.HasValue ? page.Value : 1;
            int pageSize = PageConfig.BackstagePageSize;
            int count, pageCount;
            var result = Moduls.ModulInfosToVModels(Moduls.GetModulPageList(pageIndex, pageSize, null, null, out pageCount, out count));
            PagedList <ModulVModel> pl = result.ToPagedList(pageIndex, pageSize);

            pl.TotalItemCount   = count;
            pl.CurrentPageIndex = pageIndex;
            return(View(pl));
        }
예제 #10
0
        static void Main()
        {
            SLaba a = new SLaba(5, "Пятница");

            Console.WriteLine(a.ToString());
            Moduls moduls = Moduls.ABCObjects;

            Console.WriteLine($"Текущий модуль: {moduls.ToString()}");

            // объекты для списка
            string[]    questions = { "Что такое дилектрик?", "Что делает электродвигатель на 5 В при подключении 55 В??" };
            string[]    answers   = { "Это изолятор, пропускающий ток", "Сгорает к чертям" };
            Examination ex1       = new Examination("Физика", "8:00", "Крутой Гумманитарий", questions, answers);

            questions = new string[] { "Самый страшный Звэр на свете?", "Кто такой Бедодел?" };
            answers   = new string[] { "Бедодел", "Рейд-босс первашей." };
            Examination ex2 = new Examination("ОАиП", "8:30", "Бедодел", questions, answers);

            questions = new string[] { "Академический язык программирования?", "Зачем он нужен?" };
            answers   = new string[] { "Сы плас плас", "Чтобы тратить нервы" };
            Examination ex3 = new Examination("ОАиП", "9:30", "Бедодел", questions, answers);

            questions = new string[] { "Что такое ОС?", "Что такое ОЗУ?", "Что такое ЦП?", "Зачем он нужен?", "Чем знаменит философ Зенон?" };
            answers   = new string[] { "Набор прог", "Оперативное запоминающее устройство", "Центральный процессор", "Он - \"мозг\" компа", "Да хз ваще" };
            Test test1 = new Test("ОС", "8:30", questions, answers);

            questions = new string[] { "Что такое парсек?", "Где находится Черная дыра?", "Газовые гиганты Солнечной системы?", "Созвездие в виде буквы W?", "Звезда, переливающаяся зеленым, желтым и синим цветами?" };
            answers   = new string[] { "Единица измерения расстояния, равная расстоянию до объекта. :D ", "В центре галактики", "Юпитер, Сатурн, Уран, Нептун", "Кассиопея", "Капелла" };
            Test test2 = new Test("Астрономия", "10:05", questions, answers);

            Session s = new Session();

            s.Add(ex1);
            s.Add(ex2);
            s.Add(ex3);
            s.Add(test1);
            s.Add(test2);

            s.Show();

            Console.WriteLine("Общее количество испытаний (экзов) в сессии: " + s.GetCountIspitanie());
            Console.WriteLine("\nКоличество тестов с заданным числом вопросов (ищем по 5-ке): " + s.GetCountOfTestsByQuestions(5));
            Console.WriteLine("\nИщем экзамены по заданному предмету. Ищем по - ОАиПу:\n" + s.SearchExaminationsByName("ОАиП"));


            Console.WriteLine("\nDone.");
            Console.ReadKey();
        }
예제 #11
0
        public JsonResult Add(ModulVModel model)
        {
            var result = new JsonResultModel();

            if (ModelState.IsValid)
            {
                //add
                result.ResultState = Moduls.AddModul(Moduls.ModulVModelToInfo(model)) > 0;
            }
            else
            {
                result.ResultState = false;
                result.Message     = ModelStateHelper.GetAllErrorMessage(ModelState);
            }

            return(Json(result));
        }
예제 #12
0
        public ActionResult AddOrEditCompanyNews(int appid, int id, int Level)
        {
            if (dzaccount == null)
            {
                return(Redirect("/dzhome/login"));
            }
            Miniapp listtemp = MiniappBLL.SingleModel.GetModelByRelationId(appid);

            if (listtemp == null)
            {
                return(View("PageError", new Return_Msg()
                {
                    Msg = "没有找到模板!", code = "500"
                }));
            }
            if (Level == 8)
            {
                ViewBag.Title = "编辑企业动态";
            }
            else
            {
                ViewBag.Title = "编辑产品展示";
            }
            ViewBag.appId      = listtemp.Id;
            ViewBag.rappId     = appid;
            ViewBag.Level      = Level;
            ViewBag.NewmodelId = 0;

            if (id <= 0)
            {
                return(View(new Moduls()));
            }
            else
            {
                Moduls model = ModulsBLL.SingleModel.GetModel(id);
                ViewBag.xcxImgUrlList = new List <object>();
                if (model != null)
                {
                    ViewBag.xcxImgUrlList = new List <object>()
                    {
                        new { id = model.Id, url = model.ImgUrl }
                    };
                }
                return(View(model));
            }
        }
예제 #13
0
        public ActionResult ReflashImg(int id, string newid)
        {
            if (dzaccount == null)
            {
                return(Redirect("/dzhome/login"));
            }
            //Miniapp listtemp = _miniappBll.GetModelByRelationId(id);
            //if(listtemp==null)
            //{
            //    return View("error");
            //}

            if (!string.IsNullOrWhiteSpace(newid))
            {
                Moduls infos = ModulsBLL.SingleModel.GetModel("Id = " + newid);
                if (infos != null)
                {
                    return(PartialView("MiappImgUpload", infos));
                }
            }

            return(PartialView("MiappImgUpload", new Moduls()));
        }
예제 #14
0
        public ActionResult Index(int?page)
        {
            int pageIndex = page.HasValue ? page.Value : 1;
            int pageSize = PageConfig.BackstagePageSize;
            int count, pageCount;
            var result = Moduls.ModulInfosToVModels(Moduls.GetModulPageList(pageIndex, pageSize, null, null, out pageCount, out count));

            result.ForEach(n => {
                if (n.PId != 0)
                {
                    var modulinfo = Moduls.GetModulInfo(n.PId);
                    if (modulinfo != null)
                    {
                        n.PName = modulinfo.ModulName;
                    }
                }
            });

            PagedList <ModulVModel> pl = result.ToPagedList(pageIndex, pageSize);

            pl.TotalItemCount   = count;
            pl.CurrentPageIndex = pageIndex;
            return(View(pl));
        }
예제 #15
0
        public ActionResult AddOrEdit(Moduls infos, bool isdecode = false)
        {
            ServiceResult result = new ServiceResult();

            try
            {
                if (dzaccount == null)
                {
                    return(Redirect("/dzhome/login"));
                }
                if (infos == null)
                {
                    return(Json(result.IsFailed("系统繁忙auth_limited !")));
                }

                #region Base64解密
                if (isdecode)
                {
                    string decode;
                    try
                    {
                        string strDescription = infos.Content.Replace(" ", "+");
                        byte[] bytes          = Convert.FromBase64String(strDescription);
                        decode = Encoding.UTF8.GetString(bytes);
                    }
                    catch
                    {
                        decode = infos.Content;
                    }

                    infos.Content = decode;
                    string content = StringHelper.NoHtml(infos.Content.Replace("&nbsp;", ""));
                }

                #endregion
                if (infos.Id == 0)
                {
                    infos.State      = 1;
                    infos.Createdate = DateTime.Now;
                    infos.Lastdate   = DateTime.Now;
                    object id = ModulsBLL.SingleModel.Add(infos);
                    infos.Id = int.Parse(id.ToString());
                    result.IsSucceed("添加成功 !");

                    result.Data = new Dictionary <string, object> {
                        { "datas", infos }
                    };
                }
                else
                {
                    //判断是否为动态新闻模块
                    if ((int)Miapp_Miniappmoduls_Level.EightModel == infos.Level)
                    {
                        //获取新闻动态模板背景色
                        Moduls model2 = ModulsBLL.SingleModel.GetModel("appId=" + infos.appId + " and State = 1 and Level=" + (int)Miapp_Miniappmoduls_Level.NightModel);
                        if (model2 != null)
                        {
                            //修改动态新闻背景色
                            model2.Color = infos.Color;
                            ModulsBLL.SingleModel.Update(model2, "Color");
                        }
                        else
                        {
                            //添加动态新闻背景色
                            model2            = new Moduls();
                            model2.appId      = infos.appId;
                            model2.Level      = (int)Miapp_Miniappmoduls_Level.NightModel;
                            model2.State      = 1;
                            model2.Createdate = DateTime.Now;
                            model2.Lastdate   = DateTime.Now;
                            model2.Title      = "动态新闻背景色";
                            ModulsBLL.SingleModel.Add(model2);
                        }
                    }

                    string updatecolumn = "Lastdate,Hidden,Content,ImgUrl,Content2,Name,Level,LitleImgUrl,Title,Address,AddressPoint,mobile,Color,State";
                    if (infos.State == 0)
                    {
                        updatecolumn = "Lastdate,State";
                        result.IsSucceed("删除成功 !");
                    }
                    else
                    {
                        result.IsSucceed("修改成功 !");
                    }
                    infos.Lastdate = DateTime.Now;

                    ModulsBLL.SingleModel.Update(infos, updatecolumn);
                    result.Data = new Dictionary <string, object> {
                        { "datas", infos }
                    };
                }

                //首页轮播图
                if (!string.IsNullOrEmpty(infos.ImgUrl) && infos.Level == 1)
                {
                    string[] imgArray = infos.ImgUrl.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                    if (imgArray.Length > 0)
                    {
                        foreach (string item in imgArray.Where(item => !string.IsNullOrEmpty(item) && item.IndexOf("http://", StringComparison.Ordinal) == 0))
                        {
                            C_AttachmentBLL.SingleModel.Add(new C_Attachment
                            {
                                itemId     = infos.Id,
                                createDate = DateTime.Now,
                                filepath   = item,
                                itemType   = (int)AttachmentItemType.小程序官网首页轮播图,
                                thumbnail  = item,
                                status     = 0
                            });
                        }
                    }
                    infos.ImgUrl = "";
                }

                return(Json(result));
            }
            catch (Exception ex)
            {
                return(Json(result.IsFailed("服务器出错 , 请重试 !" + ex.Message)));
            }
        }
예제 #16
0
        public ActionResult Edit(int id)
        {
            var model = Moduls.ModulInfoToVModel(Moduls.GetModulInfo(id));

            return(View(model));
        }
예제 #17
0
        /// <summary>
        /// 初始化模块
        /// </summary>
        /// <param name="Id"></param>
        /// <param name="storename"></param>
        /// <param name="Level"></param>
        /// <returns></returns>
        ///
        public ActionResult ModelData(int Id = 0, string storename = "", int Level = 0, int pageindex = 1, int pagesize = 10)
        {
            if (dzaccount == null)
            {
                return(Redirect("/dzhome/login"));
            }
            if (Id <= 0)
            {
                return(View("PageError", new Return_Msg()
                {
                    Msg = "参数出错!", code = "500"
                }));
            }

            XcxAppAccountRelation role = XcxAppAccountRelationBLL.SingleModel.GetModelByaccountidAndAppid(Id, dzaccount.Id.ToString());

            if (role == null)
            {
                return(View("PageError", new Return_Msg()
                {
                    Msg = "没有权限!", code = "403"
                }));
            }

            Miniapp listtemp = MiniappBLL.SingleModel.GetModelByRelationId(Id);

            if (listtemp != null)
            {
                //获得隐藏模板Level
                ViewBag.hidden = listtemp.hiddenModel;
            }
            else
            {
                XcxAppAccountRelation xrelationmodel = XcxAppAccountRelationBLL.SingleModel.GetModel(Id);
                if (xrelationmodel == null)
                {
                    return(View("PageError", new Return_Msg()
                    {
                        Msg = "没有权限!", code = "403"
                    }));
                }
                listtemp               = new Miniapp();
                listtemp.CreateDate    = DateTime.Now;
                listtemp.Description   = "官网小程序";
                listtemp.OpenId        = dzaccount.OpenId;
                listtemp.xcxRelationId = Id;
                listtemp.State         = 1;
                listtemp.ModelId       = xrelationmodel.AppId;
                listtemp.Id            = Convert.ToInt32(MiniappBLL.SingleModel.Add(listtemp));
                if (listtemp.Id <= 0)
                {
                    return(View("PageError", new Return_Msg()
                    {
                        Msg = "添加繁忙!", code = "500"
                    }));
                }
                ViewBag.hidden = "";
            }

            ViewBag.Title      = storename;
            ViewBag.appId      = listtemp.Id;
            ViewBag.rappId     = Id;
            ViewBag.Level      = Level;
            ViewBag.NewmodelId = 0;

            string        sql      = "appId = " + listtemp.Id + " and Level = " + Level + " and State = 1";
            List <Moduls> model    = ModulsBLL.SingleModel.GetList(sql);
            string        viewname = "";

            switch (Level)
            {
            case (int)Miapp_Miniappmoduls_Level.ModelData: viewname = "Index";
                break;

            case (int)Miapp_Miniappmoduls_Level.FirstModel: viewname = "FirstModel";
                break;

            case (int)Miapp_Miniappmoduls_Level.TwoModel: viewname = "TwoModel";
                break;

            case (int)Miapp_Miniappmoduls_Level.ThreeModel: viewname = "ThreeModel"; break;

            case (int)Miapp_Miniappmoduls_Level.FourModel:
                viewname = "ProductShow";

                List <Moduls> productlist = ModulsBLL.SingleModel.GetListByAppidandLevel(listtemp.Id, Level, pageindex, pagesize);
                ViewBag.pageSize   = 10;
                ViewBag.TotalCount = ModulsBLL.SingleModel.GetListByAppidandLevelCount(listtemp.Id, Level);
                return(View(viewname, productlist));

            case (int)Miapp_Miniappmoduls_Level.FiveModel:
                Moduls miniappmodel = new Moduls();
                if (model == null || model.Count <= 0)
                {
                    //添加动态新闻背景色
                    miniappmodel            = new Moduls();
                    miniappmodel.appId      = listtemp.Id;
                    miniappmodel.Level      = (int)Miapp_Miniappmoduls_Level.FiveModel;
                    miniappmodel.State      = 1;
                    miniappmodel.Createdate = DateTime.Now;
                    miniappmodel.Lastdate   = DateTime.Now;
                    miniappmodel.Title      = "发展历程";
                    miniappmodel.Id         = Convert.ToInt32(ModulsBLL.SingleModel.Add(miniappmodel));
                }
                else
                {
                    miniappmodel = model[0];
                }
                viewname = "Development";
                List <Development> datass = DevelopmentBLL.SingleModel.GetListByAppid(listtemp.Id, pageindex, pagesize);
                ViewBag.pageSize   = 10;
                ViewBag.dTitle     = miniappmodel.Title;
                ViewBag.did        = miniappmodel.Id;
                ViewBag.TotalCount = DevelopmentBLL.SingleModel.GetListByAppidCount(listtemp.Id);
                return(View(viewname, datass));

            case (int)Miapp_Miniappmoduls_Level.SixModel: viewname = "CallWe";
                break;

            case (int)Miapp_Miniappmoduls_Level.EightModel:
                viewname = "CompanyNews";
                List <Moduls> companynewslist = ModulsBLL.SingleModel.GetListByAppidandLevel(listtemp.Id, Level, pageindex, pagesize);
                ViewBag.pageSize   = 10;
                ViewBag.TotalCount = ModulsBLL.SingleModel.GetListByAppidandLevelCount(listtemp.Id, Level);
                return(View(viewname, companynewslist));

            default:
                viewname = "ModelData";
                break;
            }

            if (model != null && model.Count > 0)
            {
                return(View(viewname, model[0]));
            }

            return(View(viewname, new Moduls()
            {
                appId = listtemp.Id, Level = Level
            }));
        }