コード例 #1
0
        public bool TryGetReference(string uid, out ReferenceViewModel vm)
        {
            ReferenceViewModel          result = null;
            ReferenceViewModelCacheItem ci;

            if (_cache.TryFind(x => x.Block.TryGetValue(uid, out result), out ci))
            {
                vm = result;
                return(true);
            }
            foreach (var reader in Readers)
            {
                var entries = reader.GetInternal(uid);
                if (entries == null)
                {
                    continue;
                }
                foreach (var entry in entries)
                {
                    ci = new ReferenceViewModelCacheItem(entry.PackageFile, entry.EntryName, entry.Content);
                    _cache.Access(ci);
                    if (ci.Block.TryGetValue(uid, out vm))
                    {
                        return(true);
                    }
                }
            }
            vm = null;
            return(false);
        }
コード例 #2
0
ファイル: ApiNamesSpecResolver.cs プロジェクト: zyj0021/docfx
        public List <ApiLanguageValuePair <string> > Resolve(ReferenceViewModel source, ApiNames destination, List <ApiLanguageValuePair <string> > destMember, ResolutionContext context)
        {
            var result = new List <ApiLanguageValuePair <string> >();
            var specs  = source.Specs;

            foreach (var language in _supportedLanguages)
            {
                if (specs?.ContainsKey(language) == true)
                {
                    result.Add(new ApiLanguageValuePair <string>
                    {
                        Language = language,
                        Value    = GetSpecName(specs[language])
                    });
                }
                else
                {
                    result.Add(new ApiLanguageValuePair <string>
                    {
                        Language = language,
                        Value    = ModelConverter.GetXref(source.Uid, source.Name, source.FullName)
                    });
                }
            }
            return(result);
        }
コード例 #3
0
 private void FillContent(ReferenceViewModel r, dynamic item)
 {
     r.Additional["summary"]  = item.Summary;
     r.Additional["type"]     = item.Type;
     r.Additional["syntax"]   = item.Syntax;
     r.Additional["platform"] = item.Platform;
 }
コード例 #4
0
        private static ReferenceViewModel ToReferenceViewModel(KeyValuePair <string, ReferenceItem> model)
        {
            Debug.Assert(model.Value != null, "Unexpected reference.");
            var result = new ReferenceViewModel
            {
                Uid        = model.Key,
                CommentId  = model.Value.CommentId,
                Parent     = model.Value.Parent,
                Definition = model.Value.Definition,
            };

            if (model.Value.Parts != null && model.Value.Parts.Count > 0)
            {
                result.Name = GetName(model.Value, SyntaxLanguage.Default, l => l.DisplayName);
                var nameForCSharp = GetName(model.Value, SyntaxLanguage.CSharp, l => l.DisplayName);
                if (result.Name != nameForCSharp)
                {
                    result.NameInDevLangs[Constants.DevLang.CSharp] = nameForCSharp;
                }
                var nameForVB = GetName(model.Value, SyntaxLanguage.VB, l => l.DisplayName);
                if (result.Name != nameForVB)
                {
                    result.NameInDevLangs[Constants.DevLang.VB] = nameForVB;
                }

                result.NameWithType = GetName(model.Value, SyntaxLanguage.Default, l => l.DisplayNamesWithType);
                var nameWithTypeForCSharp = GetName(model.Value, SyntaxLanguage.CSharp, l => l.DisplayNamesWithType);
                if (result.NameWithType != nameWithTypeForCSharp)
                {
                    result.NameWithTypeInDevLangs[Constants.DevLang.CSharp] = nameWithTypeForCSharp;
                }
                var nameWithTypeForVB = GetName(model.Value, SyntaxLanguage.VB, l => l.DisplayNamesWithType);
                if (result.NameWithType != nameWithTypeForVB)
                {
                    result.NameWithTypeInDevLangs[Constants.DevLang.VB] = nameWithTypeForVB;
                }

                result.FullName = GetName(model.Value, SyntaxLanguage.Default, l => l.DisplayQualifiedNames);
                var fullnameForCSharp = GetName(model.Value, SyntaxLanguage.CSharp, l => l.DisplayQualifiedNames);
                if (result.FullName != fullnameForCSharp)
                {
                    result.FullNameInDevLangs[Constants.DevLang.CSharp] = fullnameForCSharp;
                }
                var fullnameForVB = GetName(model.Value, SyntaxLanguage.VB, l => l.DisplayQualifiedNames);
                if (result.FullName != fullnameForVB)
                {
                    result.FullNameInDevLangs[Constants.DevLang.VB] = fullnameForVB;
                }

                result.Specs[Constants.DevLang.CSharp] = GetSpec(model.Value, SyntaxLanguage.CSharp);
                result.Specs[Constants.DevLang.VB]     = GetSpec(model.Value, SyntaxLanguage.VB);
                result.IsExternal = GetIsExternal(model.Value);
                result.Href       = GetHref(model.Value);
            }
            else
            {
                result.IsExternal = true;
            }
            return(result);
        }
