public Car(string model, int engineSpeed, int enginePower, int cargoWeight, string cargoType, double tire1Pressure, int tire1Age, double tire2Pressure, int tire2Age, double tire3Pressure, int tire3Age, double tire4Pressure, int tire4Age) { this.Model = model; this.Engine = new CarEngine(engineSpeed, enginePower); this.Cargo = new Cargo(cargoWeight, cargoType); this.Tire1 = new Tire(tire1Pressure, tire1Age); this.Tire2 = new Tire(tire2Pressure, tire2Age); this.Tire3 = new Tire(tire3Pressure, tire3Age); this.Tire4 = new Tire(tire4Pressure, tire4Age); }
public static void Main() { int numberOfCars = int.Parse(Console.ReadLine()); var cars = new List <Car>(); for (int index = 0; index < numberOfCars; index++) { var carInfo = Console.ReadLine().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); string model = carInfo[0]; int engineSpeed = int.Parse(carInfo[1]); int enginePower = int.Parse(carInfo[2]); int cargoWeight = int.Parse(carInfo[3]); string cargoType = carInfo[4]; double tire1Pressure = double.Parse(carInfo[5]); int tire1Age = int.Parse(carInfo[6]); double tire2Pressure = double.Parse(carInfo[7]); int tire2Age = int.Parse(carInfo[8]); double tire3Pressure = double.Parse(carInfo[9]); int tire3Age = int.Parse(carInfo[10]); double tire4Pressure = double.Parse(carInfo[11]); int tire4Age = int.Parse(carInfo[12]); Engine engine = new Engine(engineSpeed, enginePower); Cargo cargo = new Cargo(cargoWeight, cargoType); Tire[] tires = new Tire[4]; tires[0] = new Tire(tire1Pressure, tire1Age); tires[1] = new Tire(tire2Pressure, tire2Age); tires[2] = new Tire(tire3Pressure, tire3Age); tires[3] = new Tire(tire4Pressure, tire4Age); Car car = new Car(model, engine, cargo, tires); cars.Add(car); } string command = Console.ReadLine(); if (command == "fragile") { cars .Where(c => c.Cargo.Type == "fragile" && c.Tires.Any(t => t.Pressure < 1)) .ToList() .ForEach(c => Console.WriteLine($"{c.Model}")); } else { cars .Where(c => c.Cargo.Type == "flamable" && c.Engine.Power > 250) .ToList() .ForEach(c => Console.WriteLine($"{c.Model}")); } }
public void HaveStringLengthAttributeAttribute() { var bm = new Tire(); var result = bm .GetType() .GetProperty("WeightIndex") .GetCustomAttributes(false) .Where(x => x.GetType() == typeof(System.ComponentModel.DataAnnotations.StringLengthAttribute)) .Any(); Assert.True(result); }
public Car(string model, Engine engine, Cargo cargo, Tire tire1, Tire tire2, Tire tire3, Tire tire4) { this.Model = model; this.Engine = engine; this.Cargo = cargo; this.Tires = new Tire[4]; this.Tires[0] = tire1; this.Tires[1] = tire2; this.Tires[2] = tire3; this.Tires[3] = tire4; }
public Car(string model, int speed, int power, int weight, string type, double pressure1, int age1, double pressure2, int age2, double pressure3, int age3, double pressure4, int age4) { this.model = model; engine = new Engine(speed, power); cargo = new Cargo(weight, type); tires = new Tire[4]; tires[0] = new Tire(pressure1, age1); tires[1] = new Tire(pressure2, age2); tires[2] = new Tire(pressure3, age3); tires[3] = new Tire(pressure4, age4); }
static void Main(string[] args) { Tire[] tires = new Tire[4] { new Tire(1, 2.5), new Tire(1, 2.1), new Tire(2, 0.5), new Tire(2, 2.3) }; Engine engine = new Engine(560, 6300); Car car = new Car("Lamborghini", "Urus", 2010, 250, 9, engine, tires); }
public void HaveRequiredAttribute() { var rim = new Tire(); var result = rim .GetType() .GetProperty("SpeedIndex") .GetCustomAttributes(false) .Where(x => x.GetType() == typeof(System.ComponentModel.DataAnnotations.RequiredAttribute)) .Any(); Assert.True(result); }
//"{model} {engineSpeed} {enginePower} {cargoWeight} {cargoType} //{tire1Pressure} {tire1Age} {tire2Pressure} {tire2Age} {tire3Pressure} {tire3Age} {tire4Pressure} {tire4Age}" public Car(string model, int engineSpeed, int enginePower, int cargoWeight, string cargoType, double tire1Pressure, int tire1Age, double tire2Pressure, int tire2Age, double tire3Pressure, int tire3Age, double tire4Pressure, int tire4Age) { Model = model; Engine = new Engine(engineSpeed, enginePower); Cargo = new Cargo(cargoWeight, cargoType); Tires = new Tire[4]; Tires[0] = new Tire(tire1Pressure, tire1Age); Tires[1] = new Tire(tire2Pressure, tire2Age); Tires[2] = new Tire(tire3Pressure, tire3Age); Tires[3] = new Tire(tire4Pressure, tire4Age); }
public IActionResult OnGet() { Tire = new Tire { Model = "any", Height = 35.0, Width = 12.5, Weight = 1100, WheelDiameter = 17, MaxPSI = 36 }; return(Page()); }
static void Main(string[] args) { var count = int.Parse(Console.ReadLine()); var cars = new List <Car>(); for (int i = 0; i < count; i++) { var carInfo = Console.ReadLine().Split(); var model = carInfo[0]; var engineSpeed = int.Parse(carInfo[1]); var enginePower = int.Parse(carInfo[2]); var cargoWeight = int.Parse(carInfo[3]); var cargoType = carInfo[4]; var engine = new Engine(engineSpeed, enginePower); var cargo = new Cargo(cargoType, cargoWeight); var tires = new Tire[4]; var counter = 0; for (int j = 0; j < 8; j += 2) { var tirePressure = double.Parse(carInfo[5 + j]); var tireAge = int.Parse(carInfo[6 + j]); var currentTire = new Tire(tirePressure, tireAge); tires[counter] = currentTire; counter++; } var car = new Car(model, engine, cargo); car.Tires = tires; cars.Add(car); } var result = new List <Car>(); var cargotype = Console.ReadLine(); if (cargotype.Equals("fragile")) { result = cars.Where(c => c.Cargo.Type.Equals("fragile") && c.Tires.Any(t => t.Pressure < 1)).ToList(); } else { result = cars.Where(c => c.Cargo.Type.Equals("flamable") && c.Engine.Power > 250).ToList(); } foreach (var car in result) { Console.WriteLine(car.Model); } }
static void Main() { int n = int.Parse(Console.ReadLine()); List <Car> cars = new List <Car>(); for (int i = 0; i < n; i++) { string[] carParam = Console.ReadLine().Split(); string model = carParam[0]; int engineSpeed = int.Parse(carParam[1]); int enginePower = int.Parse(carParam[2]); Engine engine = new Engine(engineSpeed, enginePower); int cargoWeight = int.Parse(carParam[3]); string cargoType = carParam[4]; Cargo cargo = new Cargo(cargoWeight, cargoType); List <Tire> tires = new List <Tire>(); for (int j = 0; j < 8; j += 2) { double tirePressure = double.Parse(carParam[5 + j]); int tireAge = int.Parse(carParam[6 + j]); Tire tire = new Tire(tirePressure, tireAge); tires.Add(tire); } cars.Add(new Car(model, engine, cargo, tires)); } string command = Console.ReadLine(); if (command == "fragile") { foreach (var car in cars.Where(c => c.Cargo.CargoType == command && c.Tires.Any(t => t.TirePressure < 1.0))) { Console.WriteLine($"{car.Model}"); } } else if (command == "flamable") { foreach (var car in cars.Where(c => c.Cargo.CargoType == command && c.Engine.EnginePower > 250)) { Console.WriteLine($"{car.Model}"); } } }
static void Main(string[] args) { int n = int.Parse(Console.ReadLine()); List <Car> cars = new List <Car>(); for (int i = 0; i < n; i++) { string[] carDetail = Console.ReadLine().Split(); string carModel = carDetail[0]; int engineSpeed = int.Parse(carDetail[1]); int enginePower = int.Parse(carDetail[2]); double cargoWeight = double.Parse(carDetail[3]); string cargoTipe = carDetail[4]; double tire1Pressure = double.Parse(carDetail[5]); int tire1Age = int.Parse(carDetail[6]); double tire2Pressure = double.Parse(carDetail[7]); int tire2Age = int.Parse(carDetail[8]); double tire3Pressure = double.Parse(carDetail[9]); int tire3Age = int.Parse(carDetail[10]); double tire4Pressure = double.Parse(carDetail[11]); int tire4Age = int.Parse(carDetail[12]); Engine engine = new Engine(engineSpeed, enginePower); Cargo cargo = new Cargo(cargoWeight, cargoTipe); Tire[] tires = new Tire[4]; tires[0] = new Tire(tire1Pressure, tire1Age); tires[1] = new Tire(tire2Pressure, tire2Age); tires[2] = new Tire(tire3Pressure, tire3Age); tires[3] = new Tire(tire4Pressure, tire4Age); Car car = new Car(carModel, engine, cargo, tires); cars.Add(car); } string cargoTypeForPrint = Console.ReadLine(); List <Car> sortedCars = new List <Car>(); if (cargoTypeForPrint == "fragile") { sortedCars = cars.Where(x => x.cargo.type == "fragile" && x.tires.Any(t => t.pressure < 1)).ToList(); } else { sortedCars = cars.Where(x => x.cargo.type == "flamable" && x.engine.power > 250).ToList(); } foreach (var car in sortedCars) { Console.WriteLine(car.model); } }
static void Main(string[] args) { var inputRowCount = int.Parse(Console.ReadLine()); var listOfCars = new List <Car>(); for (int i = 0; i < inputRowCount; i++) { var line = Console.ReadLine() .Split(); var model = line[0]; var engineSpeed = int.Parse(line[1]); var enginePower = int.Parse(line[2]); var cargoWeight = int.Parse(line[3]); var cargoType = line[4]; var currentEngine = new Engine(engineSpeed, enginePower); var currentCargo = new Cargo(cargoWeight, cargoType); var listOfTires = new List <Tire>(); for (int j = 5; j < 12; j += 2) { var pressureT = double.Parse(line[j]); var ageT = int.Parse(line[j += 1]); var currentTire = new Tire(pressureT, ageT); listOfTires.Add(currentTire); j -= 1; } var car = new Car(model, currentEngine, currentCargo, listOfTires); listOfCars.Add(car); } var command = Console.ReadLine(); if (command == "fragile") { foreach (var car in listOfCars.Where(c => c.Cargo.Type == "fragile" && c.Tires.Any(p => p.Pressure < 1))) { Console.WriteLine(car.Model); } } else if (command == "flamable") { foreach (var car in listOfCars.Where(c => c.Cargo.Type == "flamable" && c.Engine.Power > 250)) { Console.WriteLine(car.Model); } } }
static void Main(string[] args) { int amountOfCars = int.Parse(Console.ReadLine()); List <Car> cars = new List <Car>(); for (int car = 0; car < amountOfCars; car++) { string[] tokens = Console.ReadLine().Split(); string model = tokens[0]; int speed = int.Parse(tokens[1]); int power = int.Parse(tokens[2]); int weight = int.Parse(tokens[3]); string type = tokens[4]; List <Tire> tires = new List <Tire>(); for (int tire = 5; tire < tokens.Length; tire += 2) { double pressure = double.Parse(tokens[tire]); int age = int.Parse(tokens[tire + 1]); Tire tireInfo = new Tire(pressure, age); tires.Add(tireInfo); } Engine engine = new Engine(speed, power); Cargo cargo = new Cargo(weight, type); Car carInfo = new Car(model, engine, cargo, tires); cars.Add(carInfo); } string command = Console.ReadLine(); if (command == "fragile") { foreach (var car in cars.Where(c => c.Cargo.Type == "fragile" && c.Tires.Any(t => t.Pressure < 1)).Select(c => c.Model)) { Console.WriteLine(car); } } else if (command == "flamable") { foreach (var car in cars.Where(c => c.Cargo.Type == "flamable" && c.Engine.Power > 250).Select(c => c.Model)) { Console.WriteLine(car); } } }
private void AddTires() { var tires = new Tire[] { new Tire { Model = "Toyo OC", Height = 37.0, Width = 14.5, WheelDiameter = 17.0, MaxPSI = 36.0, Weight = GetWeight(), SessionID = GetSessionID() }, new Tire { Model = "SST PRO", Height = 36.77, Width = 10.2, WheelDiameter = 17.0, MaxPSI = 36.0, Weight = GetWeight(), SessionID = GetSessionID() } // , //new Tire { // Model = "KO2", // Height = 36.5, // Width = 12.5, // WheelDiameter = 17.0, // MaxPSI=36.0, // Weight = GetWeight(), // SessionID = GetSessionID() //} //, //new Tire { // Height = 37.8, // Width = 13.6, // WheelDiameter = 17.0, // MaxPSI=36.0, // SessionID = GetSessionID() //} }; foreach (Tire t in tires) { _context.Tire.Add(t); } _context.SaveChanges(); }
public async Task<IActionResult> OnGetAsync(string id) { if (id == null) { return NotFound(); } Tire = await _context.Tire.FirstOrDefaultAsync(m => m.Id == id); if (Tire == null) { return NotFound(); } return Page(); }
//“<Model> <EngineSpeed> <EnginePower> <CargoWeight> <CargoType> //<Tire1Pressure> <Tire1Age> <Tire2Pressure> <Tire2Age> <Tire3Pressure> <Tire3Age> //<Tire4Pressure> <Tire4Age>” public Car(string model, int engineSpeed, int enginePower, int cargoWeight, string cargoType , double t1Pressure, double t1Age , double t2Pressure, double t2Age , double t3Pressure, double t3Age , double t4Pressure, double t4Age) { Model = model; Engine = new Engine(engineSpeed, enginePower); Cargo = new Cargo(cargoWeight, cargoType); Tires = new Tire[4]; Tires[0] = new Tire(t1Age, t1Pressure); Tires[1] = new Tire(t2Age, t2Pressure); Tires[2] = new Tire(t3Age, t3Pressure); Tires[3] = new Tire(t4Age, t4Pressure); }
static void Main(string[] args) { var tires = new Tire[4] { new Tire(1, 2.5), new Tire(2, 2.4), new Tire(3, 2.3), new Tire(4, 2.2), }; var engine = new Engine(560, 6300); var car = new Car("Lamborgini", "Urus", 2019, 210, 9, engine, tires); Console.WriteLine($"{car.Make}\n{car.Model}\n{car.Year}" + $"\n{car.Engine.CubicCapacity}\n{car.Engine.HorsePower}\n"); }
public void AddTire(Tire newTire, float degradeInterval, int degradeValue) { if (tireDegrader != null) { this.StopCoroutine(tireDegrader); this.RemoveKartModifier(tireModifier); } tire = newTire; ChangeTireMesh(); //Need to copy values in a better way, but for now just copying the grip is ok. tireModifier = new AddativeKartModifier(); tireModifier.modifiers.grip = tire.GetModifier().modifiers.grip; tireDegrader = this.StartCoroutine(TireDegrader(degradeInterval, degradeValue)); }
private static double AverageDamageTyres(Tire tire) { float[] damageSegment = { tire.segment1.wear, tire.segment2.wear, tire.segment3.wear, tire.segment4.wear, tire.segment5.wear, tire.segment6.wear, tire.segment7.wear, tire.segment8.wear }; double sum = 0; for (int i = 0; i < damageSegment.Length; i++) { sum += damageSegment[i]; } double average = sum / damageSegment.Length; return(100 - (average * 100)); }
private void addTires(int tireAge1, double tirePressure1, int tireAge2, double tirePressure2, int tireAge3, double tirePressure3, int tireAge4, double tirePressure4) { this.tires = new Tire[4]; Tire tire1 = new Tire(tireAge1, tirePressure1); Tire tire2 = new Tire(tireAge2, tirePressure2); Tire tire3 = new Tire(tireAge3, tirePressure3); Tire tire4 = new Tire(tireAge4, tirePressure4); this.tires[0] = tire1; this.tires[1] = tire2; this.tires[2] = tire3; this.tires[3] = tire4; }
private static List <Tire> GetTires(string[] tiresInfo) { var tires = new List <Tire>(); for (int i = 0; i < tiresInfo.Length; i += 2) { double tirePressure = double.Parse(tiresInfo[i]); int tireage = int.Parse(tiresInfo[i + 1]); var tire = new Tire(tirePressure, tireage); tires.Add(tire); } return(tires); }
internal Tire[] MountTires(string[] carInfo) { Tire[] tires = new Tire[4] { new Tire(), new Tire(), new Tire(), new Tire() }; tires[0].Pressure = double.Parse(carInfo[5]); tires[0].Age = int.Parse(carInfo[6]); tires[1].Pressure = double.Parse(carInfo[7]); tires[1].Age = int.Parse(carInfo[8]); tires[2].Pressure = double.Parse(carInfo[9]); tires[2].Age = int.Parse(carInfo[10]); tires[3].Pressure = double.Parse(carInfo[11]); tires[3].Age = int.Parse(carInfo[12]); return(tires); }
public static void Main() { int n = int.Parse(Console.ReadLine()); List <Car> cars = new List <Car>(); for (int i = 0; i < n; i++) { string[] data = Console.ReadLine() .Trim() .Split(new[] { ' ', '\r', '\n', '\t' }, StringSplitOptions.RemoveEmptyEntries); Cargo cargo = new Cargo(int.Parse(data[3]), data[4]); Engine engine = new Engine(int.Parse(data[1]), int.Parse(data[2])); double[] arrTires = { double.Parse(data[5]), double.Parse(data[7]), double.Parse(data[9]), double.Parse(data[11]) }; Tire tires = new Tire(arrTires); Car currentCar = new Car(data[0], engine, cargo, tires); cars.Add(currentCar); } string command = Console.ReadLine(); if (command == "fragile") { foreach (var car in cars .Where(x => x.Cargo.CargoType == "fragile") .Where(y => y.Tire.FourTiresPressure.Any(x => x < 1.0))) { Console.WriteLine(car.Model); } } else if (command == "flamable") { foreach (var car in cars.Where(x => x.Engine.EnginePower > 250) .Where(y => y.Cargo.CargoType == "flamable")) { Console.WriteLine(car.Model); } } }
static void Main(string[] args) { var numberOfCars = int.Parse(Console.ReadLine()); List <Car> cars = new List <Car>(); for (int i = 0; i < numberOfCars; i++) { var input = Console.ReadLine().Split(); var model = input[0]; var speed = int.Parse(input[1]); var power = int.Parse(input[2]); Engine engine = new Engine(speed, power); var weight = int.Parse(input[3]); var type = input[4]; Cargo cargo = new Cargo(weight, type); List <Tire> tires = new List <Tire>(); for (int j = 5; j < input.Length - 1; j += 2) { var pressure = double.Parse(input[j]); var age = int.Parse(input[j + 1]); Tire tire = new Tire(pressure, age); tires.Add(tire); } Car car = new Car(model, engine, cargo, tires); cars.Add(car); } var command = Console.ReadLine(); if (command == "fragile") { foreach (var car in cars.Where(c => c.Cargo.Type == command && c.Tires.Any(p => p.Pressure < 1))) { Console.WriteLine(car.Model); } } else if (command == "flamable") { foreach (var car in cars.Where(c => c.Cargo.Type == command && c.Engine.EnginePower > 250)) { Console.WriteLine(car.Model); } } }
public void AddNewTireAd(string userId, Tire tire, IEnumerable <string> picturesPaths) { var user = this.usersService.GetById(userId); tire.Owner = user; this.tiresRepo.Add(tire); foreach (var url in picturesPaths) { var picture = new TirePicture { Url = url, Tire = tire }; tire.Pictures.Add(picture); } this.uow.Commit(); }
public async Task <IActionResult> OnPostAsync(string id) { if (id == null) { return(NotFound()); } Tire = await _context.Tire.FindAsync(id); if (Tire != null) { _context.Tire.Remove(Tire); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
public Tire CreateTire<T>() where T:Tire,new() { string id = typeof(T).Name; Tire tire = null; tire = new T(); if(_tires.Exists(t=>t.Id == id)) { tire = _tires.Find(t => t.Id == id); } else { tire = new T(); _tires.Add(tire); } return tire; }
static void Main(string[] args) { int numberOfCars = int.Parse(Console.ReadLine()); List <Car> cars = new List <Car>(); for (int i = 0; i < numberOfCars; i++) { string[] inputLine = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries) .ToArray(); string model = inputLine[0]; int engineSpeed = int.Parse(inputLine[1]); int enginePower = int.Parse(inputLine[2]); int cargoWeight = int.Parse(inputLine[3]); string cargoType = inputLine[4]; Engine engine = new Engine(engineSpeed, enginePower); Cargo cargo = new Cargo(cargoWeight, cargoType); List <Tire> tires = new List <Tire>(); for (int j = 5; j < inputLine.Length; j += 2) { Tire tire = new Tire(double.Parse(inputLine[j]), int.Parse(inputLine[j + 1])); tires.Add(tire); } Car tempCar = new Car(model, engine, cargo, tires); cars.Add(tempCar); } string typeOfCargo = Console.ReadLine(); foreach (var car in cars.Where(c => c.Cargo.CargoType == typeOfCargo)) { if (car.Cargo.CargoType == "fragile" && car.Tires.Any(t => t.Pressure < 1)) { Console.WriteLine(car.Model); } else if (car.Cargo.CargoType == "flamable" && car.Engine.Power > 250) { Console.WriteLine(car.Model); } } }
public void Awake() { if (instance == null) { instance = gameObject; } else { Destroy(gameObject); } DontDestroyOnLoad(gameObject); trackManager = (Track.TrackManager)GameObject.FindWithTag("TrackManager").GetComponent(typeof(Track.TrackManager)); playerOneTire = Tire.soft; playerTwoTire = Tire.soft; starLineColors = new Color[] { Color.red, Color.white, new Color(0.5f, 0, 0, 1) }; }
public void Merge() { var tire = new Tire(); var items = new List<TireItem>(); tire.Items.Add(new TireItem { Id = 1, Name = "Item 1" }); tire.Items.Add(new TireItem { Id = 2, Name = "Item 2" }); tire.Items.Add(new TireItem { Id = 3, Name = "Item 3" }); items.Add(new TireItem { Id = 4, Name = "Item 4", State = ObjectState.Added }); items.Add(new TireItem { Id = 2, Name = "Item 2", State = ObjectState.Deleted }); items.Add(new TireItem { Id = 3, Name = "Item 3 - Modified", Type = "1", State = ObjectState.Modified }); tire.Merge(tire.Items, items, x=>x.Name, x=>x.Type); var actualItems = tire.Items.OrderBy(x => x.Id).ToList(); Assert.AreEqual(3, actualItems.Count); Assert.AreEqual(1, actualItems[0].Id); Assert.AreEqual(3, actualItems[1].Id); Assert.AreEqual(4, actualItems[2].Id); Assert.AreEqual("Item 3 - Modified", actualItems[1].Name); Assert.AreEqual("Item 4", actualItems[2].Name); }
public void SetUp() { _dbUtil.Bind(); using (var session = SessionManager.SessionFactory.OpenSession()) { var active = new Tire {Name = "Pirelli"}; session.Save(active); var inactive = new Tire { Name = "Goodyear" }; session.Save(inactive); var car = new Car {Name = "Gol", Year = 30, Tire = active}; session.Save(car); } }
private void LoadTireInfo(int TireId) { try { txtNumberOfRecord.Enabled = false; ResourceRequiredFieldValidator10.Enabled = false; txtNumberOfRecord.CssClass = "form-control"; txtNumberOfRecord.Text = string.Empty; lblErrorAddInventory.Text = ""; lnkCompleted.Visible = false; lnkbtnUpdateInventory.Visible = true; lnkbtnAddInventory.Visible = false; //ddlTireClass.Items.Clear(); //ddlTireState.Items.Clear(); //ddlRecycleState.Items.Clear(); //ddlTireState.DataSource = Tire.getTireStateCategory(); //ddlTireState.DataBind(); //LoadTireStateType(); Utils.GetLookUpData<DropDownList>(ref ddlTireClass, LookUps.LoadInventoryClass); Utils.GetLookUpData<DropDownList>(ref ddlTireState, LookUps.LoadInventoryAction); Utils.GetLookUpData<DropDownList>(ref ddlRecycleState, LookUps.LoadInventoryOutcome); hdnTireID.Value = TireId.ToString(); Tire objInv = new Tire(TireId); txtCBarCode.Text = Conversion.ParseString(objInv.C_BarCode); txtDOTPlant.Text = objInv.PlantCode; txtDOTSize.Text = objInv.SizeNumber; txtDOTBrand.Text = objInv.BrandCode; txtDOTWeek.Text = objInv.MonthCode; txtDOTYear.Text = objInv.YearCode; txtBrand.Text = objInv.Brand1Name; btnGenerateBarCode_Click(null, null); //System.Text.Encoding enc = System.Text.Encoding.ASCII; //hdnBarCodeImageFileName.Value = enc.GetString(objInv.BarcodeImage); hdnIsPlantCodeValid.Value = "1"; hdnIsSizeCodeValid.Value = "1"; hdnIsWeekCodeValid.Value = "1"; hdnIsYearCodeValid.Value = "1"; txtBrand2.Text = objInv.Brand2Name; txtDOTBrand.Attributes.Add("prevValue", objInv.BrandCode); hdnBrand2ID.Value = Conversion.ParseString(objInv.BrandId2); txtSize.Text = objInv.TireSize; hdnTireID.Value = objInv.TireId.ToString(); hdnOldTXBarcodeID.Value = objInv.TX_BarCodeId.ToString(); ddlTireClass.SelectedValue = objInv.TireClassId.ToString(); ddlTireState.SelectedValue = objInv.TireActionId.ToString(); //LoadTireStateType(); ddlRecycleState.SelectedValue = objInv.TireOutComeID.ToString(); imgBarCode.Visible = true; imgBarCode.ImageUrl = "/Handlers/GetBarcodeImage.ashx?TireID=" + TireId; } catch (Exception ex) { new SqlLog().InsertSqlLog(0, "Addinventory.LoadTireInfo", ex); } }
private void UpdateTire() { try { Tire objInventory = new Tire(); objInventory.C_BarCode = txtCBarCode.Text.Trim() == "" ? 0 : Convert.ToInt32(txtCBarCode.Text.Trim()); objInventory.TX_BarCodeId = 0; objInventory.DotNumber = txtDOTPlant.Text.Trim() + txtDOTSize.Text.Trim() + txtDOTBrand.Text.Trim() + txtDOTWeek.Text.Trim() + txtDOTYear.Text.Trim(); objInventory.BrandId1 = 1; objInventory.BrandId2 = Conversion.ParseInt(hdnBrand2ID.Value); objInventory.TireType = ""; objInventory.PlantCode = txtDOTPlant.Text.Trim(); objInventory.SizeNumber = txtDOTSize.Text.Trim(); objInventory.MonthCode = txtDOTWeek.Text.Trim(); objInventory.YearCode = txtDOTYear.Text.Trim(); objInventory.DateCreated = DateTime.Now; objInventory.CreatedById = LoginMemberId; objInventory.LangaugeId = LanguageId; objInventory.OrganizationId = UserOrganizationId; objInventory.SerialNumber = GenerateSerialNumber(); objInventory.TireClassId = Conversion.ParseInt(ddlTireClass.SelectedValue); objInventory.TireOutComeID = Conversion.ParseInt(ddlRecycleState.SelectedValue); objInventory.TireActionId = Conversion.ParseInt(ddlTireState.SelectedValue); if (System.IO.File.Exists(Server.MapPath(String.Format("/Images/temp/{0}", hdnBarCodeImageFileName.Value)))) { objInventory.Image = System.IO.File.ReadAllBytes(Server.MapPath(String.Format("/Images/temp/{0}", hdnBarCodeImageFileName.Value))); } objInventory.Space = string.Empty; objInventory.Lane = string.Empty; objInventory.TireId = Convert.ToInt32(hdnTireID.Value); if (Request.QueryString["LoadId"] != null) { objInventory.TireId = Tire.updateTireForLoadRecieve(objInventory, Conversion.ParseInt(hdnOldTXBarcodeID.Value)); } else { objInventory.TireId = Tire.updateInventory(objInventory, Conversion.ParseInt(hdnOldTXBarcodeID.Value), Convert.ToInt32(hidLotId.Value), DateTime.Now); } if (System.IO.File.Exists(Server.MapPath(String.Format("/Images/temp/{0}", hdnBarCodeImageFileName.Value)))) { System.IO.File.Delete(Server.MapPath(String.Format("/Images/temp/{0}", hdnBarCodeImageFileName.Value))); } if (objInventory.TireId > 0) { hdnTireID.Value = ""; hdnOldTXBarcodeID.Value = ""; lblErrorSuccessInventory.Text = "Record is successfully updated"; lnkbtnUpdateInventory.Visible = false; lnkbtnAddInventory.Visible = true; lnkCompleted.Visible = true; txtCBarCode.Text = ""; txtDOTPlant.Text = ""; txtDOTSize.Text = ""; txtDOTBrand.Text = ""; txtDOTWeek.Text = ""; txtDOTYear.Text = ""; ViewState["UpdatTire"] = "0"; ddlTireState.SelectedIndex = 1; ddlRecycleState.SelectedIndex = 1; ddlTireClass.SelectedIndex = 1; txtBrand.Text = ""; txtBrand2.Text = ""; txtSize.Text = ""; txtDOTPlant.Attributes.Add("prevValue", "0"); txtDOTSize.Attributes.Add("prevValue", "0"); txtDOTBrand.Attributes.Add("prevValue", "0"); txtDOTWeek.Attributes.Add("prevValue", "0"); txtDOTYear.Attributes.Add("prevValue", "0"); imgBarCode.Visible = false; imgBarCode.ImageUrl = string.Empty; if (Request.QueryString["OpenLotId"] != null) { Lots.ChangeModifiedDate(Convert.ToInt32(hidLotId.Value)); } if (Request.QueryString["LoadId"] != null) { gvAllTire.DataSource = Loads.getLoadTireInfoByLoadId(Convert.ToInt32(Request.QueryString["LoadId"])); gvAllTire.DataBind(); } else { gvAllTire.DataSource = Tire.getCompleteTireInfo_ByLotID(Conversion.ParseInt(hidLotId.Value)); gvAllTire.DataBind(); } } txtNumberOfRecord.Enabled = true; ResourceRequiredFieldValidator10.Enabled = true; ResourceRequiredFieldValidator10.CssClass = "custom-error"; ResourceRequiredFieldValidator10.ValidationGroup = "GenerateBarCode"; ResourceRequiredFieldValidator10.ControlToValidate = "txtNumberOfRecord"; ResourceRequiredFieldValidator10.ErrorControlText = "This field is required"; } catch (Exception ex) { new SqlLog().InsertSqlLog(0, "AddInventory.UpdateTire", ex); } }
private void AddNewTire(int nOfTires, int cbarcode) { if (nOfTires == 0) { cbarcode = Conversion.ParseInt(txtCBarCode.Text.Trim()); } try { if (chkIfCBarcoreExists(cbarcode, nOfTires)) { return; } //string lotNumber = txtLotNumber.Text; Tire objInventory = new Tire(); objInventory.C_BarCode = cbarcode; objInventory.TX_BarCodeId = 0; objInventory.DotNumber = txtDOTPlant.Text.Trim() + txtDOTSize.Text.Trim() + txtDOTBrand.Text.Trim() + txtDOTWeek.Text.Trim() + txtDOTYear.Text.Trim(); objInventory.BrandId1 = 1; // Convert.ToInt32(txtBrand.Text.Trim()); objInventory.BrandId2 = Conversion.ParseInt(hdnBrand2ID.Value); // Convert.ToInt32(txtBrand2.Text.Trim()); objInventory.TireType = ""; objInventory.PlantCode = txtDOTPlant.Text.Trim(); objInventory.SizeNumber = txtDOTSize.Text.Trim(); objInventory.MonthCode = txtDOTWeek.Text.Trim(); objInventory.YearCode = txtDOTYear.Text.Trim(); objInventory.DateCreated = DateTime.Now; objInventory.CreatedById = LoginMemberId; objInventory.LangaugeId = LanguageId; objInventory.OrganizationId = UserOrganizationId;//string.IsNullOrEmpty(Session["OrganizationId"].ToString()) ? Convert.ToInt32(ddlStakeholder.SelectedValue) : Convert.ToInt32(Session["OrganizationId"]); // objInventory.TireStateCategoryId = Convert.ToInt32(ddlTireState.SelectedValue); objInventory.TireClassId = Conversion.ParseInt(ddlTireClass.SelectedValue); objInventory.TireActionId = Conversion.ParseInt(ddlTireState.SelectedValue); objInventory.TireOutComeID = Conversion.ParseInt(ddlRecycleState.SelectedValue); string BarCodeImage = ""; if (nOfTires == 0) { objInventory.SerialNumber = hdnBarCodeImageFileName.Value; BarCodeImage = hdnBarCodeImageFileName.Value; } else { btnGenerateBarCode_Click(null, null); objInventory.SerialNumber = hdnBarCodeImageFileName.Value; BarCodeImage = objInventory.SerialNumber; } //if (objInventory.TireStateCategoryId == 1) // objInventory.RecycleStateId = ddlRecycleState.SelectedIndex > 0 ? Convert.ToInt32(ddlRecycleState.SelectedValue) : 0; //else // objInventory.RetreadStateId = ddlRecycleState.SelectedIndex > 0 ? Convert.ToInt32(ddlRecycleState.SelectedValue) : 0; if (System.IO.File.Exists(Server.MapPath(String.Format("/Images/temp/{0}", BarCodeImage)))) { objInventory.Image = System.IO.File.ReadAllBytes(Server.MapPath(String.Format("/Images/temp/{0}", BarCodeImage))); } objInventory.Space = string.Empty; objInventory.Lane = string.Empty; objInventory.TireId = Tire.addNewInventory(objInventory); if (System.IO.File.Exists(Server.MapPath(String.Format("/Images/temp/{0}", BarCodeImage)))) { System.IO.File.Delete(Server.MapPath(String.Format("/Images/temp/{0}", BarCodeImage))); } if (nOfTires == Conversion.ParseInt(txtNumberOfRecord.Text.ToString()) - 1) { hdnBarCodeImageFileName.Value = ""; imgBarCode.Visible = false; } int spaceId = string.IsNullOrEmpty(hidSelectedSpace.Value) ? 0 : Convert.ToInt32(hidSelectedSpace.Value); int laneId = string.IsNullOrEmpty(hidSelectedLane.Value) ? 0 : Convert.ToInt32(hidSelectedLane.Value); //if (Conversion.ParseString(Session["lot"]) == "single") //{ // Lots.insertLotsTires(Convert.ToInt32(hidLotId.Value), objInventory.TireId, 0, DateTime.Now, 1, true, false, false, spaceId, laneId); // Lots.finishedLot(Convert.ToInt32(hidLotId.Value), true); // Response.Redirect("lotinfo"); //} if (Request.QueryString["LoadId"] != null) { int LoadId = Conversion.ParseInt(Request.QueryString["LoadId"]); if (!Loads.InsertLoadTireForReceving(LoadId, objInventory.TireId, LoginMemberId)) { lblErrorAddInventory.Text = "Error, Please try again!"; //lblErrorAddInventory.Attributes.Add("class", "custom-absolute-alert alert-danger"); } else { if (nOfTires == Conversion.ParseInt(txtNumberOfRecord.Text.ToString()) - 1) { lblErrorSuccessInventory.Text = "New Record Added."; lblErrorSuccessInventory.Visible = true; lblErrorExistCBarCode.Text = string.Empty; txtCBarCode.Text = ""; txtDOTPlant.Text = ""; txtDOTSize.Text = ""; txtDOTBrand.Text = ""; txtDOTWeek.Text = ""; txtDOTYear.Text = ""; ddlTireClass.SelectedIndex = 1; ddlTireState.SelectedIndex = 1; ddlRecycleState.SelectedIndex = 1; txtBrand.Text = ""; txtBrand2.Text = ""; txtSize.Text = ""; imgBarCode.Visible = false; imgBarCode.ImageUrl = string.Empty; txtDOTPlant.Attributes.Add("prevValue", "0"); txtDOTSize.Attributes.Add("prevValue", "0"); txtDOTBrand.Attributes.Add("prevValue", "0"); txtDOTWeek.Attributes.Add("prevValue", "0"); txtDOTYear.Attributes.Add("prevValue", "0"); gvAllTire.DataSource = Loads.getLoadTireInfoByLoadId(Convert.ToInt32(Request.QueryString["LoadId"])); gvAllTire.DataBind(); } } } else { if (!Lots.insertLotsTires(Convert.ToInt32(hidLotId.Value), objInventory.TireId, 0, DateTime.Now, 1, true, false, false, spaceId, laneId)) { lblErrorAddInventory.Text = "Error, Please try again!"; } else { if (nOfTires == Conversion.ParseInt(txtNumberOfRecord.Text.ToString()) - 1) { lblErrorSuccessInventory.Text = "New Record Added."; lblErrorSuccessInventory.Visible = true; lblErrorExistCBarCode.Text = string.Empty; txtCBarCode.Text = ""; txtDOTPlant.Text = ""; txtDOTSize.Text = ""; txtDOTBrand.Text = ""; txtDOTWeek.Text = ""; txtDOTYear.Text = ""; ddlTireClass.SelectedIndex = 1; ddlTireState.SelectedIndex = 1; ddlRecycleState.SelectedIndex = 1; txtBrand.Text = ""; txtBrand2.Text = ""; txtSize.Text = ""; imgBarCode.Visible = false; imgBarCode.ImageUrl = string.Empty; txtDOTPlant.Attributes.Add("prevValue", "0"); txtDOTSize.Attributes.Add("prevValue", "0"); txtDOTBrand.Attributes.Add("prevValue", "0"); txtDOTWeek.Attributes.Add("prevValue", "0"); txtDOTYear.Attributes.Add("prevValue", "0"); gvAllTire.DataSource = Tire.getCompleteTireInfo_ByLotID(Convert.ToInt32(hidLotId.Value)); gvAllTire.DataBind(); if (Request.QueryString["OpenLotId"] != null) { Lots.ChangeModifiedDate(Convert.ToInt32(hidLotId.Value)); } } } } } catch (Exception ex) { new SqlLog().InsertSqlLog(0, "AddInventory.AddNewTire", ex); } }
private void buttonTAdd_Click(object sender, EventArgs e) { SimProvider.Tire t = new Tire(Convert.ToDouble(numericUpDown7.Value)); t.name = textBox3.Text; save._tire.Add(t); reloadLists(); }
/// <summary> /// Update pop Up Funcation For Tire Info /// </summary> /// <param name="tireid"></param> protected void LoadUpdateInventory(int tireid) { dvInventoryUpdate.Visible = true; //ddlTireState.Items.Clear(); //ddlRecycleState.Items.Clear(); //ddlTireState.DataSource = Tire.getTireStateCategory(); //ddlTireState.DataBind(); //LoadTireStateType(); ddlTireState.Items.Clear(); ddlRecycleState.Items.Clear(); ddlTireClass.Items.Clear(); Utils.GetLookUpData<DropDownList>(ref ddlTireClass, LookUps.LoadInventoryClass); Utils.GetLookUpData<DropDownList>(ref ddlTireState, LookUps.LoadInventoryAction); Utils.GetLookUpData<DropDownList>(ref ddlRecycleState, LookUps.LoadInventoryOutcome); btnGenerateBarCode_Click(null, null); Tire inventoryobj = new Tire(tireid); txtCBarCode.Text = inventoryobj.C_BarCode.ToString(); txtDOTPlant.Text = inventoryobj.PlantCode; txtDOTSize.Text = inventoryobj.SizeNumber; txtDOTBrand.Text = inventoryobj.BrandCode; txtDOTWeek.Text = inventoryobj.MonthCode; txtDOTYear.Text = inventoryobj.YearCode; txtBrand.Text = inventoryobj.Brand1Name; txtBrand2.Text = inventoryobj.Brand2Name; btnGenerateBarCode_Click(null, null); hdnIsPlantCodeValid.Value = "1"; hdnIsSizeCodeValid.Value = "1"; hdnIsWeekCodeValid.Value = "1"; hdnIsYearCodeValid.Value = "1"; hdnBrand2ID.Value = Conversion.ParseString(inventoryobj.BrandId2); hdnTireID.Value = inventoryobj.TireId.ToString(); hdnOldBarCodeId.Value = inventoryobj.TX_BarCodeId.ToString(); txtSize.Text = inventoryobj.TireSize; //if (String.IsNullOrEmpty(inventoryobj.TireClassId.ToString()) || String.IsNullOrEmpty(inventoryobj.TireActionId.ToString()) || String.IsNullOrEmpty(inventoryobj.TireOutComeID.ToString())) //{ // ddlTireClass.SelectedIndex = 1; // ddlTireClass.SelectedIndex = 1; // ddlRecycleState.SelectedIndex = 1; //} ddlTireClass.SelectedValue = inventoryobj.TireClassId.ToString(); ddlTireState.SelectedValue = inventoryobj.TireActionId.ToString(); ddlRecycleState.SelectedValue = inventoryobj.TireOutComeID.ToString(); DataSet ds = Lots.getBarcodeByTireId(tireid); //lblLotNumber.Visible = true; lblLotNumber.Text = "Lot# " + ds.Tables[0].Rows[0]["LotId"].ToString(); imgTireBarcode.Visible = true; imgTireBarcode.ImageUrl = "/Handlers/GetBarcodeImage.ashx?LotId=" + Request.QueryString["OpenLotId"]; imgBarCode.Visible = true; imgBarCode.ImageUrl = "/Handlers/GetBarcodeImage.ashx?TireID=" + tireid; }
private void UpdateTire() { try { if (!string.IsNullOrEmpty(lblerror.Text)) { return; } //string lotNumber = txtLotNumber.Text; Tire objInventory = new Tire(); objInventory.C_BarCode = txtCBarCode.Text.Trim() == "" ? 0 : Convert.ToInt32(txtCBarCode.Text.Trim()); objInventory.TX_BarCodeId = 0; objInventory.DotNumber = txtDOTPlant.Text.Trim() + txtDOTSize.Text.Trim() + txtDOTBrand.Text.Trim() + txtDOTWeek.Text.Trim() + txtDOTYear.Text.Trim(); objInventory.BrandId1 = 1; // Convert.ToInt32(txtBrand.Text.Trim()); objInventory.BrandId2 = Conversion.ParseInt(hdnBrand2ID.Value); // Convert.ToInt32(txtBrand2.Text.Trim()); objInventory.TireType = ""; objInventory.PlantCode = txtDOTPlant.Text.Trim(); objInventory.SizeNumber = txtDOTSize.Text.Trim(); objInventory.MonthCode = txtDOTWeek.Text.Trim(); objInventory.YearCode = txtDOTYear.Text.Trim(); objInventory.DateCreated = DateTime.Now; objInventory.CreatedById = LoginMemberId; objInventory.LangaugeId = LanguageId; objInventory.OrganizationId = UserOrganizationId;//string.IsNullOrEmpty(Session["OrganizationId"].ToString()) ? Convert.ToInt32(ddlStakeholder.SelectedValue) : Convert.ToInt32(Session["OrganizationId"]); objInventory.TireStateCategoryId = Convert.ToInt32(ddlTireState.SelectedValue); objInventory.SerialNumber = GenerateSerialNumber(); objInventory.TireClassId = Conversion.ParseInt(ddlTireClass.SelectedValue); objInventory.TireOutComeID = Conversion.ParseInt(ddlRecycleState.SelectedValue); objInventory.TireActionId = Conversion.ParseInt(ddlTireState.SelectedValue); //if (objInventory.TireStateCategoryId == 1) // objInventory.RecycleStateId = ddlRecycleState.SelectedIndex > 0 ? Convert.ToInt32(ddlRecycleState.SelectedValue) : 0; //else // objInventory.RetreadStateId = ddlRecycleState.SelectedIndex > 0 ? Convert.ToInt32(ddlRecycleState.SelectedValue) : 0; if (System.IO.File.Exists(Server.MapPath(String.Format("/images/temp/{0}", hdnBarCodeImageFileName.Value)))) { objInventory.Image = System.IO.File.ReadAllBytes(Server.MapPath(String.Format("/images/temp/{0}", hdnBarCodeImageFileName.Value))); } objInventory.Space = string.Empty; objInventory.Lane = string.Empty; int lotid = Convert.ToInt32(Request.QueryString["OpenLotId"]); objInventory.TireId = Convert.ToInt32(hdnTireID.Value); objInventory.TireId = Tire.updateInventorybyTireIdandLotId(objInventory, Convert.ToInt32(hdnOldBarCodeId.Value), lotid, DateTime.Now); lblTireUpdate.ForeColor = Color.Green; lblTireUpdate.Visible = true; ScriptManager.RegisterStartupScript(this, GetType(), "RemoveIt", "rmSeccesMsg();", true); if (System.IO.File.Exists(Server.MapPath(String.Format("/images/temp/{0}", hdnBarCodeImageFileName.Value)))) { System.IO.File.Delete(Server.MapPath(String.Format("/images/temp/{0}", hdnBarCodeImageFileName.Value))); } hdnBarCodeImageFileName.Value = ""; imgBarCode.Visible = false; //int spaceId = string.IsNullOrEmpty(hidSelectedSpace.Value) ? 0 : Convert.ToInt32(hidSelectedSpace.Value); //int laneId = string.IsNullOrEmpty(hidSelectedLane.Value) ? 0 : Convert.ToInt32(hidSelectedLane.Value); //if (Conversion.ParseString(Session["lot"]) == "single") //{ // LotsInfo.InsertLotsTires(Convert.ToInt32(hidLotId.Value), objInventory.TireId, 0, DateTime.Now, 1, true, false, false, spaceId, laneId); // LotsInfo.FinishedLot(Convert.ToInt32(hidLotId.Value), true); // Response.Redirect("lotinfo"); //} //else //{ // if (!LotsInfo.InsertLotsTires(Convert.ToInt32(hidLotId.Value), objInventory.TireId, 0, DateTime.Now, 1, true, false, false, spaceId, laneId)) // Response.Redirect("lotinfo"); txtCBarCode.Text = ""; txtDOTPlant.Text = ""; txtDOTSize.Text = ""; txtDOTBrand.Text = ""; txtDOTWeek.Text = ""; txtDOTYear.Text = ""; ddlTireState.SelectedIndex = 0; ddlRecycleState.SelectedIndex = 0; txtBrand.Text = ""; txtBrand2.Text = ""; txtDOTPlant.Attributes.Add("prevValue", "0"); txtDOTSize.Attributes.Add("prevValue", "0"); txtDOTBrand.Attributes.Add("prevValue", "0"); txtDOTWeek.Attributes.Add("prevValue", "0"); txtDOTYear.Attributes.Add("prevValue", "0"); hdnOldBarCodeId.Value = ""; Load_AllAdminInventory(1); //} } catch (Exception ex) { new SqlLog().InsertSqlLog(0, "inventory-tire.UpdateTire", ex); } }