public static void Main(string[] args) { Par <int, string> par = new Par <int, string>(1, "A"); Console.WriteLine(par.getValor()); Console.WriteLine(par.getClave()); }
public ActionResult ParGridViewNew(Par par) { if (ModelState.IsValid) { try { if (par != null) { HseqCaseFile hseqCaseFile; par.CreatedBy = _RecordService.GetCurrentUser().FullName; par = (Par)_RecordService.CreateCaseFile(par, out hseqCaseFile, db); db.HseqRecords.Add(par); db.SaveChanges(); } } catch (Exception e) { ViewData["EditError"] = e.Message; return(PartialView("_ParNewView", par)); } } else { ViewData["EditError"] = "Please, correct all errors."; return(PartialView("_ParNewView", par)); } return(PartialView("_MainContentCallbackPanel")); }
public ActionResult ParGridViewUpdate(ParEditViewModel parEditVM) { if (ModelState.IsValid) { try { if (parEditVM != null) { Par par = db.ParRecords.Find(parEditVM.HseqRecordID); Mapper.Map(parEditVM, par); db.Entry(par).State = EntityState.Modified; db.SaveChanges(); } } catch (Exception e) { ViewData["EditError"] = e.Message; } } else { ViewData["EditError"] = "Please, correct all errors."; return(PartialView("_ParEditView", parEditVM)); } return(PartialView("_MainContentCallbackPanel")); }
void OnSync(Par par) { if (enabled) { int len = (par.vals != null) ? par.vals.Length : 0; if (mList.size == len) { for (int i = 0; i < len; ++i) { ExtendedEntry ext = mList[i]; ext.lastValue = par.vals[i]; if (ext.field != null) { ext.field.SetValue(ext.target, ext.lastValue); } else { ext.property.SetValue(ext.target, ext.lastValue, null); } } } else { Debug.LogError("Mismatched number of parameters sent via TNAutoSync!"); } } }
public HseqRecord CreateLinkedRecord(int recordId, String recordSource, RecordType recordType, ApplicationDbContext db) { HseqRecord sourceRecord = GetSourceRecord(recordId, recordSource, db); //var defaults = PopulateRecordTypeLinked(linkedRecord, RecordType.NCR); HseqRecord newRecord = null; if (recordType == RecordType.NCR) { newRecord = new Ncr(sourceRecord); newRecord.RecordType = RecordType.NCR; } else if (recordType == RecordType.FIS) { newRecord = new Fis(sourceRecord); newRecord.RecordType = RecordType.FIS; } else if (recordType == RecordType.CAR) { newRecord = new Car(sourceRecord); newRecord.RecordType = RecordType.CAR; } else if (recordType == RecordType.PAR) { newRecord = new Par(sourceRecord); newRecord.RecordType = RecordType.PAR; } newRecord.HseqRecordID = sourceRecord.HseqRecordID; sourceRecord.LinkedRecords.Add(newRecord); return(newRecord); }
/// <summary> /// Immediately cache all synchronized values and return whether something actually changed. /// </summary> bool Cache() { bool initial = false; bool changed = false; if (mCached == null) { initial = true; mCached = new Par() { vals = new object[mList.size] }; } for (int i = 0; i < mList.size; ++i) { ExtendedEntry ext = mList[i]; object val = (ext.field != null) ? val = ext.field.GetValue(ext.target) : val = ext.property.GetValue(ext.target, null); if (!val.Equals(ext.lastValue)) { changed = true; } if (initial || changed) { ext.lastValue = val; mCached.vals[i] = val; } } return(changed); }
public ActionResult Create([Bind(Include = "HseqRecordID,AlfrescoNoderef,Title,Description,RecordType,EnteredBy,ReportedBy,HseqCaseFileID,JobNumber,DrawingNumber,status,DateCreated,DateLastUpdated,CreatedBy,LastUpdatedBy,CoordinatorID")] Par par) { if (ModelState.IsValid) { string caseNo; HseqCaseFile hseqCaseFile; par.CreatedBy = _RecordService.GetCurrentUser().FullName; par = (Par)_RecordService.CreateCaseFile(par, out caseNo, out hseqCaseFile, db); db.HseqRecords.Add(par); db.SaveChanges(); //create the folder in Alfresco and return the alfresconoderef //Dummy for now //int alfresconoderef = caseNo; //hseqCaseFile.AlfrescoNoderef = caseNo; //par.AlfrescoNoderef = caseNo; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.HseqCaseFileID = new SelectList(db.HseqCaseFiles, "HseqCaseFileID", "HseqCaseFileID", par.HseqCaseFileID); ViewBag.CoordinatorID = new SelectList(db.HseqUsers, "HseqUserID", "FullName"); return(View(par)); }
/// <summary> /// get default value of an optional parameter (e.g. #_UpLim -> POS_INFINITE) /// note that only 'legal' calls are assumed, therefore throw exceptions otherwise (is a programming error) /// </summary> public static T GetParDefault <T>(string funName, string parName) { Fun fun = GetFunDefinition(funName); if (fun == null) { ReportIllegal(); } Par par = fun.GetParDef(parName); if (par == null) { par = fun.GetGroupParDef(parName, out string dummy); } if (par == null) { ReportIllegal(); return(default(T)); } T defaultValue; try { defaultValue = (T)par.defaultValue; } catch (Exception ex) { ReportIllegal(ex.Message); } return(defaultValue); void ReportIllegal(string exMess = null) { throw new Exception( $"Illegal call of DefinitionAdmin.GetParDefault (funName={funName}, parName={parName}" + exMess == null ? string.Empty : $"{Environment.NewLine}{exMess}"); } }
public ActionResult ParGridViewPartialUpdate(Par item) { var model = db1.ParRecords; if (ModelState.IsValid) { try { var modelItem = model.FirstOrDefault(it => it.HseqRecordID == item.HseqRecordID); if (modelItem != null) { this.UpdateModel(modelItem); db1.SaveChanges(); } } catch (Exception e) { ViewData["EditError"] = e.Message; } } else { ViewData["EditError"] = "Please, correct all errors."; } return(PartialView("_ParGridView", model.ToList())); }
private void hundir(int n) { int i = n; Par parmov = v[i]; int m = 2 * i; // hijo izquierdo de i, si existe while (m <= numElems) { // cambiar al hijo derecho de i si existe y va antes que el izquierdo if ((m < numElems) && ((v[m + 1].prioridad.CompareTo(v[m].prioridad) < 0))) { m = m + 1; } // flotar el hijo m si va antes que el elemento hundiendose if (v[m].prioridad.CompareTo(parmov.prioridad) < 0) { v[i] = v[m]; posiciones[v[i].elem] = i; i = m; m = 2 * i; } else { break; } } v[i] = parmov; posiciones[v[i].elem] = i; }
public static void Main(string[] args) { Par <int, string> mipar = new Par <int, string>(1, "A"); Console.WriteLine(mipar.getAnios()); Console.WriteLine(mipar.getNombre()); Console.WriteLine("Hello World"); }
private static void TrocaValores <T>(Par <T, T> array) { T aux; aux = array.Var1; array.Var1 = array.Var2; array.Var2 = aux; }
//---------------------------BOTONES-------------------------------------------- //----------------------------IA---------------------------------------------- Queue <Nodo> DameAdyacentes(Nodo nodo) { Queue <Nodo> colaAdy = new Queue <Nodo>();//Se crea la cola de nodos bool[] ady = new bool[4]; Par posVacia = EncontrarVacio(nodo.getTablero()); int numAdy; ady = DameMovimientosPosibles(nodo.getTablero(), posVacia, out numAdy); if (UnityEngine.Random.Range(0, 2) == 0) { //Buscamos los adyacentes y los procesamos for (int i = 0; i < ady.Length; i++) { Par posVaciaAux; posVaciaAux.x = posVacia.x; posVaciaAux.y = posVacia.y; if (ady[i]) { int[,] tabAdy = new int[3, 3]; Direccion dir = (Direccion)i; IgualarTablero(ref tabAdy, nodo.getTablero()); IntercambioFichas(ref posVaciaAux, dir, ref tabAdy); Nodo aux = new Nodo(tabAdy, nodo, dir, nodo.getCoste() + 1); colaAdy.Enqueue(aux); } } } else { //Buscamos los adyacentes y los procesamos for (int i = ady.Length - 1; i >= 0; i--) { Par posVaciaAux; posVaciaAux.x = posVacia.x; posVaciaAux.y = posVacia.y; if (ady[i]) { int[,] tabAdy = new int[3, 3]; Direccion dir = (Direccion)i; IgualarTablero(ref tabAdy, nodo.getTablero()); IntercambioFichas(ref posVaciaAux, dir, ref tabAdy); Nodo aux = new Nodo(tabAdy, nodo, dir, nodo.getCoste() + 1); colaAdy.Enqueue(aux); } } } return(colaAdy); }
/// <summary> /// /// </summary> /// <param name="report"></param> /// <param name="transferTemplateUnforgeable"></param> /// <returns></returns> private List <Transaction> FindTransferComm(SingleReport report, Par transferTemplateUnforgeable) { var transfers = new List <ReportProto>(); var transactions = new List <Transaction>(); foreach (var item in report.Events) { if (item.Comm != null) { var channel = item.Comm.Consume.Channels[0]; if (channel.Unforgeables.Count > 0 && channel.Unforgeables[0].GPrivateBody != null && channel.Unforgeables[0].GPrivateBody.Id == transferTemplateUnforgeable.Unforgeables[0].GPrivateBody.Id) { transfers.Add(item); var fromAddr = item.Comm.Produces[0].Data.Pars[0].Exprs[0].GString; var toAddr = item.Comm.Produces[0].Data.Pars[2].Exprs[0].GString; var amount = item.Comm.Produces[0].Data.Pars[3].Exprs[0].GInt; var ret = item.Comm.Produces[0].Data.Pars[5]; transactions.Add(new Transaction() { FromAddress = fromAddr, ToAddress = toAddr, Amount = amount, ret_unforgeable = ret, }); } } } transactions.ForEach((transaction) => { bool walletCreated = false; foreach (var item in report.Events) { if (item.Produce != null) { var channel = item.Produce.Channel; if (channel.Unforgeables.Count > 0 && channel.Unforgeables[0].GPrivateBody != null && channel.Unforgeables[0].GPrivateBody.Id == transaction.ret_unforgeable.Unforgeables[0].GPrivateBody.Id) { var data = item.Produce.Data; var result = data.Pars[0].Exprs[0].ETupleBody.Ps[0].Exprs[0].GBool; var reason = result ? "" : data.Pars[0].Exprs[0].ETupleBody.Ps[1].Exprs[0].GString; transaction.Success = result; transaction.Reason = reason; walletCreated = true; } } } if (walletCreated == false) { transaction.Success = true; transaction.Reason = "Possibly the transfer toAddr wallet is not created in chain. Create the wallet to make transaction succeed."; } }); return(transactions); }
public Object getValue() { Par par = new Par(); par.Key = this.txt_key.Text; par.Label = this.txt_label.Text; par.Value = this.txt_value.Text; return(par); }
void Add_Updatetext(Par par) { Dic dic = par._context as Dic; string msg = dic[EventName.msg] as string; Color color = (Color)dic[EventName.color]; bool nextline = (bool)dic[EventName.nextline]; Updatetext(msg, color, nextline); }
void Start() { crossHair = GameObject.Find("CrossHair"); mainCamera = GameObject.FindGameObjectWithTag("MainCamera"); par = this.GetComponent <Par>(); projectileCamera = GameObject.Find("ShotCamera").GetComponent <LookAtProjectile>(); projectileCamera.enabled = false; }
public bool Insert(Par par) { int rowsAffected = _db.Execute(@"INSERT Par([Naziv],[Adresa],[PostBr]) values (@Naziv, @Adresa, @PostBr)", new { Naziv = par.Naziv, Adresa = par.Adresa, PostBr = "78000" }); if (rowsAffected > 0) { return(true); } return(false); }
public bool Update(Par par) { int rowsAffected = _db.Execute("UPDATE [Par] SET [Naziv] = @Naziv ,[Adresa] = @Adresa, [PostBr] = @PostBr WHERE ParID = " + par.ParID, par); if (rowsAffected > 0) { return(true); } return(false); }
public void AgregarParSegunda() { Defectos defe2 = new Defectos("suela despegada"); Unidad uniizq = new Unidad("izquierdo", defe2); Unidad unider = new Unidad("derecho", defe2); Par par2 = new Par(uniizq, unider); OrdenProduccion op2 = new OrdenProduccion(); op2.AgregarParPrimera(par2); }
public void AgregarParPrimera() { Defectos defe1 = new Defectos("N/A"); Unidad uniizq = new Unidad("izquierdo", defe1); Unidad unider = new Unidad("derecho", defe1); Par par1 = new Par(uniizq, unider); OrdenProduccion op1 = new OrdenProduccion(); op1.AgregarParPrimera(par1); }
public ActionResult DeleteConfirmed(int id) { HseqCaseFile hseqCaseFile = db.HseqCaseFiles.Find(id); Console.WriteLine(hseqCaseFile.HseqRecords); Console.WriteLine(hseqCaseFile.HseqRecords.LongCount()); var tmp = new List <HseqRecord>(hseqCaseFile.HseqRecords); foreach (var hsr in tmp) { //Ncr ncr = db.HseqRecords.Find(hsr.HseqRecordID); HseqRecord hr = db.HseqRecords.Find(hsr.HseqRecordID); if (hr is Ncr) { Ncr ncr = (Ncr)hr; _LinkRecordService.RemoveLinkedRecords(ncr); db.NcrRecords.Remove((Ncr)hr); } else if (hr is Fis) { Fis ncr = (Fis)hr; _LinkRecordService.RemoveLinkedRecords(ncr); db.FisRecords.Remove((Fis)hr); } else if (hr is Car) { Car ncr = (Car)hr; _LinkRecordService.RemoveLinkedRecords(ncr); db.CarRecords.Remove((Car)hr); } else if (hr is Par) { Par ncr = (Par)hr; _LinkRecordService.RemoveLinkedRecords(ncr); db.ParRecords.Remove((Par)hr); } } db.HseqCaseFiles.Remove(hseqCaseFile); db.SaveChanges(); return(RedirectToAction("Index")); }
//Reestablece el tablero al pulsar el botón de Reestablecer public void OnClickRestablecer() { if (_puedoMover) { IgualarTablero(ref _tablero, _tableroCopia); _posVacia = EncontrarVacio(_tablero); UpdateTablero(); } }
//Devuelve todos los movimientos que puede hacer una posVacia y el número de posibles en un parámetro out bool[] DameMovimientosPosibles(int[,] tab, Par posVaciaAux, out int numAdy) { bool[] direcciones = new bool[4]; numAdy = 0; //Comprobar izquierda if ((posVaciaAux.x >= 1)) { direcciones[1] = true; numAdy++; } else { direcciones[1] = false; } //Comprobar derecha if ((posVaciaAux.x <= 1)) { direcciones[3] = true; numAdy++; } else { direcciones[3] = false; } //Comprobar arriba if ((posVaciaAux.y >= 1)) { direcciones[0] = true; numAdy++; } else { direcciones[0] = false; } //Comprobar abajo if ((posVaciaAux.y <= 1)) { direcciones[2] = true; numAdy++; } else { direcciones[2] = false; } return(direcciones); }
private void flotar(int n) { int i = n; Par parmov = v[i]; while ((i != 1) && (parmov.prioridad.CompareTo(v[i / 2].prioridad) < 0)) { v[i] = v[i / 2]; posiciones[v[i].elem] = i; i = i / 2; } v[i] = parmov; posiciones[v[i].elem] = i; }
// GET: Pars/Create public ActionResult Create() { Par par = new Par(); par = (Par)_RecordService.PopulateRecordTypeDefaults(RecordType.PAR, par); //PopulateDefaults(defaults); // ViewBag.BusinessAreaID = new SelectList(db.BusinessAreas, "BusinessAreaID", "Name"); ViewBag.HseqCaseFileID = new SelectList(db.HseqCaseFiles, "HseqCaseFileID", "HseqCaseFileID"); ViewBag.CoordinatorID = new SelectList(db.HseqUsers, "HseqUserID", "FullName"); return(View(par)); }
public void RemoveBehavior(string name) { if (actions.ContainsKey(name)) { if (actions[name] is IVelocityModifier) { Par.VelocityModifiers.Remove((IVelocityModifier)actions[name]); Par.UpdateXYVelocity(); } act.Remove(actions[name]); actions.Remove(name); } }
public AkcijaEditPar(Akcija akcija) { InitializeComponent(); this.akcija = akcija; parCopy = new Par(new Namestaj(), 0); cbNamestaj.ItemsSource = Projekat.Instance.Namestaj; tbPopust.DataContext = parCopy; cbNamestaj.DataContext = parCopy; operacija = Operacija.DODAVANJE; }
private Par crearRolUsuario() { Par par = new Par(); SqlDataReader resultSet = _dbm.executeSelect(GET_ROLID_CLIENT_QUERY); if (resultSet.HasRows) { resultSet.Read(); par.Value = ((int)resultSet.GetValue(resultSet.GetOrdinal("ROL_ID"))).ToString(); par.Text = "Cliente"; return(par); } return(null); }
private void Start() { player = GameObject.Find("Player"); playerLocal = player.GetComponent <Transform>(); rigid = GetComponent <Rigidbody>(); mapController = GameObject.Find("MapController"); wind = mapController.GetComponent <WindSpeed>(); par = mapController.GetComponent <Par>(); projectileCamera = GameObject.Find("ShotCamera").GetComponent <LookAtProjectile>(); //Debug.Log(wind.jesusRocks); }
static void Main(string[] args) { Par<int>[] p = new Par<int>[10]; Random random = new Random(); for (int i = 0; i < p.Length; i++ ){ p[i] = new Par<int>(random.Next(0,20), random.Next(0,20)); } Console.WriteLine("Sin Ordenar:"); foreach(var i in p){ Console.WriteLine(i); } Console.WriteLine("#########################"); Algorithms.Sort(p); Console.WriteLine("Ordenado:"); foreach(var i in p){ Console.WriteLine(i); } Console.WriteLine("#########################"); Console.WriteLine("Maximo: {0}", Algorithms.Max(p)); }