Inheritance: System.Web.UI.Page
Ejemplo n.º 1
0
    public void setValues(WorkOrder s)
    {
        data = s;

        latitude.text = "" + Mathf.Round(s.latitude * 10000f) / 10000f;
        longitude.text = "" + Mathf.Round(s.longitude * 10000f) / 10000f;
        hours.text = "" + s.duration.Hours;
        minutes.text = "" + s.duration.Minutes;

        switch ((Data.ResourceNames)s.enumType)
        {
            case Data.ResourceNames.Clay:
                res.sprite = clay;
                break;
            case Data.ResourceNames.Ore:
                res.sprite = iron;
                break;
            case Data.ResourceNames.Stone:
                res.sprite = stone;
                break;
            case Data.ResourceNames.Wood:
                res.sprite = wood;
                break;
        }
    }
    public void Relational_Store_Inserts_record_with_name_attributes() {
      var WorkOrderStore = new SqliteRelationalStore<WorkOrder>(_db);
      var newWorkOrder = new WorkOrder { Description = "Take out the Trash" };
      WorkOrderStore.Add(newWorkOrder);

      var foundWorkOrder = WorkOrderStore.TryLoadData().FirstOrDefault();
      Assert.IsTrue(foundWorkOrder != null && foundWorkOrder.WorkOrderId == 1);
    }
 public void Relational_Store_Inserts_range_of_records_with_name_attributes() {
   var WorkOrderStore = new SqliteRelationalStore<WorkOrder>(_db);
   var myBatch = new List<WorkOrder>();
   int qtyToAdd = 10;
   for (int i = 1; i <= qtyToAdd; i++) {
     var newWorkOrder = new WorkOrder { Description = "Replace Lightbulbs " + i };
     myBatch.Add(newWorkOrder);
   }
   WorkOrderStore.Add(myBatch);
   var workOrders = WorkOrderStore.TryLoadData();
   Assert.IsTrue(workOrders.Count == qtyToAdd);
 }
        // PUT api/awbuildversion/5
        public void Put(WorkOrder value)
        {
            var GetActionType = Request.Headers.Where(x => x.Key.Equals("ActionType")).FirstOrDefault();

            if (GetActionType.Key != null)
            {
                if (GetActionType.Value.ToList()[0].Equals("DELETE"))
                    adventureWorks_BC.WorkOrderDelete(value);
                if (GetActionType.Value.ToList()[0].Equals("UPDATE"))
                    adventureWorks_BC.WorkOrderUpdate(value);
            }
        }
Ejemplo n.º 5
0
 public List <DTOWorkOrder> Add(WorkOrder workOrder)
 {
     foreach (Product_WorkOrder item in workOrder.Product_WorkOrder)
     {
         foreach (Product product in listProduct)
         {
             if (product.ID == item.ProductID)
             {
                 product.Stock = product.Stock - item.Used;
             }
         }
     }
     return(MapperWorkOrder.ToDToList(repWorkOrder.Add(workOrder)));
 }
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            WorkOrder workOrder = db.WorkOrders.Find(id);

            if (workOrder == null)
            {
                return(HttpNotFound());
            }

            string query = $@"SELECT   
            C.LT,
            S.SampleId, S.Sequence,
            SUM(T.BasePrice + T.MaterialsCost + T.WageEstimate) AS Cost 
            FROM Work_Order WO 
            INNER JOIN Compound C ON C.OrderId = WO.OrderId 
            INNER JOIN Sample S ON S.CompoundId = C.CompoundId 
            INNER JOIN Sample_Test ST ON S.SampleId = ST.SampleId 
            INNER JOIN Test T ON T.TestId = ST.TestId 
            WHERE WO.OrderId = {workOrder.OrderId}
            GROUP BY S.SampleId, C.LT, S.Sequence";

            var sampleTotalCostList = db.Database.SqlQuery <SampleCost>(query).ToList <SampleCost>();

            ViewBag.SampleCosts = sampleTotalCostList;

            var chargesList = db.Charges.SqlQuery("SELECT * FROM Charge WHERE OrderId = " + workOrder.OrderId).ToList <Charge>();

            ViewBag.Charges = chargesList;

            decimal amountDue = 0;

            foreach (var item in sampleTotalCostList)
            {
                amountDue += item.Cost;
            }
            foreach (var item in chargesList)
            {
                amountDue += item.Cost;
            }
            ViewBag.AmountDue = amountDue;

            var associatedCompounds = db.Compounds.SqlQuery("SELECT * FROM Compound WHERE OrderId = " + id).ToList <Compound>();

            workOrder.Compounds = associatedCompounds;
            return(View(workOrder));
        }
Ejemplo n.º 7
0
        public async Task <ActionResult <WorkOrderViewModel> > DeleteWorkOrder(int id)
        {
            WorkOrder workOrder = await _workOrdersRepository.FindByIdAsync(id);

            if (workOrder == null)
            {
                return(NotFound($"No se pudo eliminar la orden de trabjo con código { id }. Verifique la existencia de esta."));
            }

            _workOrdersRepository.Delete(workOrder);
            await _unitWork.SaveAsync();

            return(_mapper.Map <WorkOrderViewModel>(workOrder));
        }
