Пример #1
0
    private void ConvertServiceOrderItemToReceiptItem(ServiceOrderItem serviceOrderItem)
    {
        var receiptItem = new ReceiptItem();

        receiptItem.CompanyId = Company.CompanyId;
        receiptItem.Quantity  = 1;

        if (serviceOrderItem.ProductId.HasValue)
        {
            receiptItem.ProductId   = serviceOrderItem.ProductId.Value;
            receiptItem.Description = serviceOrderItem.Product.Name;
            receiptItem.FiscalClass = serviceOrderItem.Product.FiscalClass;
            Inventory inventory = new InventoryManager(this).GetProductInventory(Company.CompanyId,
                                                                                 receiptItem.ProductId.Value,
                                                                                 Deposit.DepositId);
            receiptItem.UnitPrice = inventory != null
                                        ? inventory.UnitPrice
                                        : Decimal.Zero;
            AddReceiptItem(serviceOrderItem.Product, receiptItem);
        }
        else
        {
            receiptItem.UnitPrice   = serviceOrderItem.Price;
            receiptItem.ServiceId   = serviceOrderItem.ServiceId.Value;
            receiptItem.Description = serviceOrderItem.Service.Name;
            AddReceiptItem(serviceOrderItem.Service, receiptItem);
        }
    }
Пример #2
0
        public void SerializeOrderToJson()
        {
            var item1 = new ServiceOrderItem(new Item(1, "One", 10.00m), 1);
            var item2 = new MaterialOrderItem(new Item(2, "Two", 10.02m), 4);

            OrderItem[] items = { item1, item2 };
            var         order = new Order(items);
            var         serializationSettings = new JsonSerializerSettings();

            serializationSettings.TypeNameHandling = TypeNameHandling.Auto;

            var orderJson = JsonConvert.SerializeObject(order, serializationSettings);

            Debug.WriteLine(orderJson);

            var orderDeserialized = JsonConvert.DeserializeObject <Order>(orderJson, serializationSettings);

            Assert.IsTrue(orderDeserialized.OrderItems.Length > 0);
            Assert.IsTrue(orderDeserialized.OrderItems[0] is ServiceOrderItem);
            Assert.IsTrue(orderDeserialized.OrderItems[1] is MaterialOrderItem);
            Assert.IsInstanceOfType(order.OrderItems[1], typeof(MaterialOrderItem));
            Assert.IsTrue(orderDeserialized.OrderItems[1] is ITaxable);
            Assert.IsTrue(orderDeserialized.OrderItems[0].Item.Name == item1.Item.Name);
            Assert.IsTrue(orderDeserialized.OrderItems[0].Item.Price == item1.Item.Price);
            Assert.IsTrue(orderDeserialized.OrderItems[0].Quantity == item1.Quantity);
        }