コード例 #5
0
        private void cbPaymentType_EditValueChanged(object sender, EventArgs e)
        {
            ReferenceViewModel refSelected = (sender as DevExpress.XtraEditors.LookUpEdit).GetSelectedDataRow() as ReferenceViewModel;

            if (refSelected != null)
            {
                if (refSelected.Code == DbConstant.REF_INVOICE_PAYMENTMETHOD_UANGMUKA_KAS ||
                    refSelected.Code == DbConstant.REF_INVOICE_PAYMENTMETHOD_UANGMUKA_BANK_EKONOMI ||
                    refSelected.Code == DbConstant.REF_INVOICE_PAYMENTMETHOD_UANGMUKA_BANK_BCA1 ||
                    refSelected.Code == DbConstant.REF_INVOICE_PAYMENTMETHOD_UANGMUKA_BANK_BCA2 ||
                    refSelected.Code == DbConstant.REF_INVOICE_PAYMENTMETHOD_PIUTANG)
                {
                    TotalPayment = 0;
                }
                else
                {
                    TotalPayment = TotalTransaction;
                }

                if (refSelected.Code == DbConstant.REF_INVOICE_PAYMENTMETHOD_UANGMUKA_KAS ||
                    refSelected.Code == DbConstant.REF_INVOICE_PAYMENTMETHOD_UANGMUKA_BANK_EKONOMI ||
                    refSelected.Code == DbConstant.REF_INVOICE_PAYMENTMETHOD_UANGMUKA_BANK_BCA1 ||
                    refSelected.Code == DbConstant.REF_INVOICE_PAYMENTMETHOD_UANGMUKA_BANK_BCA2)
                {
                    txtTotalPayment.ReadOnly = false;
                }
                else
                {
                    txtTotalPayment.ReadOnly = true;
                }
            }
        }
コード例 #6
0
        private void MergeWithReference(ItemViewModel item, ReferenceViewModel reference)
        {
            item.Name         = reference.Name;
            item.NameWithType = reference.NameWithType;
            item.FullName     = reference.FullName;
            item.CommentId    = reference.CommentId;

            if (reference.NameInDevLangs.Count > 0)
            {
                foreach (var pair in item.Names)
                {
                    item.Metadata[Constants.ExtensionMemberPrefix.Name + pair.Key] = pair.Value;
                }
            }
            if (reference.FullNameInDevLangs.Count > 0)
            {
                foreach (var pair in item.FullNames)
                {
                    item.Metadata[Constants.ExtensionMemberPrefix.FullName + pair.Key] = pair.Value;
                }
            }
            if (reference.NameWithTypeInDevLangs.Count > 0)
            {
                foreach (var pair in item.NamesWithType)
                {
                    item.Metadata[Constants.ExtensionMemberPrefix.NameWithType + pair.Key] = pair.Value;
                }
            }
        }
