public async Task InsertProducts(ServiceOrder serviceOrder, Product product) { Product objProduct = await _context.Products.Where(x => x.ProductId == product.ProductId).FirstOrDefaultAsync(); ServiceOrderHasProducts objServiceProduct = new ServiceOrderHasProducts(serviceOrder, objProduct); await _context.ServiceOrderHasProducts.AddAsync(objServiceProduct); }
private void CheckParams(ServiceOrder serviceOrder) { //检测必填参数 if (string.IsNullOrEmpty(serviceOrder.out_trade_no)) { throw new WxPayException("缺少统一支付接口必填参数out_trade_no!"); } else if (string.IsNullOrEmpty(serviceOrder.body)) { throw new WxPayException("缺少统一支付接口必填参数body!"); } else if (serviceOrder.total_fee <= 0) { throw new WxPayException("缺少统一支付接口必填参数total_fee!"); } else if (string.IsNullOrEmpty(serviceOrder.trade_type)) { throw new WxPayException("缺少统一支付接口必填参数trade_type!"); } //关联参数 if (serviceOrder.trade_type == "JSAPI" && string.IsNullOrEmpty(serviceOrder.openid)) { throw new WxPayException("统一支付接口中,缺少必填参数openid!trade_type为JSAPI时,openid为必填参数!"); } if (serviceOrder.trade_type == "NATIVE" && string.IsNullOrEmpty(serviceOrder.product_id)) { throw new WxPayException("统一支付接口中,缺少必填参数product_id!trade_type为JSAPI时,product_id为必填参数!"); } }
private object CheckIfPartialDeliveryExists(ServiceOrder serviceOrder) { var result = false; if (serviceOrder != null && serviceOrder.ServiceOrderDestinationAgentPartialDelivery != null && serviceOrder.ServiceOrderDestinationAgentPartialDelivery.Count > 0) { result = true; //TODO: cordinate with UI Team to fix this. Currently they are posting a blank record var firstPartialDelivery = serviceOrder.ServiceOrderDestinationAgentPartialDelivery.First(); if (serviceOrder.ServiceOrderDestinationAgentPartialDelivery.Count == 1) { if ( !firstPartialDelivery.PartialDeliveryDate.HasValue && !firstPartialDelivery.WeightDeliveredLb.HasValue) { result = false; } } } return(result); }
private void ExecuteDocumentOptions(ServiceOrder document) { foreach (IDocumentOption option in document.DocumentOptions) { option.Execute(document); } }
public async Task <IHttpActionResult> PutServiceOrder(Guid id, ServiceOrder serviceOrder) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != serviceOrder.Id) { return(BadRequest()); } db.Entry(serviceOrder).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ServiceOrderExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IHttpActionResult> PostServiceOrder(ServiceOrder serviceOrder) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.ServiceOrders.Add(serviceOrder); try { await db.SaveChangesAsync(); } catch (DbUpdateException) { if (ServiceOrderExists(serviceOrder.Id)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = serviceOrder.Id }, serviceOrder)); }
private void ButtonOrder_Click(object sender, RoutedEventArgs e) { if (recipesInBucket.Count == 0) { MessageBox.Show("Votre commande ne contient aucune recette"); return; } if (AuthUser.Client.Cooks < order.TotalCost) { MessageBox.Show("Solde Cook insuffisant"); ButtonGiveCooks.Visibility = Visibility.Visible; return; } ServiceOrder serviceOrder = new ServiceOrder(); serviceOrder.Save(order); MessageBox.Show("Votre commande a bien été enregistrée vous serez livrés dans 35 min"); //Reload la page après une commande FragmentMarket fragmentMarket = new FragmentMarket(); NavigationService.Navigate(fragmentMarket); }
public void OrderIsCreatedWithDefaultValues() { var order = new ServiceOrder(); Assert.IsTrue(order.IsTaxInclusive); Assert.AreEqual(DocumentAction.Print, order.DeliveryStatus); }
public async Task <IActionResult> Edit(int id, ServiceOrder serviceOrder) { if (id != serviceOrder.id) { return(NotFound()); } if (ModelState.IsValid) { try { var service_Order = _context.ServiceOrder.First(x => x.id == id); service_Order.ProjectName = serviceOrder.ProjectName; service_Order.Comments = serviceOrder.Comments; service_Order.PaymentStatus = serviceOrder.PaymentStatus; _context.Update(service_Order); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ServiceOrderExists(serviceOrder.id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(serviceOrder)); }
public async Task <IActionResult> Edit(int id, [Bind("ServiceOrderID,CustomerID,Status,Opened,Updated,PhysicalAddress,Requested,Notes")] ServiceOrder serviceOrder) { if (id != serviceOrder.ServiceOrderID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(serviceOrder); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ServiceOrderExists(serviceOrder.ServiceOrderID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CustomerID"] = new SelectList(_context.Customers, "CustomerId", "LastName", serviceOrder.CustomerID); return(View(serviceOrder)); }
public static void AssertService(ServiceOrder a, ServiceOrder b) { Assert.AreEqual(a.Id, b.Id); Assert.AreEqual(a.ServiceId, b.ServiceId); Assert.AreEqual(a.VehicleId, b.VehicleId); Assert.AreEqual(a.Quantity, b.Quantity); }
/// <summary> /// this method update a ServiceOrder /// </summary> /// <param name="original_entity"></param> /// <param name="entity"></param> public void UpdateServiceOrder(ServiceOrder original_entity, ServiceOrder entity) { original_entity = GetServiceOrder(original_entity.ServiceOrderId); original_entity.ModifiedDate = DateTime.Now; original_entity.CopyPropertiesFrom(checkClosedServiceOrder(entity)); DbContext.SubmitChanges(); }
/// <summary> /// this method checks the serviceOrder(closed,opened) /// </summary> /// <param name="entity"></param> /// <returns></returns> private ServiceOrder checkClosedServiceOrder(ServiceOrder entity) { if (entity.ServiceOrderStatusId == (int)ServiceOrderStatus.Success) { entity.ClosedDate = DateTime.Now; } return(entity); }
public async Task <bool> Update(ServiceOrder serviceOrder) { var _serviceOrder = await _context.ServiceOrder.Include(i => i.ServiceOrderImage).FirstAsync(f => f.Id == serviceOrder.Id); _context.ServiceOrder.RemoveRange(_serviceOrder); _context.Update(serviceOrder); return(await _context.SaveChangesAsync() > 0); }
public IActionResult UpdateServiceOrder(Guid Id, [FromBody] ServiceOrder serviceOrder) { var obj = FindServiceOrder(Id); obj.Quantity = serviceOrder.Quantity; return(Ok(obj)); }
public void Insert(ServiceOrder serviceOrder) { if (serviceOrder != null) { _db.Add(serviceOrder); _db.SaveChanges(); } }
public ServiceOrderProduct(ServiceOrder serviceOrder, Product product, long quantity, long price) { _serviceOrder = serviceOrder; _product = product; _quantity = quantity; _price = price; _currentPrice = product.SellPrice; }
/// <summary> /// this method delete a serviceOrder and all ServiceOrderItem from the ServiceOrder /// </summary> /// <param name="entity"></param> public void DeleteServiceOrder(ServiceOrder entity) { DeleteAllServiceOrderItems(entity); //DbContext.ServiceOrders.Attach(entity); DbContext.ServiceOrders.DeleteOnSubmit(entity); DbContext.SubmitChanges(); }
public async Task <ServiceOrder> Insert(ServiceOrder serviceOrder) { Client objClient = await _context.Clients.Where(x => x.ClientId == serviceOrder.Client.ClientId).FirstOrDefaultAsync(); ServiceOrder objServiceOrder = new ServiceOrder(objClient); await _context.ServiceOrders.AddAsync(objServiceOrder); return(objServiceOrder); }
public ServiceOrder Update(ServiceOrder serviceOrder) { if (serviceOrder != null) { _db.Update(serviceOrder); _db.SaveChanges(); } return(serviceOrder); }
public ServiceOrder Remove(ServiceOrder serviceOrder) { if (serviceOrder != null) { _db.Remove(serviceOrder); _db.SaveChanges(); } return(serviceOrder); }
public IActionResult UpdateServiceOrder(Guid id, [FromBody] ServiceOrder serviceOrder) { var obj = FindServiceOrder(id); obj.Quantity = serviceOrder.Quantity; _serviceOrderWriteRepository.Update(obj); return(Ok(obj)); }
/// <summary> /// this method insert a ServiceOrder /// </summary> /// <param name="entity"></param> /// <returns></returns> public Int32 InsertServiceOrder(ServiceOrder entity) { entity.OpenedDate = DateTime.Now; entity.ServiceOrderStatusId = (int)ServiceOrderStatus.InProgress; entity.ServiceOrderTypeId = (int)ServiceOrderType.Sundry; DbContext.ServiceOrders.InsertOnSubmit(checkClosedServiceOrder(entity)); DbContext.SubmitChanges(); return(entity.ServiceOrderId); }
public IActionResult PaymentStatus(ServiceOrder status) { var _status = _context.ServiceOrder.Where(l => l.id == status.id).First(); _status.PaymentStatus = status.PaymentStatus; _context.ServiceOrder.Update(_status); _context.SaveChanges(); return(RedirectToAction(nameof(Index))); }
public ServiceOrder AddServiceOrder(ServiceOrder order) { ServiceOrder serviceOrder = order; _lastId++; serviceOrder.Id = _lastId; _orders.Add(order); return(serviceOrder); }
protected void dgvServiceOrder_SelectedIndexChanged(object sender, EventArgs e) { int SOid = Convert.ToInt32(this.dgvServiceOrder.SelectedDataKey.Value.ToString()); this.ISOGV = new MServiceOrder(); ServiceOrder auxSO = ISOGV.SearchServiceOrder(SOid); this.txtIdServiceOrder.Text = auxSO.IdServiceOrder.ToString(); }
/// <summary> /// This method sends an email to customer, case the status of Service Order /// was changed to success /// </summary> /// <param name="originalServiceOrder"></param> private void SendEmailToCustomer(ServiceOrder originalServiceOrder) { if (originalServiceOrder.Customer.UserId.HasValue) { Postman.Send("*****@*****.**", originalServiceOrder.Customer.User.UserName, "Ordem de serviço atendida", String.Format(@"Ordem de serviço de número: {0} criada no dia {1}, foi atendida e concluída !! <br/><br/> <a href='{2}'>Clique aqui para gerar sua nota fiscal!</a>", originalServiceOrder.ServiceOrderNumber, originalServiceOrder.OpenedDate, originalServiceOrder.Company.LegalEntityProfile.Website), null); } }
public void RemoveServiceOrder(ServiceOrder order) { var serviceOrder = _orders.FirstOrDefault((p) => p.Id == order.Id); if (serviceOrder == null) { throw new CityServiceException(500, "Solicitação de Serviço não encontrada! Contactar administrador."); } _orders.Remove(serviceOrder); }
public async Task <Appointment> Insert(Appointment appointment, Guid orderService) { ServiceOrder objServiceOrder = await _context.ServiceOrders .Where(x => x.ServiceOrderId == orderService).FirstOrDefaultAsync(); Appointment objAppointment = new Appointment(appointment.VisitDate, objServiceOrder); await _context.Appointments.AddAsync(objAppointment); return(objAppointment); }
private void dgvPendingServices_CellEnter(object sender, DataGridViewCellEventArgs e) { lblServiceCode.Text = @"-"; lblCustomerCode.Text = @"-"; if (dgvPendingServices.Rows.Count > 0) { _selectedServiceOrder = _pendingServiceOrders.First(x => x.Id.ToString() == dgvPendingServices[0, e.RowIndex].Value.ToString()); } }
private Int32? SaveServiceOrder() { ServiceOrder serviceOrder = new ServiceOrder(); List<ServiceOrderItem> lstServiceOrderItem = new List<ServiceOrderItem>(); if (IsLoaded) { serviceOrder.CopyPropertiesFrom(Original_ServiceOrder); serviceOrder.ModifiedByUser = User.Identity.UserName; } else serviceOrder.CreatedByUser = User.Identity.UserName; serviceOrder.CompanyId = Company.CompanyId; serviceOrder.CustomerId = Convert.ToInt32(Page.ViewState["CustomerId"]); if (!String.IsNullOrEmpty(cboCustomerEquipments.SelectedValue)) serviceOrder.CustomerEquipmentId = Convert.ToInt32(cboCustomerEquipments.SelectedValue); if (!String.IsNullOrEmpty(cboCustomerCalls.SelectedValue)) serviceOrder.CustomerCallId = Convert.ToInt32(cboCustomerCalls.SelectedValue); if (!String.IsNullOrEmpty(cboCustomerContracts.SelectedValue)) serviceOrder.ContractId = Convert.ToInt32(cboCustomerContracts.SelectedValue); else serviceOrder.ContractId = null; serviceOrder.DepositId = null; if (!String.IsNullOrEmpty(cboDeposit.SelectedValue)) serviceOrder.DepositId = Convert.ToInt32(cboDeposit.SelectedValue); serviceOrder.ServiceOrderNumber = txtServiceOrderNumber.Text; if (Page.ViewState["CustomerCallId"] != null) serviceOrder.CustomerCallId = Convert.ToInt32(Page.ViewState["CustomerCallId"]); serviceOrder.ServiceOrderTypeId = Convert.ToInt32(cboServiceOrderType.SelectedValue); if (!String.IsNullOrEmpty(cboServiceOrderStatus.SelectedValue)) serviceOrder.ServiceOrderStatusId = Convert.ToInt32(cboServiceOrderStatus.SelectedValue); //add the ServiceOrderItems in lstServiceOrderItem ServiceOrderItem serviceOrderItem; foreach (ServiceItem item in ServiceItemsList) { serviceOrderItem = new ServiceOrderItem(); serviceOrderItem.CompanyId = item.CompanyId; serviceOrderItem.EmployeeId = item.EmployeeId; serviceOrderItem.ServiceId = item.ServiceId; serviceOrderItem.Description = item.Name; serviceOrderItem.Price = item.ServicePrice; serviceOrderItem.IsApplied = true; serviceOrderItem.ServiceOrderId = serviceOrder.ServiceOrderId; lstServiceOrderItem.Add(serviceOrderItem); } foreach (ProductItem item in ProductItemsList) { serviceOrderItem = new ServiceOrderItem(); serviceOrderItem.Description = item.Description; serviceOrderItem.IsApplied = item.IsApplied; serviceOrderItem.ProductId = item.ProductId; serviceOrderItem.CompanyId = item.CompanyId; serviceOrderItem.Quantity = item.Quantity; serviceOrderItem.ServiceOrderId = serviceOrder.ServiceOrderId; lstServiceOrderItem.Add(serviceOrderItem); } //clear ids serviceOrder.ServiceOrderProductDamageId = String.Empty; serviceOrder.ServiceOrderEquipmentDamageId = String.Empty; serviceOrder.ServiceOrderTestId = String.Empty; serviceOrder.ServiceOrderInstallType = String.Empty; serviceOrder.ServiceOrderProductType = String.Empty; serviceOrder.ServiceOrderHaltType = String.Empty; serviceOrder.ServiceType = String.Empty; ///save serviceType foreach (ListItem item in chkServiceType.Items) if (item.Selected) serviceOrder.ServiceType += String.Empty + item.Value + ","; ///save InstallType foreach (ListItem item in chkInstallType.Items) if (item.Selected) serviceOrder.ServiceOrderInstallType += String.Empty + item.Value + ","; ///save ProductType foreach (ListItem item in chkProductType.Items) if (item.Selected) serviceOrder.ServiceOrderProductType += String.Empty + item.Value + ","; ///save HaltType foreach (ListItem item in chkHaltType.Items) if (item.Selected) serviceOrder.ServiceOrderHaltType += String.Empty + item.Value + ","; ///save tests foreach (ListItem item in chklstTests.Items) if (item.Selected) serviceOrder.ServiceOrderTestId += String.Empty + item.Value + ","; ///save ProductsDamage foreach (ListItem item in chklstEquipmentDamage.Items) if (item.Selected) serviceOrder.ServiceOrderEquipmentDamageId += String.Empty + item.Value + ","; ///save EquipmentsDamage foreach (ListItem item in chklstProductDamage.Items) if (item.Selected) serviceOrder.ServiceOrderProductDamageId += String.Empty + item.Value + ","; ///remove a last if (!String.IsNullOrEmpty(serviceOrder.ServiceType)) serviceOrder.ServiceType = serviceOrder.ServiceType.Remove(serviceOrder.ServiceType.Length - 1); if (!String.IsNullOrEmpty(serviceOrder.ServiceOrderTestId)) serviceOrder.ServiceOrderTestId = serviceOrder.ServiceOrderTestId.Remove(serviceOrder.ServiceOrderTestId.Length - 1); if (!String.IsNullOrEmpty(serviceOrder.ServiceOrderInstallType)) serviceOrder.ServiceOrderInstallType = serviceOrder.ServiceOrderInstallType.Remove(serviceOrder.ServiceOrderInstallType.Length - 1); if (!String.IsNullOrEmpty(serviceOrder.ServiceOrderProductType)) serviceOrder.ServiceOrderProductType = serviceOrder.ServiceOrderProductType.Remove(serviceOrder.ServiceOrderProductType.Length - 1); if (!String.IsNullOrEmpty(serviceOrder.ServiceOrderHaltType)) serviceOrder.ServiceOrderHaltType = serviceOrder.ServiceOrderHaltType.Remove(serviceOrder.ServiceOrderHaltType.Length - 1); if (!String.IsNullOrEmpty(serviceOrder.ServiceOrderEquipmentDamageId)) serviceOrder.ServiceOrderEquipmentDamageId = serviceOrder.ServiceOrderEquipmentDamageId.Remove(serviceOrder.ServiceOrderEquipmentDamageId.Length - 1); if (!String.IsNullOrEmpty(serviceOrder.ServiceOrderProductDamageId)) serviceOrder.ServiceOrderProductDamageId = serviceOrder.ServiceOrderProductDamageId.Remove(serviceOrder.ServiceOrderProductDamageId.Length - 1); int? depositId = null; if (serviceOrder.DepositId.HasValue) depositId = serviceOrder.DepositId; ///Save the ServiceOrder ServicesManager.SaveServiceOrder(Original_ServiceOrder, serviceOrder, lstServiceOrderItem, depositId); return serviceOrder.ServiceOrderId; }