Ejemplo n.º 8
0
        public ActionResult Create([Bind(Include = "OrderNumber,OrderTypeID,CustomerID,QuoteDate,OrderDate,StatusID,Comments")] WorkOrder workOrder)
        {
            if (ModelState.IsValid)
            {
                db.WorkOrders.Add(workOrder);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.CustomerID  = new SelectList(db.Customers, "CustomerID", "FirstName", workOrder.CustomerID);
            ViewBag.StatusID    = new SelectList(db.OrderStatus, "StatusID", "Status", workOrder.StatusID);
            ViewBag.OrderTypeID = new SelectList(db.OrderTypes, "OrderTypeID", "OrderTypeDesc", workOrder.OrderTypeID);
            return(View(workOrder));
        }
Ejemplo n.º 9
0
        public void SeEmployer_Create_workorder()
        {
            //Arrange
            Employer  _emp = frb.CloneEmployer();
            WorkOrder _wo  = frb.CloneWorkOrder();

            _wo.statusID = frb.ToLookupCache().getByKeys(LCategory.orderstatus, LOrderStatus.Pending); // start work order off as pending
            //Act
            ui.employerCreate(_emp);
            ui.workOrderCreate(_emp, _wo);

            //Assert
            ui.workOrderValidate(_wo);
        }
Ejemplo n.º 10
0
        public static void Initialize(WorkOrderContext context)
        {
            context.Database.EnsureCreated();

            if (context.WorkOrders.Any())
            {
                return;
            }

            var workorders = new WorkOrder[]
            {
                new WorkOrder {
                    WorkOrderID         = 1
                    , WorkOrderType     = "Install"
                    , PropertyInfo      = "Trevors House"
                    , SchedulingManager = "Trevor Carter"
                    , TechInfo          = "Mickey Mouse"
                    , CurrentStatus     = "Complete"
                    , ProposedDate      = DateTime.Parse("2010-10-02")
                    , ScheduledDate     = DateTime.Parse("2013-01-04")
                },
                new WorkOrder {
                    WorkOrderID         = 2
                    , WorkOrderType     = "Review"
                    , PropertyInfo      = "Conservice"
                    , SchedulingManager = "Tom Brady"
                    , TechInfo          = "Josh Groban"
                    , CurrentStatus     = "Eternal Work Order"
                    , ProposedDate      = DateTime.Parse("1960-10-07")
                    , ScheduledDate     = DateTime.Parse("2017-01-05")
                },
                new WorkOrder {
                    WorkOrderID         = 3
                    , WorkOrderType     = "New System"
                    , PropertyInfo      = "White House"
                    , SchedulingManager = "George Washington"
                    , TechInfo          = "Donald Trump"
                    , CurrentStatus     = "Patriotic"
                    , ProposedDate      = DateTime.Parse("1776-07-04")
                    , ScheduledDate     = DateTime.Parse("2018-08-24")
                }
            };

            foreach (WorkOrder w in workorders)
            {
                context.WorkOrders.Add(w);
            }

            context.SaveChanges();
        }
Ejemplo n.º 11
0
        public ActionResult PlaceOrder([Bind(Include = "OrderID,AgentID,CustomerID,TestTubeID,PaymentInfo,Comments,DiscountApplied,Deposit")] WorkOrder workOrder)
        {
            if (ModelState.IsValid)
            {
                workOrder.CustomerID = currentCustID;
                db.WorkOrders.Add(workOrder);
                db.SaveChanges();
                return(RedirectToAction("SampleForm", new { OrderID = workOrder.OrderID }));
            }

            ViewBag.CustomerID = new SelectList(db.Customers, "CustomerID", "CustName", workOrder.CustomerID);
            ViewBag.AgentID    = new SelectList(db.SalesAgents, "AgentID", "AgentName", workOrder.AgentID);
            return(View());
        }
Ejemplo n.º 12
0
 public ActionResult Edit([Bind(Include = "WorkOrderID,BillID,UserID,StatusID,StartTime,EndTime,EarlyDate,DueDate,Description,PriorityID,TotalQuote,ActualPrice,AdvanceAmtPaid,ConfirmationDate")] WorkOrder workOrder)
 {
     if (ModelState.IsValid)
     {
         db.Entry(workOrder).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.BillID     = new SelectList(db.BillDetails, "BillID", "BillFirstName", workOrder.BillID);
     ViewBag.PriorityID = new SelectList(db.Priorities, "PriorityID", "Description", workOrder.PriorityID);
     ViewBag.StatusID   = new SelectList(db.Status, "StatusID", "StatusDescription", workOrder.StatusID);
     ViewBag.UserID     = new SelectList(db.Users, "UserID", "UserFirstName", workOrder.UserID);
     return(View(workOrder));
 }
        public IHttpActionResult DeleteWorkOrder(int id)
        {
            WorkOrder workOrder = db.WorkOrders.FirstOrDefault(wo => wo.Property.UserId == User.Identity.Name);

            if (workOrder == null)
            {
                return(NotFound());
            }

            db.WorkOrders.Remove(workOrder);
            db.SaveChanges();

            return(Ok(workOrder));
        }
    public void Relational_Store_Updates_record_with_name_attributes() {
      var WorkOrderStore = new SqliteRelationalStore<WorkOrder>(_db);
      var newWorkOrder = new WorkOrder { Description = "Snake toilet" };
      WorkOrderStore.Add(newWorkOrder);

      // Now go fetch the record again and update:
      string newValue = "Update: Call Roto-Rooter";
      var foundWorkOrder = WorkOrderStore.TryLoadData().FirstOrDefault();
      foundWorkOrder.Description = newValue;
      WorkOrderStore.Update(foundWorkOrder);

      foundWorkOrder = WorkOrderStore.TryLoadData().FirstOrDefault();
      Assert.IsTrue(foundWorkOrder != null && foundWorkOrder.Description == newValue);
    }
Ejemplo n.º 15
0
        public async Task <ActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            WorkOrder workOrder = await _applicationDbContext.WorkOrders.FindAsync(id);

            if (workOrder == null)
            {
                return(HttpNotFound());
            }
            return(View(workOrder));
        }
Ejemplo n.º 16
0
        public string[] InsertWorkOrder(int typeRequest, int userId)
        {
            var workOrder = new WorkOrder
            {
                idTypeRequest   = typeRequest,
                secureCode      = GenerateSecureCode(),
                idProjectStatus = 1,
                idUser          = userId
            };

            DbContext.WorkOrders.Add(workOrder);
            DbContext.SaveChanges();
            return(new[] { workOrder.uniqueId.ToString(), workOrder.secureCode });
        }
Ejemplo n.º 17
0
 private static JobStatusUpdate CreateJobStatusUpdateRequest
     (WorkOrder workOrder, Generated.JobStatusUpdateTypeCode jobStatus)
 {
     return(new JobStatusUpdate
     {
         RelatedWorkOrder = workOrder,
         TypeCode = jobStatus,
         MoreSpecificSORCode = new WorkElement
         {
             Trade = new List <Trade>(),
             RateScheduleItem = new List <RateScheduleItem>()
         }
     });
 }
Ejemplo n.º 18
0
        private async Task <order> CreateOrder(WorkOrder workOrder)
        {
            var property       = workOrder.Site?.PropertyClass.FirstOrDefault();
            var locationAlerts = property != null ? (await _alertsGateway.GetLocationAlertsAsync(property.PropertyReference)).Alerts : new List <Alert>();

            var tenureInfo = await _tenureInformationUseCase.GetTenureInformationWithPropertyReference(property?.PropertyReference);

            var personAlerts  = tenureInfo != null ? (await _alertsGateway.GetPersonAlertsAsync(tenureInfo.TenancyAgreementReference)).Alerts : new List <Alert>();
            var uniqueCodes   = locationAlerts?.Union(personAlerts);
            var orderComments =
                @$ "{uniqueCodes.ToCodeString()} {workOrder.DescriptionOfWork}".Truncate(250);

            var orderCommentsExtended = ($"Property Alerts {locationAlerts?.ToCommentsExtendedString()} " +
                                         $"Person Alerts {personAlerts?.ToCommentsExtendedString()}").Truncate(250);

            var priorityCharacter = workOrder.WorkPriority.PriorityCode.HasValue
                ? await _sorPriorityGateway.GetLegacyPriorityCode(workOrder.WorkPriority.PriorityCode.Value)
                : " ";

            var phoneNumber = workOrder.Customer.Person.Communication.GetPhoneNumber();

            return(new order
            {
                status = orderStatus.PLANNED,
                primaryOrderNumber = workOrder.Id.ToString(CultureInfo.InvariantCulture),
                orderComments = orderComments,
                contract = workOrder.AssignedToPrimary.ContractorReference,
                locationID = workOrder.Site?.PropertyClass.FirstOrDefault()?.PropertyReference,
                priority = priorityCharacter,
                targetDate =
                    workOrder.WorkPriority.RequiredCompletionDateTime.HasValue
                        ? DrsHelpers.ConvertToDrsTimeZone(workOrder.WorkPriority.RequiredCompletionDateTime.Value)
                        : DateTime.UtcNow,
                userId = workOrder.AgentEmail ?? workOrder.AgentName,
                contactName = workOrder.Customer.Name,
                phone = phoneNumber,
                orderCommentsExtended = orderCommentsExtended,
                theLocation = new location
                {
                    locationId = workOrder.Site?.PropertyClass.FirstOrDefault()?.PropertyReference,
                    name = workOrder.Site?.Name,
                    address1 = workOrder.Site?.PropertyClass.FirstOrDefault()?.Address.AddressLine,
                    postCode = workOrder.Site?.PropertyClass.FirstOrDefault()?.Address.PostalCode,
                    contract = workOrder.AssignedToPrimary.ContractorReference,
                    citizensName = workOrder.Customer.Name
                },
                theBookingCodes = await BuildBookingCodes(workOrder),
                message = phoneNumber != null && Regex.IsMatch(phoneNumber, @"^(07\d{8,12}|447\d{7,11})$")
            });
        }
Ejemplo n.º 19
0
        public ActionResult CreateOrder([Bind(Include = "WrkOrderID,DueDate,RushOrder,Comments,ClientID")] WorkOrder workOrder)
        {
            if (ModelState.IsValid)
            {
                db.WorkOrders.Add(workOrder);
                db.SaveChanges();

                int?OldId = workOrder.ClientID;

                return(RedirectToAction("ViewOrders", new { id = OldId }));
            }

            return(View(workOrder));
        }
        public IHttpActionResult PostWorkOrder(WorkOrderModel workOrder)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var dbWorkOrder = new WorkOrder(workOrder);

            db.WorkOrders.Add(dbWorkOrder);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = dbWorkOrder.WorkOrderId }, Mapper.Map <WorkOrderModel>(workOrder)));
        }
        public IHttpActionResult DeleteWorkOrder(int id)
        {
            WorkOrder workOrder = db.WorkOrders.Find(id);

            if (workOrder == null)
            {
                return(NotFound());
            }

            db.WorkOrders.Remove(workOrder);
            db.SaveChanges();

            return(Ok(Mapper.Map <WorkOrderModel>(workOrder)));
        }