Пример #3
0
        public ActionResult DeleteConfirmed(int id)
        {
            ServiceOrderItem serviceOrderItem = db.ServiceOrderItems.Find(id);

            db.ServiceOrderItems.Remove(serviceOrderItem);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Пример #4
0
 public ActionResult Edit([Bind(Include = "ServiceOrderItemsID,OrderID")] ServiceOrderItem serviceOrderItem)
 {
     if (ModelState.IsValid)
     {
         db.Entry(serviceOrderItem).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.OrderID = new SelectList(db.ServiceRequests, "ServiceRequestID", "ServiceRequestID", serviceOrderItem.OrderID);
     return(View(serviceOrderItem));
 }
        public void ServiceOrderItem_Extension_AsDTO_Null()
        {
            // Arrange
            ServiceOrderItem serviceOrderItem = null;

            // Act
            var result = serviceOrderItem.AsDto();

            // Assert
            Assert.IsNull(result);
            Assert.AreEqual(null, result);
        }
Пример #6
0
        public ActionResult Create([Bind(Include = "ServiceOrderItemsID,OrderID")] ServiceOrderItem serviceOrderItem)
        {
            if (ModelState.IsValid)
            {
                db.ServiceOrderItems.Add(serviceOrderItem);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.OrderID = new SelectList(db.ServiceRequests, "ServiceRequestID", "ServiceRequestID", serviceOrderItem.OrderID);
            return(View(serviceOrderItem));
        }
Пример #7
0
        public void CalculateTotal()
        {
            // http://www.softschools.com/math/topics/rounding_to_the_nearest_hundredth/
            var item1 = new ServiceOrderItem(new Item(1, "One", 10.00m), 1, new ServiceOrderItemCalc());
            var item2 = new MaterialOrderItem(new Item(2, "Two", 10.02m), 2, new MaterialOrderItemCalc());

            OrderItem[] items           = { item1, item2 };
            var         order           = new Order(items);
            var         orderCalculator = new OrderCalculator();
            var         total           = order.GetOrderTotal(orderCalculator, 0.0825m);

            Assert.IsTrue(total == 31.69m);
        }
        public void ServiceOrderItem_Property_Quantity()
        {
            // Arrange
            var     serviceOrderItem = new ServiceOrderItem();
            decimal value            = 100;

            // Act
            serviceOrderItem.Quantity = value;

            // Assert
            Assert.IsNotNull(serviceOrderItem.Quantity);
            Assert.IsInstanceOfType(serviceOrderItem.Quantity, typeof(decimal));
            Assert.AreEqual(value, serviceOrderItem.Quantity);
        }
Пример #9
0
        // GET: ServiceOrderItems/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ServiceOrderItem serviceOrderItem = db.ServiceOrderItems.Find(id);

            if (serviceOrderItem == null)
            {
                return(HttpNotFound());
            }
            return(View(serviceOrderItem));
        }
        public static ServiceOrderItemDto AsDto(this ServiceOrderItem serviceOrderItem)
        {
            if (serviceOrderItem == null)
            {
                return(null);
            }

            return(new ServiceOrderItemDto
            {
                OrderId = serviceOrderItem.OrderId,
                ServiceId = serviceOrderItem.ServiceId,
                Quantity = serviceOrderItem.Quantity
            });
        }
        public void ServiceOrderItem_Property_ServiceId()
        {
            // Arrange
            var serviceOrderItem = new ServiceOrderItem();
            var value            = 99;

            // Act
            serviceOrderItem.ServiceId = value;

            // Assert
            Assert.IsNotNull(serviceOrderItem.ServiceId);
            Assert.IsInstanceOfType(serviceOrderItem.ServiceId, typeof(int));
            Assert.AreEqual(value, serviceOrderItem.ServiceId);
        }
Пример #12
0
        // GET: ServiceOrderItems/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ServiceOrderItem serviceOrderItem = db.ServiceOrderItems.Find(id);

            if (serviceOrderItem == null)
            {
                return(HttpNotFound());
            }
            ViewBag.OrderID = new SelectList(db.ServiceRequests, "ServiceRequestID", "ServiceRequestID", serviceOrderItem.OrderID);
            return(View(serviceOrderItem));
        }
Пример #13
0
        public void AreItemsSorted()
        {
            var item1 = new ServiceOrderItem(new Item(1, "One", 10.00m), 1);
            var item2 = new MaterialOrderItem(new Item(2, "Two", 10.02m), 1);
            var item3 = new MaterialOrderItem(new Item(3, "Three", 10.03m), 1);
            var item4 = new MaterialOrderItem(new Item(4, "four", 10.04m), 2);

            OrderItem[] items = { item1, item2, item3, item4 };

            var order     = new Order(items);
            var itemsList = (IList <Item>)order.GetItems();

            Assert.IsTrue(itemsList[0].GetName() == "four");
            Assert.IsTrue(itemsList[1].GetName() == "One");
            Assert.IsTrue(itemsList[2].GetName() == "Three");
            Assert.IsTrue(itemsList[3].GetName() == "Two");
        }
Пример #14
0
        public void IsOrderImmutable()
        {
            var item1 = new ServiceOrderItem(new Item(1, "One", 10.00m), 1);
            var item2 = new MaterialOrderItem(new Item(2, "Two", 10.02m), 1);

            OrderItem[] items = { item1, item2 };

            var order     = new Order(items);
            var orderitem = order.OrderItems;
            var test1     = orderitem[0];

            // the follwoing not allowed by compiler.
            //test1.Quantity = 3;
            //test1.Item = new Item(3, "three", 3);
            //order.OrderItems = items;
            order.OrderItems[0] = items[1];
            Assert.AreNotEqual(order.OrderItems[0].Item.Name, order.OrderItems[1].Item.Name);
        }
Пример #15
0
        public void NewDeepCopyTest()
        {
            var item1 = new ServiceOrderItem(new Item(1, "One", 10.00m), 1);
            var item2 = new MaterialOrderItem(new Item(2, "Two", 10.02m), 2);

            OrderItem[] items = { item1, item2 };
            var         order = new Order(items);

            var order2 = DeepCopier.Copy <Order>(order);

            //unsafe
            //{
            //    Item* ptr1 = &order.OrderItems[1].Item;
            //    Item* ptr2 = &order2.OrderItems[1].Item;

            //    //Assert.AreNotEqual(ptr1,ptr2);
            //}
            Assert.AreEqual(order.OrderItems[1].Item.Name, order2.OrderItems[1].Item.Name);
        }
Пример #16
0
        public void CreateServiceOrderItem()
        {
            var item = new ServiceOrderItem(new Item(1, "One", 10.00m), 1, new ServiceOrderItemCalc());

            Assert.IsNotNull(item);
        }
Пример #17
0
    private void ConvertServiceOrderItemToReceiptItem(ServiceOrderItem serviceOrderItem)
    {
        var receiptItem = new ReceiptItem();

        receiptItem.CompanyId = Company.CompanyId;
        receiptItem.Quantity = 1;

        if (serviceOrderItem.ProductId.HasValue)
        {
            receiptItem.ProductId = serviceOrderItem.ProductId.Value;
            receiptItem.Description = serviceOrderItem.Product.Name;
            receiptItem.FiscalClass = serviceOrderItem.Product.FiscalClass;
            Inventory inventory = new InventoryManager(this).GetProductInventory(Company.CompanyId,
                                                                                 receiptItem.ProductId.Value,
                                                                                 Deposit.DepositId);
            receiptItem.UnitPrice = inventory != null
                                        ? inventory.UnitPrice
                                        : Decimal.Zero;
            AddReceiptItem(serviceOrderItem.Product, receiptItem);
        }
        else
        {
            receiptItem.UnitPrice = serviceOrderItem.Price; 
            receiptItem.ServiceId = serviceOrderItem.ServiceId.Value;
            receiptItem.Description = serviceOrderItem.Service.Name;
            AddReceiptItem(serviceOrderItem.Service, receiptItem);
        }
    }
Пример #18
0
        //this region contains all function of ServiceOrderItem

        #region ServiceOrderItem

        /// <summary>
        /// this method insert a ServiceOrderItem
        /// </summary>
        /// <param name="entity"></param>
        public void InsertServiceOrderItem(ServiceOrderItem entity)
        {
            DbContext.ServiceOrderItems.InsertOnSubmit(entity);
            DbContext.SubmitChanges();
        }
    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;
    }
Пример #20
0
    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);
    }
        public void ServiceOrderItem_Property_Count()
        {
            var serviceOrderItem = new ServiceOrderItem();

            Assert.AreEqual(3, serviceOrderItem.GetType().GetProperties().Count());
        }