コード例 #7
0
        private static XRefSpec GetXRefInfo(ReferenceViewModel item, string key)
        {
            var result = GetXRefSpecFromReference(item);

            result.Href = ((RelativePath)key).UrlEncode().ToString();
            return(result);
        }
コード例 #8
0
        private void MergeWithReference(ItemViewModel item, ReferenceViewModel reference)
        {
            item.Name         = reference.Name;
            item.NameWithType = reference.NameWithType;
            item.FullName     = reference.FullName;
            item.CommentId    = reference.CommentId;

            if (reference.NameInDevLangs.Count > 0)
            {
                foreach (var pair in reference.NameInDevLangs)
                {
                    item.Names[pair.Key] = pair.Value;
                }
            }
            if (reference.FullNameInDevLangs.Count > 0)
            {
                foreach (var pair in reference.FullNameInDevLangs)
                {
                    item.FullNames[pair.Key] = pair.Value;
                }
            }
            if (reference.NameWithTypeInDevLangs.Count > 0)
            {
                foreach (var pair in reference.NameWithTypeInDevLangs)
                {
                    item.NamesWithType[pair.Key] = pair.Value;
                }
            }
        }
コード例 #9
0
        public static ApiReferenceBuildOutput FromModel(ReferenceViewModel vm, string[] supportedLanguages)
        {
            if (vm == null)
            {
                return(null);
            }

            // TODO: may lead to potential problems with have vm.Additional["syntax"] as SyntaxDetailViewModel
            // It is now working as syntax is set only in FillReferenceInformation and not from YAML deserialization
            var result = new ApiReferenceBuildOutput
            {
                Uid          = vm.Uid,
                Id           = Utility.GetHtmlId(vm.Uid),
                Parent       = vm.Parent,
                Definition   = vm.Definition,
                IsExternal   = vm.IsExternal,
                Href         = vm.Href,
                Name         = ApiBuildOutputUtility.TransformToLanguagePairList(vm.Name, vm.NameInDevLangs, supportedLanguages),
                NameWithType = ApiBuildOutputUtility.TransformToLanguagePairList(vm.NameWithType, vm.NameWithTypeInDevLangs, supportedLanguages),
                FullName     = ApiBuildOutputUtility.TransformToLanguagePairList(vm.FullName, vm.FullNameInDevLangs, supportedLanguages),
                Spec         = GetSpecNames(ApiBuildOutputUtility.GetXref(vm.Uid, vm.FullName, vm.Name), supportedLanguages, vm.Specs),
                Metadata     = vm.Additional,
            };
            object syntax;

            if (result.Metadata.TryGetValue("syntax", out syntax))
            {
                result.Syntax = ApiSyntaxBuildOutput.FromModel(syntax as SyntaxDetailViewModel, supportedLanguages);
                result.Metadata.Remove("syntax");
            }
            return(result);
        }
コード例 #10
0
        bool ApprovalCheck()
        {
            bool result = false;

            ReferenceViewModel selectedReference = lookUpCategory.Properties.GetDataSourceRowByKeyValue(lookUpCategory.EditValue) as ReferenceViewModel;
            decimal            vehicleBills      = _presenter.GetAllPurchaseByVehicleToday();

            #region contract as high priority
            //if (this.isContractWork && (this.ContractWorkFee + vehicleBills) + this.CostEstimation.AsDecimal() >= this.ContractThreshold)
            //{
            //    result = true;
            //}
            //else
            //{
            //    if (selectedReference.Code == DbConstant.REF_SPK_CATEGORY_SERVICE &&
            //        (this.TotalSparepartPrice + vehicleBills) + this.CostEstimation.AsDecimal() >= this.ServiceThreshold)
            //    {
            //        result = true;
            //    }

            //    if (selectedReference.Code == DbConstant.REF_SPK_CATEGORY_REPAIR &&
            //        (this.TotalSparepartPrice + vehicleBills) + this.CostEstimation.AsDecimal() >= this.RepairThreshold)
            //    {
            //        result = true;
            //    }
            //}
            #endregion

            if (selectedReference.Code == DbConstant.REF_SPK_CATEGORY_SERVICE)
            {
                if (isContractWork && ContractWorkFee >= this.ContractThreshold)
                {
                    result = true;
                }
                else if ((this.TotalSparepartPrice + vehicleBills) + this.CostEstimation.AsDecimal() >= this.ServiceThreshold)
                {
                    result = true;
                }
            }

            if (selectedReference.Code == DbConstant.REF_SPK_CATEGORY_REPAIR)
            {
                if (isContractWork && ContractWorkFee >= this.ContractThreshold)
                {
                    result = true;
                }
                else if ((this.TotalSparepartPrice + vehicleBills) + this.CostEstimation.AsDecimal() >= this.RepairThreshold)
                {
                    result = true;
                }

                //always true?
                //result = true;
            }

            return(result);
        }
