示例#1
0
        //对话框载入
        private void MemberTypeForm_Load(object sender, EventArgs e)
        {
            offer.Items.AddRange(db.Promotion.Select(x => x.name).ToArray());
            offer.SelectedIndex = 0;
            if (!newElement)
            {
                foreach (Control c in this.Controls)
                {
                    if (c.GetType() == typeof(TextBox) || c.GetType() == typeof(DateTimePicker))
                    {
                        var pro = m_Element.GetType().GetProperty(c.Name);
                        if (pro == null)
                        {
                            continue;
                        }

                        var proVal = pro.GetValue(m_Element, null);
                        if (proVal != null)
                        {
                            c.Text = proVal.ToString();
                        }
                    }
                }
                userOneTime.Checked = MConvert <bool> .ToTypeOrDefault(m_Element.userOneTimeOneDay, false);

                LimitedTimesPerMonth.Checked = MConvert <bool> .ToTypeOrDefault(m_Element.LimitedTimesPerMonth, false);

                TimesPerMonth.Text = m_Element.TimesPerMonth.ToString();
                credits.Checked    = m_Element.credits;
                sms.Checked        = MConvert <bool> .ToTypeOrDefault(m_Element.smsAfterUsing, false);

                var promotion = db.Promotion.FirstOrDefault(x => x.id == m_Element.offerId);
                if (promotion != null)
                {
                    offer.Text = promotion.name;
                }
            }
        }
 public static void SaveToDisk(MemberType item)
 {
     if (item != null)
     {
         try
         {
             XmlDocument xmlDoc = helpers.XmlDoc.CreateDoc();
             xmlDoc.AppendChild(MemberTypeHelper.ToXml(xmlDoc, item));
             // xmlDoc.AddMD5Hash();
             helpers.XmlDoc.SaveXmlDoc(item.GetType().ToString(), GetMemberPath(item), "def", xmlDoc);
         }
         catch (Exception ex)
         {
             LogHelper.Info <SyncMemberType>("uSync: Error Saving Member Type {0}, {1}",
                                             () => item.Text, () => ex.ToString());
         }
     }
 }
        public override ICollection <Type> GetKnownTypes([Optional] Container container)
        {
            Console.WriteLine("Member Info Node KnownType");

            return(new Type [] { DeclaringType?.FromNode(), MemberType.GetType(), this.GetType(), Name?.GetType() });
        }