コード例 #1
0
        public async Task <IActionResult> PutViewCategory(int id, ViewCategory viewCategory)
        {
            if (id != viewCategory.ID)
            {
                return(BadRequest());
            }

            _context.Entry(viewCategory).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ViewCategoryExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
コード例 #2
0
ファイル: MainViewController.cs プロジェクト: jmptrader/Creek
        public void CreateView(ViewCategory c)
        {
            IViewsManager          vm = Task.Navigator.ViewsManager;
            InteractionPointInfoEx ip = (vm as IDynamicViewsManager).CreateView(c);

            (View as IMainView).AddViewToNavPane(ip);
        }
コード例 #3
0
        public async Task <ActionResult <ViewCategory> > PostViewCategory(ViewCategory viewCategory)
        {
            _context.ViewCategory.Add(viewCategory);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetViewCategory", new { id = viewCategory.ID }, viewCategory));
        }
コード例 #4
0
        public List <ViewCategory> Display()
        {
            List <ViewCategory> viewCategories = new List <ViewCategory>();

            string        sqlString     = @"Server=FATEMA-PC\SQLEXPRESS; Database=SMS; Integrated Security=True";
            SqlConnection sqlConnection = new SqlConnection(sqlString);

            string     commandString = @"SELECT * FROM Categories";
            SqlCommand sqlCommand    = new SqlCommand(commandString, sqlConnection);

            sqlConnection.Open();

            SqlDataReader sqlDataReader = sqlCommand.ExecuteReader();

            while (sqlDataReader.Read())
            {
                ViewCategory viewCategory = new ViewCategory();

                viewCategory.ID   = Convert.ToInt32(sqlDataReader["ID"]);
                viewCategory.Code = sqlDataReader["Code"].ToString();
                viewCategory.Name = sqlDataReader["Name"].ToString();


                viewCategories.Add(viewCategory);
            }

            sqlConnection.Close();

            return(viewCategories);
        }
コード例 #5
0
        public ViewCategory PutCategory(int id, Category category)
        {
            if (!ModelState.IsValid)
            {
                throw new Exception("No valido");
            }

            if (id != category.CategoryId)
            {
                throw new Exception("No valido");
            }

            db.Entry(category).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CategoryExists(id))
                {
                    throw new Exception("No valido");
                }
                else
                {
                    throw;
                }
            }

            ViewCategory viewCategory = category;

            return(viewCategory);
        }
コード例 #6
0
        /// <summary>
        /// Open the course to public. Check whether there are existing public course event and its status
        /// If so, decide to reuse or not
        /// Enrollment code is
        /// </summary>
        /// <param name="id">CourseId</param>
        /// <returns></returns>
        ///
        public async Task <ActionResult> Publish(int id, string title, ViewCategory viewCategory)
        {
            var createdBy = CurrentUser.UserId;

            var response = await WepApiMethod.SendApiAsync <ChangeCourseStatusModel>(HttpVerbs.Post,
                                                                                     CourseEventApiUrl.Publish + $"?id={id}&createdBy={createdBy}");

            if (response.isSuccess)
            {
                await LogActivity(Modules.Learning, $"Success publishing - Course - {id}-{title}");

                await Notifier.NotifyCoursePublish(NotificationType.Course_Publish,
                                                   id, CurrentUser.UserId.Value, "", createdBy.ToString(),
                                                   title, Url.AbsoluteAction("Content", "Course", new { id = id }));

                if (viewCategory == ViewCategory.Public)
                {
                    TempData["SuccessMessage"] = $"Course titled {title} published successfully and open for public.";
                }
                else
                {
                    TempData["SuccessMessage"] = $"Course titled {title} published successfully.You can now invite group / students to enroll to the course.";
                }
            }
            else
            {
                await LogError(Modules.Learning, $"Error publishing - Course - {id}-{title}");

                TempData["ErrorMessage"] = $"Error publishing the course {title}.";
            }

            return(RedirectToAction("Content", "Courses", new { area = "eLearning", id = id }));
        }
