public override int GetHashCode() { unchecked { return(((ServiceID != null ? ServiceID.GetHashCode() : 0) * 397) ^ (ID != null ? ID.GetHashCode() : 0)); } }
private void Button1_Click(object sender, EventArgs e) { int studentId = ((MainInterface)this.MdiParent).Services.GetStudentId(); int serviceId = ((ServiceID)cboname.SelectedItem).Id; int type = -1; ServiceID selectedItem = (ServiceID)cboname.SelectedItem; if (selectedItem.recur == 4) { type = cbojoiningterm.SelectedIndex + 1; } sql.addprams("@stu_id", studentId); sql.addprams("@serv_id", serviceId); sql.addprams("@term", type); sql.addprams("@amount", selectedItem.Amount); sql.ExecProc("EXEC [dbo].[Insert_Sub] @stu_id,@serv_id,@term,@amount"); if (sql.exep != "") { MessageBox.Show(sql.exep, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } MessageBox.Show("Associated service", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); ((MainInterface)this.MdiParent).Services.Cboname_SelectedIndexChanged(sender, e); this.Close(); }
public void AddServiceID(ServiceType service_type, int service_id) { if (ServiceID.ContainsKey(service_type)) { return; } ServiceID.Add(service_type, service_id); }
public ActivityFeedMediaUpdate(UserInfo user, ServiceID mediaID, Uri activityFeedImage, string header, string content, DateTime timestamp) : base() { User = user; MediaID = mediaID; ActivityFeedImage = activityFeedImage; Header = header; Content = content; Timestamp = timestamp; }
public override bool Equals(object obj) { if (ReferenceEquals(this, obj)) { return(true); } if (!(obj is ProcessorInfo o)) { return(false); } return(ServiceID.Equals(o.ServiceID, StringComparison.InvariantCulture)); }
private void Cboname_SelectedIndexChanged(object sender, EventArgs e) { ServiceID selectedItem = (ServiceID)cboname.SelectedItem; if (selectedItem.recur == 4) { label2.Visible = true; cbojoiningterm.Visible = true; } else { label2.Visible = false; cbojoiningterm.Visible = false; } }
/// <summary> /// 注册一个服务 /// <para>使用接口或抽象类型作为类型参数 可以获得替换同类服务的功能</para> /// <para>使用具体实现类型作为类型参数 则无法替换同类型服务</para> /// </summary> public static void register <IService>(IService service) where IService : ITezService { switch (ServiceID <IService> .ID) { case TezTypeInfo.ErrorID: ServiceID <IService> .setID(m_List.Count); ServiceID <IService> .service = service; m_List.Add(service); Debug.Log(string.Format("Service : [{0}] is registered!", service.GetType().Name)); break; default: ServiceID <IService> .service = service; m_List[ServiceID <IService> .ID] = service; break; } }
private void AssociateService_Load(object sender, EventArgs e) { label2.Visible = false; cbojoiningterm.Visible = false; sql.ExecSql("Select * from services;"); if (sql.exep != "") { MessageBox.Show(sql.exep); } foreach (DataRow r in sql.data.Tables[0].Rows) { ServiceID obj = new ServiceID(); obj.Id = (int)r["id"]; obj.Name = r["name"].ToString(); obj.recur = (Int16)r["recur"]; obj.Amount = double.Parse(r["amount"].ToString()); cboname.Items.Add(obj); } cbojoiningterm.SelectedIndex = 0; }
private void OnConnectionAttemptConcluded(SocketAsyncEventArgs args) { args.Completed -= new EventHandler <SocketAsyncEventArgs>(OnConnectEvent_Completed); m_ConnectionInProgress = false; try { if (args.SocketError != SocketError.Success) { FireConnectedEvent(false, args.SocketError.ToString()); return; } } catch (Exception conExc) { FireConnectedEvent(false, "Unable to connect to server: " + conExc.Message); return; } FireConnectedEvent(true, "Endpoint " + RemoteEndPoint.ToString()); try { // send serviceId request Log.LogMsg("Sending service ID " + ServiceID.ToString()); Send(BitConverter.GetBytes(ServiceID), PacketFlags.IsCritical); if (!Transit.ListenForDataOnSocket()) { // ListenForDataOnSocket calls all appropriate kill events KillConnection("Failed to listen on socket."); return; } } catch (Exception con2Exc) { KillConnection(con2Exc.Message); } }
public UIntPtr GetServiceAddress(UIntPtr serviceList, ServiceID serviceId) { int count = ReadInt(serviceList + 0x840); if (count > 48) { return(UIntPtr.Zero); } int index = 0; while (index < count) { uint currentId = ReadUInt(serviceList + 4); if ((uint)serviceId == currentId) { return(ReadUIntPtr(serviceList)); } serviceList += 0x2C; index++; } return(UIntPtr.Zero); }
public override PagedData ProcessRequest(HttpContext context, CookDBDataContext db) { if (context.Request.Params.Count == 0) { return(new PagedData("Can't call AddServiceID.ashx without parameters")); } if (context.Request.Params.Get("name") == null) { return(new PagedData("Name is null")); } ServiceID serviceID = new ServiceID(); serviceID.name = context.Request.Params.Get("name"); db.ServiceIDs.InsertOnSubmit(serviceID); db.SubmitChanges(); return(new PagedData("")); }
public override string ToString() { return(string.Format("(int) ServiceID = {0}\r\n(int) RemittanceID = {1}\r\n(string) consignment_reference = {2}\r\n(string) Token = {3}\r\n(string) service_key = {4}\r\n(ToAddressRequest) to_address =\r\n{5}\r\n(List<Parcel>) parcels =\r\n{6}", ServiceID.ToString(), RemittanceID.ToString(), consignment_reference.Write(), Token.Write(), service_key.Write(), to_address.ToString(), parcels.ToString())); }
/// <summary> /// Serves as a hash function for a particular type. GetHashCode() is suitable /// for use in hashing algorithms and data structures like a hash table. /// </summary> /// <returns>A hash code for the current object.</returns> public override int GetHashCode() { return(ServiceID.GetHashCode()); }
///<summary> /// Returns a String that represents the current object. ///</summary> public override string ToString() { return("ServiceID:" + ServiceID.ToString()); }
public override async Task <ObservableCollection <AActivityFeedItem> > GetActivityFeed(string username, int paginationIndex, IProgress <APIProgressReport> progress) { if (string.IsNullOrWhiteSpace(username)) { if (progress != null) { progress.Report(new APIProgressReport(100.0, "Please enter a Username", APIResponse.Failed)); } return(new ObservableCollection <AActivityFeedItem>()); } HttpRequestMessage requestMessage = new HttpRequestMessage(HttpMethod.Get, Service.CreateAPIServiceUri("/users/" + username + "/feed?page=" + paginationIndex)); HttpResponseMessage response = await APIWebClient.MakeAPICall(requestMessage); if (response.IsSuccessStatusCode) { string responseAsString = await response.Content.ReadAsStringAsync(); if (progress != null) { progress.Report(new APIProgressReport(50.0, "Recieved Activity Feed From Server", APIResponse.ContinuingExecution)); } JObject o = JObject.Parse("{\"status_feed\":" + responseAsString + "}"); StoryObjectListHummingbirdV1 activityFeedRaw = JsonConvert.DeserializeObject <StoryObjectListHummingbirdV1>(o.ToString()); ObservableCollection <AActivityFeedItem> convertedActivityFeed = new ObservableCollection <AActivityFeedItem>(); foreach (var aFO in activityFeedRaw.status_feed) { string tts = aFO.updated_at.Substring(0, aFO.updated_at.Length - 1); string[] tS = tts.Split('T'); UserInfo user = new UserInfo(); DateTime timestamp; if (!DateTime.TryParse(tts, out timestamp)) { timestamp = DateTime.MinValue; } if (aFO.story_type == "comment") { user.Username = aFO.poster.name; user.AvatarUrl = new Uri(aFO.poster.avatar, UriKind.Absolute); convertedActivityFeed.Add(new ActivityFeedComment(user, aFO.substories[0].comment, timestamp)); } else if (aFO.story_type == "media_story") { user.Username = aFO.user.name; user.AvatarUrl = new Uri(aFO.user.avatar, UriKind.Absolute); string intelligibleString = ""; if (aFO.substories[0].substory_type == "watchlist_status_update") { LibrarySection librarySection = Converters.LibrarySectionConverter.StringToLibrarySection(aFO.substories[0].new_status); intelligibleString = user.Username + " " + Converters.LibrarySectionConverter.LibrarySectionToIntelligableStatusString(librarySection); } else if (aFO.substories[0].substory_type == "watched_episode") { intelligibleString = user.Username + " watched episode " + aFO.substories[0].episode_number; } ServiceID mediaID = new ServiceID(ServiceName.Hummingbird, MediaType.Anime, aFO.media.slug); Uri activityFeedImage = new Uri(aFO.media.cover_image, UriKind.Absolute); convertedActivityFeed.Add(new ActivityFeedMediaUpdate(user, mediaID, activityFeedImage, aFO.media.title, intelligibleString, timestamp)); } } if (progress != null) { progress.Report(new APIProgressReport(100.0, "Converted Successfully", APIResponse.Successful, convertedActivityFeed, activityFeedRaw)); } return(convertedActivityFeed); } if (progress != null) { progress.Report(new APIProgressReport(100.0, "API Call wasn't successul", APIResponse.Failed)); } return(new ObservableCollection <AActivityFeedItem>()); }
private bool ValidBlock1() { bool valid = true; string temp = Block_1; string sub = null; // Check the length first. // If this is wrong don't bother checking anything else. if ((Block_1.Length < MIN_BLOCK_1_LEN) || (Block_1.Length > MAX_BLOCK_1_LEN)) { errors.Add("Invalid length for block 1 : " + Block_1.Length + " Expecting length between : " + MIN_BLOCK_1_LEN + " and " + MAX_BLOCK_1_LEN); valid = false; return(valid); } // Check START OF BLOCK INDICATOR = { // This is a mandatory field. // The character { indicates the beginning of a block. if (temp[0] != '{') { errors.Add("BLOCK 1: Message missing START OF BLOCK INDICATOR ({)"); valid = false; } temp = temp.Substring(1); // Check BLOCK IDENTIFIER = 3c // This is a mandatory field. // 1 to 3 alphanumeric characters used to define block contents. // This block identiifer must be 1. sub = temp.Substring(0, temp.IndexOf(':')); if (string.Equals(sub, "1") == false) { errors.Add("BLOCK 1: Invalid BLOCK IDENTIFIER : " + sub + " Expecting : 1"); valid = false; } // We found the colon in the last step now get rid of it // This is a mandatory field. temp = temp.Substring(2); // Check the APPLICATION IDENTIFIER = 1a // This is a mandatory field. // The Application Identifier identifies the application within which the message is being sent or received. // The available options are: // F = FIN All user-to-user, FIN system and FIN service messages // A = GPA (General Purpose Application) Most GPA system and service messages // L = GPA Certain GPA service messages, for example, LOGIN, LAKs, ABORT These values are automatically assigned by the SWIFT system and the user's CBT ApplicationID = temp.Substring(0, 1); if ((ApplicationID.Equals("F") == false) && (ApplicationID.Equals("A") == false) && (ApplicationID.Equals("L") == false)) { errors.Add("BLOCK 1: Invalid APPLICATION IDENTIFIER : " + ApplicationID + " Expecting : F, A or L"); valid = false; } // Check SERVICE IDENTIFIER = 2n // This is a mandatory field. // The Service Identifier consists of two numeric characters. // It identifies the type of data that is being sent or received and, in doing so, whether the message which follows is one of the following: // a user-to-user message, // a system message, // a service message, // for example, a session control command, such as SELECT, or a logical acknowledgment, such as ACK/SAK/UAK. // Possible values are 01 = FIN/GPA or 21 = ACK/NAK. temp = temp.Substring(1); ServiceID = temp.Substring(0, 2); if ((ServiceID.Equals("01") == false) && (ServiceID.Equals("21") == false)) { errors.Add("BLOCK 1: Invalid SERVICE IDENTIFIER : " + ServiceID + " Expecting : 01 or 21"); valid = false; } // Check the LOGICAL TERMINAL ADDRESS = 12x // This is a mandatory field. // The Logical Termial (LT) Address is a 12-character FIN address. // It is the address of the sending LT for input messages or of the receiving LT for output messages, and includes the Branch Code. // It consists of: - the BIC 8 CODE (8 characters) - the Logical Terminal Code (1 upper case alphabetic character) - the BIC Branch Code (3 characters) temp = temp.Substring(2); LTAddress = temp.Substring(0, 12); BICCode = LTAddress.Substring(0, 8); LogicalTerminalCode = LTAddress.Substring(8, 1); BICBranchCode = LTAddress.Substring(9, 3); if (IsValidBICCode(BICCode) == false) { errors.Add("BLOCK 1: Invalid BIC Code : " + BICCode); valid = false; } if (IsValidLogicalTerminal(LogicalTerminalCode) == false) { errors.Add("BLOCK 1: Invalid Logical Terminal : " + LogicalTerminalCode); valid = false; } if (IsValidBICBranchCode(BICBranchCode) == false) { errors.Add("BLOCK 1: Invalid BIC Branch Code : " + BICBranchCode); valid = false; } // Check the SESSION NUMBER = 4n // This is a mandatory field. // The Session Number identifies the session in which the message was transmitted. // It is a four digits number that is automatically generated by the user's computer and padded with zeros. temp = temp.Substring(12); SessionNumber = temp.Substring(0, 4); if (IsValidSessionNumber(SessionNumber) == false) { errors.Add("BLOCK 1: Invalid SESSION NUMBER : " + SessionNumber); valid = false; } // Check the INPUT SEQUENCE NUMBER = 6n // This is a mandatory field. // The sequence number always consists of six digits. // It is the Input Sequence Number (ISN) of the sender's current input session or the Output Sequence Number (OSN) of the receiver's current output session. // It is automatically generated by the user's computer and padded with zeros. temp = temp.Substring(4); SequenceNumber = temp.Substring(0, 6); if (IsValidSequenceNumber(SequenceNumber) == false) { errors.Add("BLOCK 1: Invalid INPUT SEQUENCE NUMBER : " + SequenceNumber); valid = false; } // Check END OF BLOCK INDICATOR = { // This is a mandatory field. // The character } indicates the end of a block. temp = temp.Substring(6); if (temp[0] != '}') { errors.Add("BLOCK 1: Message missing START OF BLOCK INDICATOR ({)"); valid = false; } return(valid); }
/// <summary> /// Returns if the ServiceID is valid ("configure","debug",or "restore") /// </summary> /// <returns>true if valid</returns> public bool Validate() { return(ServiceID.ToLower() == "configure" || ServiceID.ToLower() == "debug" || ServiceID.ToLower() == "restore"); }