public ActionResult DeleteConfirmed(int id) { Opera opera = db.Operas.Find(id); db.Operas.Remove(opera); db.SaveChanges(); return(RedirectToAction("Index")); }
public void Opera_Windows() { var isOpera = Opera.TryParse(UserAgents.Opera_Windows, out var operea); Assert.True(isOpera); Assert.Equal(DeviceTypes.Desktop, operea.DeviceType); Assert.Equal(OperatingSystems.Windows, operea.OS); }
public async Task <ActionResult> DeleteConfirmed(int id) { Opera opera = await db.Operas.FindAsync(id); db.Operas.Remove(opera); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public IList <int> DiffWaysToCompute(string input) { if (memResult.ContainsKey(input)) { return(memResult[input]); } List <int> result = new List <int>(); int len = input.Length; string first, second; for (int i = 0; i < len; i++) { if (input[i] == '+' || input[i] == '-' || input[i] == '*') { first = input.Substring(0, i); second = input.Substring(i + 1); IList <int> firstResult = DiffWaysToCompute(first); IList <int> secondResult = DiffWaysToCompute(second); // IList<int> result; Opera op = null; if (input[i] == '+') { op = Add; } if (input[i] == '-') { op = Sub; } if (input[i] == '*') { op = Mult; } for (int k = 0; k < firstResult.Count; k++) { for (int j = 0; j < secondResult.Count; j++) { int temp = op(firstResult[k], secondResult[j]); result.Add(temp); } } // return result; } } if (result.Count == 0) { result.Add(Int32.Parse(input)); } memResult.Add(input, result); return(result); }
public ActionResult Edit([Bind(Include = "OperaID,Nazwa,Rok,Kompozytor,Dlugosc")] Opera opera) { if (ModelState.IsValid) { db.Entry(opera).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(opera)); }
public ActionResult DetailsByTitle(string title) { Opera opera = (Opera)(from o in contextDB.Operas where o.Title == title select o).FirstOrDefault(); if (opera == null) { return(HttpNotFound()); } return(View("Details", opera)); }
public ActionResult Create(Opera opera) { if (ModelState.IsValid) { context.Operas.Add(opera); context.SaveChanges(); return(RedirectToAction("Index")); } return(View(opera)); }
public ActionResult Edit(Opera opera) { if (ModelState.IsValid) { db.Entry(opera).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(opera)); }
// // GET: /Opera/Delete/5 public ActionResult Delete(int id = 0) { Opera opera = db.Operas.Find(id); if (opera == null) { return(HttpNotFound()); } return(View(opera)); }
public ActionResult Edit([Bind(Include = "OperaID,Title,Year,Composer")] Opera opera) { if (ModelState.IsValid) { db.Entry(opera).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(opera)); }
public Opera GetOperas(int id) { Opera opera = contextDB.Operas.Find(id); if (opera == null) { throw new HttpResponseException(HttpStatusCode.NotFound); } return(opera); }
public IHttpActionResult GetOpera(int id) { Opera opera = db.Operas.Find(id); if (opera == null) { return(NotFound()); } return(Ok(opera)); }
/// <summary> /// /// </summary> /// <param name="task"></param> private static void AddDownTask(XD2300Device xd2300) { log.Debug("add xd2300 down task"); // add down command // Opera downOP = xd2300.DeviceDefine.CreateOpera(XD2300OperaNames.Down); Task downTask = new Task(xd2300, downOP, new ImmediateStrategy()); YeHeCommuniServerApp.Default.CommuniSoft.TaskManager.Tasks.Add(downTask); }
public ActionResult Create([Bind(Include = "OperaID,Nazwa,Rok,Kompozytor,Dlugosc")] Opera opera) { if (ModelState.IsValid) { db.Opery.Add(opera); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(opera)); }
// GET: Details public ActionResult Details(int id) { Opera opera = _contextDB.Operas.Find(id); if (opera == null) { return(HttpNotFound()); } return(View("Details", opera)); }
public ActionResult Create([Bind(Include = "OperaID,Title,Year,Composer")] Opera opera) { if (ModelState.IsValid) { db.Operas.Add(opera); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(opera)); }
//TODO: GET: Edit public ActionResult Edit(int id) { Opera opera = _contextDB.Operas.Find(id); if (opera != null) { return(View("Edit", opera)); } return(RedirectToAction("Index")); }
public ActionResult Create([Bind(Include = "OperaID,ComposerID,Name,Language,PremierDate")] Opera opera) { if (ModelState.IsValid) { db.Operas.Add(opera); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(opera)); }
// GET: Opera 如果沒有寫 就是預設抓Index // GET: Opera/Index public ActionResult Index() { Opera o = new Opera(); o.OperaID = 1; o.Title = "尤利迪西"; o.Year = 1600; o.Composer = "佩里"; return(View(o)); }
[Route("Opera/Title/{title?}")] //title? can null or title=Wozzeck // [Route("Opera/Title/{title=Wozzeck}")] public ActionResult DetailsByTitle(string title) { OperaContext context = new OperaContext(); Opera opera = context.Operas.FirstOrDefault <Opera>(o => o.Title == title); if (opera == null) { return(HttpNotFound()); } return(View("Details", opera)); }
// GET: Opera public ActionResult Index() { Opera o = new Opera() { OperaID = 1, Title = "胖胖胖胖", Year = 107, Composer = "胖胖胖胖胖胖胖胖" }; return(View(o)); }
// GET: Opera public ActionResult Index() { Opera o = new Opera() { OperaID = 1, Title = "尤利迪西", Year = 1600, Composer = "佩里" }; return(View(o)); }
public ActionResult Index(Opera opera) { //Opera o = new Opera() //{ // OperaId = opera.OperaId, // Title = opera.Title, // Year = opera.Year, // Composer = opera.Composer //}; //return View( o ); return(View(context.Operas.ToList())); }
// GET: Opera public ActionResult Index(Opera opera) { Opera o = new Opera() { OperaID = opera.OperaID, Title = opera.Title, Year = opera.Year, Composer = opera.Composer }; return(View(o)); }
public IHttpActionResult PostOpera(Opera opera) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.Operas.Add(opera); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = opera.OperaID }, opera)); }
public ActionResult Index2(int?year) { Opera o = new Opera() { OperaID = 1, Title = "胖胖胖胖", Year = year.Value, Composer = "胖胖胖胖胖胖胖胖" }; return(View("index", o)); }
public Opera Get(int id) { var opera = new Opera { OperaID = 101, Title = "Some Title", Year = 1940, Composer = "Someone" }; return(opera); }
public async Task <ActionResult> Create([Bind(Include = "OperaId,Title,Year,Composer")] Opera opera) { if (ModelState.IsValid) { db.Operas.Add(opera); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(opera)); }
public ActionResult Create(Opera newOpera) { if (ModelState.IsValid) { // Add record to the db. return(RedirectToAction("Index")); } else { return(View("Create", newOpera)); } }
// GET: Opera/Index?yy=1986 由網址帶參數進去 public ActionResult Index(int?yy) { Opera o = new Opera(); o.OperaID = 2; o.Title = "歌劇魅影"; //o.Year = 1986; o.Year = yy; o.Composer = "安德魯·洛伊·韋伯"; return(View(o)); }
protected override void ExecuteInsertVenueCommand(string[] commandWords) { switch (commandWords[2]) { case "opera": var opera = new Opera(commandWords[3], commandWords[4], int.Parse(commandWords[5])); this.Venues.Add(opera); break; case "sports_hall": var sportsHall = new Sport(commandWords[3], commandWords[4], int.Parse(commandWords[5])); this.Venues.Add(sportsHall); break; case "concert_hall": var concertHall = new Concert(commandWords[3], commandWords[4], int.Parse(commandWords[5])); this.Venues.Add(concertHall); break; default: base.ExecuteInsertVenueCommand(commandWords); break; } }
static void Main(string[] args) { BaseConfig bc = new BaseConfig(); #region //Prueba de QUINIELA TransacQuinielaB jue = new TransacQuinielaB(); jue.TipoApuesta = new byte[] { 0x06, 0x06, 0x07, 0x06, 0x0b }; jue.NumeroAp1 = new string[] { "0233", "077", "12", "2411", "33" }; jue.RangoDesde1 = new byte[] { 0x01, 0x01, 0x01, 0x01, 0x00 }; jue.RangoHasta1 = new byte[] { 0x01, 0x01, 0x05, 0x14, 0x00 }; jue.NumeroAp2 = new string[] { null, null, "34", null, "77" }; jue.NumeroAp3 = new string[] { null, null, null, null, "12" }; jue.RangoDesde2 = new byte[] { 0x00, 0x00, 0x01, 0x00, 0x00 }; jue.RangoHasta2 = new byte[] { 0x00, 0x00, 0x0a, 0x00, 0x00 }; jue.Importe = new ushort[] { 300, 600, 300, 400, 200 };//en centavos //jue.TipoApuesta = new byte[] { 0x06, 0x07 }; //jue.NumeroAp1 = new string[] { "12", "21" }; //jue.RangoDesde1 = new byte[] { 0x01, 0x01 }; //jue.RangoHasta1 = new byte[] { 0x01, 0x01 }; //jue.NumeroAp2 = new string[] { null, "45" }; //jue.NumeroAp3 = new string[] { null, null }; //jue.RangoDesde2 = new byte[] { 0x00, 0x01 }; //jue.RangoHasta2 = new byte[] { 0x00, 0x05 }; //jue.Importe = new ushort[] { 1000, 1000 };//en centavos #endregion try { Opera opera = new Opera(); ArchivoConfig lee = new ArchivoConfig(); Errorof errConfig = opera.LeeArchivo(ref lee); Error errBConfig = bc.LeeBaseConfig(ref bc); if (errConfig.Error != 0) { lee = new ArchivoConfig(); #region //PARAMETROS CONFIGURACION PARA CONFIG bc.Terminal = 80732555;//1300000006; bc.Tarjeta = 19511;//50026; bc.TerminalModelo = EnumTerminalModelo.TML; bc.MAC = new byte[] { 0x15, 0xBE, 0x07, 0x91, 0xFD, 0x32, 0xA4, 0xB3 };//{ 0x8b, 0x3d, 0x39, 0xff, 0x6a, 0xdd, 0x16, 0xb8 };//{ 0x5e, 0x01, 0xd2, 0x69, 0x78, 0x8b, 0x7d, 0x02 }; { 0xa0, 0xca, 0x14, 0x1d, 0xba, 0xdf, 0x7b, 0x44 }; bc.MsgMAC = new byte[] { 0x00, 0x91, 0x00, 0x07, 0x00, 0x32, 0xBE, 0xB3, 0x00, 0x15, 0xFD, 0xA4}; //lee.EncryptMAC = mac;//new byte[] { 0x00 }; lee.ImpresoraReportes = "impresoraPDF"; lee.ImpresoraTicket = "THERMAL Receipt Printer"; lee.MaskEscape = 0xfc; //lee.MaskEnmascara = new byte[] { 0x01, 0x03, 0xfc }; //lee.MaskDesenmascara = new byte[] { 0x06, 0x07, 0x05 }; lee.MaskEnmascara = new byte[] { 0x01, 0x03, 0x04, 0x10, 0x1e, 0x9e, 0xfc, 0x83, 0x84, 0x0d, 0x8d, 0x90, 0xff }; lee.MaskDesenmascara = new byte[] { 0x06, 0x07, 0xdd, 0x0a, 0x09, 0x41, 0x05, 0xde, 0xdf, 0x15, 0x11, 0x0b, 0x08 }; lee.LogPath = "C:\\BetmakerTP\\Logs\\"; lee.LogFileName = "LogDisp.lg"; lee.LogMaxFileSize = 10485760; lee.NumeringWithSecuential = false; lee.LevelLog = EnumMessageType.DEBUG; lee.IpTerminal = IPAddress.Parse("133.61.1.12"); lee.IpMask = IPAddress.Parse("255.255.0.0"); lee.DW = IPAddress.Parse("133.61.1.30"); lee.DNS = IPAddress.Parse("133.61.1.194"); lee.PathPRN = "C:\\BetmakerTP\\Conexion\\"; lee.ArchivoPRN = "ArchivoPRN.xml"; lee.DefaultServer = IPAddress.Parse("133.61.1.71"); lee.Host = "Win7x86"; lee.Port = 9950; //MENDOZA lee.Telefono = "08006665807"; lee.PCName = "PCjorge"; lee.FTPServer = IPAddress.Parse("133.61.1.195"); lee.FTPport = 21; lee.FTPUser = "******"; lee.FTPPassword = "******"; lee.FTPWorkingDirectory = "Reportes"; #endregion //opera.GeneraArchivo(archivo, lee); } #region //Prueba de paquete A Terminal paqA = new Terminal(); var entrada = new BaseConfig(); var salida = bc.LeeBaseConfig(ref entrada); if (salida.CodError != 0) { Exception ex = new Exception(salida.Descripcion); throw ex; } else { paqA.Tarjeta = entrada.Tarjeta; paqA.NumeroTerminal = entrada.Terminal; paqA.MacTarjeta = entrada.MsgMAC; } byte[] mac = new byte[] { 0xdf, 0x72, 0x0f, 0xae, 0xdf, 0xd4, 0xe9, 0x1e, 0xdf, 0x8e, 0x1f, 0x61 };//{ 0x00, 0xc2, 0x00, 0x71, 0x00, 0x09, 0xb3, 0x5a, 0x00, 0xde, 0xbf, 0x82 };//{ 0x8e, 0xe9, 0x0f, 0x72, 0x1f, 0xd4, 0x61, 0x1e } 0xdf, , , 0xae, 0xdf, , , , 0xdf,,, }; //paqA.Tarjeta = lee.Tarjeta;//53164;//tarjeta 54781 //58977 //paqA.NumeroTerminal = lee.Terminal;//terminal paqA.FechaHora = DateTime.Now; Version assemblyversion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version; paqA.Version = (ushort)((assemblyversion.Major * 1000) + (assemblyversion.Minor * 10) + (assemblyversion.Build));//version //paqA.MacTarjeta = lee.MsgMAC;//mac paqA.Tipo = EnumTerminalModelo.TML; //0x0c; #endregion MonedaJuego Monedas = new MonedaJuego(); Comunicacion com = new Comunicacion(bc, lee); ProtocoloLib.TransacManager.ProtoConfig.CLAVE_TARJETA = BitConverter.GetBytes(0x8EE9AE721FD4611E).Reverse().ToArray(); //Error errCxn = Comunicacion.AbrePuerto(); Error errCxn = com.Conectar(paqA, EnumModoConexion.ETHERNET); Agente agente = new Agente(); if (errCxn.CodError != 0) { Console.Write("Error: " + errCxn.CodError); Console.WriteLine(" " + errCxn.Descripcion + "\n"); Environment.Exit(0); } else { IList objsRec = com.InteraccionAB(ref paqA); TransaccionMSG mensaje; if(objsRec.Count == 6) mensaje = (TransaccionMSG)objsRec[5]; if (objsRec[1] is Agente) { agente = (Agente)objsRec[1]; Console.WriteLine("Agencia: " + agente.Nombre + "\nNúmero de Agencia: " + agente.Numero + "\n"); Error errOffline = new Error(); } IList objsRec3 = new List<object>(); IList objsRec2 = new List<object>(); TransacQuinielaH cabeceraAnul = new TransacQuinielaH(); TransacQuinielaB cuerposAnul = new TransacQuinielaB(); AnulReimpQuiniela anulacionQ = new AnulReimpQuiniela(); TransacPoceado poceadoAnul = new TransacPoceado(); AnulReimpPoceado anulacionP = new AnulReimpPoceado(); if (objsRec.Count < 2 && objsRec[0] is Error) { Error err = (Error)objsRec[0]; if (err.CodError != 0) { Console.Write("Error: " + err.CodError); Console.WriteLine(" " + err.Descripcion + "\n"); } } else if (objsRec.Count > 1) { bool validValue = false; while (!validValue) { Console.WriteLine("Seleccione el tipo de mensaje: "); Console.WriteLine("(1) Quiniela"); Console.WriteLine("(x) Salir"); ConsoleKeyInfo messageType = Console.ReadKey(); Console.WriteLine(); switch (messageType.KeyChar.ToString()) { case "1": #region objsRec2 = com.InteraccionPQ1(PedidosSorteos.QUINIELA, Convert.ToUInt32(paqA.NumeroTerminal), EnumEstadoParametrosOff.HABILITADO); if (objsRec2.Count > 0 && objsRec2[0] != null && objsRec2[0] is Error) { Error psQErr = (Error)objsRec2[0]; if (psQErr.CodError != 0) { Console.Write("Error: " + psQErr.CodError); Console.WriteLine(" " + psQErr.Descripcion + "\n"); } else if (objsRec[1] is Agente && objsRec2[1] is ParamSorteoQuiniela) { psQErr = (Error)objsRec2[0]; if (psQErr.CodError != 0) { Console.Write("Error: " + psQErr.CodError); Console.WriteLine(" " + psQErr.Descripcion + "\n"); } else if (objsRec[1] is Agente && objsRec2[1] is ParamSorteoQuiniela) { ParamSorteoQuiniela psQ = (ParamSorteoQuiniela)objsRec2[1]; TransacQuinielaH cabecera = new TransacQuinielaH(); cabecera.Sorteo = (ushort)psQ.SorteosNumeros[0]; cabecera.FechaHora = DateTime.Now; cabecera.NroSecuencia = 1; //cabecera.Entes = psQ.SorteoBmpEntes[0]; byte[] byteEnte = {1,2,3}; //byte[] bt = Conversiones.SeteaBits(byteEnte, 1, true); //cabecera.Entes = bt[0]; cabecera.CantApu = 5; objsRec3 = com.InteraccionPQ2(cabecera, jue, PedidosSorteos.QUINIELA); if (objsRec3[0] != null && objsRec3[0] is Error) { Error TransErr = (Error)objsRec3[0]; if (TransErr.CodError != 0) { Console.Write("Error: " + TransErr.CodError); Console.WriteLine(" " + TransErr.Descripcion + "\n"); } else if (objsRec3[1] is TransacQuinielaH) { TransacQuinielaH transRta = (TransacQuinielaH)objsRec3[1]; //certifica.CertificadoQuiniela(transRta.Protocolo, bc.MAC, (int)paqA.Tarjeta, (int)paqA.NumeroTerminal, ref transRta.Certificado); LogBMTP.LogBuffer(byteToChar(transRta.Protocolo), "Test LoggeLib", transRta.Protocolo.Length, EnumNivelLog.Trace); Console.WriteLine("Número de apuesta de QUINIELA: " + transRta.id_ticket + "\n"); Console.WriteLine("Número de certificado: " + transRta.Certificado + "\n"); Console.WriteLine("Fecha y hora de Host: " + transRta.Timehost + "\n"); cabeceraAnul.id_ticket = transRta.id_ticket; cabeceraAnul.Certificado = transRta.Certificado; cabeceraAnul.TipoTransacc = transRta.TipoTransacc; } } } } } validValue = false; break; #endregion } } validValue = false; while (!validValue) { Console.WriteLine("(x) Salir"); ConsoleKeyInfo messageType = Console.ReadKey(); Console.WriteLine(); Error err = new Error(); switch (messageType.KeyChar.ToString()) { case "x": case "X": com.Desconectar(false); Environment.Exit(0); validValue = true; break; default: Console.WriteLine("Debe seleccionar un valor válido. Seleccionó: " + messageType.KeyChar.ToString()); validValue = false; break; } } } } } catch(Exception e) { Console.WriteLine("Exception: {0}", e.ToString()); } }
/// <summary> /// Clear's opera's history /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void clearOpera_Click(object sender, EventArgs e) { if (DialogResult.OK == MessageBox.Show(this, "Are you sure ?", "Clear Opera History", MessageBoxButtons.OKCancel, MessageBoxIcon.Question)) { Opera program = new Opera(); const string methodString = "ClearHistory"; runBackgroundWorker(program, null, methodString); } }
/// <summary> /// /// </summary> /// <param name="operanode"></param> /// <returns></returns> private Opera Create(string deviceType, XmlNode operaNode) { XmlElement e = operaNode as XmlElement; Opera opera = null; SendPart sp = null; ReceivePartCollection rps = new ReceivePartCollection(); string name = GetAttribute(e, DeviceDefineNodeNames.OperaName); string text = GetAttribute(e, DeviceDefineNodeNames.OperaText, true); //if (text == string.Empty) //{ //} string args = GetAttribute(e, DeviceDefineNodeNames.OperaArgs, true); foreach (XmlNode node in operaNode.ChildNodes) { switch (node.Name) { case DeviceDefineNodeNames.SendPart: sp = CreateSendPart(node); break; case DeviceDefineNodeNames.ReceivePart: ReceivePart rp = CreateReceivePart(node); rps.Add(rp); break; } } opera = new Opera(deviceType, name, text, args); opera.SendPart = sp; opera.ReceiveParts = rps; log.Info("Create opera '{0}', receivepart count '{1}'", name, rps.Count); return opera; }
/// <summary> /// Sync's opera history /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void syncOpera_Click(object sender, EventArgs e) { Opera program = new Opera(); const string methodString = "SyncOpera"; runBackgroundWorker(program, null, methodString); }
protected override void ExecuteInsertVenueCommand(string[] commandWords) { string name = commandWords[3]; string location = commandWords[4]; int numberOfSeats = int.Parse(commandWords[5]); switch (commandWords[2]) { case "opera": var opera = new Opera(name, location, numberOfSeats); this.Venues.Add(opera); break; case "sports_hall": var sportsHall = new SportsHall(name, location, numberOfSeats); this.Venues.Add(sportsHall); break; case "concert_hall": var concertHall = new ConcertHall(name, location, numberOfSeats); this.Venues.Add(concertHall); break; default: base.ExecuteInsertVenueCommand(commandWords); break; } }