/// <summary> /// Initializes a new instance of the <see cref="RepeatModeCommand"/> class. /// </summary> /// <param name="mode">The <see cref="MediaControlRepeatMode"/>.</param> /// <exception cref="ArgumentException"><paramref name="mode"/> is not vailid.</exception> /// <since_tizen> 5 </since_tizen> public RepeatModeCommand(MediaControlRepeatMode mode) { ValidationUtil.ValidateEnum(typeof(MediaControlRepeatMode), mode, nameof(mode)); Mode = mode; }
/// <summary>Sets the class name of the IEventListener.</summary> /// <remarks> /// Sets the class name of the IEventListener. /// If a implementation was set, it will be removed. /// </remarks> /// <param name="className">the name of the class of the IEventListener.</param> /// <returns>the updated ListenerConfig.</returns> /// <exception cref="System.ArgumentException">if className is null or an empty String.</exception> /// <seealso cref="SetImplementation(IEventListener)" /> /// <seealso cref="GetClassName()">GetClassName()</seealso> public ListenerConfig SetClassName(string className) { _className = ValidationUtil.HasText(className, "className"); _implementation = null; return(this); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.Configure <CookiePolicyOptions>(options => { // This lambda determines whether user consent for non-essential cookies is needed for a given request. options.CheckConsentNeeded = context => true; options.MinimumSameSitePolicy = Microsoft.AspNetCore.Http.SameSiteMode.None; }); services.AddDbContextPool <CodexBankDbContext>(options => options.UseSqlServer( Configuration.GetConnectionString("DefaultConnection"))); services .Configure <CookieTempDataProviderOptions>(options => { options.Cookie.IsEssential = true; }); services.AddIdentity <BankUser, IdentityRole>(options => { options.Password.RequireNonAlphanumeric = false; options.SignIn.RequireConfirmedEmail = true; options.Lockout.DefaultLockoutTimeSpan = TimeSpan.FromMinutes(10); options.Lockout.MaxFailedAccessAttempts = 5; options.Lockout.AllowedForNewUsers = true; }) .AddEntityFrameworkStores <CodexBankDbContext>() .AddDefaultTokenProviders(); services.ConfigureApplicationCookie(options => { options.Cookie.HttpOnly = true; options.ExpireTimeSpan = TimeSpan.FromMinutes(5); options.SlidingExpiration = true; options.LoginPath = "/account/login"; options.LogoutPath = "/account/logout"; }); services .AddDomainServices() .AddApplicationServices() .AddCommonProjectServices() .AddAuthentication(); services.Configure <SecurityStampValidatorOptions>(options => { options.ValidationInterval = TimeSpan.Zero; }); services.Configure <RouteOptions>(options => options.LowercaseUrls = true); services .Configure <BankConfiguration>( this.Configuration.GetSection(nameof(BankConfiguration))) .Configure <SendGridConfiguration>( this.Configuration.GetSection(nameof(SendGridConfiguration))); services .PostConfigure <BankConfiguration>(settings => { if (!ValidationUtil.IsObjectValid(settings)) { throw new ApplicationException("BankConfiguration is invalid."); } }) .PostConfigure <SendGridConfiguration>(settings => { if (!ValidationUtil.IsObjectValid(settings)) { throw new ApplicationException("SendGridConfiguration is invalid."); } }); services .AddResponseCompression(options => options.EnableForHttps = true); services.AddMvc(options => { options.Filters.Add <AutoValidateAntiforgeryTokenAttribute>(); }) .AddRazorPagesOptions(options => { options.Conventions.AuthorizePage("/Transactions"); }) .SetCompatibilityVersion(CompatibilityVersion.Version_2_2); }
/// <summary> /// Creates a new Builder instance with the PNG as a bitmap. /// </summary> /// <param name="pngImage">the PNG as a bitmap</param> /// <returns>new Builder instance</returns> public static Builder NewInstance(Bitmap pngImage) { ValidationUtil.RequireNonNull(pngImage); return(new Builder(pngImage)); }
/// <summary>Sets the IEventListener implementation.</summary> /// <remarks> /// Sets the IEventListener implementation. /// If a className was set, it will be removed. /// </remarks> /// <param name="implementation">the IEventListener implementation.</param> /// <returns>the updated ListenerConfig.</returns> /// <exception cref="System.ArgumentException">the implementation is null.</exception> /// <seealso cref="SetClassName(string)">SetClassName(string)</seealso> /// <seealso cref="GetImplementation()">GetImplementation()</seealso> public virtual ListenerConfig SetImplementation(IEventListener implementation) { _implementation = ValidationUtil.IsNotNull(implementation, "implementation"); _className = null; return(this); }
/// <summary>Sets the password.</summary> /// <remarks>Sets the password.</remarks> /// <param name="password">the password to set</param> /// <returns>the updated GroupConfig.</returns> /// <exception cref="System.ArgumentException">if password is null.</exception> public GroupConfig SetPassword(string password) { this.password = ValidationUtil.IsNotNull(password, "group password"); return(this); }
/// <summary> /// Initializes a new instance of the <see cref="ShuffleModeCapabilityUpdatedEventArgs"/> class. /// </summary> /// <param name="support">The shuffle mode capabilities.</param> /// <exception cref="ArgumentException"><paramref name="support"/> is not vaild.</exception> /// <since_tizen> 5 </since_tizen> public ShuffleModeCapabilityUpdatedEventArgs(MediaControlCapabilitySupport support) { ValidationUtil.ValidateEnum(typeof(MediaControlCapabilitySupport), support, nameof(support)); Support = support; }
/// <summary> /// Centers the text inside the specified box. /// <para> /// Note: this might result in a <see cref="ArgumentException"/> in the <see cref="IPlottable.Plot(ICanvas)"/> method /// if the text cannot fit in the box. /// </para> /// </summary> /// <param name="box">the box</param> /// <returns>this Builder for chaining</returns> public Builder SetCenterIn(PointPair box) { CenterIn = ValidationUtil.RequireNonNull(box); return(this); }
/// <inheritdoc cref="IPlottable"/> public void Plot(ICanvas canvas) { canvas.SetFont(TextInfo.Type, TextInfo.Style, TextInfo.Size); var textHeight = canvas.GetTextHeight(Text); var textWidth = canvas.GetTextWidth(Text); ValidationUtil.RequireBetween(textWidth, 0f, 1f, $"the text is to wide with a relative width of {textWidth}."); ValidationUtil.RequireBetween(textHeight, 0f, 1f, $"the text is to high with a relative height of {textHeight}."); var textBox = PointPair.NewInstance(0.5f - textWidth / 2, 0.5f - textHeight / 2, 0.5f + textWidth / 2, 0.5f + textHeight / 2); var x = 0.5f - textWidth / 2; var y = 0.5f - textHeight / 2; if (StartAt != null) { ValidationUtil.RequireBetween(StartAt.Item1 + textWidth, 0f, 1f, $"x({StartAt.Item1}) + textWidth({textWidth}) must be less than or equal to 1."); ValidationUtil.RequireBetween(StartAt.Item2 + textHeight, 0f, 1f, $"y({StartAt.Item2}) + textHeight({textHeight}) must be less than or equal to 1."); x = StartAt.Item1; y = StartAt.Item2; textBox = PointPair.NewInstance(x, y, x + textWidth, y + textHeight); if (canvas.GetModeParam() == ModeParam.Calibration || canvas.GetModeParam() == ModeParam.BoxedCalibration) { canvas.SetColor(Colors.Red); canvas.DrawRectangle(textBox); } } else if (CenterIn != null) { ValidationUtil.RequireNonNegative(CenterIn.Width - textWidth, $"CenterIn.Width({CenterIn.Width}) cannot be less than textWidth({textWidth})."); ValidationUtil.RequireNonNegative(CenterIn.Height - textHeight, $"CenterIn.Height({CenterIn.Height}) cannot be less than textHeight({textHeight})."); x = CenterIn.FromX + CenterIn.Width / 2 - textWidth / 2; y = CenterIn.FromY + CenterIn.Height / 2 - textHeight / 2; textBox = CenterIn; if (canvas.GetModeParam() == ModeParam.Calibration || canvas.GetModeParam() == ModeParam.BoxedCalibration) { canvas.SetColor(Colors.Red); canvas.DrawRectangle(CenterIn); } } if (!IsGravity(GravityType.None)) { if (IsGravity(GravityType.Top) && !IsGravity(GravityType.Bottom, GravityType.Top)) { textBox = PointPair.NewInstance(textBox.FromX, 0, textBox.ToX, textBox.Height); y = textBox.FromY + textBox.Height / 2 - textHeight / 2; } if (IsGravity(GravityType.Bottom) && !IsGravity(GravityType.Bottom, GravityType.Top)) { textBox = PointPair.NewInstance(textBox.FromX, 1 - textBox.Height, textBox.ToX, 1f); y = textBox.FromY + textBox.Height / 2 - textHeight / 2; } if (IsGravity(GravityType.Left) && !IsGravity(GravityType.Left, GravityType.Right)) { textBox = PointPair.NewInstance(0f, textBox.FromY, textBox.Width, textBox.ToY); x = textBox.FromX + textBox.Width / 2 - textWidth / 2; } if (IsGravity(GravityType.Right) && !IsGravity(GravityType.Left, GravityType.Right)) { textBox = PointPair.NewInstance(1 - textBox.Width, textBox.FromY, 1f, textBox.ToY); x = textBox.FromX + textBox.Width / 2 - textWidth / 2; } if (canvas.GetModeParam() == ModeParam.Calibration || canvas.GetModeParam() == ModeParam.BoxedCalibration) { canvas.SetColor(Colors.Green); canvas.DrawRectangle(textBox); } } if (x.CompareTo(0f) < 0) { x = 0; } if (y.CompareTo(0f) < 0) { y = 0; } canvas.SetColor(TextInfo.Color); if (canvas.GetModeParam() == ModeParam.Calibration || canvas.GetModeParam() == ModeParam.BoxedCalibration) { canvas.SetColor(Color.Black); } canvas.SetFont(TextInfo.Type, TextInfo.Style, TextInfo.Size); canvas.WriteText(Text, x, y + textHeight * 0.85f); }
/// <summary> /// Sets the content type of latest played media. /// </summary> /// <param name="support">A value indicating whether the <see cref="MediaControlRepeatMode"/> is supported or not.</param> /// <exception cref="InvalidOperationException"> /// The server is not running .<br/> /// -or-<br/> /// An internal error occurs. /// </exception> /// <exception cref="ArgumentException"><paramref name="support"/> is invalid.</exception> /// <since_tizen> 5 </since_tizen> public static void SetRepeatModeCapability(MediaControlCapabilitySupport support) { ValidationUtil.ValidateEnum(typeof(MediaControlCapabilitySupport), support, nameof(support)); Native.SetRepeatModeCapability(Handle, support).ThrowIfError("Failed to set shuffle mode capability."); }
/// <summary> /// Returns a new Builder instance. /// </summary> /// <param name="text">the text</param> /// <param name="textInfo">the text information</param> /// <returns>new Builder instance</returns> public static Builder NewInstance(string text, TextInfo textInfo) { ValidationUtil.RequireNonNull(text); ValidationUtil.RequireNonNull(textInfo); return(new Builder(text, textInfo)); }
protected bool IsEntityStateValid(object model) => ValidationUtil.IsObjectValid(model);
protected virtual void AddTemplateParameters(IDictionary <string, object> templateParameters) { if (templateParameters == null) { throw new ArgumentNullException("templateParameters"); } if (String.IsNullOrEmpty(Model.ControllerName)) { throw new InvalidOperationException(Resources.InvalidControllerName); } templateParameters.Add("ControllerName", Model.ControllerName); templateParameters.Add("ControllerNamespace", Model.ControllerNamespace); templateParameters.Add("AreaName", Model.AreaName ?? String.Empty); templateParameters.Add("ServiceName", Model.ServiceType.ShortTypeName); System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex(@"\b([_\d\w]*)$"); string viewModelShortName = regex.Match(Model.ViewModelTypeName).Result("$1"); templateParameters.Add("ViewModelPropertys", Model.ViewModelPropertys.Where(p => p.Checked).ToList()); CodeType modelCodeType = Context.ServiceProvider.GetService <ICodeTypeService>().GetCodeType(Context.ActiveProject, Model.ModelType.TypeName); CodeModelModelMetadata modelMetadata = new CodeModelModelMetadata(modelCodeType); CodeType modelType = Model.ModelType.CodeType; templateParameters.Add("ModelMetadata", modelMetadata); string modelTypeNamespace = modelType.Namespace != null ? modelType.Namespace.FullName : String.Empty; templateParameters.Add("ModelTypeNamespace", modelTypeNamespace); string viewModelNamespace = Model.ActiveProject.Name + "." + CommonFolderNames.Models; templateParameters.Add("ViewModelNamespace", viewModelNamespace); string validatorNamespace = Model.ActiveProject.Name + "." + CommonFolderNames.Validator; templateParameters.Add("ValidatorNamespace", validatorNamespace); string serviceNamespace = Model.ServiceProject.GetDefaultNamespace(); templateParameters.Add("ServiceNamespace", serviceNamespace); string serviceShortTypeName = Model.ServiceType.ShortTypeName; templateParameters.Add("ServiceShortTypeName", serviceShortTypeName); string viewModelShortTypeName = Model.ViewModelType.ShortTypeName; templateParameters.Add("ViewModelShortTypeName", viewModelShortName); HashSet <string> requiredNamespaces = GetRequiredNamespaces(new List <CodeType>() { modelType }); templateParameters.Add("RequiredNamespaces", requiredNamespaces); string modelTypeName = modelType.Name; templateParameters.Add("ModelTypeName", modelTypeName); templateParameters.Add("UseAsync", Model.IsAsyncSelected); CodeDomProvider provider = ValidationUtil.GenerateCodeDomProvider(Model.ActiveProject.GetCodeLanguage()); string modelVariable = provider.CreateEscapedIdentifier(Model.ModelType.ShortTypeName.ToLowerInvariantFirstChar()); templateParameters.Add("ModelVariable", modelVariable); }
private void textBoxWaitBeforeStartServers_PreviewTextInput(object sender, TextCompositionEventArgs e) { e.Handled = !ValidationUtil.IsNumber(e.Text); }
/// <summary> /// Updates the repeat mode. /// </summary> /// <param name="mode">A value indicating the repeat mode.</param> /// <exception cref="InvalidOperationException"> /// The server is not running .<br/> /// -or-<br/> /// An internal error occurs. /// </exception> /// <exception cref="ArgumentException"><paramref name="mode"/> is invalid.</exception> /// <since_tizen> 4 </since_tizen> public static void SetRepeatMode(MediaControlRepeatMode mode) { ValidationUtil.ValidateEnum(typeof(MediaControlRepeatMode), mode, nameof(mode)); Native.UpdateRepeatMode(Handle, mode.ToNative()).ThrowIfError("Failed to set repeat mode."); }
private bool CheckValues() { if (string.IsNullOrEmpty(txtBranchName.Text)) { txtError.Text = "Enter Branch Name."; return(false); } if (string.IsNullOrEmpty(txtAddress.Text)) { txtError.Text = "Enter Branch Address."; return(false); } if (string.IsNullOrEmpty(txtZipCode.Text)) { txtError.Text = "Enter Zip Code of Branch."; return(false); } else if (!ValidationUtil.IsPositiveInteger(txtZipCode.Text)) { txtError.Text = "Zip Code must be positive integer values."; return(false); } if (string.IsNullOrEmpty(txtState.Text)) { txtError.Text = "Enter State."; return(false); } else if (!ValidationUtil.IsName(txtState.Text)) { txtError.Text = "State must be character values."; return(false); } if (string.IsNullOrEmpty(txtPhone.Text)) { txtError.Text = "Enter Telephone Number."; return(false); } if (string.IsNullOrEmpty(txtFax.Text)) { txtError.Text = "Enter Fax Number."; return(false); } if (string.IsNullOrEmpty(txtOpenTime.DateInput.Text)) { txtError.Text = "Enter Branch open time."; return(false); } if (string.IsNullOrEmpty(txtCloseTime.DateInput.Text)) { txtError.Text = "Enter Branch close time."; return(false); } if (txtPercentage.Value == null) { txtError.Text = "Enter Tax Percentage."; return(false); } if (txtYes.Checked == txtNo.Checked) { txtError.Text = "Select Yes or No for branch delivery."; return(false); } else if (txtYes.Checked) { if (txtDeliveryTax.Value == null) { txtError.Text = "You must enter delivery charges."; return(false); } } return(true); }
/// <summary>Sets the group name.</summary> /// <remarks>Sets the group name.</remarks> /// <param name="name">the name to set</param> /// <returns>the updated GroupConfig.</returns> /// <exception cref="System.ArgumentException">if name is null.</exception> public GroupConfig SetName(string name) { this.name = ValidationUtil.IsNotNull(name, "group name"); return(this); }
/// <summary> /// Creates a HazelcastJsonValue from given string. /// </summary> /// <param name="jsonString">a non null Json string</param> /// <exception cref="System.NullReferenceException">if jsonString param is null</exception> public HazelcastJsonValue(string jsonString) { ValidationUtil.CheckNotNull(jsonString, ValidationUtil.NullJsonStringIsNotAllowed); _jsonString = jsonString; }
/// <summary> /// Initializes a new instance of the <see cref="RepeatModeUpdatedEventArgs"/> class. /// </summary> /// <param name="mode">A value indicating the updated repeat mode.</param> /// <exception cref="ArgumentException"><paramref name="mode"/> is invalid.</exception> /// <since_tizen> 4 </since_tizen> public RepeatModeUpdatedEventArgs(MediaControlRepeatMode mode) { ValidationUtil.ValidateEnum(typeof(MediaControlRepeatMode), mode, nameof(mode)); RepeatMode = mode; }
public void RemoveAll(IPredicate predicate) { ValidationUtil.CheckNotNull(predicate, "predicate cannot be null"); RemoveAllInternal(predicate); }
/// <summary> /// Creates a new Builder instance with the image at the given path. /// </summary> /// <param name="imageFile">the path to the image</param> /// <returns>new Builder instance</returns> public static Builder NewInstance(string imageFile) { ValidationUtil.RequireImageFile(imageFile); return(new Builder(imageFile)); }
/// <summary> /// Creates a HazelcastJsonValue from given string. /// </summary> /// <param name="jsonString">a non null Json string</param> /// <exception cref="System.NullReferenceException">if jsonString param is null</exception> public HazelcastJsonValue(string jsonString) { ValidationUtil.CheckNotNull(jsonString, ValidationUtil.NULL_JSON_STRING_IS_NOT_ALLOWED); _jsonString = jsonString; }
/// <summary> /// Sets the scale of the image inside the specified image box. /// <para> /// Defaults to <see cref="ScaleType.Fill"/> with maximum <see cref="PointPair"/>. /// </para> /// </summary> /// <param name="scale">the scale type to apply</param> /// <param name="imageBox">the box to apply scale typ inside</param> /// <returns></returns> public Builder SetScale(ScaleType scale, PointPair imageBox) { Scale = scale; ImageBox = ValidationUtil.RequireNonNull(imageBox); return(this); }
public void TestThrowIfNonPositive([Values(-1, 0)] int value) { ArgumentOutOfRangeException ex = Assert.Throws <ArgumentOutOfRangeException>(() => ValidationUtil.ThrowIfNonPositive(value, nameof(value))); Assert.NotNull(ex); Assert.True(ex.Message.StartsWith("Cannot be less than or equal to zero.")); Assert.AreEqual("value", ex.ParamName); }
/// <summary>Creates a ListenerConfig with the given implementation.</summary> /// <remarks>Creates a ListenerConfig with the given implementation.</remarks> /// <param name="implementation">the implementation to use as IEventListener.</param> /// <exception cref="System.ArgumentException">if the implementation is null.</exception> public ListenerConfig(IEventListener implementation) { _implementation = ValidationUtil.IsNotNull(implementation, "implementation"); }
public void TestThrowIfNegativeWithoutFieldName([Values(-1)] int value) { ArgumentOutOfRangeException ex = Assert.Throws <ArgumentOutOfRangeException>(() => ValidationUtil.ThrowIfNegative(value, null)); Assert.NotNull(ex); Assert.True(ex.Message.StartsWith("Cannot be negative.")); Assert.AreEqual(string.Empty, ex.ParamName); }
/// <summary> /// Returns a new <see cref="GraphPlottable"/> instance from this Builder. /// </summary> /// <returns>new GraphPlottable instance</returns> public GraphPlottable Build() { ValidationUtil.RequirePositive(Lines.Count, "There must be at least one line given to plot."); return(new GraphPlottable(this)); }
public virtual void Lock(TKey key) { ValidationUtil.ThrowExceptionIfNull(key); Lock(key, long.MaxValue, TimeUnit.Milliseconds); }
public void getQueueList(ListBox listbox) { int queueid = 0; try { string strSql = ""; if (isLive) { strSql = @" SELECT iid, MsgType, subMsgType, MID, HID, RefID, FlightSeq, ResendYN, EDIAddressBook, CustomerId, MsgBody_SITAfreeMSG, MsgAddress_SITAfreeMSG FROM EDI_Msg_Queue WHERE Status = 'W' ORDER BY iid"; //strSql = @" SELECT iid, MsgType, subMsgType, MID, HID, FlightSeq, ResendYN, EDIAddressBook, CustomerId FROM EDI_Msg_Queue WHERE iid = 4326345"; //strSql = @" select * from EDI_Msg_Queue where iid in (9733306)"; //strSql = @" select * from EDI_Msg_Queue where iid in (14397617)"; } else { //strSql = @"select * from EDI_Msg_Queue where Status = 'W' and createddate >= DATEADD(D, 0, DATEDIFF(D, 0, GETDATE())) and Msgtype <> 'Email' order by iid desc"; // strSql = @"select iid, MsgType, subMsgType, MID, HID, FlightSeq, ResendYN, EDIAddressBook, CustomerId, MsgBody_SITAfreeMSG, MsgAddress_SITAfreeMSG // from EDI_Msg_Queue where Status = 'W' and createddate >= DATEADD(D, 0, DATEDIFF(D, 0, GETDATE())) order by iid desc"; //strSql = @" select iid, MsgType, subMsgType, MID, HID, FlightSeq, ResendYN, EDIAddressBook, CustomerId, MsgBody_SITAfreeMSG, MsgAddress_SITAfreeMSG // from EDI_Msg_Queue where iid in (6578241) // "; //strSql = @"select * from EDI_Msg_Queue where Status = 'W' and createddate >= '2018-1-30' and Msgtype <> 'Email' "; //strSql = @" select * from EDI_Msg_Queue where iid in (4344460)"; //strSql = @"select * from EDI_Msg_Queue where Status = 'W' and createddate >= DATEADD(D, 0, DATEDIFF(D, 0, GETDATE())) and Msgtype = 'Email' and submsgtype = 'TTN' order by iid desc"; // strSql = @" select iid, MsgType, subMsgType, MID, HID, FlightSeq, ResendYN, EDIAddressBook, CustomerId, MsgBody_SITAfreeMSG, MsgAddress_SITAfreeMSG // from EDI_Msg_Queue where MsgType = 'FBR' and createddate >= '2016-05-02 14:50'"; } DataTable dt = baseDB.GetSqlDataTable(strSql); string msgReturn = ""; string result = ""; foreach (DataRow dr in dt.Rows) { queueid = Convert.ToInt32(dr["iid"].ToString()); string msgType = dr["MsgType"].ToString().Trim(); string subType = dr["subMsgType"].ToString().Trim(); int mid = 0; try { mid = Convert.ToInt32(dr["MID"].ToString().Trim()); } catch { } int hid = 0; try { hid = Convert.ToInt32(dr["HID"].ToString().Trim()); } catch { } int refID = 0; try { refID = Convert.ToInt32(dr["refID"].ToString().Trim()); } catch { } int flightSeq = 0; try { flightSeq = Convert.ToInt32(dr["FlightSeq"].ToString().Trim()); } catch { } string resendYN = dr["ResendYN"].ToString().Trim(); int EDIAddressBook = 0; try { EDIAddressBook = Convert.ToInt32(dr["EDIAddressBook"].ToString().Trim()); } catch { } string CustomerId = dr["CustomerId"].ToString().Trim(); string MsgBody_SITA = dr["MsgBody_SITAfreeMSG"].ToString(); string MsgAddress_SITA = dr["MsgAddress_SITAfreeMSG"].ToString(); //if (msgType != "" && msgType != "Email") // 2016-01-20 In case of Free Text, MsgType can be empty. if (msgType.ToUpper() != "EMAIL") { GenerateBase baseMessage = null; //added. 2015-12-14 if (MsgBody_SITA != null && MsgBody_SITA != string.Empty) { //for send free SITA MSG baseMessage = new sendSITAmsg(); } else { #region Init. if (msgType.ToUpper() == "FSU") { switch (subType.ToUpper()) { case "DLV": baseMessage = new GenerateDLV(); break; case "RCF": case "RTF": // added for realtime RCF. 2018-1-11 case "ARR": baseMessage = new GenerateRCF(); break; // added for realtime RCF. 2018-1-11 case "DIS": baseMessage = new GenerateDIS(); break; case "NFD": case "AWD": baseMessage = new GenerateAWD(); break; case "MAN": case "DEP": baseMessage = new GenerateMAN(); break; //RDS Added 2015-08-12 case "RCS": case "RDS": baseMessage = new GenerateRCS(); break; //RDT Added 2015-08-12 case "RCT": case "RDT": baseMessage = new GenerateRCT(); break; // FOH added. 2016-11-08 case "FOH": baseMessage = new GenerateFOH(); break; case "TFD": baseMessage = new GenerateTFD(); break; } } //NFM added by NA if (msgType.ToUpper() == "NFM") { baseMessage = new GenerateNFM(); } if (msgType.ToUpper() == "FFM") { baseMessage = new GenerateFFM(); } if (msgType.ToUpper() == "IRP") { baseMessage = new GenerateIRP(); } if (msgType.ToUpper() == "FWB") { baseMessage = new GenerateFWB(); } if (msgType.ToUpper() == "FHL") { baseMessage = new GenerateFHL(); } if (msgType.ToUpper() == "FBR") { baseMessage = new GenerateFBR(); } if (msgType.ToUpper() == "UWS") { baseMessage = new GeneratwUWS(); } } #endregion if (baseMessage != null) { //Clear Static Variables baseMessage.msgDestAddrEmail = ""; //added. 2015-12-14 if (MsgBody_SITA != null && MsgBody_SITA != string.Empty) { //for send free SITA MSG msgReturn = MsgBody_SITA; //for email list if (MsgAddress_SITA != null && MsgAddress_SITA != string.Empty) { string[] tmpGetEmail = MsgAddress_SITA.Split(' '); if (tmpGetEmail.Count() > 0) { for (int i = 0; i < tmpGetEmail.Count(); i++) { if (tmpGetEmail[i].IndexOf("@") > -1) { baseMessage.msgDestAddrEmail += tmpGetEmail[i]; baseMessage.msgDestAddrEmail += ";"; } } baseMessage.msgDestAddrEmail = baseMessage.msgDestAddrEmail.TrimEnd(';'); } } } else { if (msgType.ToUpper() == "FHL") { msgReturn = baseMessage.doBuildUp(msgType, subType, hid, refID, flightSeq, queueid); } else { msgReturn = baseMessage.doBuildUp(msgType, subType, mid, refID, flightSeq, queueid); } } if (msgReturn != "") { /* 2014-04-14 * msgReturn = msgReturn.ToUpper(); */ msgReturn = msgReturn.ToUpper().Replace(",", ""); string[] arrMsg = msgReturn.Split('|'); foreach (string msg in arrMsg) { if (ValidationUtil.isThereSitaReciever(msg)) { string test = "good"; } if (isLive) { if (ValidationUtil.isThereSitaReciever(msg)) { result = myMQ.WriteLocalQMsg(msg, MQ_ManagerExp.GR1MQNMRInfo, MQ_ManagerExp.QUEUEID1, MQ_ManagerExp.GR1MQCONInfo, MQ_ManagerExp.GR1MQMInfo); } else { result = "Message sent to successfully"; } } else { result = "Message sent to the queue successfully"; } if (result.IndexOf("successful") > 0) { if (isLive) { baseMessage.UpdateQueue(queueid, "S", ""); //added. 2015-12-14 if (MsgBody_SITA != null && MsgBody_SITA != string.Empty) { baseMessage.InsertLogforFreeSITAmsg(queueid, msg); } else { baseMessage.InsertLog(queueid, msg, msgType, subType); } } else { baseMessage.UpdateQueue(queueid, "S", ""); //added. 2015-12-14 if (MsgBody_SITA != null && MsgBody_SITA != string.Empty) { baseMessage.InsertLogforFreeSITAmsg(queueid, msg); } else { baseMessage.InsertLog(queueid, msg, msgType, subType); } } //added. 2015-12-14 if (MsgBody_SITA != null && MsgBody_SITA != string.Empty) { } else { //Create Copy to Cargo-Spot Queue if (msgType == "UWS" || msgType == "NFM" || msgType == "FFM" || msgType == "FWB" || (msgType == "FSU" && subType == "DEP") || (msgType == "FSU" && subType == "MAN")) { if (isLive) { if (ValidationUtil.isThereSitaReciever(msg)) { result = myMQ.WriteLocalQMsg(msg, MQ_ManagerExp.GR2MQNMRInfo, MQ_ManagerExp.QUEUEID2, MQ_ManagerExp.GR2MQCONInfo, MQ_ManagerExp.GR2MQMInfo); } } else { } } } } else { baseMessage = new GenerateDLV(); baseMessage.UpdateQueue(queueid, "E", result); buildLog(queueid, result, "CASMqm.WriteLocalQMsg"); } // added on 2017-11-20. requested by Mike(2017-11-20 03:04pm) if (isLive) { // changed on 2017-11-30. all SITA message. requested by Cecile(2017-11-30 12:40pm) //if(msgType == "FWB" || msgType == "FHL" || msgType == "FHL") if (msgReturn != "") { if (baseMessage.msgDestAddrEmail != null && baseMessage.msgDestAddrEmail != "") { baseMessage.msgDestAddrEmail += ";[email protected]"; } else { baseMessage.msgDestAddrEmail = "*****@*****.**"; } } } baseMessage.msgDestAddrEmail = ""; if (baseMessage.msgDestAddrEmail != "") { string emailBody = ""; emailBody = setMSGformat(msgReturn, msgType ?? ""); //emailBody = emailBody.Replace("\r\n", "<br>"); //emailBody = msgReturn.Replace("\r\n", "<br>"); string emailSubj = ""; if (msgType != null && msgType.ToUpper() == "IRP") { emailSubj = "IRP Message: "; emailSubj += baseMessage.IRPSubject ?? ""; } else if (subType != null && subType.Trim() != string.Empty) { emailSubj = msgType.ToUpper() + " - " + subType.ToUpper() + " message"; } else { emailSubj = msgType.ToUpper() + " message"; } if (isLive) { GenerateEmail email = new GenerateEmail(); int emailStatus = 1; try { bool mailSent = baseMail.mailSend(baseMessage.msgDestAddrEmail, emailBody, emailSubj); if (!mailSent) { email.UpdateQueue(queueid, "S", "Error sending email!"); emailStatus = 255; email.UpdateEmailQueue(mid, emailStatus); } } catch (Exception e) { email.UpdateQueue(queueid, "S", "Error sending email!"); emailStatus = 255; email.UpdateEmailQueue(mid, emailStatus); buildLog(queueid, e.Message, e.StackTrace); } } else { bool mailSent = baseMail.mailSend(baseMessage.msgDestAddrEmail, emailBody, emailSubj); } } } } //Clear Static Variables baseMessage.msgDestAddrEmail = ""; } } //Email Sending #region Sending Email if (msgType.ToUpper() == "EMAIL") { GenerateEmail email = new GenerateEmail(); int emailResult; int emailStatus = 1; try { emailResult = email.sendEamil(mid, subType); if (emailResult == 0) { if (resendYN.ToUpper() == "Y") { emailStatus = 3; } email.UpdateQueue(queueid, "S", ""); email.UpdateEmailQueue(mid, emailStatus); if (listbox.Items.Count >= 100) { listbox.Items.Clear(); } listbox.Items.Add(string.Format("Email QueueId:{0} is successfully sent!", mid)); } else if (emailResult == -2) { email.UpdateQueue(queueid, "E", "No receiver email address."); emailStatus = 255; email.UpdateEmailQueue(mid, emailStatus); } else { email.UpdateQueue(queueid, "E", "Error sending email!"); emailStatus = 255; email.UpdateEmailQueue(mid, emailStatus); } } catch (Exception e) { email.UpdateQueue(queueid, "E", e.Message); emailStatus = 255; email.UpdateEmailQueue(mid, emailStatus); buildLog(queueid, e.Message, e.StackTrace); } } #endregion } } catch (Exception e) { GenerateBase baseMessage = new GenerateDLV(); baseMessage.UpdateQueue(queueid, "E", e.Message); buildLog(queueid, e.Message, e.StackTrace); } }
/// <summary> /// Initializes a new instance of the <see cref="PlaybackCommand"/> class. /// </summary> /// <param name="action">A <see cref="MediaControlPlaybackCommand"/>.</param> /// <exception cref="ArgumentException"><paramref name="action"/> is not valid.</exception> /// <since_tizen> 5 </since_tizen> public PlaybackCommand(MediaControlPlaybackCommand action) { ValidationUtil.ValidateEnum(typeof(MediaControlPlaybackCommand), action, nameof(action)); Action = action; }