Пример #1
0
        [HttpPost]/*, ValidateAntiForgeryToken]*/
        public ActionResult AddIntellectual(IntellectualModel model)
        {
            if (ModelState.IsValid && MainObject.CheckUserHasWriteAccess(model.MainId))
            {
                model.Save();

                return(PartialView("Partials/_intellectualList", IntellectualPropertyObject.GetIntellectualProperties(model.MainId)));
            }

            return(null);
        }
Пример #2
0
        public void Save()
        {
            bool needSave = false;

            if (string.IsNullOrWhiteSpace(IdrNumber))
            {
                return;
            }

            var data = IntellectualPropertyObject.GetIntellectualProperty(IntellectualPropertyId ?? 0) ?? new IntellectualPropertyObject();

            if (data.MainId == 0)
            {
                data.MainId = MainId;
            }

            if (IdrNumber?.Trim() != data.IdrNumber)
            {
                data.IdrNumber = IdrNumber?.Trim();
                needSave       = true;
            }

            if (DocketNumber?.Trim() != data.DocketNumber)
            {
                data.DocketNumber = DocketNumber?.Trim();
                needSave          = true;
            }

            if (Aty?.Trim() != data.Aty)
            {
                data.Aty = Aty?.Trim();
                needSave = true;
            }

            if (Ae?.Trim() != data.Ae)
            {
                data.Ae  = Ae?.Trim();
                needSave = true;
            }

            if (Title?.Trim() != data.Title)
            {
                data.Title = Title?.Trim();
                needSave   = true;
            }

            if (needSave)
            {
                data.Save();
            }
        }
Пример #3
0
        public ActionResult RemoveIntellectual(int?id)
        {
            int mid = 0;

            if (id.HasValue)
            {
                var data = IntellectualPropertyObject.GetIntellectualProperty(id.Value);
                if (data != null)
                {
                    mid = data.MainId;
                    if (MainObject.CheckUserHasWriteAccess(mid))
                    {
                        data.Delete();
                    }
                }
            }

            return(PartialView("Partials/_intellectualList", IntellectualPropertyObject.GetIntellectualProperties(mid)));
        }
Пример #4
0
        public IntellectualModel(int mainId, int?intellectualId)
        {
            MainId        = mainId;
            Intellectuals = IntellectualPropertyObject.GetIntellectualProperties(MainId);

            if (intellectualId.HasValue)
            {
                var ip = IntellectualPropertyObject.GetIntellectualProperty(intellectualId.Value);
                if (ip != null)
                {
                    IntellectualPropertyId = ip.IntellectualPropertyId;
                    IdrNumber    = ip.IdrNumber;
                    DocketNumber = ip.DocketNumber;
                    Aty          = ip.Aty;
                    Ae           = ip.Ae;
                    Title        = ip.Title;
                }
            }
        }