Ejemplo n.º 22
0
        public ActionResult WorkOrderEdit([Bind(Include = "WrkOrdID,ReceivedDate,DueDate,RushedOrder,Comments,WOReport,ReceivedBy,ClientID,SummaryStatus")] WorkOrder workOrder)
        {
            ViewBag.Clients   = db.Clients.ToList();
            ViewBag.Summary   = testStatus;
            ViewBag.Employees = db.Employees.ToList();

            if (ModelState.IsValid)
            {
                db.Entry(workOrder).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("WorkIndex"));
            }
            return(View(workOrder));
        }
Ejemplo n.º 23
0
        public async Task <IActionResult> Create([Bind("WorkOrderId,WorkOrderDate,OwnerId")] WorkOrder workOrder)
        {
            if (ModelState.IsValid)
            {
                workOrder.WorkOrderDate = DateTime.Now;

                _context.Add(workOrder);
                await _context.SaveChangesAsync();

                return(Redirect("/home/processing"));
            }
            ViewData["OwnerId"] = new SelectList(_context.Owners, "OwnerId", "OwnerId", workOrder.OwnerId);
            return(View(workOrder));
        }
        public async Task <WorkOrderAdapterModel> GetAsync(int id)
        {
            WorkOrder item = await context.WorkOrder
                             .Include(x => x.CategoryMain)
                             .Include(x => x.CategorySub)
                             .AsNoTracking()
                             .FirstOrDefaultAsync(x => x.Id == id);

            WorkOrderAdapterModel result = Mapper.Map <WorkOrderAdapterModel>(item);

            await OhterDependencyData(result);

            return(result);
        }
Ejemplo n.º 25
0
        public ActionResult DownloadTestResult(int LTNum)
        {
            if (Authorized.userAuth == "technician")
            {
                WorkOrder workOrder = db.WorkOrders.Find(LTNum);

                Response.AppendHeader("content-disposition", "attachment; filename=" + LTNum + "TestResults.txt"); //this will download the file
                return(File(workOrder.TestResultFile, "plain/text"));
            }
            else
            {
                return(RedirectToAction("NotAuthorized", "Home"));
            }
        }
        private async Task SetStatus(WorkOrder workOrder)
        {
            var user       = _currentUserService.GetUser();
            var authorised = await _authorizationService.AuthorizeAsync(user, workOrder, "RaiseSpendLimit");

            if (await _featureManager.IsEnabledAsync(FeatureFlags.SpendLimits) && !authorised.Succeeded)
            {
                workOrder.StatusCode = WorkStatusCode.PendingApproval;
            }
            else
            {
                workOrder.StatusCode = WorkStatusCode.Open;
            }
        }
        private async Task <WorkOrderOpened> NotifyHandlers(WorkOrder workOrder)
        {
            if (workOrder.StatusCode != WorkStatusCode.Open)
            {
                await _notifier.Notify(new HighCostWorkOrderCreated(workOrder));

                return(null);
            }

            var notification = new WorkOrderOpened(workOrder);
            await _notifier.Notify(notification);

            return(notification);
        }
Ejemplo n.º 28
0
        public void MapEFToBOList()
        {
            var       mapper = new DALWorkOrderMapper();
            WorkOrder entity = new WorkOrder();

            entity.SetProperties(DateTime.Parse("1/1/1987 12:00:00 AM"), DateTime.Parse("1/1/1987 12:00:00 AM"), DateTime.Parse("1/1/1987 12:00:00 AM"), 1, 1, 1, 1, DateTime.Parse("1/1/1987 12:00:00 AM"), 1, 1);

            List <BOWorkOrder> response = mapper.MapEFToBO(new List <WorkOrder>()
            {
                entity
            });

            response.Count.Should().Be(1);
        }
Ejemplo n.º 29
0
 public ActionResult Edit([Bind(Include = "WorkOrderID,OrderCompleteDate,OrderFinalPrice,OrderDueDate,CustomerID,DiscountID,EmployeeID,QuoteID")] WorkOrder workOrder)
 {
     if (ModelState.IsValid)
     {
         db.Entry(workOrder).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CustomerID = new SelectList(db.Customers, "CustomerID", "FirstName", workOrder.CustomerID);
     ViewBag.DiscountID = new SelectList(db.Discounts, "DiscountID", "DiscountID", workOrder.DiscountID);
     ViewBag.EmployeeID = new SelectList(db.Employees, "EmployeeID", "FirstName", workOrder.EmployeeID);
     ViewBag.QuoteID    = new SelectList(db.Quotes, "QuoteID", "QuoteID", workOrder.QuoteID);
     return(View(workOrder));
 }
        public async Task <ActionResult> Edit([Bind(Include = "WorkOrderId,CustomerId,OrderDateTime,TargetDateTime,DropDeadDateTime,Description,WorkOrderStatus,Total,CertificationRequirements,CurrentWorkerId")] WorkOrder workOrder)
        {
            if (ModelState.IsValid)
            {
                workOrder.CurrentWorkerId = User.Identity.GetUserId();
                _applicationDbContext.Entry(workOrder).State = EntityState.Modified;
                await _applicationDbContext.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            //ViewBag.CurrentWorkerId = new SelectList(_applicationDbContext.ApplicationUsers, "Id", "FirstName", workOrder.CurrentWorkerId);
            ViewBag.CustomerId = new SelectList(_applicationDbContext.Customers, "CustomerId", "AccountNumber", workOrder.CustomerId);
            return(View(workOrder));
        }
Ejemplo n.º 31
0
        public static void LinkKeypartDataloader(MESStationBase Station, MESStationInput Input, List <R_Station_Action_Para> Paras)
        {
            if (Paras.Count != 3)
            {
                string errMsg = MESReturnMessage.GetMESReturnMessage("MES00000057");
                throw new MESReturnMessage(errMsg);
            }
            string            Sn        = Input.Value.ToString();
            MESStationSession WOSession = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY);

            if (WOSession == null)
            {
                WOSession = new MESStationSession()
                {
                    MESDataType = Paras[0].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[0].SESSION_KEY, ResetInput = Input
                };
                Station.StationSession.Add(WOSession);
            }

            MESStationSession SubKPSession = Station.StationSession.Find(t => t.MESDataType == Paras[1].SESSION_TYPE && t.SessionKey == Paras[1].SESSION_KEY);

            if (SubKPSession == null)
            {
                SubKPSession = new MESStationSession()
                {
                    MESDataType = Paras[1].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[1].SESSION_KEY, ResetInput = Input
                };
                Station.StationSession.Add(SubKPSession);
            }
            MESStationSession MainKPSession = Station.StationSession.Find(t => t.MESDataType == Paras[2].SESSION_TYPE && t.SessionKey == Paras[2].SESSION_KEY);

            if (MainKPSession == null)
            {
                MainKPSession = new MESStationSession()
                {
                    MESDataType = Paras[2].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[2].SESSION_KEY, ResetInput = Input
                };
                Station.StationSession.Add(MainKPSession);
            }
            SN          sn  = null;
            WorkOrder   wo  = null;
            T_C_KEYPART tck = new T_C_KEYPART(Station.SFCDB, DB_TYPE_ENUM.Oracle);

            sn.Load(Sn, Station.SFCDB, DB_TYPE_ENUM.Oracle);
            wo.Init(sn.WorkorderNo, Station.SFCDB, DB_TYPE_ENUM.Oracle);
            List <C_KEYPART> keyparts = tck.GetKeypartListByWOAndStation(Station.SFCDB, wo.WorkorderNo, Station.StationName);

            SubKPSession.Value  = keyparts.Where(s => s.SEQ_NO == 10).ToList();
            MainKPSession.Value = keyparts.Where(s => s.SEQ_NO != 10).ToList().OrderBy(s => s.SEQ_NO);
        }
Ejemplo n.º 32
0
 public static IncidentWorkOrderDomain ToDomainModel(this WorkOrder obj)
 {
     return(obj == null ? null : new IncidentWorkOrderDomain()
     {
         WorkOrderId = obj.WorkOrderId,
         DateCreated = obj.DateCreated,
         CreatedBy = obj.CreatedBy,
         ModifiedBy = obj.ModifiedBy,
         DateModified = obj.DateModified,
         TenantId = obj.TenantId,
         IncidentId = obj.IncidentId,
         IncidentSettlementId = obj.IncidentSettlementId
     });
 }
Ejemplo n.º 33
0
        //获取工单明细
        public WorkOrder GetWorkOrder(string orderNumber)
        {
            WorkOrder workOrder = new WorkOrder();

            using (WorkOrderServiceClient client = new WorkOrderServiceClient())
            {
                MethodReturnResult <WorkOrder> result = client.Get(orderNumber);
                if (result.Code <= 0)
                {
                    workOrder = result.Data;
                }
            }
            return(workOrder);
        }
Ejemplo n.º 34
0
        private void MakeNextWorkOrder(int?id)
        {
            activeCustomer = db.Customers.Find(id);
            WorkOrder newOrder = new WorkOrder()
            {
                CustomerId      = activeCustomer.Id,
                ScheduledPickup = AccountController.GetNextWeekday(DateTime.Today, activeCustomer.PickupDay),
                PickupCompleted = false,
                ServicePaidFor  = false
            };

            db.WorkOrders.Add(newOrder);
            db.SaveChanges();
        }
        // GET: WorkOrder/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            WorkOrder workOrder = db.WorkOrders.Find(id);

            if (workOrder == null)
            {
                return(HttpNotFound());
            }
            return(View(workOrder));
        }