コード例 #11
0
        public ActionResult Index()
        {
            ReferenceViewModel model = new ReferenceViewModel();

            model.FolderTree      = GetCurrentFolderTree();
            model.CurrentLanguage = CurrentLanguage;
            model.PageTitle       = "Index";
            return(View(model));
        }
コード例 #12
0
        public ViewResult Detail(int id)
        {
            ReferenceInfoDto   reference = GetReference(id);
            ReferenceViewModel model     = new ReferenceViewModel(reference);

            model.FolderTree      = GetCurrentFolderTree(reference.FolderId);
            model.CurrentLanguage = CurrentLanguage;
            model.PageTitle       = string.Format("Page Detail: {0}", model.Instance.Name);
            return(View(model));
        }
コード例 #13
0
 public override void RefreshDataView()
 {
     if (!bgwMain.IsBusy)
     {
         MethodBase.GetCurrentMethod().Info("Fecthing category journal account data...");
         SelectedChildren = null;
         FormHelpers.CurrentMainForm.UpdateStatusInformation("Memuat data kategori akun jurnal...", false);
         bgwMain.RunWorkerAsync();
     }
 }
        public void UpdateChildren(ReferenceViewModel children)
        {
            if (!Validate(children.Id, children.ParentId, children.Value)) return;

            Reference entity = _referenceRepository.GetById(children.Id);
            Map(children, entity);
            _referenceRepository.AttachNavigation<Reference>(entity.Parent);
            _referenceRepository.Update(entity);
            _unitOfWork.SaveChanges();
        }
        public void InsertChildren(ReferenceViewModel children)
        {
            if (!Validate(children.ParentId, children.Value)) return;

            Reference entity = new Reference();
            Map(children, entity);
            _referenceRepository.AttachNavigation<Reference>(entity.Parent);
            _referenceRepository.Add(entity);
            _unitOfWork.SaveChanges();
        }
コード例 #16
0
ファイル: Program.cs プロジェクト: yigedakoudaiya/docfx
        private void RebuildReference()
        {
            var references = GetReferences();

            foreach (var model in GetViewModels())
            {
                bool dirty = false;
                // Add references for exceptions
                var types = from i in model.Item2.Items
                            where i.Exceptions != null
                            from e in i.Exceptions
                            select e.Type;
                HashSet <string> set = new HashSet <string>(model.Item2.References.Select(r => r.Uid));
                foreach (var type in types)
                {
                    if (set.Add(type))
                    {
                        ReferenceViewModel reference;
                        if (!references.TryGetValue(type, out reference))
                        {
                            reference = references[type] = new ReferenceViewModel()
                            {
                                Uid = type
                            };
                        }

                        model.Item2.References.Add(reference);
                        dirty = true;
                    }
                }

                // Add summary for classes in namespace
                if (model.Item2.Items[0].Type == MemberType.Namespace)
                {
                    foreach (var reference in model.Item2.References)
                    {
                        if (reference.Type == MemberType.Class || reference.Type == MemberType.Delegate || reference.Type == MemberType.Enum || reference.Type == MemberType.Interface || reference.Type == MemberType.Struct)
                        {
                            ReferenceViewModel refWithSummary;
                            if (references.TryGetValue(reference.Uid, out refWithSummary))
                            {
                                reference.Summary = refWithSummary.Summary;
                                dirty             = true;
                            }
                        }
                    }
                }

                if (dirty)
                {
                    Console.WriteLine($"Rebuilding references: {model.Item1}");
                    YamlUtility.Serialize(model.Item1, model.Item2);
                }
            }
        }