コード例 #7
0
 public IActionResult GetRecordTypes(string id, ViewCategory view = ViewCategory.Id)
 {
     if (view.Equals(ViewCategory.Id))
     {
         return(Ok(_accountService.GetRecordTypeIds(id)));
     }
     return(Ok(_accountService.GetRecordTypes(id)));
 }
コード例 #8
0
        public ActionResult Categories()
        {
            DataBaseCategories dataBaseCategory = new DataBaseCategories();
            ViewCategory       viewCategory     = new ViewCategory();

            viewCategory.Categories = dataBaseCategory.Select();

            return(View(viewCategory));
        }
コード例 #9
0
        public async Task <IActionResult> Create([Bind("ID,Name")] ViewCategory viewCategory)
        {
            if (ModelState.IsValid)
            {
                await NetworkMethodModel.Post <ViewCategory>(ConsulUri, viewCategory);

                return(RedirectToAction(nameof(Index)));
            }
            return(View(viewCategory));
        }
コード例 #10
0
        public IActionResult GetAccounts(bool?includeInactive, ViewCategory view = ViewCategory.Id)
        {
            bool getActiveAccountOnly = (includeInactive == null) || (!(bool)(includeInactive));

            if (view.Equals(ViewCategory.Id))
            {
                return(Ok(_accountService.GetAccountIds(getActiveAccountOnly)));
            }
            return(Ok(_accountService.GetAccountEntities(getActiveAccountOnly)));
        }
コード例 #11
0
 public IActionResult AddCategory(ViewCategory viewCategory)
 {
     if (viewCategory.Name != null)
     {
         categoryRepository.AddCategory(new Category {
             Name = viewCategory.Name
         });
     }
     return(RedirectToAction("Index", "Home"));
 }
コード例 #12
0
        public ViewCategory PostCategory([FromBody] Category category)
        {
            if (!ModelState.IsValid)
            {
                throw new Exception("No valido");
            }
            db.Category.Add(category);
            db.SaveChanges();
            ViewCategory viewCategory = category;

            return(viewCategory);
        }
コード例 #13
0
ファイル: DALCategory.cs プロジェクト: ronycwy98/gen-proj-pos
        public List <ViewCategory> GetAll()
        {
            var categories     = db.Categories.ToList();
            var viewCategories = new List <ViewCategory>();

            foreach (var li in categories)
            {
                var viewCategory = new ViewCategory(li);
                viewCategories.Add(viewCategory);
            }
            return(viewCategories);
        }
コード例 #14
0
    public void OnGUI()
    {
        EditorGUILayout.Space();

        GUILayout.BeginHorizontal();

        GUI.backgroundColor = Color.green;
        bool choose = false;

        choose = GUILayout.Button("Choose Effect folder", GUILayout.Width(200f));

        if (choose)
        {
            mEffectPath = EditorUtility.SaveFolderPanel("Choose Effect folder", "", "");
        }

        GUI.backgroundColor = Color.white;
        mEffectPath         = GUILayout.TextField(mEffectPath);

        GUILayout.EndHorizontal();


        if (GUILayout.Button("Collect Effect Performance Data"))
        {
            CollectEffectPerformanceData();
        }

        EditorGUILayout.Space();
        mViewCategory = (ViewCategory)GUILayout.Toolbar((int)mViewCategory, mViewToolbarStrings);

        switch (mViewCategory)
        {
        case ViewCategory.VC_EFFECT:
            EditorGUILayout.Space();
            ShowEffectPerformanceHeadInfo();

            EditorGUILayout.Space();
            mListPosition = GUILayout.BeginScrollView(mListPosition);
            ShowEffectPerformanceList();
            GUILayout.EndScrollView();
            break;

        case ViewCategory.VC_SUB_EFFECT:
            EditorGUILayout.Space();
            ShowSubEffectPerformanceHeadInfo();

            EditorGUILayout.Space();
            mListPosition = GUILayout.BeginScrollView(mListPosition);
            ShowSubEffectPerformanceList();
            GUILayout.EndScrollView();
            break;
        }
    }