Ejemplo n.º 36
0
		/// <summary>
		/// Inserts a mock WorkOrder entity into the database.
		/// </summary>
		private void Step_01_Insert_Generated()
		{
			using (TransactionManager tm = CreateTransaction())
			{
				mock = CreateMockInstance(tm);
				Assert.IsTrue(DataRepository.WorkOrderProvider.Insert(tm, mock), "Insert failed");
										
				System.Console.WriteLine("DataRepository.WorkOrderProvider.Insert(mock):");			
				System.Console.WriteLine(mock);			
				
				//normally one would commit here
				//tm.Commit();
				//IDisposable will Rollback Transaction since it's left uncommitted
			}
		}
    public void Relational_Store_Updates_range_of_records_with_name_attributes() {
      var WorkOrderStore = new SqliteRelationalStore<WorkOrder>(_db);
      var myBatch = new List<WorkOrder>();
      int qtyToAdd = 10;
      for (int i = 1; i <= qtyToAdd; i++) {
        var newWorkOrder = new WorkOrder { Description = "Caulk Tub " + i };
        myBatch.Add(newWorkOrder);
      }
      WorkOrderStore.Add(myBatch);

      // Re-load, and update:
      var workOrders = WorkOrderStore.TryLoadData();
      for (int i = 0; i < qtyToAdd; i++) {
        workOrders.ElementAt(i).Description = "Updated Tubs" + i;
      }
      WorkOrderStore.Update(workOrders);

      // Reload, and check updated names:
      workOrders = WorkOrderStore.TryLoadData().Where(c => c.Description.Contains("Updated")).ToList();
      Assert.IsTrue(workOrders.Count == qtyToAdd);
    }
Ejemplo n.º 38
0
 public void AddToWorkOrders(WorkOrder workOrder)
 {
     base.AddObject("WorkOrders", workOrder);
 }
Ejemplo n.º 39
0
 public static WorkOrder CreateWorkOrder(int ID, string workOrderNumber, global::System.DateTime workOrderDate, int workOrder_Machine, bool isReceiveComplete, byte[] rowVersion)
 {
     WorkOrder workOrder = new WorkOrder();
     workOrder.Id = ID;
     workOrder.WorkOrderNumber = workOrderNumber;
     workOrder.WorkOrderDate = workOrderDate;
     workOrder.WorkOrder_Machine = workOrder_Machine;
     workOrder.IsReceiveComplete = isReceiveComplete;
     workOrder.RowVersion = rowVersion;
     return workOrder;
 }
 // POST api/awbuildversion
 public void Post(WorkOrder value)
 {
     adventureWorks_BC.WorkOrderAdd(value);
 }