コード例 #17
0
        private void lookUpCategory_EditValueChanged(object sender, EventArgs e)
        {
            LookUpEdit lookup = sender as LookUpEdit;

            ReferenceViewModel category = lookup.GetSelectedDataRow() as ReferenceViewModel;

            if (category.Code == DbConstant.REF_SPK_CATEGORY_SALE)
            {
                this.IsSPKSales = true;
            }
        }
コード例 #18
0
        public static ReferenceViewModel ToViewModel(this ResourceReference resourceReference)
        {
            var refIdPos = resourceReference.Reference.LastIndexOf("/");

            var viewModel = new ReferenceViewModel
            {
                Id        = resourceReference.Reference?.Substring(refIdPos + 1),
                Reference = resourceReference.Reference
            };

            return(viewModel);
        }
コード例 #19
0
        private static XRefSpec GetXRefSpecFromReference(ReferenceViewModel item)
        {
            var result = new XRefSpec
            {
                Uid       = item.Uid,
                Name      = item.Name,
                Href      = item.Href,
                CommentId = item.CommentId,
                IsSpec    = item.IsExternal != true,
            };

            if (item.NameInDevLangs.Count > 0)
            {
                foreach (var pair in item.NameInDevLangs)
                {
                    result["name." + pair.Key] = pair.Value;
                }
            }
            if (!string.IsNullOrEmpty(item.FullName))
            {
                result["fullName"] = item.FullName;
            }
            if (item.FullNameInDevLangs.Count > 0)
            {
                foreach (var pair in item.FullNameInDevLangs)
                {
                    result["fullName." + pair.Key] = pair.Value;
                }
            }
            if (!string.IsNullOrEmpty(item.NameWithType))
            {
                result["nameWithType"] = item.NameWithType;
            }
            if (item.NameWithTypeInDevLangs.Count > 0)
            {
                foreach (var pair in item.NameWithTypeInDevLangs)
                {
                    result["nameWithType." + pair.Key] = pair.Value;
                }
            }
            if (item.Additional != null)
            {
                foreach (var pair in item.Additional)
                {
                    if (pair.Value is string s)
                    {
                        result[pair.Key] = s;
                    }
                }
            }
            return(result);
        }
コード例 #20
0
        private void bgwMain_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            if (e.Result is Exception)
            {
                this.ShowError("Proses memuat data gagal!");
            }

            if (gvCatJournal.RowCount > 0)
            {
                SelectedChildren = gvCatJournal.GetRow(0) as ReferenceViewModel;
            }

            FormHelpers.CurrentMainForm.UpdateStatusInformation("Memuat data kategori akun selesai", true);
        }
コード例 #21
0
        public void UpdateChildren(ReferenceViewModel children)
        {
            if (!Validate(children.Id, children.ParentId, children.Value))
            {
                return;
            }

            Reference entity = _referenceRepository.GetById(children.Id);

            Map(children, entity);
            _referenceRepository.AttachNavigation <Reference>(entity.Parent);
            _referenceRepository.Update(entity);
            _unitOfWork.SaveChanges();
        }
コード例 #22
0
        public void InsertChildren(ReferenceViewModel children)
        {
            if (!Validate(children.ParentId, children.Value))
            {
                return;
            }

            Reference entity = new Reference();

            Map(children, entity);
            _referenceRepository.AttachNavigation <Reference>(entity.Parent);
            _referenceRepository.Add(entity);
            _unitOfWork.SaveChanges();
        }
