public void CreateItem()
        {
            var res = FreshBooks.CreateRequestXML("item.create", x => x.item = new {
                name        = "Fuzzy Slippers",
                description = "Extra soft",
                unit_cost   = "59.99",
                quantity    = 1,
                inventory   = 10
            });

            Console.Write(res.ToString());
        }
Example #2
0
        public static List <FBProject> GetFBProjects(Instance_Config instanceConfig, int page, int limit, int clientID, int staffID)
        {
            List <FBProject> arrProjects;
            string           result = FreshBooks.GetProjectsList(instanceConfig, out arrProjects, instanceConfig.FBoAuthConsumerKey, instanceConfig.FBoAuthSecret, limit, page, clientID, staffID);

            if (result == "ok")
            {
                return(arrProjects);
            }
            else
            {
                throw new HttpError(HttpStatusCode.NotFound, result.Replace("\n", " ").Replace("\r", " "));
            }
        }
Example #3
0
        public static FBClient CreateClient(ApiUser User, Instance_Config instanceConfig, int accountID)
        {
            FBClient fbClient;
            string   result = FreshBooks.CreateClient(User.OrganizationId, User.DepartmentId, instanceConfig, instanceConfig.FBoAuthConsumerKey, instanceConfig.FBoAuthSecret, accountID, out fbClient);

            if (result == "ok")
            {
                return(fbClient);
            }
            else
            {
                throw new HttpError(HttpStatusCode.NotFound, Utils.ClearString(result));
            }
        }
Example #4
0
        public static List <FBCategory> GetFBCategories(Instance_Config instanceConfig)
        {
            List <FBCategory> arrCategories;
            string            result = FreshBooks.GetCategoryList(instanceConfig, out arrCategories, instanceConfig.FBoAuthConsumerKey, instanceConfig.FBoAuthSecret);

            if (result == "ok")
            {
                return(arrCategories);
            }
            else
            {
                throw new HttpError(HttpStatusCode.NotFound, Utils.ClearString(result));
            }
        }
Example #5
0
        public static List <FBStaff> GetFBStaff(Instance_Config instanceConfig, int page, int limit)
        {
            List <FBStaff> arrStaff;
            string         result = FreshBooks.GetStaffList(instanceConfig, out arrStaff, instanceConfig.FBoAuthConsumerKey, instanceConfig.FBoAuthSecret, limit, page);

            if (result == "ok")
            {
                return(arrStaff);
            }
            else
            {
                throw new HttpError(HttpStatusCode.NotFound, Utils.ClearString(result));
            }
        }
Example #6
0
        public static FBTask CreateTask(ApiUser User, Instance_Config instanceConfig, int taskTypeID, int fbProjectID)
        {
            FBTask fbTask;
            string result = FreshBooks.CreateTask(User.OrganizationId, User.DepartmentId, instanceConfig, instanceConfig.FBoAuthConsumerKey,
                                                  instanceConfig.FBoAuthSecret, taskTypeID, fbProjectID, out fbTask);

            if (result == "ok")
            {
                return(fbTask);
            }
            else
            {
                throw new HttpError(HttpStatusCode.NotFound, Utils.ClearString(result));
            }
        }
Example #7
0
        public static FBTask FindFBTask(Instance_Config instanceConfig, string name)
        {
            FBTask arrTask;
            string result = FreshBooks.FindTask(instanceConfig, instanceConfig.FBoAuthConsumerKey, instanceConfig.FBoAuthSecret,
                                                name, out arrTask);

            if (result == "ok")
            {
                if (arrTask == null)
                {
                    arrTask = new FBTask(0, "");
                }
                return(arrTask);
            }
            else
            {
                throw new HttpError(HttpStatusCode.NotFound, Utils.ClearString(result));
            }
        }
        public void CreateTimeEntry()
        {
            var fb = Shared.NewCaller();

            var res = FreshBooks.CreateRequestXML("time_entry.create", x => x.time_entry = new {
                task_id   = 999999,
                hours     = 25,
                something = "else"
            });

            Console.Write(res.ToString());

            dynamic time_entry = new ExpandoObject();

            time_entry.task_id   = 999998;
            time_entry.hours     = 24;
            time_entry.something = "otherwise";

            res = FreshBooks.CreateRequestXML("time_entry.create", x => x.time_entry = time_entry);
            Console.Write(res.ToString());
        }
Example #9
0
 public static void UnlinkFreshBooksTimeEntry(ApiUser hdUser, int timeLogID, bool isProjectLog)
 {
     FreshBooks.UnlinkFreshBooksTimeEntry(hdUser.OrganizationId, hdUser.DepartmentId, timeLogID, isProjectLog);
 }
Example #10
0
 public static void UpdateData(ApiUser User, int userID, int fbStaffID, int accountID, int fbClientId, int projectID,
                               int fbProjectID, int taskTypeID, int fbTaskTypeID)
 {
     FreshBooks.UpdateData(User.OrganizationId, User.DepartmentId, userID, fbStaffID, accountID, fbClientId, projectID, fbProjectID, taskTypeID, fbTaskTypeID);
 }
