//Methods public static UIControlResourceHolder GetUIControlResources(BusinessObjects.UIControlTypes controltype) { //Variables string resourcePath = "BLL.UIControls." + controltype.ToString() + "." + controltype.ToString(); string controlTagElem = "", script = "", innerHtml = "", css = ""; string controlTagPath = "BLL.UIControls.ControlTag.htm"; //Get the innerHtml content and script innerHtml = GetEmbeddedUIControlResource(resourcePath + ".htm"); css = GetEmbeddedUIControlResource(resourcePath + ".css"); script = GetEmbeddedUIControlResource(resourcePath + ".js"); // UIControlResourceHolder holder = new UIControlResourceHolder(controltype, innerHtml, css, script); return holder; }
public override System.Net.WebResponse ExecuteFeed(string feedURL, IProvider provider, BusinessObjects.Token connectionToken, BusinessObjects.TRANSPORT_METHOD transportMethod, byte[] content = null, Dictionary<string, string> headers = null) { string signature = ""; OAuthHelper oauthHelper = new OAuthHelper(); string timestamp = oauthHelper.GenerateTimeStamp(); QueryParameters oauthParams = new QueryParameters(); oauthParams.Add("oauth_consumer_key", provider.Consumerkey); oauthParams.Add("oauth_nonce", oauthHelper.GenerateNonce()); oauthParams.Add("oauth_signature_method", provider.SignatureMethod.ToString()); oauthParams.Add("oauth_timestamp", timestamp); oauthParams.Add("oauth_token", connectionToken.AccessToken); oauthParams.Add("oauth_version", "1.0"); signature = oauthHelper.GenerateSignature(new Uri(feedURL), oauthParams, provider.Consumerkey, provider.Consumersecret, provider.SignatureMethod, TRANSPORT_METHOD.POST, connectionToken.TokenSecret); oauthParams.Add("oauth_signature", signature); HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(feedURL); request.Method = transportMethod.ToString(); if (headers != null) { foreach (var header in headers) { switch (header.Key) { case "ContentLength": { request.ContentLength = long.Parse(header.Value); break; } case "ContentType": { request.ContentType = header.Value; break; } default: { request.Headers[header.Key] = header.Value; break; } } } } request.ContentLength = (content == null) ? 0 : content.Length; request.Headers.Add("Authorization", oauthHelper.GetAuthorizationHeader(oauthParams)); request.GetRequestStream().Write(content, 0, content.Length); WebResponse wr = null; try { logger.Debug("Executing " + feedURL + " using " + transportMethod.ToString() + Environment.NewLine + "Request Parameters: " + oauthParams.ToString()); wr = (WebResponse)request.GetResponse(); logger.Info("Successfully executed " + feedURL + " using " + transportMethod.ToString()); } catch (Exception ex) { logger.Error(ErrorMessages.CustomFeedExecutionError(feedURL, oauthParams), ex); throw new OAuthException(ErrorMessages.CustomFeedExecutionError(feedURL, oauthParams), ex); } return wr; }
public override System.Net.WebResponse ExecuteFeed(string feedURL, IProvider provider, BusinessObjects.Token connectionToken, BusinessObjects.TRANSPORT_METHOD transportMethod) { string signature = ""; OAuthHelper oauthHelper = new OAuthHelper(); QueryParameters oauthParams = new QueryParameters(); oauthParams.Add("oauth_consumer_key", provider.Consumerkey); oauthParams.Add("oauth_nonce", oauthHelper.GenerateNonce()); oauthParams.Add("oauth_signature_method", provider.SignatureMethod.ToString()); oauthParams.Add("oauth_timestamp", oauthHelper.GenerateTimeStamp()); oauthParams.Add("oauth_token", connectionToken.AccessToken); oauthParams.Add("oauth_version", "1.0"); ////1. Generate Signature signature = oauthHelper.GenerateSignature(new Uri(feedURL), oauthParams, provider.Consumerkey, provider.Consumersecret, provider.SignatureMethod, TRANSPORT_METHOD.GET, connectionToken.TokenSecret); oauthParams.Add("oauth_signature", signature); //3.Connect and Execute Feed HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(feedURL); request.Method = transportMethod.ToString(); request.Headers.Add("Authorization", oauthHelper.GetAuthorizationHeader(oauthParams)); //request.ContentType = "application/atom+xml"; request.ContentLength = 0; WebResponse wr; try { logger.Debug("Executing " + feedURL + " using " + transportMethod.ToString() + Environment.NewLine + "Request Parameters: " + oauthParams.ToString()); wr = (WebResponse)request.GetResponse(); logger.Info("Successfully executed " + feedURL + " using " + transportMethod.ToString()); } catch (Exception ex) { logger.Error(ErrorMessages.CustomFeedExecutionError(feedURL, oauthParams), ex); throw new OAuthException(ErrorMessages.CustomFeedExecutionError(feedURL, oauthParams), ex); } return wr; }
public static bool RemoveAppointment(int jobID, int jobInstanceNumber, string changeUser, bool informEngineer, BusinessObjects.WorkManagement.eSchedulerAppointmentMissedReason missedReason ) { DataAccess objADO = new DataAccess(); ArrayList colParameters = new ArrayList(); string strStoredProcedure = "updJobAppointment"; colParameters.Add(new SqlParameter("@WMSourceID", jobID)); colParameters.Add(new SqlParameter("@JobInstanceNumber", jobInstanceNumber)); colParameters.Add(new SqlParameter("@ChangeUser", changeUser)); if (informEngineer) { colParameters.Add(new SqlParameter("@DateChangeDetected", DateTime.Now)); } colParameters.Add(new SqlParameter("@IsActive", false)); colParameters.Add(new SqlParameter("@MissedReason", missedReason.ToString())); int intReturn = objADO.ExecuteSQL(strStoredProcedure, (SqlParameter[])colParameters.ToArray(typeof(SqlParameter))); objADO = null; return (intReturn > 0); }