private void button4_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(amountTxt.Text)) { amountTxt.BackColor = Color.Red; return; } if (string.IsNullOrEmpty(itemTxt.Text)) { itemTxt.BackColor = Color.Red; return; } if (!string.IsNullOrEmpty(existingID)) { if (MessageBox.Show("YES or No?", "Are you sure you want to update the current existing information ? ", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { Labor j = new Labor(existingID, Convert.ToDateTime(dateTxt.Text).Year.ToString(), Convert.ToInt32(weekLbl.Text), startLbl.Text, endLbl.Text, itemTxt.Text, Convert.ToDouble(amountTxt.Text), month); DBConnect.Update(j, existingID); existingID = ""; } return; } existingID = ""; string ID = Guid.NewGuid().ToString(); Labor i = new Labor(ID, Convert.ToDateTime(dateTxt.Text).Year.ToString(), Convert.ToInt32(weekLbl.Text), startLbl.Text, endLbl.Text, itemTxt.Text, Convert.ToDouble(amountTxt.Text), month); DBConnect.Insert(i); MessageBox.Show("Information Saved "); itemTxt.Text = ""; amountTxt.Text = ""; autocomplete(); }
public async Task <Labor> GetCurrentLabor() { generalParameter = await LoadGeneralParameter(); if (generalParameter != null) { this.Description = this.Description?.Trim(); this.EstimationTime = ValidateInteger(this.EstimationTime); this.WorkedTime = ValidateInteger(this.WorkedTime); var mainModel = MainViewModel.GetInstance(); var oLabor = new Labor(); oLabor.LaborId = this.LaborId; //Se captura el valor del cuadro de texto de horas estimadas oLabor.EstimationTime = obtenerHoras(this.EstimationMin, (int)this.EstimationTime); oLabor.LastUpDate = DateTime.Now; DateTime fechaInicio = this.StartDate; string fechaInicioLabor = fechaInicio.Year + "-" + fechaInicio.Month + "-" + fechaInicio.Day + " " + fechaInicio.Hour + ":" + fechaInicio.Minute + ":" + fechaInicio.Second; oLabor.StartDate = Convert.ToDateTime(fechaInicioLabor); oLabor.LastUpdateUser = mainModel.CurrentUser.UserCode; //Se captura el valor del cuadro de texto de horas estimadas oLabor.WorkedTime = obtenerHoras(this.WorkedMin, (int)this.WorkedTime); //Detalle de la labor oLabor.Description = this.Description; oLabor.Task = new Models.Task() { TaskId = mainModel.TaskSelected }; oLabor.Resource = mainModel.CurrentUser; oLabor.GeneralParameterDays = obtenerDiasHabilesRegistro(); DateTime fechaActual = DateTime.Now; oLabor.EndDate = fechaActual.AddDays(oLabor.GeneralParameterDays * -1); return(oLabor); } return(null); }
private void itemTxt_Leave(object sender, EventArgs e) { try { amountTxt.Text = Labor.List("SELECT * from labor WHERE department='" + itemTxt.Text + "' AND week = '" + weekLbl.Text + "' AND date = '" + Convert.ToDateTime(dateTxt.Text).Year.ToString() + "'").First().Amount.ToString(); } catch (Exception y) { // Helper.Exceptions(y.Message, "on adding inventory auto fill the category list selected item"); } try { month = Labor.List("SELECT * from labor WHERE department='" + itemTxt.Text + "' AND week = '" + weekLbl.Text + "' AND date = '" + Convert.ToDateTime(dateTxt.Text).Year.ToString() + "'").First().Month; } catch (Exception y) { // Helper.Exceptions(y.Message, "on adding inventory auto fill the category list selected item"); } try { existingID = Labor.List("SELECT * from labor WHERE department='" + itemTxt.Text + "' AND week = '" + weekLbl.Text + "' AND date = '" + Convert.ToDateTime(dateTxt.Text).Year.ToString() + "'").First().Id.ToString(); } catch (Exception y) { // Helper.Exceptions(y.Message, "on adding inventory auto fill the category list selected item"); } }
public static void AddLabor(Labor model) { var db = new RoyalFinishingDataContext(); db.Labors.InsertOnSubmit(model); db.SubmitChanges(); }
public ActionResult Edit([Bind(Include = "Id_labor,Name")] Labor labor) { ViewBag.Id_ExtAttr = new SelectList(db.ExtendedAttributes, "Id_ExtAttr", "Name", labor.Id_ExtAttr); if (labor.Name == null) { ModelState.AddModelError("", "Debe indicar un nombre para la labor"); } if (ModelState.IsValid) { try { var id_ExtAttr = db.Labors.Where(x => x.Id_labor == labor.Id_labor).Select(x => x.Id_ExtAttr).FirstOrDefault(); labor.Id_ExtAttr = id_ExtAttr; db.Entry(labor).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index", new { updated = true })); } catch (Exception) { ModelState.AddModelError("", "Algo salio mal, intente nuevamente"); return(View(labor)); } } return(View(labor)); }
/// <summary> /// Pauses timer /// </summary> public Task PauseAsync() { if (activeAssignment == null || timerEntry == null) { return(Task.Factory.StartNew(delegate { })); } IsBusy = true; Recording = false; var labor = new Labor { Type = LaborType.Hourly, AssignmentId = activeAssignment.Id, Description = "Time entered automatically at: " + DateTime.Now.ToShortTimeString(), Hours = (DateTime.Now - timerEntry.Date), }; return(service .SaveLaborAsync(labor) .ContinueWith(service.DeleteTimerEntryAsync(timerEntry)) .ContinueOnCurrentThread(_ => { CurrentHours = TimeSpan.Zero; IsBusy = false; })); }
public string Post([FromBody] Labor labor) { //Create db.Labor.Add(labor); db.SaveChanges(); return(JsonConvert.SerializeObject(labor)); }
public ActionResult Create([Bind(Include = "Name, Id_ExtAttr")] Labor labor) { ViewBag.Id_ExtAttr = new SelectList(db.ExtendedAttributes, "Id_ExtAttr", "Name", labor.Id_ExtAttr); if (labor.Name == null) { ModelState.AddModelError("", "Debe seleccionar un nombre para la labor "); } //if (labor.Id_ExtAttr == null) //{ // ModelState.AddModelError("", "Debe seleccionar un valor para el atributo extendido "); //} if (ModelState.IsValid) { try { db.Labors.Add(labor); db.SaveChanges(); return(RedirectToAction("Index", new { added = true })); } catch (Exception) { ModelState.AddModelError("", "Algo salio mal, intente nuevamente"); return(View(labor)); } } return(View(labor)); }
public async Task <IActionResult> Edit(int id, [Bind("LaborId,Quantity,Description,LaborCost")] Labor labor) { if (id != labor.LaborId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(labor); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!LaborExists(labor.LaborId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(labor)); }
// GET: Labors/Create public ActionResult Create(int workOrderId) { Labor labor = new Labor(); labor.WorkOrderId = workOrderId; return(PartialView("_Create", labor)); }
public LaborDto Add(LaborDto dto) { Labor labor = Map(dto); _context.Labors.Add(labor); _context.SaveChanges(); return(Map(labor)); }
// GET: Labors/Create public ActionResult Create(int workOrderId) { Labor labor = new Labor(); labor.WorkOrderId = workOrderId; ViewBag.WorkOrderId = new SelectList(db.WorkOrders, "WorkOrderId", "Description", labor.WorkOrderId); return(PartialView("_Create", labor)); }
public LaborDto Delete(long id) { Labor labor = _context.Labors.FirstOrDefault(x => x.Id == id); _context.Labors.Remove(labor); _context.SaveChanges(); return(Map(labor)); }
/// <summary> /// Deletes a labor entry /// </summary> public Task DeleteLaborAsync(Assignment assignment, Labor labor) { return(service.DeleteLaborAsync(labor) .ContinueWith(t => { laborHours.Remove(labor); CalculateHours(assignment); })); }
public LaborDto Update(LaborDto dto) { Labor labor = Map(dto); _context.Labors.Update(labor); _context.SaveChanges(); return(Map(labor)); }
public ActionResult DeleteConfirmed(int id) { Labor labor = db.Labors.Find(id); db.Labors.Remove(labor); db.SaveChanges(); return(RedirectToAction("Index")); }
public async Task <ActionResult> DeleteConfirmed(int id) { Labor labor = await _applicationDbContext.Labors.FindAsync(id); _applicationDbContext.Labors.Remove(labor); await _applicationDbContext.SaveChangesAsync(); return(RedirectToAction("Index")); }
public static void ExtractSubMain() { var Joao = new Employee(50); ServiceItem s1 = new Labor(5, Joao); ServiceItem s2 = new RawMaterial(15, 10); var TotalService = s1.GetTotalPrice() + s2.GetTotalPrice(); Console.WriteLine(TotalService); }
public void Execute(object parameter) { Labor Labor = new Labor(); Labor.DataContext = new LaborVM(WorkOrderDetailVM); Labor.ShowInTaskbar = false; //Labor.Owner = ((App)Application.Current).MainWindow; Labor.ShowDialog(); }
public async Task <ActionResult> DeleteConfirmed(int id) { Labor labor = await db.Labors.FindAsync(id); db.Labors.Remove(labor); await db.SaveChangesAsync(); return(Json(new { success = true })); //RedirectToAction("Index"); }
public async Task <ActionResult> DeleteConfirmed(int id) { Labor labor = await context.Labors.FindAsync(id); context.Labors.Remove(labor); await context.SaveChangesAsync(); return(Json(new { success = true })); }
public ActionResult Edit([Bind(Include = "idLabor,nombre,precio")] Labor labor) { if (ModelState.IsValid) { db.Entry(labor).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(labor)); }
public void ClearLaborRelations() { // remove this job from all related labors foreach (var labor in Labor) { labor.Jobs.Remove(this); } // then clear labors Labor.Clear(); }
public ActionResult Create([Bind(Include = "idLabor,nombre,precio")] Labor labor) { if (ModelState.IsValid) { db.Labors.Add(labor); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(labor)); }
public ActionResult Edit([Bind(Include = "Lab_id,Lab_name,Lab_OrgId,Lab_status,Ph_no,address,LastName,RoleID,Password,Email")] Labor labor) { if (ModelState.IsValid) { db.Entry(labor).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Lab_OrgId = new SelectList(db.Organizations, "org_id", "org_name", labor.Lab_OrgId); return(View(labor)); }
public async Task <IActionResult> Create([Bind("LaborId,Quantity,Description,LaborCost")] Labor labor) { if (ModelState.IsValid) { _context.Add(labor); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(labor)); }
public ActionResult Edit([Bind(Include = "LaborID,QuestID,Title,Description,Location")] Labor labor) { if (ModelState.IsValid) { db.Entry(labor).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.QuestID = new SelectList(db.Quests, "QuestID", "Title", labor.QuestID); return(View(labor)); }
public async Task <ActionResult> Edit([Bind(Include = "LaborId,WorkOrderId,ServiceItemCode,ServiceItemName,LaborHours,Rate,Notes,PercentComplete")] Labor labor) { if (ModelState.IsValid) { _applicationDbContext.Entry(labor).State = EntityState.Modified; await _applicationDbContext.SaveChangesAsync(); return(Json(new { success = true })); } return(PartialView("_Edit", labor)); }
public async Task <ActionResult> Create([Bind(Include = "LaborId,WorkOrderId,ServiceItemCode,ServiceItemName,LaborHours,Rate,PercentComplete,Notes")] Labor labor) { if (ModelState.IsValid) { context.Labors.Add(labor); await context.SaveChangesAsync(); return(Json(new { success = true })); } return(PartialView("_Create", labor)); }
public async Task <ActionResult> Edit([Bind(Include = "LaborId,WorkOrderId,ServiceItemCode,ServiceItemName,LaborHours,Rate,ExtendedPrice,Notes")] Labor labor) { if (ModelState.IsValid) { _applicationDbContext.Entry(labor).State = EntityState.Modified; await _applicationDbContext.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewBag.WorkOrderId = new SelectList(_applicationDbContext.WorkOrders, "WorkOrderId", "Description", labor.WorkOrderId); return(View(labor)); }
//public static string GetServiceTotal(IEnumerable<ServiceTotal> serviceList) //{ // decimal total = (from s in serviceList select s.Total).Sum(); // return total.ToString("C2"); //} //public static string GetServiceCount(IEnumerable<ServiceTotal> serviceList) //{ // int total = (from s in serviceList select s.Cars).Sum(); // return total.ToString(); //} public static string GetInvoiceId(Labor l) { return l.Invoice.Id.ToString(); }