Esempio n. 1
0
 public ActionResult SaveOrUpdate(CommonCode obj)
 {
     if (obj.Id > 0)
     {
         obj = this.CommonCodeRepository.Get(obj.Id);
         TryUpdateModel(obj);
     }
     obj = this.CommonCodeRepository.SaveOrUpdate(obj);
     return JsonSuccess(obj);
 }
Esempio n. 2
0
        public ActionResult Edit(int? id,int? parentid,CommonCodeType? type)
        {
            CommonCode item = null;

            if (id.HasValue)
            {
                item = this.CommonCodeRepository.Get(id.Value);
            }

            if (item == null && parentid.HasValue && type.HasValue)
            {
                item = new CommonCode();
                item.Type = type.Value;
                item.Parent = this.CommonCodeRepository.Get(parentid.Value);
            }

            return View(item);
        }
Esempio n. 3
0
        public ActionResult Edit(int? id, int? parentid, CommonCodeType? type)
        {
            CommonCode item = null;
            String viewName = "Edit";

            if (id.HasValue)
            {
                item = this.CommonCodeRepository.Get(id.Value);
            }

            if (item == null && parentid.HasValue && type.HasValue)
            {
                item = new CommonCode();
                item.Type = type.Value;
                item.Parent = this.CommonCodeRepository.Get(parentid.Value);
            }

            if (item != null)
            {
                viewName += ParseExtName(item.Type);
            }

            return View(viewName,item);
        }
Esempio n. 4
0
 public static CommonCodeModel From(CommonCode commonCode)
 {
     return new CommonCodeModel(commonCode);
 }
Esempio n. 5
0
 public CommonCodeModel(CommonCode commonCode)
 {
     this.Id = commonCode.Id;
     this.ParentId = 0;
     if(commonCode.Parent != null)
         this.ParentId = commonCode.Parent.Id;
     this.Name = commonCode.Name;
     this.FullName = commonCode.FullNameString();
     this.Note = commonCode.Note;
 }
Esempio n. 6
0
        public CommonCodeModel(CommonCode commonCode)
        {
            this.Id = commonCode.Id;
            this.ParentId = 0;
            if (commonCode.Parent != null)
                this.ParentId = commonCode.Parent.Id;
            this.Name = commonCode.Name;
            this.FullName = commonCode.FullNameString();
            this.CodeNo = commonCode.CodeNo;
            this.ParamString = commonCode.ParamString;
            this.ParamFlag = commonCode.ParamFlag;
            this.ParamDecimal = commonCode.ParamDecimal;

            this.Note = commonCode.Note;
        }