コード例 #23
0
        public async Task <ActionResult> Index(CancellationToken cancellationToken)
        {
            var home         = pageDataContextRetriever.Retrieve <Home>().Page;
            var homeSections = await homeSectionRepository.GetHomeSectionsAsync(home.NodeAliasPath, cancellationToken);

            var reference = (await referenceRepository.GetReferencesAsync(home.NodeAliasPath, cancellationToken, 1)).FirstOrDefault();

            var viewModel = new HomeIndexViewModel
            {
                HomeSections = homeSections.Select(section => HomeSectionViewModel.GetViewModel(section, pageUrlRetriever, attachmentUrlRetriever)),
                Reference    = ReferenceViewModel.GetViewModel(reference, attachmentUrlRetriever)
            };

            return(View(viewModel));
        }
コード例 #24
0
        public bool TryGetReference(string uid, out ReferenceViewModel vm)
        {
            vm = null;
            var entries = GetInternal(uid);

            if (entries == null)
            {
                return(false);
            }
            vm = (from entry in entries
                  from item in entry.Content
                  where item.Uid == uid
                  select item).FirstOrDefault();
            return(vm != null);
        }
コード例 #25
0
        public async Task <ActionResult> Index(CancellationToken cancellationToken)
        {
            var aboutUs = dataRetriever.Retrieve <AboutUs>().Page;

            var sideStories = await aboutUsRepository.GetSideStoriesAsync(aboutUs.NodeAliasPath, cancellationToken);

            var reference = (await referenceRepository.GetReferencesAsync($"{aboutUs.NodeAliasPath}/References", cancellationToken, 1)).FirstOrDefault();

            AboutUsViewModel mode = new AboutUsViewModel()
            {
                Sections  = sideStories.Select(s => AboutUsSectionViewModel.GetViewModel(s, pageAttachmentUrlRetriever)).ToList(),
                Reference = ReferenceViewModel.GetViewModel(reference, pageAttachmentUrlRetriever)
            };

            return(View(mode));
        }
コード例 #26
0
        public ActionResult Index(int?refTypeId)
        {
            if (refTypeId == null)
            {
                return(View("Blank"));
            }

            //the grid called... 2?Grid-mode=insert
            ToolbarMenuHelpers.SetToolBar(ViewData, new { New = "Index" }, "Reference",
                                          new RouteValueDictionary {
                { "Grid-mode", "insert" }, { "refTypeId", refTypeId }
            }, null, true);

            ReferenceViewModel refVM = new ReferenceViewModel(refRepo, refTypeId ?? 0);

            populateReferences(refTypeId ?? 0);
            return(View("Index", refVM));
        }
コード例 #27
0
        private string AddOverloadReference(ArticleItemYaml yaml)
        {
            string id      = yaml.Uid;
            var    uidBody = RemoveArgs(id);

            uidBody = GenericMethodPostFix.Replace(uidBody, string.Empty);
            string             uid       = uidBody + "*";
            ReferenceViewModel reference = new ReferenceViewModel()
            {
                Uid          = uid,
                Name         = RemoveArgs(yaml.Name),
                FullName     = RemoveArgs(yaml.FullName),
                NameWithType = RemoveArgs(yaml.NameWithType),
                PackageName  = yaml.PackageName,
            };

            _references.Add(reference);
            return(uid);
        }
        protected override void ExecuteSave()
        {
            ReferenceViewModel selectedTransactionType = ListTransactionTypeReference.Where(x => x.Id == this.TransactionTypeId).FirstOrDefault();

            if (valMode.Validate() && valQty.Validate() && valItemPrice.Validate() &&
                this.StockUpdate > 0 && selectedTransactionType != null &&
                (selectedTransactionType.Value == DbConstant.REF_SPAREPART_TRANSACTION_MANUAL_TYPE_PLUS ||
                 (selectedTransactionType.Value == DbConstant.REF_SPAREPART_TRANSACTION_MANUAL_TYPE_MINUS && this.Stock >= this.StockUpdate)
                )
                )
            {
                bool ok = true;
                if (this.IsSpecialSparepart)
                {
                    if (string.IsNullOrEmpty(this.SerialNumber))
                    {
                        ok = false;
                        this.ShowWarning("Nomor seri harus diisi.");
                    }
                    else if (_presenter.IsSerialNumberExist())
                    {
                        ok = false;
                        this.ShowWarning("Nomor seri " + this.SerialNumber + " sudah digunakan.");
                    }
                }

                if (ok)
                {
                    try
                    {
                        MethodBase.GetCurrentMethod().Info("Save Sparepart Transaction's changes");
                        _presenter.SaveChanges();
                        this.Close();
                    }
                    catch (Exception ex)
                    {
                        MethodBase.GetCurrentMethod().Fatal("An error occured while trying to save SparepartManualTransaction: '" + SelectedSparepartManualTransaction.Sparepart.Name + "'", ex);
                        this.ShowError("Proses simpan data transaksi barang bekas: '" + SelectedSparepartManualTransaction.Sparepart.Name + "' gagal!");
                    }
                }
            }
        }
