示例#1
0
        private void NoControl_Load(object sender, EventArgs e)
        {
            this.Result = System.Windows.Forms.DialogResult.Cancel;

            if (!string.IsNullOrEmpty(Caption))
            {
                try
                { this.BackgroundImage = new Bitmap(Application.StartupPath + "/images/Background.jpg"); }
                catch { }
                this.ControlBox = true;
                this.Text       = Caption;
                if (NoValue.ToString().IndexOf(".") > -1)
                {
                    if ((decimal.Parse(NoValue.ToString().Substring(NoValue.ToString().IndexOf('.')))) > decimal.Parse("0.01"))
                    {
                        txtNo.Text = NoValue.ToString("#,##0.#0");
                    }
                    else
                    {
                        txtNo.Text = NoValue.ToString("#,##0");
                    }
                }
                else
                {
                    txtNo.Text = NoValue.ToString("#,##0");
                }

                txtNo.SelectAll();
            }
        }
示例#2
0
        /// <summary>
        ///   Gets the source property
        /// </summary>
        private static object GetColumnValue(Aliases aliases, PropertyInfo targetProperty,
                                             Exclusions exclusions, DataRow sourceRow, bool ignoreMissingField)
        {
            object value = new NoValue();

            if (aliases != null && aliases.Keys.Contains(targetProperty.Name))
            {
                //Excluded properties should not be mapped... even if aliased
                if (!(exclusions != null && GenericTypeHelper.ContainsExclusion(aliases[targetProperty.Name], exclusions)))
                {
                    value = sourceRow[aliases[targetProperty.Name]];
                }
            }
            else
            {
                // If target property is already aliased then do not match on source property of the same name... this will cause a double mapping
                if (aliases == null || (!aliases.Values.Contains(targetProperty.Name)))
                {
                    //do not map excluded properties
                    if (!(exclusions != null && GenericTypeHelper.ContainsExclusion(targetProperty.Name, exclusions)))
                    {
                        if (sourceRow.Table.Columns.Contains(targetProperty.Name))
                        {
                            value = sourceRow[targetProperty.Name];
                        }
                        else if (ignoreMissingField)
                        {
                            return(value);
                        }
                        else
                        {
                            throw new MissingFieldException(string.Format("{0} field does not exist", targetProperty.Name));
                        }
                    }
                }
            }
            return(value);
        }
示例#3
0
 public void Write(NoValue _, BinaryWriter stream)
 {
     stream.WriteBigEndian((short)0);
 }