public List <TimesheetWithWorkItems> GetWorkItemsByTimesheetRestURL(string RestUrl, string siteUrl) { WorkItemsOperations objWorkItems = new WorkItemsOperations(); List <TimesheetWithWorkItems> timesheetWorkItems = new List <TimesheetWithWorkItems>(); timesheetWorkItems = CRUDOperations.GetListByRestURL <TimesheetWithWorkItems>(RestUrl); foreach (TimesheetWithWorkItems timesheetItem in timesheetWorkItems) { List <WorkItems> workItems = objWorkItems.GetWorkItemsByTimesheetID(Convert.ToString(timesheetItem.ID), siteUrl); timesheetItem.WorkItems = workItems; } return(timesheetWorkItems); }
public List <ApprovalHistory> GetApprovalHistory(string siteUrl) { try { string RestUrl = string.Concat(siteUrl, Lists.ListURLs.RestUrlListItemWithQuery(Lists.Lists.ApprovalHistory, true)); return(CRUDOperations.GetListByRestURL <ApprovalHistory>(RestUrl)); } catch (Exception ex) { string guid = RestAPI.WriteException(ex, MethodBase.GetCurrentMethod().Name, MethodBase.GetCurrentMethod().DeclaringType.Name); throw new Exception(string.Format(Lists.Messages.MsgExceptionOccured, guid)); } }
public Phases PhaseByID(string id, string siteUrl) { try { string RestUrl = string.Concat(siteUrl, Lists.ListURLs.RestUrlListItemWithQuery(Lists.Lists.Phases, true), string.Format(Lists.RestFilters.ByID, id)); return(CRUDOperations.GetListByRestURL <Phases>(RestUrl).FirstOrDefault()); } catch (Exception ex) { string guid = RestAPI.WriteException(ex, MethodBase.GetCurrentMethod().Name, MethodBase.GetCurrentMethod().DeclaringType.Name); throw new Exception(string.Format(Lists.Messages.MsgExceptionOccured, guid)); } }
public List <Phases> PhasesByProjectName(string projectName, string siteUrl) { try { string RestUrl = string.Concat(siteUrl, Lists.ListURLs.RestUrlListItemWithQuery(Lists.Lists.Phases, true), string.Format(Lists.RestFilters.ByProjectName, projectName), string.Format(Lists.RestFilters.topItems, GetTop.Default)); return(CRUDOperations.GetListByRestURL <Phases>(RestUrl)); } catch (Exception ex) { string guid = RestAPI.WriteException(ex, MethodBase.GetCurrentMethod().Name, MethodBase.GetCurrentMethod().DeclaringType.Name); throw new Exception(string.Format(Lists.Messages.MsgExceptionOccured, guid)); } }
/// <summary> /// Update Timesheets into database /// </summary> /// <param name="objTimesheets">Timesheet object</param> /// <param name="siteUrl">Targeted site URL</param> /// <returns>Result</returns> public Result UpdateTimesheet(Timesheet objWorkItems, string siteUrl) { Result res = new Result(); try { res = CRUDOperations.UpdateListItem <Timesheet>(Lists.Lists.Timesheet, objWorkItems); res.StatusCode = StatusCode.Success; res.Message = Messages.MsgSuccessUpdate; return(res); } catch (Exception ex) { string guid = RestAPI.WriteException(ex, MethodBase.GetCurrentMethod().Name, MethodBase.GetCurrentMethod().DeclaringType.Name); res.Message = Messages.MsgSomethingWentWrong; res.StatusCode = StatusCode.Error; return(res); } }
public Result AddApprovalHistory(ApprovalHistory objApprovalHistory, string siteUrl) { Result res = new Result(); try { res = CRUDOperations.AddListItem <ApprovalHistory>(Lists.Lists.ApprovalHistory, objApprovalHistory); res.StatusCode = StatusCode.Success; res.Message = Messages.MsgSuccessAdd; return(res); } catch (Exception ex) { string guid = RestAPI.WriteException(ex, MethodBase.GetCurrentMethod().Name, MethodBase.GetCurrentMethod().DeclaringType.Name); res.Message = Messages.MsgSomethingWentWrong; res.StatusCode = StatusCode.Error; return(res); } }
public Result UpdateProject(Projects objProjects, string siteUrl) { Result res = new Result(); try { res = CRUDOperations.UpdateListItem <Projects>(Lists.Lists.Projects, objProjects); res.StatusCode = StatusCode.Success; //res.Message = Messages.MsgProjectCategoryUpdateSuccess; return(res); } catch (Exception ex) { string guid = RestAPI.WriteException(ex, MethodBase.GetCurrentMethod().Name, MethodBase.GetCurrentMethod().DeclaringType.Name); res.Message = Messages.MsgSomethingWentWrong; res.StatusCode = StatusCode.Error; return(res); } }
private void Start_Api(string var, bool start) { // The connection to the Organization web service. OrganizationServiceProxy serviceProxy = null; EntityReferenceCollection records = null; // Obtain the target organization's web address and client logon credentials // from the user by using a helper class. ServerConnection serverConnect = new ServerConnection(); ServerConnection.Configuration config = serverConnect.GetServerConfiguration(); // Establish an authenticated connection to the Organization web service. serviceProxy = new OrganizationServiceProxy(config.OrganizationUri, config.HomeRealmUri, config.Credentials, config.DeviceCredentials); CRUDOperations app = new CRUDOperations(); // Create any records that must exist in the database. These record references are // stored in a collection so the records can be deleted later. records = app.CreateRequiredEntityRecords(serviceProxy); // Enable early-bound entity types. This enables use of IntelliSense in Visual Studio // and avoids spelling errors in attribute names when using the Entity property bag. serviceProxy.EnableProxyTypes(); // Here we will use the interface instead of the proxy object. IOrganizationService service = (IOrganizationService)serviceProxy; // Display information about the logged on user. Guid userid = ((WhoAmIResponse)service.Execute(new WhoAmIRequest())).UserId; SystemUser systemUser = (SystemUser)service.Retrieve("systemuser", userid, new ColumnSet(new string[] { "firstname", "lastname" })); Console.WriteLine("Logged on user is {0} {1}.", systemUser.FirstName, systemUser.LastName); // Retrieve the version of Microsoft Dynamics CRM. RetrieveVersionRequest versionRequest = new RetrieveVersionRequest(); RetrieveVersionResponse versionResponse = (RetrieveVersionResponse)service.Execute(versionRequest); Console.WriteLine("Microsoft Dynamics CRM version {0}.", versionResponse.Version); // Perform the primary operation of this sample. // Some exceptions to consider catching. //<snippetCRUDOperations3> //</snippetCRUDOperations3> if (start) { MyTimer.Interval = (Convert.ToInt32(var) * 60 * 1000); // 1 mins MyTimer.Tick += (sender2, e2) => MyTimer_Tick(sender2, e2, serviceProxy, records); MyTimer.Start(); } else { MyTimer.Stop(); } }
private void MyTimer_Tick(object sender, EventArgs e, OrganizationServiceProxy serviceProxy, EntityReferenceCollection records) { CRUDOperations app = new CRUDOperations(); app.Run(serviceProxy, records, checkBox1, checkBox2, checkBox3, checkBox4, checkBox5); }
public List <Kunde> Retrieve() { List <Kunde> kunder = CRUDOperations.StartUp(); return(kunder); }