コード例 #29
0
        private static XRefSpec GetXRefInfo(ReferenceViewModel item, string key)
        {
            var result = new XRefSpec
            {
                Uid       = item.Uid,
                Name      = item.Name,
                Href      = ((RelativePath)key).UrlEncode().ToString(),
                CommentId = item.CommentId,
            };

            if (item.NameInDevLangs.Count > 0)
            {
                foreach (var pair in item.NameInDevLangs)
                {
                    result["name." + pair.Key] = pair.Value;
                }
            }
            if (!string.IsNullOrEmpty(item.FullName))
            {
                result["fullName"] = item.FullName;
            }
            if (item.FullNameInDevLangs.Count > 0)
            {
                foreach (var pair in item.FullNameInDevLangs)
                {
                    result["fullName." + pair.Key] = pair.Value;
                }
            }
            if (!string.IsNullOrEmpty(item.NameWithType))
            {
                result["nameWithType"] = item.NameWithType;
            }
            if (item.NameWithTypeInDevLangs.Count > 0)
            {
                foreach (var pair in item.NameWithTypeInDevLangs)
                {
                    result["nameWithType." + pair.Key] = pair.Value;
                }
            }
            return(result);
        }
コード例 #30
0
        private void cbPayment_EditValueChanged(object sender, EventArgs e)
        {
            ReferenceViewModel refSelected = (sender as DevExpress.XtraEditors.LookUpEdit).GetSelectedDataRow() as ReferenceViewModel;

            if (refSelected != null)
            {
                if (refSelected.Code == DbConstant.REF_PURCHASE_PAYMENTMETHOD_UANGMUKA_KAS ||
                    refSelected.Code == DbConstant.REF_PURCHASE_PAYMENTMETHOD_UANGMUKA_BANK_EKONOMI ||
                    refSelected.Code == DbConstant.REF_PURCHASE_PAYMENTMETHOD_UANGMUKA_BANK_BCA1 ||
                    refSelected.Code == DbConstant.REF_PURCHASE_PAYMENTMETHOD_UANGMUKA_BANK_BCA2)
                {
                    txtDP.Visible = true;
                    lblDP.Visible = true;
                }
                else
                {
                    txtDP.Visible = false;
                    lblDP.Visible = false;
                }
            }
        }
コード例 #31
0
        public async Task <IActionResult> CreateOrEditCategory(ReferenceEnum type, int?id)
        {
            var model = new ReferenceViewModel();

            if (id.HasValue)
            {
                model = ObjectMapper.Map <ReferenceViewModel>(await _referenceAppService.Get((int)id, type));
            }
            model.Type = type;
            if (type == ReferenceEnum.SubCategory)
            {
                model.Categories = await _referenceAppService.GetList(ReferenceEnum.Category);

                model.Types = await _referenceAppService.GetList(ReferenceEnum.SubCategoryType);
            }
            else if (type == ReferenceEnum.SubCategoryType)
            {
                model.Types = await _referenceAppService.GetList(ReferenceEnum.SubCategory);
            }
            return(PartialView("_CreateOrEditCategoryModal", model));
        }