Ejemplo n.º 41
0
    public void ReceiveGCMMessage(string message)
    {
        Dictionary<string, string> json = JsonConvert.DeserializeObject<Dictionary<string, string>>(message);
        //Is our packet class sent via GCM
        if (json.ContainsKey("packetType"))
        {
            if (getPacketType(json) == Packet.PacketType.LoginReturn)
            {
                DebugConsole.Log("Received Login Packet.");
                if (JsonConvert.DeserializeObject<bool[]>(json["sendBool"])[0])
                {
                    loginID = JsonConvert.DeserializeObject<string[]>(json["sendString"])[0];
                    loggedIn = true;
                    GCM.ShowToast("You have logged in!");
                }
                lastMessage = JsonConvert.DeserializeObject<string[]>(json["sendString"])[1];
            }
            else if (getPacketType(json) == Packet.PacketType.NearbyPlayers)
            {
                DebugConsole.Log("Received Nearby Players Packet.");
                if (JsonConvert.DeserializeObject<float[]>(json["sendFloat"])[0] == 0.0f)
                {
                    Data.Instance.nearbyPlayersIDs = JsonConvert.DeserializeObject<string[]>(json["sendString"]);
                }
                else Data.Instance.nearbyPlayersNames = JsonConvert.DeserializeObject<string[]>(json["sendString"]);
                
            }
            else if (getPacketType(json) == Packet.PacketType.Friends)
            {
                DebugConsole.Log("Received Friends Packet.");
                if (JsonConvert.DeserializeObject<int[]>(json["sendInt"])[0] == 0)
                {
                    Data.Instance.friendsIDs = JsonConvert.DeserializeObject<string[]>(json["sendString"]);
                }
                else Data.Instance.friendsNames = JsonConvert.DeserializeObject<string[]>(json["sendString"]);
            }
            else if (getPacketType(json) == Packet.PacketType.Dictionary)
            {
                int type = JsonConvert.DeserializeObject<int[]>(json["sendInt"])[0];
                switch (type)
                {
                    //Resources Packet
                    case 0:
                        DebugConsole.Log("Received Resources Packet.");
                        Data.Instance.UpdateResources(JsonConvert.DeserializeObject<Dictionary<int, uint>>(json["sendDictionary"]));
                        break;
                    //Food Packet
                    case 1:
                        DebugConsole.Log("Received Food Packet.");
                        Data.Instance.UpdateFood(JsonConvert.DeserializeObject<Dictionary<int, uint>>(json["sendDictionary"]));
                        break;
                    //Units Packet
                    case 2:
                        DebugConsole.Log("Received Units Packet.");
                        Data.Instance.UpdateUnits(JsonConvert.DeserializeObject<Dictionary<int, uint>>(json["sendDictionary"]));
                        break;
                    //Keep Packet
                    case 3:
                        DebugConsole.Log("Received Keep Packet.");
                        Data.Instance.UpdateKeep(JsonConvert.DeserializeObject<Dictionary<int, uint>>(json["sendDictionary"]));
                        break;
                }
            }
            else if (getPacketType(json) == Packet.PacketType.RequestWorker)
            {
                DebugConsole.Log("Received Current Workers Packet.");
                Data.Instance.workOrders.Clear();

                List<TimeSpan> tList = new List<TimeSpan>(JsonConvert.DeserializeObject<TimeSpan[]>(json["sendTime"]));
                List<int> rList = new List<int>(JsonConvert.DeserializeObject<int[]>(json["sendInt"]));
                List<float> latList = new List<float>(JsonConvert.DeserializeObject<float[]>(json["sendFloat"]));
                List<float> longList = new List<float>(JsonConvert.DeserializeObject<float[]>(json["sendFloat2"]));
                List<int> aList = new List<int>(JsonConvert.DeserializeObject<int[]>(json["sendInt2"]));

                List<WorkOrder> temp = new List<WorkOrder>();

                for (int i = 0; i < tList.Count; i++)
                {
                    WorkOrder w = new WorkOrder();
                    w.type = WorkOrder.OrderType.Resource;
                    w.duration = tList[i];
                    w.enumType = rList[i];
                    w.latitude = latList[i];
                    w.longitude = longList[i];
                    w.amount = aList[i];
                    temp.Add(w);
                }

                Data.Instance.workerPositions = temp;
            }
            else if (getPacketType(json) == Packet.PacketType.TileResources)
            {
                DebugConsole.Log("Received Tile Resources Packet.");    
                Data.Instance.currentResources = JsonConvert.DeserializeObject<int[]>(json["sendInt"]);
                Data.mapReady = true;
            }
            else if (getPacketType(json) == Packet.PacketType.PlayerInfo)
            {
                DebugConsole.Log("Received Player Info Packet.");
                Data.Instance.playerName = JsonConvert.DeserializeObject<string[]>(json["sendString"])[0];
                Data.Instance.gender = JsonConvert.DeserializeObject<bool[]>(json["sendBool"])[0];
            }
            else if (getPacketType(json) == Packet.PacketType.WorkOrders)
            {
                DebugConsole.Log("Received Work Orders Packet.");
                string[] sArr = JsonConvert.DeserializeObject<string[]>(json["sendString"]);
                int[] iArr = JsonConvert.DeserializeObject<int[]>(json["sendInt"]);
                float[] fArr = JsonConvert.DeserializeObject<float[]>(json["sendFloat"]);
                System.TimeSpan[] tArr = JsonConvert.DeserializeObject<System.TimeSpan[]>(json["sendTime"]);
                List<WorkOrder> orders = new List<WorkOrder>();

                for (int i = 0; i < sArr.Length; i++)
                {
                    WorkOrder w = new WorkOrder();
                    w.type = (WorkOrder.OrderType)(int.Parse(sArr[i]));
                    w.enumType = iArr[i];
                    w.amount = (int)fArr[i];
                    w.duration = tArr[i];
                    orders.Add(w);
                    DebugConsole.Log(w.type.ToString() + "," + w.enumType + "," + w.amount + "," + w.duration.ToString());
                }

                Data.Instance.workOrders = orders;
            }
            else if (getPacketType(json) == Packet.PacketType.AttackOrders)
            {
                DebugConsole.Log("Received Attack Order Packet.");

                AttackOrder a = new AttackOrder();

                Dictionary<int, uint> tempDict = JsonConvert.DeserializeObject<Dictionary<int, uint>>(json["sendDictionary"]);
                
                Data.Instance.attackOrder.units.Clear();
                foreach (KeyValuePair<int, uint> entry in tempDict)
                {
                    Data.Instance.attackOrder.units.Add((Data.UnitNames)entry.Key, entry.Value);
                }
                Data.Instance.attackOrder.timeToDestination = JsonConvert.DeserializeObject<TimeSpan[]>(json["sendTime"])[0];
            }
           
        }
        foreach (KeyValuePair<string, string> entry in json)
        {
            //DebugConsole.Log(entry.Key + ":" + entry.Value);
        }
       // DebugConsole.Log("/////////////////////");
    }
Ejemplo n.º 42
0
		/// <summary>
		/// Deep load all WorkOrder children.
		/// </summary>
		private void Step_03_DeepLoad_Generated()
		{
			using (TransactionManager tm = CreateTransaction())
			{
				int count = -1;
				mock =  CreateMockInstance(tm);
				mockCollection = DataRepository.WorkOrderProvider.GetPaged(tm, 0, 10, out count);
			
				DataRepository.WorkOrderProvider.DeepLoading += new EntityProviderBaseCore<WorkOrder, WorkOrderKey>.DeepLoadingEventHandler(
						delegate(object sender, DeepSessionEventArgs e)
						{
							if (e.DeepSession.Count > 3)
								e.Cancel = true;
						}
					);

				if (mockCollection.Count > 0)
				{
					
					DataRepository.WorkOrderProvider.DeepLoad(tm, mockCollection[0]);
					System.Console.WriteLine("WorkOrder instance correctly deep loaded at 1 level.");
									
					mockCollection.Add(mock);
					// DataRepository.WorkOrderProvider.DeepSave(tm, mockCollection);
				}
				
				//normally one would commit here
				//tm.Commit();
				//IDisposable will Rollback Transaction since it's left uncommitted
			}
		}
Ejemplo n.º 43
0
		/// <summary>
		/// Serialize a WorkOrder collection into a temporary file.
		/// </summary>
		private void Step_08_SerializeCollection_Generated()
		{
			using (TransactionManager tm = CreateTransaction())
			{
				string fileName = System.IO.Path.Combine(System.IO.Path.GetTempPath(), "temp_WorkOrderCollection.xml");
				
				mock = CreateMockInstance(tm);
				TList<WorkOrder> mockCollection = new TList<WorkOrder>();
				mockCollection.Add(mock);
			
				EntityHelper.SerializeXml(mockCollection, fileName);
				
				Assert.IsTrue(System.IO.File.Exists(fileName), "Serialized mock collection not found");
				System.Console.WriteLine("TList<WorkOrder> correctly serialized to a temporary file.");					
			}
		}
Ejemplo n.º 44
0
		///<summary>
		///  Returns a Typed WorkOrder Entity with mock values.
		///</summary>
		static public WorkOrder CreateMockInstance_Generated(TransactionManager tm)
		{		
			WorkOrder mock = new WorkOrder();
						
			mock.OrderQty = TestUtility.Instance.RandomNumber();
			mock.ScrappedQty = TestUtility.Instance.RandomShort();
			mock.StartDate = TestUtility.Instance.RandomDateTime();
			mock.EndDate = TestUtility.Instance.RandomDateTime();
			mock.DueDate = TestUtility.Instance.RandomDateTime();
			mock.ModifiedDate = TestUtility.Instance.RandomDateTime();
			
			int count0 = 0;
			TList<Product> _collection0 = DataRepository.ProductProvider.GetPaged(tm, 0, 10, out count0);
			//_collection0.Shuffle();
			if (_collection0.Count > 0)
			{
				mock.ProductId = _collection0[0].ProductId;
						
			}
			int count1 = 0;
			TList<ScrapReason> _collection1 = DataRepository.ScrapReasonProvider.GetPaged(tm, 0, 10, out count1);
			//_collection1.Shuffle();
			if (_collection1.Count > 0)
			{
				mock.ScrapReasonId = _collection1[0].ScrapReasonId;
						
			}
		
			// create a temporary collection and add the item to it
			TList<WorkOrder> tempMockCollection = new TList<WorkOrder>();
			tempMockCollection.Add(mock);
			tempMockCollection.Remove(mock);
			
		
		   return (WorkOrder)mock;
		}