Example #11
0
 public static string CreateTimeEntry(ApiUser hdUser, Instance_Config instanceConfig, int staffID, int projectID, int taskID,
                                      decimal hours, string notes, DateTime date, int timeLogID, bool isProjectLog)
 {
     return(FreshBooks.CreateTimeEntry(hdUser.OrganizationId, hdUser.DepartmentId, instanceConfig, instanceConfig.FBoAuthConsumerKey, instanceConfig.FBoAuthSecret,
                                       staffID, projectID, taskID, hours, notes, date, timeLogID, isProjectLog));
 }
Example #12
0
 public static void DeleteFreshBooksExpense(ApiUser hdUser, Instance_Config instanceConfig, string expenseID)
 {
     FreshBooks.DeleteAndUnlinkExpense(hdUser.OrganizationId, hdUser.DepartmentId, instanceConfig, instanceConfig.FBoAuthConsumerKey, instanceConfig.FBoAuthSecret, expenseID);
 }
Example #13
0
 public static void UnlinkFreshBooksExpense(ApiUser hdUser, string expenseID)
 {
     FreshBooks.UnlinkFreshBooksExpense(hdUser.OrganizationId, hdUser.DepartmentId, expenseID);
 }
Example #14
0
 public static void UnlinkFreshBooksProject(ApiUser hdUser, int projectID)
 {
     FreshBooks.UnlinkFreshBooksProject(hdUser.OrganizationId, hdUser.DepartmentId, projectID);
 }
Example #15
0
        public void Clients_Get_Request()
        {
            var req = FreshBooks.CreateRequestXML("client.get", x => x.client_id = 12);

            Console.Write(req.ToString());
        }
Example #16
0
 public static void DeleteFreshBooksCategory(ApiUser hdUser, Instance_Config instanceConfig, string categoryID)
 {
     FreshBooks.DeleteAndUnlinkCategory(hdUser.OrganizationId, hdUser.DepartmentId, instanceConfig, instanceConfig.FBoAuthConsumerKey, instanceConfig.FBoAuthSecret, categoryID);
 }
Example #17
0
 public static void UnlinkFreshBooksCategory(ApiUser hdUser, string categoryID)
 {
     FreshBooks.UnlinkFreshBooksCategory(hdUser.OrganizationId, hdUser.DepartmentId, categoryID);
 }
Example #18
0
 public static void DeleteFreshBooksProject(ApiUser hdUser, Instance_Config instanceConfig, int projectID)
 {
     FreshBooks.DeleteAndUnlinkProject(hdUser.OrganizationId, hdUser.DepartmentId, instanceConfig, instanceConfig.FBoAuthConsumerKey, instanceConfig.FBoAuthSecret, projectID);
 }
Example #19
0
 public static void UnlinkFreshBooksStaff(ApiUser hdUser, int userID)
 {
     FreshBooks.UnlinkFreshBooksStaff(hdUser.OrganizationId, hdUser.DepartmentId, userID);
 }
Example #20
0
 public static void UnlinkFreshBooksTask(ApiUser hdUser, int taskTypeID)
 {
     FreshBooks.UnlinkFreshBooksTask(hdUser.OrganizationId, hdUser.DepartmentId, taskTypeID);
 }
Example #21
0
 public static void UnlinkFreshBooksExpense(ApiUser hdUser, int accountID)
 {
     FreshBooks.UnlinkFreshBooksClient(hdUser.OrganizationId, hdUser.DepartmentId, accountID);
 }
Example #22
0
 public static void DeleteFreshBooksTimeEntry(ApiUser hdUser, Instance_Config instanceConfig, int timeLogID, bool isProjectLog)
 {
     FreshBooks.DeleteAndUnlinkTimeEntry(hdUser.OrganizationId, hdUser.DepartmentId, instanceConfig, instanceConfig.FBoAuthConsumerKey, instanceConfig.FBoAuthSecret, timeLogID, isProjectLog);
 }
Example #23
0
 public static void DeleteFreshBooksTask(ApiUser hdUser, Instance_Config instanceConfig, int taskTypeID)
 {
     FreshBooks.DeleteAndUnlinkTask(hdUser.OrganizationId, hdUser.DepartmentId, instanceConfig, instanceConfig.FBoAuthConsumerKey, instanceConfig.FBoAuthSecret, taskTypeID);
 }
Example #24
0
 public static string CreateExpense(ApiUser hdUser, Instance_Config instanceConfig, int staffID, int projectID, int categoryID, int clientID, decimal amount,
                                    string vendor, string notes, DateTime date, string expenseID, int fbExpenseID)
 {
     return(FreshBooks.CreateExpense(hdUser.OrganizationId, hdUser.DepartmentId, instanceConfig, instanceConfig.FBoAuthConsumerKey, instanceConfig.FBoAuthSecret,
                                     staffID, projectID, categoryID, clientID, amount, vendor, notes, date, expenseID, fbExpenseID));
 }