Beispiel #1
0
    public bool AddService(string name, string description, string examples, int sectionID)
    {
        //Create a new ServiceRow instance
        TimeKeeper.ServicesDataTable Services = new TimeKeeper.ServicesDataTable();
        TimeKeeper.ServicesRow service = Services.NewServicesRow();

        service.Name = name;
        service.Description = description;
        service.Examples = examples;
        service.SectionID = sectionID;
        service.Core = false;				//all efforts added by the UI will not be core, so we hardcode that here

        //Add the new service
        Services.AddServicesRow(service);
        int rowsAffected = Adaptor.Update(Services);

        //Return true if precisely one row was inserted, otherwise false
        return rowsAffected == 1;
    }
    public bool AddService(string name, string description, string examples, int sectionID)
    {
        //Create a new ServiceRow instance
        TimeKeeper.ServicesDataTable Services = new TimeKeeper.ServicesDataTable();
        TimeKeeper.ServicesRow       service  = Services.NewServicesRow();

        service.Name        = name;
        service.Description = description;
        service.Examples    = examples;
        service.SectionID   = sectionID;
        service.Core        = false;                            //all efforts added by the UI will not be core, so we hardcode that here

        //Add the new service
        Services.AddServicesRow(service);
        int rowsAffected = Adaptor.Update(Services);

        //Return true if precisely one row was inserted, otherwise false
        return(rowsAffected == 1);
    }
    public bool UpdateService(string name, string description, string examples, int serviceID)
    {
        TimeKeeper.ServicesDataTable services = Adaptor.GetServiceByServiceID(serviceID);
        if (services.Count == 0)
        {
            //no matching record found, return false
            return(false);
        }

        TimeKeeper.ServicesRow service = services[0];

        service.Name        = name;
        service.Description = description;
        service.Examples    = examples;

        //Update the service record
        int rowsAffected = Adaptor.Update(services);

        //Return true if precisely one row was inserted, otherwise false
        return(rowsAffected == 1);
    }