Ejemplo n.º 45
0
        private static XmlDocument BuildAddOrModRq(WorkOrder wo)
        {
            RotoTrackDb db = new RotoTrackDb();
            XmlDocument doc = XmlUtils.MakeRequestDocument();
            XmlElement parent = XmlUtils.MakeRequestParentElement(doc);

            BillingInstruction bi = db.BillingInstructions.Find(wo.BillingInstructionsId);
            Area area = db.Areas.Find(wo.AreaId);
            Customer customer = db.Customers.Find(wo.CustomerId);
            WorkOrderType wot = db.WorkOrderTypes.Find(wo.WorkOrderTypeId);
            Contact contact = db.Contacts.Find(wo.ContactId);
            Site site = db.Sites.Find(wo.SiteId);
            JobType jt = db.JobTypes.Find(wo.JobTypeId);

            XmlElement CustomerAddOrModRq = null;
            XmlElement CustomerAddOrMod = null;

            if (wo.QBListId == null)
            {
                CustomerAddOrModRq = doc.CreateElement("CustomerAddRq");
                parent.AppendChild(CustomerAddOrModRq);
                CustomerAddOrMod = doc.CreateElement("CustomerAdd");
                CustomerAddOrModRq.AppendChild(CustomerAddOrMod);
            }
            else
            {
                CustomerAddOrModRq = doc.CreateElement("CustomerModRq");
                parent.AppendChild(CustomerAddOrModRq);
                CustomerAddOrMod = doc.CreateElement("CustomerMod");
                CustomerAddOrModRq.AppendChild(CustomerAddOrMod);

                CustomerAddOrMod.AppendChild(XmlUtils.MakeSimpleElem(doc, "ListID", wo.QBListId));
                CustomerAddOrMod.AppendChild(XmlUtils.MakeSimpleElem(doc, "EditSequence", wo.QBEditSequence));
            }

            CustomerAddOrMod.AppendChild(XmlUtils.MakeSimpleElem(doc, "Name", wo.WorkOrderNumber));

            string isActive = (wo.statusValue != (int)WorkOrderStatus.Inactive) ? "1" : "0";
            CustomerAddOrMod.AppendChild(XmlUtils.MakeSimpleElem(doc, "IsActive", isActive));

            XmlElement ParentRef = doc.CreateElement("ParentRef");
            CustomerAddOrMod.AppendChild(ParentRef);
            ParentRef.AppendChild(XmlUtils.MakeSimpleElem(doc, "ListID", customer.QBListId));

            CustomerAddOrMod.AppendChild(XmlUtils.MakeSimpleElem(doc, "CompanyName", customer.CompanyName));

            if (contact != null)
            {
                string[] namePieces = contact.Name.Split(' ');
                string firstName;
                string lastName;
                string middleName;
                if (namePieces.Count() == 2)
                {
                    firstName = namePieces[0];
                    lastName = namePieces[1];

                    if (firstName.Length > 15) firstName = firstName.Substring(0, 15);
                    if (lastName.Length > 18) lastName = lastName.Substring(0, 18);
                    contact.Name = firstName + " " + lastName;

                    CustomerAddOrMod.AppendChild(XmlUtils.MakeSimpleElem(doc, "FirstName", firstName));
                    CustomerAddOrMod.AppendChild(XmlUtils.MakeSimpleElem(doc, "LastName", lastName));
                }
                else if (namePieces.Count() == 3)
                {
                    firstName = namePieces[0];
                    middleName = namePieces[1];
                    lastName = namePieces[2];

                    if (firstName.Length > 15) firstName = firstName.Substring(0, 15);
                    if (middleName.Length > 5) middleName = middleName.Substring(0, 5);
                    if (lastName.Length > 18) lastName = lastName.Substring(0, 18);
                    contact.Name = firstName + " " + middleName + " " + lastName;

                    CustomerAddOrMod.AppendChild(XmlUtils.MakeSimpleElem(doc, "FirstName", firstName));
                    CustomerAddOrMod.AppendChild(XmlUtils.MakeSimpleElem(doc, "MiddleName", middleName));
                    CustomerAddOrMod.AppendChild(XmlUtils.MakeSimpleElem(doc, "LastName", lastName));
                }
                else if (namePieces.Count() == 1)
                {
                    firstName = namePieces[0];

                    if (firstName.Length > 15) firstName = firstName.Substring(0, 15);
                    contact.Name = firstName;

                    CustomerAddOrMod.AppendChild(XmlUtils.MakeSimpleElem(doc, "FirstName", firstName));
                }
            }

            XmlElement BillAddress = doc.CreateElement("BillAddress");
            CustomerAddOrMod.AppendChild(BillAddress);

            BillAddress.AppendChild(XmlUtils.MakeSimpleElem(doc, "Addr1", customer.Address.Address1));
            BillAddress.AppendChild(XmlUtils.MakeSimpleElem(doc, "Addr2", customer.Address.Address2));
            BillAddress.AppendChild(XmlUtils.MakeSimpleElem(doc, "Addr3", customer.Address.Address3));
            BillAddress.AppendChild(XmlUtils.MakeSimpleElem(doc, "Addr4", customer.Address.Address4));
            BillAddress.AppendChild(XmlUtils.MakeSimpleElem(doc, "Addr5", customer.Address.Address5));
            BillAddress.AppendChild(XmlUtils.MakeSimpleElem(doc, "City", customer.Address.City));
            BillAddress.AppendChild(XmlUtils.MakeSimpleElem(doc, "State", customer.Address.State));
            BillAddress.AppendChild(XmlUtils.MakeSimpleElem(doc, "PostalCode", customer.Address.Zip));

            if (contact != null)
            {
                if (contact.Name.Length > 40) contact.Name = contact.Name.Substring(0, 40);
                CustomerAddOrMod.AppendChild(XmlUtils.MakeSimpleElem(doc, "Contact", contact.Name));

                if (contact.Phone != null && contact.Phone != "")
                {
                    XmlElement AdditionalContactRef1 = doc.CreateElement("AdditionalContactRef");
                    CustomerAddOrMod.AppendChild(AdditionalContactRef1);
                    AdditionalContactRef1.AppendChild(XmlUtils.MakeSimpleElem(doc, "ContactName", "Main Phone"));
                    AdditionalContactRef1.AppendChild(XmlUtils.MakeSimpleElem(doc, "ContactValue", contact.Phone));
                }

                if (contact.Email != null && contact.Email != "")
                {
                    XmlElement AdditionalContactRef2 = doc.CreateElement("AdditionalContactRef");
                    CustomerAddOrMod.AppendChild(AdditionalContactRef2);
                    AdditionalContactRef2.AppendChild(XmlUtils.MakeSimpleElem(doc, "ContactName", "Main Email"));
                    AdditionalContactRef2.AppendChild(XmlUtils.MakeSimpleElem(doc, "ContactValue", contact.Email));
                }
            }

            XmlElement CustomerTypeRef = doc.CreateElement("CustomerTypeRef");
            CustomerAddOrMod.AppendChild(CustomerTypeRef);
            CustomerTypeRef.AppendChild(XmlUtils.MakeSimpleElem(doc, "ListID", bi.QBListId));

            switch (wo.JobStatus)
            {
                case JobStatus.Awarded:
                    CustomerAddOrMod.AppendChild(XmlUtils.MakeSimpleElem(doc, "JobStatus", "Awarded"));
                    break;

                case JobStatus.Complete:
                    CustomerAddOrMod.AppendChild(XmlUtils.MakeSimpleElem(doc, "JobStatus", "Closed"));
                    break;

                case JobStatus.InProgress:
                    CustomerAddOrMod.AppendChild(XmlUtils.MakeSimpleElem(doc, "JobStatus", "InProgress"));
                    break;

                case JobStatus.NotApplicable:
                    CustomerAddOrMod.AppendChild(XmlUtils.MakeSimpleElem(doc, "JobStatus", "None"));
                    break;

                case JobStatus.NotAwarded:
                    CustomerAddOrMod.AppendChild(XmlUtils.MakeSimpleElem(doc, "JobStatus", "NotAwarded"));
                    break;

                case JobStatus.Pending:
                    CustomerAddOrMod.AppendChild(XmlUtils.MakeSimpleElem(doc, "JobStatus", "Pending"));
                    break;

                default:
                    break;
            }

            CustomerAddOrMod.AppendChild(XmlUtils.MakeSimpleElem(doc, "JobStartDate", wo.EstStartDate.ToString("yyyy-MM-dd")));
            CustomerAddOrMod.AppendChild(XmlUtils.MakeSimpleElem(doc, "JobProjectedEndDate", wo.EstEndDate.ToString("yyyy-MM-dd")));
            if (wo.ActualEndDate != DateTime.Parse("1900-01-01 00:00:00.000"))
            {
                CustomerAddOrMod.AppendChild(XmlUtils.MakeSimpleElem(doc, "JobEndDate", wo.ActualEndDate.ToString("yyyy-MM-dd")));
            }

            if (wo.JobDescription != null)
            {
                CustomerAddOrMod.AppendChild(XmlUtils.MakeSimpleElem(doc, "JobDesc", wo.JobDescription));
            }
            if (jt != null)
            {
                XmlElement JobTypeRef = doc.CreateElement("JobTypeRef");
                CustomerAddOrMod.AppendChild(JobTypeRef);
                JobTypeRef.AppendChild(XmlUtils.MakeSimpleElem(doc, "ListID", jt.QBListId));
            }
            if (wo.BillingNotes != null)
            {
                CustomerAddOrMod.AppendChild(XmlUtils.MakeSimpleElem(doc, "Notes", wo.BillingNotes));
            }

            return doc;
        }
