Beispiel #1
0
        private void ConvertToTBap(TBapViewModel vm, TBap entity, string ParentProjectId)
        {
            entity.ProjectId = string.IsNullOrEmpty(ParentProjectId) ? null : _TProjectTasks.One(ParentProjectId);
            entity.WorkId    = string.IsNullOrEmpty(vm.WorkId) ? null : _TWorkTasks.One(vm.WorkId);

            entity.BapPeriod = new DateTime(vm.BapPeriod.Value.Year, vm.BapPeriod.Value.Month, 1);
            entity.BapQty    = vm.BapQty;
            entity.BapTotal  = vm.BapQty * vm.WorkPrice;
            entity.BapStatus = vm.BapStatus;
            entity.BapDesc   = vm.BapDesc;
        }
Beispiel #2
0
        public ActionResult TBaps_Create([DataSourceRequest] DataSourceRequest request, TBapViewModel vm, string ParentProjectId)
        {
            if (vm != null && ModelState.IsValid)
            {
                TBap entity = new TBap();
                entity.SetAssignedIdTo(Guid.NewGuid().ToString());

                ConvertToTBap(vm, entity, ParentProjectId);

                entity.CreatedDate = DateTime.Now;
                entity.CreatedBy   = User.Identity.Name;
                entity.DataStatus  = EnumDataStatus.New.ToString();

                _tasks.Insert(entity);
            }

            return(Json(new[] { vm }.ToDataSourceResult(request, ModelState)));
        }