public IActionResult GetVersions(string name) { try { var func = _funcManager.GetFunction(Language.Node, name, throwIfNotFound: false) ?? _funcManager.GetFunction(Language.Ruby, name, throwIfNotFound: true); return(Ok(func.GetVersions())); } catch (FileNotFoundException e) { return(NotFound(e.Message)); } }
protected void Page_Load(object sender, EventArgs e) { Vivina.Erp.DataClasses.Function originalFunction; FunctionManager functionManager; if (!IsPostBack) { if (Context.Items["FunctionId"] != null) { Page.ViewState["FunctionId"] = Context.Items["FunctionId"]; functionManager = new FunctionManager(this); //originalFunction = functionManager.GetFunction(Convert.ToInt32(Page.ViewState["FunctionId"])); originalFunction = functionManager.GetFunction(Convert.ToInt32(Page.ViewState["FunctionId"])); txtName.Text = originalFunction.Name; txtCode.Text = originalFunction.CodeName; txtDescription.Value = originalFunction.Description ?? ""; } } }
protected void btnSave_Click(object sender, EventArgs e) { Vivina.Erp.DataClasses.Function originalFunction = new Vivina.Erp.DataClasses.Function(); FunctionManager functionManager = new FunctionManager(this); Vivina.Erp.DataClasses.Function function = new Vivina.Erp.DataClasses.Function(); if (Page.ViewState["FunctionId"] != null) { originalFunction = functionManager.GetFunction(Convert.ToInt32(Page.ViewState["FunctionId"])); function.CopyPropertiesFrom(originalFunction); } function.Name = txtName.Text; function.CodeName = txtCode.Text; function.Description = txtDescription.Value; SiteMapNode node = SiteMap.RootNode.GetAllNodes().Cast<SiteMapNode>().Where(n => n.ResourceKey == function.FunctionId.ToString()).FirstOrDefault(); if (node != null) node.Description = function.Description; if (Page.ViewState["FunctionId"] != null) //functionManager.update(originalFunction, function); functionManager.Update(originalFunction, function); else functionManager.InsertFunction(function); Server.Transfer("Functions.aspx"); }
protected void btnSave_Click(object sender, EventArgs e) { Vivina.Erp.DataClasses.Function originalFunction = new Vivina.Erp.DataClasses.Function(); FunctionManager functionManager = new FunctionManager(this); Vivina.Erp.DataClasses.Function function = new Vivina.Erp.DataClasses.Function(); if (Page.ViewState["FunctionId"] != null) { originalFunction = functionManager.GetFunction(Convert.ToInt32(Page.ViewState["FunctionId"])); function.CopyPropertiesFrom(originalFunction); } function.Name = txtName.Text; function.CodeName = txtCode.Text; function.Description = txtDescription.Value; SiteMapNode node = SiteMap.RootNode.GetAllNodes().Cast <SiteMapNode>().Where(n => n.ResourceKey == function.FunctionId.ToString()).FirstOrDefault(); if (node != null) { node.Description = function.Description; } if (Page.ViewState["FunctionId"] != null) { //functionManager.update(originalFunction, function); functionManager.Update(originalFunction, function); } else { functionManager.InsertFunction(function); } Server.Transfer("Functions.aspx"); }
/// <summary> /// Perform the full SiteMapTree and register functions /// </summary> /// <param name="node">SiteMapNode that will registered</param> /// <returns>Id the function</returns> protected virtual void RegisterFunctions(SiteMapNode node) { node.ReadOnly = false; isRegisterFunctions = true; // // Check if the function is registered // var function = new Function(); string permissionRequiredKey = Resources.PermissionRequiredKey; if (!String.IsNullOrEmpty(node[permissionRequiredKey])) { // // Get the full path name // String title = node.Title; SiteMapNode parentNode = node.ParentNode; while (parentNode != null && !String.IsNullOrEmpty(parentNode.Title)) { title = parentNode.Title + " > " + title; parentNode = parentNode.ParentNode; } title = title.Trim().Trim('>').Trim(); function = functions.Where(f => f.Name == title).FirstOrDefault() ?? new Function(); function.Name = title; if (function.FunctionId == 0) { function.CodeName = node[permissionRequiredKey].Trim(); using (var manager = new FunctionManager(null)) manager.Insert(function); } else { node.ResourceKey = function.FunctionId.ToString(); if (!String.IsNullOrEmpty(function.Description)) node.Description = function.Description; if (!String.IsNullOrEmpty(node.ParentNode.ResourceKey)) if (function.ParentId.ToString() != node.ParentNode.ResourceKey) using (var manager = new FunctionManager(null)) { // Recupera do banco para criar o link e deixar o objeto ativo function = manager.GetFunction(title); function.ParentId = Convert.ToInt32(node.ParentNode.ResourceKey); manager.DbContext.SubmitChanges(); } } } var args = new CreatingSiteMapNodeArgs(node, node[permissionRequiredKey], function.FunctionId); CreatingSiteMapNodeEventHandler(new object(), args); isRegisterFunctions = false; // // Perfoms the tree // foreach (SiteMapNode childNode in node.ChildNodes) RegisterFunctions(childNode); }
private IEnumerator ExeFunction(Card card) { //进入繁忙状态, 将不再监听卡牌 isBusy = true; //GameController和IA的繁忙状态必须同步 act.SetBusy(isBusy); CardData cardData = null; CardData nCardData = null; ////////////////////////////卡牌阶段////////////////////////////// if (card != null) { cardData = card.CurCardData; card.UseCard(); Debug.Log("选择卡牌 " + cardData.name + " 使用技能"); /////////////////////应用数据效果///////////////////// //应用数据效果 currentPlayer.PD.money += (-cardData.cost.money + cardData.gain.money); currentPlayer.PD.score += (-cardData.cost.point + cardData.gain.point); Debug.Log("玩家" + currentPlayer.name + "付出代价: 金钱:" + cardData.cost.money + " 分数:" + cardData.cost.point); Debug.Log("玩家" + currentPlayer.name + "得到增益: 金钱:" + cardData.gain.money + " 分数:" + cardData.gain.point); Debug.Log("玩家" + currentPlayer.name + "总分为: 金钱:" + currentPlayer.PD.money + " 分数:" + currentPlayer.PD.score); //执行特殊函数 for (int i = 0; i < cardData.specialFunctions.Length; i++) { Debug.Log("this is " + i); Debug.Log("mode is " + cardData.specialFunctions[i].functionMode); isFunctionEnd = false; FunctionManager.FunctionDelegate function = functionManager.GetFunction(cardData.specialFunctions[i].functionMode); PlayerBehaviour player = GetPlayer(cardData.specialFunctions[i].self); function(player, cardData.specialFunctions[i].parameters); //等待前端响应 while (!isFunctionEnd) { yield return(new WaitForEndOfFrame()); } } /////////////////////为player换牌///////////////////// cardFactory.Return(cardData); //当if不存在, 只看else if (replaceWithSelectCard && mSelectedCard.Count > 0) { int index = Random.Range(0, mSelectedCard.Count - 1); nCardData = mSelectedCard[index]; replaceWithSelectCard = false; } else { nCardData = cardFactory.Get(); } Debug.Log("放回旧牌: " + cardData.name + cardData.id + " 得到新牌: " + nCardData.name + nCardData.id); isSkillEnd = false; card.CurCardData = nCardData; Debug.Log(card.name + "上的牌是: " + nCardData.name + nCardData.id); currentPlayer.UseCardSkill(cardData, nCardData); //等待玩家换牌完毕 while (!isSkillEnd) { yield return(new WaitForEndOfFrame()); } } else { currentPlayer.UseCardSkill(null, null); } state = States.mapFunc; isBusy = false; //GameController和IA的繁忙状态必须同步 act.SetBusy(isBusy); StartCoroutine(ExeStationEvent()); }
public Function GetFunction(int id) { return(_functionManager.GetFunction(id)); }