Exemple #1
0
 public SexViewModel(Sex sex)
 {
     if (sex == null)
     {
         throw new ArgumentNullException("sex");
     }
     this.Model = sex;
 }
 /// <summary>
 /// Create a new Sex object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="name">Initial value of the Name property.</param>
 /// <param name="code">Initial value of the Code property.</param>
 /// <param name="sourceId">Initial value of the SourceId property.</param>
 public static Sex CreateSex(global::System.Guid id, global::System.String name, global::System.String code, global::System.Int32 sourceId)
 {
     Sex sex = new Sex();
     sex.Id = id;
     sex.Name = name;
     sex.Code = code;
     sex.SourceId = sourceId;
     return sex;
 }
Exemple #3
0
        public int ImportSexes()
        {
            var res = 0;
            try
            {
                var obj = new Sex();

                obj = DataManager.Instance.CreateObject<Sex>();
                obj.Id = GuidComb.Generate();
                obj.Code = "-";
                obj.Name = "-";
                obj.SourceId = 0;
                DataManager.Instance.AddSex(obj);
                obj = DataManager.Instance.CreateObject<Sex>();
                obj.Id = GuidComb.Generate();
                obj.Code = "";
                obj.Name = "Мужской";
                obj.SourceId = 1;
                DataManager.Instance.AddSex(obj);
                obj = DataManager.Instance.CreateObject<Sex>();
                obj.Id = GuidComb.Generate();
                obj.Code = "";
                obj.Name = "Женский";
                obj.SourceId = 2;
                DataManager.Instance.AddSex(obj);
                res = 1;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + " || " + ex.InnerException);
                res = 0;
            }
            return res;
        }
 /// <summary>
 /// Deprecated Method for adding a new object to the Sexes EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToSexes(Sex sex)
 {
     base.AddObject("Sexes", sex);
 }