static void Main(string[] args) { Category obj = new Category(); SpareParts objSpare = new SpareParts(); obj.Display(); objSpare.Display(); }
static void Snippet678() { Category ctg = new Category(); SpareParts sp = new SpareParts(); ctg.Display(); sp.Display(); }
public IActionResult EditSparePart(SpareParts detail) { if (ModelState.IsValid) { repo.Update(detail); return(RedirectToAction("ViewSpareParts")); } return(View("EditSparePart")); }
public ActionResult Index() { var reddit = new Reddit(); //var user = reddit.LogIn("EddieValiantsRabbit", "camaro"); var all = reddit.GetSubreddit("/r/news"); var listOfPosts = all.Hot.Take(25); ViewBag.Posts = new List <RedditSharp.Things.Post>(); ViewBag.Posts = listOfPosts; ViewBag.Greeting = "Good " + SpareParts.DeterminePartOfDay(); WebRequest weatherRequest = WebRequest.Create(@"http://api.openweathermap.org/data/2.5/weather?zip=94040,us&appid=8b3de9d1132f5c7199d2650d858cef68"); weatherRequest.ContentType = "application/json; charset=utf-8"; WeatherResponse jsonResponse = new WeatherResponse(); using (HttpWebResponse weatherResponse = weatherRequest.GetResponse() as HttpWebResponse) { if (weatherResponse.StatusCode != HttpStatusCode.OK) { throw new Exception(String.Format( "Server error (HTTP {0}: {1}).", weatherResponse.StatusCode, weatherResponse.StatusDescription)); } DataContractJsonSerializer jsonSerializer = new DataContractJsonSerializer(typeof(WeatherResponse)); object objResponse = jsonSerializer.ReadObject(weatherResponse.GetResponseStream()); jsonResponse = objResponse as WeatherResponse; } ViewBag.CurrentMonth = SpareParts.GetCurrentMonth(DateTime.Now.Month); ViewBag.CurrentDayOfMonth = DateTime.Now.Day; ViewBag.CurrentDayOfWeek = DateTime.Now.DayOfWeek; ViewBag.CurrentHour = DateTime.Now.Hour; ViewBag.CurrentMinute = DateTime.Now.Minute; ViewBag.CurrentSecond = DateTime.Now.Second; ViewBag.CurrentTemp = (jsonResponse.main.Temp - 273.15) * 1.8 + 32; ViewBag.WeatherDescription = jsonResponse.weather[0].Description; return(View()); }
private void saveButton_Click(object sender, EventArgs e) { double result; numberPictureBox.Visible = false; namePictureBox.Visible = false; pricePictureBox.Visible = false; bool error = false; if (nameTextBox.Text.Length == 0) { namePictureBox.Visible = true; error = true; } if (numberTextBox.Text.Length == 0) { numberPictureBox.Visible = true; error = true; } if (priceTextBox.Text.Length == 0 || !Double.TryParse(priceTextBox.Text, out result)) { pricePictureBox.Visible = true; error = true; } if (error) { return; } SpareParts p = new SpareParts(this.id, nameTextBox.Text, numberTextBox.Text, Double.Parse(priceTextBox.Text, CultureInfo.InvariantCulture)); if (p.Id == 0) { PartRepository.Add(p); } else { PartRepository.Update(p); } this.Close(); }
public PartForm(int id = 0) { InitializeComponent(); numberPictureBox.Visible = false; namePictureBox.Visible = false; pricePictureBox.Visible = false; SpareParts part = null; if (id != 0) { this.id = id; part = PartRepository.Get(id); } if (part != null) { numberTextBox.Text = part.Number; nameTextBox.Text = part.Name; priceTextBox.Text = part.Price.ToString(); } }
public EntitySparePart Insert(EntitySparePart data) { try { SpareParts dataNew = new SpareParts() { PK_SparePartsID = data.PK_SparePartsID, FK_OrderID = data.FK_OrderID, FK_BuildOfMaterialsID = data.FK_BuildOfMaterialsID, FK_ProductID = data.FK_ProductID, FK_WorkforceID = data.FK_WorkforceID, RefManID = data.RefManID, SparePartDescription = data.ItemRefMan, Quantity = data.Quantity, Price = data.Price, StatusSchema = data.StatusSchema, Status = data.Status, PosicionItem = data.PosicionItem, SparePartStatus = data.SparePartStatus, CreateDate = data.CreateDate, ModifyDate = data.ModifyDate }; base.DataContext.SpareParts.Add(dataNew); base.DataContext.SaveChanges(); data.PK_SparePartsID = dataNew.PK_SparePartsID; return(data); } catch (DbException dbex) { throw dbex; } catch (Exception ex) { throw ex; } }
public IActionResult ConfirmSparePartDelete(int id) { SpareParts detail = repo.Get(id); return(View(detail) ?? (IActionResult)NotFound()); }
public IActionResult EditSparePart(int id) { SpareParts detail = repo.Get(id); return(View(detail) ?? (IActionResult)NotFound()); }
public PriceOfferDbEntity() { TotalPrice = (int)SpareParts.Sum(sp => sp.TotalPrice); }