コード例 #32
0
        private async Task <List <ReferenceViewModel> > GetReferenceVMAsync(ClassEntry entry)
        {
            List <ReferenceViewModel> result = new List <ReferenceViewModel>(entry.Items.Count);
            var type = entry.Items.Find(item => item.Uid == entry.EntryName);
            ReferenceViewModel typeVM = null;

            if (type != null)
            {
                typeVM = await GetViewModelItemAsync(type);

                result.Add(typeVM);
            }
            int size = 0;

            foreach (var vmsTask in
                     from block in
                     (from item in entry.Items
                      where item != type
                      select item).BlockBuffer(() => size = size * 2 + 1)
                     select Task.WhenAll(from item in block select GetViewModelItemAsync(item)))
            {
                result.AddRange(await vmsTask);
            }
            if (typeVM != null && typeVM.Href != null)
            {
                // handle enum field, or other one-page-member
                foreach (var item in result)
                {
                    if (item.Href == null)
                    {
                        item.Href = typeVM.Href;
                    }
                }
            }
            else
            {
                result.RemoveAll(item => item.Href == null);
            }
            return(result);
        }
コード例 #33
0
ファイル: ReferenceDetail.xaml.cs プロジェクト: kehh/biolink
        public ReferenceDetail(User user, int referenceID, bool readOnly)
            : base(user, "Reference:" + referenceID)
        {
            InitializeComponent();

            this.IsReadOnly = readOnly;

            var refTypeList = new List<RefTypeMapping>();
            foreach (string reftypecode in SupportService.RefTypeMap.Keys) {
                refTypeList.Add(SupportService.RefTypeMap[reftypecode]);
            }

            Reference model = null;
            if (referenceID >= 0) {
                var service = new SupportService(user);
                model = service.GetReference(referenceID);
            } else {
                model = new Reference();
                model.RefID = -1;
                txtRefCode.IsReadOnly = false;
                Loaded += new RoutedEventHandler(ReferenceDetail_Loaded);
                model.RefType = refTypeList[0].RefTypeCode;
            }

            _viewModel = new ReferenceViewModel(model);

            _viewModel.DataChanged += new DataChangedHandler(viewModel_DataChanged);

            this.DataContext = _viewModel;

            cmbRefType.ItemsSource = refTypeList;
            cmbRefType.DisplayMemberPath = "RefTypeName";

            txtPossess.BindUser(User, PickListType.Phrase, "Reference Possess", TraitCategoryType.Reference);
            txtSource.BindUser(User, PickListType.Phrase, "Reference Source", TraitCategoryType.Reference);

            _traitsTab = tabRef.AddTabItem("Traits", new TraitControl(User, TraitCategoryType.Reference, _viewModel) { IsReadOnly = readOnly });
            _notesTab = tabRef.AddTabItem("Notes", new NotesControl(User, TraitCategoryType.Reference, _viewModel) { IsReadOnly = readOnly });
            _mmTab = tabRef.AddTabItem("Multimedia", new MultimediaControl(User, TraitCategoryType.Reference, _viewModel) { IsReadOnly = readOnly });
            _linksTab = tabRef.AddTabItem("Taxon Links", new OneToManyControl(new TaxonRefLinksControl(User, _viewModel.RefID)) { IsReadOnly = readOnly });

            _viewModel.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(_viewModel_PropertyChanged);

            tabRef.AddTabItem("Ownership", new OwnershipDetails(_viewModel.Model));

            cmbRefType.SelectionChanged += new SelectionChangedEventHandler(cmbRefType_SelectionChanged);

            this.ChangesCommitted += new PendingChangesCommittedHandler(ReferenceDetail_ChangesCommitted);
        }