コード例 #15
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,Name")] ViewCategory viewCategory)
        {
            if (id != viewCategory.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                await NetworkMethodModel.Put <ViewCategory>(ConsulUri, id, viewCategory);

                return(RedirectToAction(nameof(Index)));
            }
            return(View(viewCategory));
        }
コード例 #16
0
ファイル: DaoCategory.cs プロジェクト: twgroup-vn/ACheck
        public ViewCategory GetCategoriesByGroupID(string GroupId)
        {
            DaoAsset     daoAsset = new DaoAsset(context);
            ViewCategory result   = new ViewCategory();

            result.lsSubCategory = context.Category.AsNoTracking().Where(p => p.Active == true && p.ParentId.Equals("0") && p.CategoryType.Equals(GroupId))
                                   .Include(p => p.EavAttributeValue).ThenInclude(x => x.Eav).AsEnumerable().ToList();
            result.lsSubCategory.ForEach(e =>
            {
                e.CountAsset       = context.EavAttributeValue.Where(p => p.EavId.Equals(e.CategoryId) && p.Active == true).Count();
                e.CountSubCategory = context.Category.Where(p => p.ParentId.Equals(e.CategoryId) && p.Active == true).Count();
            });
            result.countSubCategory = result.lsSubCategory.Count();
            return(result);
        }
コード例 #17
0
        private void CurrentCategoryChanged(string catName)
        {
            ViewCategory selectedCat = (ViewCategory)Enum.Parse(typeof(ViewCategory), catName);

            switch (selectedCat)
            {
            case ViewCategory.Mail:
                navigateBar.SelectedButton = navigateBar.NavigateBarButtons[0];
                CheckToolBarCategoryButtons(true, false, false); break;

            case ViewCategory.Notes:
                navigateBar.SelectedButton = navigateBar.NavigateBarButtons[1];
                CheckToolBarCategoryButtons(false, true, false); break;

            case ViewCategory.Tasks:
                navigateBar.SelectedButton = navigateBar.NavigateBarButtons[2];
                CheckToolBarCategoryButtons(false, false, true); break;
            }
        }
コード例 #18
0
        public ActionResult Categories(ViewCategory category)
        {
            DataBaseCategories dataBaseCategory = new DataBaseCategories();
            bool check = dataBaseCategory.Insert(category.NewCategory);

            ViewCategory viewCategory = new ViewCategory();

            viewCategory.Categories = dataBaseCategory.Select();

            Response.Redirect(Request.Path);
            if (check)
            {
                ModelState.AddModelError("", "Категория успешно добавлена");
            }
            else
            {
                ModelState.AddModelError("", "Данная категория уже существует");
            }
            return(View(viewCategory));
        }
コード例 #19
0
 public InteractionPointInfoEx CreateView(ViewCategory vc)
 {
     InteractionPointInfoEx result = new InteractionPointInfoEx();
     result.ViewName = vc.ToString() + " " + (ViewInfos.Count-1).ToString();
     result.IsCommonTarget = true;
     result.ViewCategory = vc;
     Navigator.TaskInfo.InteractionPoints[result.ViewName] = result;
     ViewInfoEx vi = new ViewInfoEx(result.ViewName, "", null);
     switch (vc)
     {
         case ViewCategory.Mail:
             vi.ImgName = "Mail"; vi.ViewType = typeof(MailView); break;
         case ViewCategory.Notes:
             vi.ImgName = "Notes"; vi.ViewType = typeof(NoteView); break;
         case ViewCategory.Tasks:
             vi.ImgName = "Tasks"; vi.ViewType = typeof(TaskView); break;
     }
     ViewInfos.Add(vi);
     return result;
 }
