コード例 #1
0
        public RequirementTypeContext(RequirementType rType)
        {
            this.TenantId = rType.TenantId;
            this.TypeId = rType.TypeId;
            this.Name = rType.Name;

            this.MatchedProjects = DbUtils.GetProjectsByRequirementType(rType.TypeId);
        }
コード例 #2
0
        public ActionResult Create(string typeName)
        {
            if (!Auth.IsLoggedIn())
            {
                return RedirectToAction("Login", "Home");
            }
            if (!Auth.IsUsingCustomTypes() || !Auth.GetCurrentUser().IsAdmin)
            {
                return RedirectToAction("Index");
            }

            if (string.IsNullOrWhiteSpace(typeName))
            {
                return View();
            }

            RequirementType newType = new RequirementType();
            newType.Name = typeName;

            DbUtils.InsertRequirementType(newType);

            return RedirectToAction("Index");
        }
コード例 #3
0
        public ActionResult Edit(RequirementType rType)
        {
            if (!Auth.IsLoggedIn())
            {
                return RedirectToAction("Login", "Home");
            }
            if (!Auth.IsUsingCustomTypes() || !Auth.GetCurrentUser().IsAdmin)
            {
                return RedirectToAction("Index");
            }

            if (string.IsNullOrWhiteSpace(rType.Name))
            {
                return RedirectToAction("Edit", new { id = rType.TypeId });
            }

            DbUtils.UpdateRequirementType(rType);

            return RedirectToAction("Index");
        }
コード例 #4
0
        public static bool UpdateRequirementType(RequirementType rType)
        {
            bool success = false;

            using (var db = new DataClassesDataContext())
            {
                var target = db.RequirementTypes.Where(t => t.TenantId == Auth.GetTenantId() && t.TypeId == rType.TypeId).FirstOrDefault();
                if (target != null)
                {
                    target.Name = rType.Name;
                    db.SubmitChanges();
                    success = true;
                }
            }

            return success;
        }
コード例 #5
0
        public static bool InsertRequirementType(RequirementType rType)
        {
            bool success = false;
            rType.TenantId = Auth.GetTenantId();

            using (var db = new DataClassesDataContext())
            {
                db.RequirementTypes.InsertOnSubmit(rType);
                db.SubmitChanges();
                success = true;
            }

            return success;
        }
コード例 #6
0
 partial void DeleteRequirementType(RequirementType instance);
コード例 #7
0
 partial void UpdateRequirementType(RequirementType instance);
コード例 #8
0
 partial void InsertRequirementType(RequirementType instance);
コード例 #9
0
		private void detach_RequirementTypes(RequirementType entity)
		{
			this.SendPropertyChanging();
			entity.Tenant = null;
		}