Ejemplo n.º 46
0
        ///<summary>
        ///  Update the Typed WorkOrder Entity with modified mock values.
        ///</summary>
        static public void UpdateMockInstance(TransactionManager tm, WorkOrder mock)
        {
            WorkOrderTest.UpdateMockInstance_Generated(tm, mock);
            
			// make any alterations necessary 
            // (i.e. for DB check constraints, special test cases, etc.)
			SetSpecialTestData(mock);
        }
Ejemplo n.º 47
0
		/// <summary>
		/// Serialize the mock WorkOrder entity into a temporary file.
		/// </summary>
		private void Step_06_SerializeEntity_Generated()
		{	
			using (TransactionManager tm = CreateTransaction())
			{
				mock =  CreateMockInstance(tm);
				string fileName = System.IO.Path.Combine(System.IO.Path.GetTempPath(), "temp_WorkOrder.xml");
			
				EntityHelper.SerializeXml(mock, fileName);
				Assert.IsTrue(System.IO.File.Exists(fileName), "Serialized mock not found");
					
				System.Console.WriteLine("mock correctly serialized to a temporary file.");			
			}
		}
Ejemplo n.º 48
0
 public static void Update(WorkOrder workOrder)
 {
     WcfData.WorkOrder inDbWorkOrder = (WcfData.WorkOrder)workOrder;
     WcfData.WorkOrderDbOperations.Update(inDbWorkOrder);
 }
Ejemplo n.º 49
0
		/// <summary>
		/// Test methods exposed by the EntityHelper class.
		/// </summary>
		private void Step_20_TestEntityHelper_Generated()
		{
			using (TransactionManager tm = CreateTransaction())
			{
				mock = CreateMockInstance(tm);
				
				WorkOrder entity = mock.Copy() as WorkOrder;
				entity = (WorkOrder)mock.Clone();
				Assert.IsTrue(WorkOrder.ValueEquals(entity, mock), "Clone is not working");
			}
		}
    public void Relational_Store_Deletes_all_records_with_name_attributes() {
      var WorkOrderStore = new SqliteRelationalStore<WorkOrder>(_db);
      var myBatch = new List<WorkOrder>();
      int qtyToAdd = 10;
      for (int i = 0; i < qtyToAdd; i++) {
        var newWorkOrder = new WorkOrder { Description = "Kill Roaches dead " + i };
        myBatch.Add(newWorkOrder);
      }
      WorkOrderStore.Add(myBatch);

      // Re-load from back-end:
      var workOrders = WorkOrderStore.TryLoadData();
      int qtyAdded = workOrders.Count;

      // Delete:
      WorkOrderStore.DeleteAll();
      int remaining = WorkOrderStore.TryLoadData().Count;
      Assert.IsTrue(qtyAdded == qtyToAdd && remaining == 0);
    }