コード例 #20
0
ファイル: DaoCategory.cs プロジェクト: twgroup-vn/ACheck
        public ViewCategory GetCategoriesByID(string CategoryId)
        {
            DaoAsset     daoAsset = new DaoAsset(context);
            ViewCategory result   = new ViewCategory();

            result.Category      = context.Category.AsNoTracking().Where(p => p.Active == true && p.CategoryId.Equals(CategoryId)).AsEnumerable().FirstOrDefault();
            result.lsSubCategory = context.Category.AsNoTracking().Where(p => p.Active == true && p.ParentId.Equals(CategoryId)).OrderBy(p => p.No)
                                   //.Include(p => p.EavAttributeValue)
                                   //.ThenInclude(x => x.Eav).AsEnumerable()
                                   .ToList();
            result.lsSubCategory.ForEach(e =>
            {
                e.CountAsset       = context.EavAttributeValue.Where(p => p.EavId.Equals(e.CategoryId) && p.Active == true).Count();
                e.CountSubCategory = context.Category.Where(p => p.ParentId.Equals(e.CategoryId) && p.Active == true).Count();
            });

            result.lsAsset          = daoAsset.GetAssetByCategoryId(CategoryId);
            result.countAsset       = result.lsAsset.Count() + result.lsSubCategory.Sum(p => p.CountAsset);
            result.countSubCategory = result.lsSubCategory.Count();
            return(result);
        }
コード例 #21
0
        public IActionResult GetUsers(string accountId, bool?includeInactive, ViewCategory view = ViewCategory.Id)
        {
            bool getActiveUserOnly = (includeInactive == null) || (!(bool)(includeInactive));

            if (string.IsNullOrEmpty(accountId)) // not passing accountId then return everything
            {
                if (view.Equals(ViewCategory.Id))
                {
                    return(Ok(_userService.GetUserIds(getActiveUserOnly)));
                }
                return(Ok(_userService.GetUsers(getActiveUserOnly)));
            }
            else
            {
                if (view.Equals(ViewCategory.Id))
                {
                    return(Ok(_userService.GetListUserIdForAccount(accountId, getActiveUserOnly)));
                }
                return(Ok(_userService.GetListUsersForAccount(accountId, getActiveUserOnly)));
            }
        }
コード例 #22
0
        public InteractionPointInfoEx CreateView(ViewCategory vc)
        {
            InteractionPointInfoEx result = new InteractionPointInfoEx();

            result.ViewName       = vc.ToString() + " " + (ViewInfos.Count - 1).ToString();
            result.IsCommonTarget = true;
            result.ViewCategory   = vc;
            Navigator.TaskInfo.InteractionPoints[result.ViewName] = result;
            ViewInfoEx vi = new ViewInfoEx(result.ViewName, "", null);

            switch (vc)
            {
            case ViewCategory.Mail:
                vi.ImgName = "Mail"; vi.ViewType = typeof(MailView); break;

            case ViewCategory.Notes:
                vi.ImgName = "Notes"; vi.ViewType = typeof(NoteView); break;

            case ViewCategory.Tasks:
                vi.ImgName = "Tasks"; vi.ViewType = typeof(TaskView); break;
            }
            ViewInfos.Add(vi);
            return(result);
        }
コード例 #23
0
ファイル: IPointExAttribute.cs プロジェクト: jmptrader/Creek
 public IPointExAttribute(ViewCategory viewCat, Type controllerType)
     : this(viewCat, controllerType, true)
 {
 }
コード例 #24
0
ファイル: MainViewController.cs プロジェクト: hanleyChu/prj
 public void CreateView(ViewCategory c)
 {
     IViewsManager vm = Task.Navigator.ViewsManager;
     InteractionPointInfoEx ip = (vm as IDynamicViewsManager).CreateView(c);
     (View as IMainView).AddViewToNavPane(ip);
 }
