Exemplo n.º 1
0
        //CRUD DELETE
        //POST a deletion/deactivation to the db
        //error checking
        //POST: /TSMaintenanceOrderGroup/DeleteMaintOrdGroup
        public string DeleteMaintOrdGroup(TSMaintenanceOrderGroupModel tsMaintenanceOrder)
        {
            try
            {
                //if the object has data, insert the data, else if there is no data just return a string

                //create a new MaintOrdGroup-type object called oMaintOrdGroup
                MaintOrdGroup oMaintOrdGroup = new MaintOrdGroup();

                //populate the DAL-object with the MVC object data
                oMaintOrdGroup.TA_Code       = tsMaintenanceOrder.TA_Code;
                oMaintOrdGroup.MaintOrdGroup = tsMaintenanceOrder.MaintOrdGrp;
                //set the object property to false. When you load the table in, with the
                //GetMaintOrdGroup() method called and filering in only active=true objects,
                //you'll only get the objects labelled as true (i.e. not "deleted")
                oMaintOrdGroup.Active = false;

                //connect via interface to DAL App, and delete the object. The DAL parses out just the equipment number, deleting the object with that number
                itsApp.DeleteMaintOrdGroup(oMaintOrdGroup);
                return("Deleted");
            }
            catch
            {
                return("Not Deleted");
            }
        }
Exemplo n.º 2
0
        //inserts/creates a Maintenance Order Group object in the DAL->db
        //POST: /TSMaintenanceOrderGroup/InsertMaintOrdGroup
        public string InsertMaintOrdGroup(TSMaintenanceOrderGroupModel tsMaintenanceOrder)
        {
            try {
                //create a new DAL-based TaskWO-type object called oTaskWO
                MaintOrdGroup oMaintOrdGroup = new MaintOrdGroup();

                //populate the DAL-object with the MVC object data
                oMaintOrdGroup.TA_Code       = tsMaintenanceOrder.TA_Code;
                oMaintOrdGroup.MaintOrdGroup = tsMaintenanceOrder.MaintOrdGrp;
                oMaintOrdGroup.Active        = tsMaintenanceOrder.Active;

                //connect via interface to DAL App, and insert the object
                itsApp.InsertMaintOrdGroup(oMaintOrdGroup);
                return("Added");
            }
            catch
            {
                return("Not Added");
            }
        }