Ejemplo n.º 51
0
		///<summary>
		///  Update the Typed WorkOrder Entity with modified mock values.
		///</summary>
		static public void UpdateMockInstance_Generated(TransactionManager tm, WorkOrder mock)
		{
			mock.OrderQty = TestUtility.Instance.RandomNumber();
			mock.ScrappedQty = TestUtility.Instance.RandomShort();
			mock.StartDate = TestUtility.Instance.RandomDateTime();
			mock.EndDate = TestUtility.Instance.RandomDateTime();
			mock.DueDate = TestUtility.Instance.RandomDateTime();
			mock.ModifiedDate = TestUtility.Instance.RandomDateTime();
			
			int count0 = 0;
			TList<Product> _collection0 = DataRepository.ProductProvider.GetPaged(tm, 0, 10, out count0);
			//_collection0.Shuffle();
			if (_collection0.Count > 0)
			{
				mock.ProductId = _collection0[0].ProductId;
			}
			int count1 = 0;
			TList<ScrapReason> _collection1 = DataRepository.ScrapReasonProvider.GetPaged(tm, 0, 10, out count1);
			//_collection1.Shuffle();
			if (_collection1.Count > 0)
			{
				mock.ScrapReasonId = _collection1[0].ScrapReasonId;
			}
		}
        public static XmlDocument BuildUpdateRq(WorkOrder wo)
        {
            RotoTrackDb db = new RotoTrackDb();
            XmlDocument doc = XmlUtils.MakeRequestDocument();
            XmlElement parent = XmlUtils.MakeRequestParentElement(doc);

            string listID = wo.QBListId;
            Site site = db.Sites.Find(wo.SiteId);

            string salesRep = "";
            UserProfile up = db.UserProfiles.Find(wo.SalesRepId);
            if (up != null)
            {
                salesRep = up.FirstName + " " + up.LastName;
            }

            doc = BuildDataExtModOrDelRq(doc, parent, listID, "Site Name", site.SiteName);
            doc = BuildDataExtModOrDelRq(doc, parent, listID, "Site Unit Number", site.UnitNumber);
            doc = BuildDataExtModOrDelRq(doc, parent, listID, "Site County", site.County);
            doc = BuildDataExtModOrDelRq(doc, parent, listID, "Site City/State", site.CityState);
            doc = BuildDataExtModOrDelRq(doc, parent, listID, "Site POAFE", wo.POAFENumber);
            doc = BuildDataExtModOrDelRq(doc, parent, listID, "Work Order Sales Rep", salesRep);

            switch (wo.CloseStatus)
            {
                case CloseStatus.BillPerPreCloseSalePrice:
                    doc = BuildDataExtModOrDelRq(doc, parent, listID, "Close Status", "Bill per PreClose Sale Price");
                    break;

                case CloseStatus.BillPerQuote:
                    doc = BuildDataExtModOrDelRq(doc, parent, listID, "Close Status", "Bill per Quote");
                    break;

                case CloseStatus.BillWithCore:
                    doc = BuildDataExtModOrDelRq(doc, parent, listID, "Close Status", "Bill with Core");
                    break;

                case CloseStatus.ClosedAtZeroDollars:
                    doc = BuildDataExtModOrDelRq(doc, parent, listID, "Close Status", "Closed at Zero $");
                    break;

                case CloseStatus.NotApplicable:
                    doc = BuildDataExtModOrDelRq(doc, parent, listID, "Close Status", "");
                    break;

                case CloseStatus.PreClose:
                    doc = BuildDataExtModOrDelRq(doc, parent, listID, "Close Status", "Pre-close");
                    break;

                case CloseStatus.PreCloseHold:
                    doc = BuildDataExtModOrDelRq(doc, parent, listID, "Close Status", "Pre-close HOLD");
                    break;

                case CloseStatus.PreInvoice:
                    doc = BuildDataExtModOrDelRq(doc, parent, listID, "Close Status", "Pre-Invoice");
                    break;

                case CloseStatus.Approved:
                    doc = BuildDataExtModOrDelRq(doc, parent, listID, "Close Status", "Approved");
                    break;

                case CloseStatus.ReadyForPreClose:
                    doc = BuildDataExtModOrDelRq(doc, parent, listID, "Close Status", "Ready for Pre-close");
                    break;

                case CloseStatus.Warranty:
                    doc = BuildDataExtModOrDelRq(doc, parent, listID, "Close Status", "Warranty");
                    break;

                case CloseStatus.RnDResearchAndDev:
                    doc = BuildDataExtModOrDelRq(doc, parent, listID, "Close Status", "R&D-Research & Development");
                    break;

                default:
                    doc = BuildDataExtModOrDelRq(doc, parent, listID, "Close Status", "");
                    break;
            }

            return doc;
        }
    public void Relational_Store_Deletes_range_of_records_with_name_attributes() {
      var WorkOrderStore = new SqliteRelationalStore<WorkOrder>(_db);
      var myBatch = new List<WorkOrder>();
      int qtyToAdd = 10;
      for (int i = 0; i < qtyToAdd; i++) {
        var newWorkOrder = new WorkOrder { Description = "Kill mice dead " + i };
        myBatch.Add(newWorkOrder);
      }
      WorkOrderStore.Add(myBatch);

      // Re-load from back-end:
      var workOrders = WorkOrderStore.TryLoadData();
      int qtyAdded = workOrders.Count;

      // Select 5 for deletion:
      int qtyToDelete = 5;
      var deleteThese = workOrders.Where(c => c.WorkOrderId <= qtyToDelete);

      // Delete:
      WorkOrderStore.Delete(deleteThese);
      int remaining = WorkOrderStore.TryLoadData().Count;
      Assert.IsTrue(qtyAdded == qtyToAdd && remaining == qtyAdded - qtyToDelete);
    }
        public static XmlDocument BuildUpdateSalesRepRq(WorkOrder wo)
        {
            RotoTrackDb db = new RotoTrackDb();
            XmlDocument doc = XmlUtils.MakeRequestDocument();
            XmlElement parent = XmlUtils.MakeRequestParentElement(doc);

            string listID = wo.QBListId;
            Site site = db.Sites.Find(wo.SiteId);

            string salesRep = "";
            UserProfile up = db.UserProfiles.Find(wo.SalesRepId);
            if (up != null)
            {
                salesRep = up.FirstName + " " + up.LastName;
            }

            doc = BuildDataExtModOrDelRq(doc, parent, listID, "Work Order Sales Rep", salesRep);

            return doc;
        }
Ejemplo n.º 55
0
		/// <summary>
        /// Make any alterations necessary (i.e. for DB check constraints, special test cases, etc.)
        /// </summary>
        /// <param name="mock">Object to be modified</param>
        static private void SetSpecialTestData(WorkOrder mock)
        {
            //Code your changes to the data object here.
            mock.EndDate = mock.StartDate.AddDays(1);
        }
 /// <summary>
 /// Create a new WorkOrder object.
 /// </summary>
 /// <param name="workOrderID">Initial value of WorkOrderID.</param>
 /// <param name="orderQty">Initial value of OrderQty.</param>
 /// <param name="stockedQty">Initial value of StockedQty.</param>
 /// <param name="scrappedQty">Initial value of ScrappedQty.</param>
 /// <param name="startDate">Initial value of StartDate.</param>
 /// <param name="dueDate">Initial value of DueDate.</param>
 /// <param name="modifiedDate">Initial value of ModifiedDate.</param>
 public static WorkOrder CreateWorkOrder(int workOrderID, int orderQty, int stockedQty, short scrappedQty, global::System.DateTime startDate, global::System.DateTime dueDate, global::System.DateTime modifiedDate)
 {
     WorkOrder workOrder = new WorkOrder();
     workOrder.WorkOrderID = workOrderID;
     workOrder.OrderQty = orderQty;
     workOrder.StockedQty = stockedQty;
     workOrder.ScrappedQty = scrappedQty;
     workOrder.StartDate = startDate;
     workOrder.DueDate = dueDate;
     workOrder.ModifiedDate = modifiedDate;
     return workOrder;
 }
Ejemplo n.º 57
0
 /// <summary>
 /// Create a new WorkOrder object.
 /// </summary>
 /// <param name="workOrderId">Initial value of WorkOrderId.</param>
 /// <param name="computedOrderId">Initial value of ComputedOrderId.</param>
 /// <param name="createDate">Initial value of CreateDate.</param>
 public static WorkOrder CreateWorkOrder(int workOrderId, string computedOrderId, global::System.DateTime createDate)
 {
     WorkOrder workOrder = new WorkOrder();
     workOrder.WorkOrderId = workOrderId;
     workOrder.ComputedOrderId = computedOrderId;
     workOrder.CreateDate = createDate;
     return workOrder;
 }
Ejemplo n.º 58
0
 public static void Add(WorkOrder workOrder)
 {
     WcfData.WorkOrder inDbWorkOrder = (WcfData.WorkOrder)workOrder;
     WcfData.WorkOrderDbOperations.Add(inDbWorkOrder);
 }
    public void Relational_Store_Deletes_record_with_name_attributes() {
      var WorkOrderStore = new SqliteRelationalStore<WorkOrder>(_db);
      var newWorkOrder = new WorkOrder { Description = "Eradicate bed bugs" };
      WorkOrderStore.Add(newWorkOrder);

      // Load from back-end:
      var workOrders = WorkOrderStore.TryLoadData();
      int qtyAdded = workOrders.Count;

      // Delete:
      var foundWorkOrder = workOrders.FirstOrDefault();
      WorkOrderStore.Delete(foundWorkOrder);

      int remaining = WorkOrderStore.TryLoadData().Count;
      Assert.IsTrue(qtyAdded == 1 && remaining == 0);
    }
Ejemplo n.º 60
0
 public static XmlDocument BuildModRq(WorkOrder wo)
 {
     return BuildAddOrModRq(wo);
 }