コード例 #25
0
        // GET: Category
        public ActionResult Index(int id, string name, int?page, int?limit, string key, string range)
        {
            ViewCategory model = new ViewCategory {
                category = db.Categories.Find(id),
                Tags     = db.Tags.OrderByDescending(t => t.Id).Take(10).ToList(),
            };

            if (limit == null)
            {
                limit = 12;
            }
            ;
            if (limit != 12 && limit != 24 && limit != 36)
            {
                return(HttpNotFound());
            }
            if (page == null)
            {
                page = 1;
            }
            if (model.category == null)
            {
                return(HttpNotFound());
            }

            if (model.category.Products.Count > 1)
            {
                if (model.category.Products.Min(p => p.Price) > model.category.Products.Min(p => p.DiscountPrice))
                {
                    model.Min = model.category.Products.Min(p => p.DiscountPrice.Value);
                }
                else
                {
                    model.Min = model.category.Products.Min(p => p.Price);
                }
            }


            if (model.category.Products.Count > 1)
            {
                if (model.category.Products.Max(p => p.Price) < model.category.Products.Max(p => p.DiscountPrice))
                {
                    model.Max = model.category.Products.Max(p => p.DiscountPrice.Value);
                }
                else
                {
                    model.Max = model.category.Products.Max(p => p.Price);
                }
            }

            if (range != null)
            {
                if (range.Contains("-"))
                {
                    string[] price = range.Split('-');

                    if (!int.TryParse(price[0], out model.SltMin))
                    {
                        return(HttpNotFound());
                    }
                    else
                    {
                        if (model.SltMin < model.Min)
                        {
                            return(HttpNotFound());
                        }
                    }

                    if (!int.TryParse(price[1], out model.SltMax))
                    {
                        return(HttpNotFound());
                    }
                    else
                    {
                        if (model.SltMax > model.Max)
                        {
                            return(HttpNotFound());
                        }
                    }
                }
                else
                {
                    return(HttpNotFound());
                }
            }
            model.Key      = key;
            model.Page     = (int)page;
            model.Limit    = (int)limit;
            model.products = model.category.Products.Where(p => (key != null && key != string.Empty)?p.Name.Contains(key):true && (model.SltMin != -1 ? (p.DiscountPrice != null?p.DiscountPrice:p.Price) >= model.SltMin : true) && (model.SltMax != -1 ? (p.DiscountPrice != null ? p.DiscountPrice : p.Price) <= model.SltMax : true) && p.Status).Skip(((int)page - 1) * (int)limit).Take((int)limit).ToList();
            model.Total    = (int)Math.Ceiling(model.category.Products.Count() / (decimal)limit);
            model.Sizes    = db.Sizes.Where(s => s.ProductColorSizes.Where(pcs => pcs.Product.CategoryId == model.category.Id).Count() > 0).ToList();

            if (model.Total > 0)
            {
                if (model.Page > model.Total)
                {
                    return(HttpNotFound());
                }
            }


            return(View(model));
        }
コード例 #26
0
        // GET: Category/Details/5
        public ActionResult Details(int id)
        {
            ViewCategory viewCategory = dal.Get(id);

            return(View(viewCategory));
        }
コード例 #27
0
ファイル: IPointExAttribute.cs プロジェクト: hanleyChu/prj
 public IPointExAttribute(ViewCategory viewCat)
     : this(viewCat, null)
 {
 }
コード例 #28
0
ファイル: IPointExAttribute.cs プロジェクト: jmptrader/Creek
 public IPointExAttribute(ViewCategory viewCat, Type controllerType,
                          bool isCommonTarget)
     : base(controllerType, isCommonTarget)
 {
     this.viewCat = viewCat;
 }
コード例 #29
0
ファイル: IPointExAttribute.cs プロジェクト: hanleyChu/prj
 public IPointExAttribute(ViewCategory viewCat, Type controllerType,
                                                bool isCommonTarget)
     : base(controllerType, isCommonTarget)
 {
     this.viewCat = viewCat;
 }
コード例 #30
0
ファイル: IPointExAttribute.cs プロジェクト: jmptrader/Creek
 public IPointExAttribute(ViewCategory viewCat)
     : this(viewCat, null)
 {
 }
コード例 #31
0
ファイル: IPointExAttribute.cs プロジェクト: hanleyChu/prj
 public IPointExAttribute(ViewCategory viewCat, Type controllerType)
     : this(viewCat, controllerType, true)
 {
 }