private void btnSave_Click(object sender, EventArgs e)
        {
            Word w=new Word();
            using(Data2Container c=new Data2Container())
            {
                if (selectedId > 0)
                {
                    w = (from l in c.Word where l.Id == selectedId select l).First();
                }
                else
                {
                    if(c.Word.Any(p=>p.Content==txtWord.Text||(p.Regex==txtRegex.Text && string.IsNullOrEmpty(p.Regex)==false)))
                    {
                        MessageBox.Show("Exist");
                        return;
                    }
                }

                w.Content = txtWord.Text;
                w.Regex = txtRegex.Text;

                w.cn = cn.Checked;
                w.an = an.Checked;
                w.on = on.Checked;
                w.pp = pp.Checked;
                w.dp = dp.Checked;
                w.qp = qp.Checked;
                w.tv = tv.Checked;
                w.iv = iv.Checked;
                w.cv = cv.Checked;
                w.nv = nv.Checked;
                w.wv = wv.Checked;
                w.dv = dv.Checked;
                w.adjn = adjn.Checked;
                w.adjs = adjs.Checked;
                w.bno = bno.Checked;
                w.ono = ono.Checked;
                w.cno = cno.Checked;
                w.mno = mno.Checked;
                w.ano = ano.Checked;
                w.nq = nq.Checked;
                w.vq = vq.Checked;
                w.advd = advd.Checked;
                w.advr = advr.Checked;
                w.advt = advt.Checked;
                w.prer = prer.Checked;
                w.pred = pred.Checked;
                w.prepu = preu.Checked;
                w.prec = prec.Checked;
                w.pree = pree.Checked;
                w.conu = conu.Checked;
                w.conp = conp.Checked;
                w.pars = pars.Checked;
                w.part = part.Checked;
                w.parm = parm.Checked;
                w.inth = inth.Checked;
                w.ints = ints.Checked;
                w.inta = inta.Checked;
                w.intsu = intsu.Checked;
                w.intc = intc.Checked;
                w.intr = intr.Checked;
                w.oo = oo.Checked;

                w.favor = Convert.ToInt32(favor.Value);
                w.happy = Convert.ToInt32(happy.Value);
                w.anger = Convert.ToInt32(anger.Value);

                w.ZhuWei = ZhuWei.Checked;
                w.DongBin = DongBin.Checked;
                w.PianZhengDingZhong = PianZhengDingZhong.Checked;
                w.PianZhengZhuangZhong = PianzhengZhuangZhong.Checked;
                w.ZhongBu = ZhongBu.Checked;
                w.LianWei = LianWei.Checked;
                w.JianYu = JianYu.Checked;
                w.TongWei = TongWei.Checked;
                w.FangWei = FangWei.Checked;
                 if (selectedId == 0)
                     c.AddToWord(w);
                c.SaveChanges();

            }
            status.Text = txtWord.Text + " saved.";
            IniDefault();
        }
        private void LoadInfo(long id)
        {
            Word w;
            using(Data2Container c=new Data2Container())
            {
                var q = from l in c.Word where l.Id == id select l;
                if(q.Count()>0)
                {
                    w = q.First();
                }
                else
                {
                    w=new Word();
                }
            }

            txtWord.Text = w.Content;
            txtRegex.Text = w.Regex;

            cn.Checked = w.cn;
            an.Checked = w.an;
            on.Checked = w.on;
            pp.Checked = w.pp;
            dp.Checked = w.dp;
            qp.Checked = w.qp;
            tv.Checked = w.tv;
            iv.Checked = w.iv;
            cv.Checked = w.cv;
            nv.Checked = w.nv;
            wv.Checked = w.wv;
            dv.Checked = w.dv;
            adjn.Checked = w.adjn;
            adjs.Checked = w.adjs;
            bno.Checked = w.bno;
            ono.Checked = w.ono;
            cno.Checked = w.cno;
            mno.Checked = w.mno;
            ano.Checked = w.ano;
            nq.Checked = w.nq;
            vq.Checked = w.vq;
            advd.Checked = w.advd;
            advr.Checked = w.advr;
            advt.Checked = w.advt;
            prer.Checked = w.prer;
            pred.Checked = w.pred;
            preu.Checked = w.prepu;
            prec.Checked = w.prec;
            pree.Checked = w.pree;
            conu.Checked = w.conu;
            conp.Checked = w.conp;
            pars.Checked = w.pars;
            part.Checked = w.part;
            parm.Checked = w.parm;
            inth.Checked = w.inth;
            ints.Checked = w.ints;
            inta.Checked = w.inta;
            intsu.Checked = w.intsu;
            intc.Checked = w.intc;
            intr.Checked = w.intr;
            oo.Checked = w.oo;

            favor.Value = w.favor;
            happy.Value = w.happy;
            anger.Value = w.anger;

            ZhuWei.Checked = w.ZhuWei;
            DongBin.Checked = w.DongBin;
            PianZhengDingZhong.Checked = w.PianZhengDingZhong;
            PianzhengZhuangZhong.Checked = w.PianZhengZhuangZhong;
            ZhongBu.Checked = w.ZhongBu;
            LianWei.Checked = w.LianWei;
            JianYu.Checked = w.JianYu;
            TongWei.Checked = w.TongWei;
            FangWei.Checked = w.FangWei;

            status.Text = txtWord.Text + " loaded.";
        }
 /// <summary>
 /// Create a new Word object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="content">Initial value of the Content property.</param>
 /// <param name="length">Initial value of the Length property.</param>
 /// <param name="cn">Initial value of the cn property.</param>
 /// <param name="an">Initial value of the an property.</param>
 /// <param name="on">Initial value of the on property.</param>
 /// <param name="pp">Initial value of the pp property.</param>
 /// <param name="dp">Initial value of the dp property.</param>
 /// <param name="qp">Initial value of the qp property.</param>
 /// <param name="tv">Initial value of the tv property.</param>
 /// <param name="iv">Initial value of the iv property.</param>
 /// <param name="cv">Initial value of the cv property.</param>
 /// <param name="nv">Initial value of the nv property.</param>
 /// <param name="wv">Initial value of the wv property.</param>
 /// <param name="dv">Initial value of the dv property.</param>
 /// <param name="adjn">Initial value of the adjn property.</param>
 /// <param name="adjs">Initial value of the adjs property.</param>
 /// <param name="bno">Initial value of the bno property.</param>
 /// <param name="ono">Initial value of the ono property.</param>
 /// <param name="cno">Initial value of the cno property.</param>
 /// <param name="mno">Initial value of the mno property.</param>
 /// <param name="ano">Initial value of the ano property.</param>
 /// <param name="nq">Initial value of the nq property.</param>
 /// <param name="vq">Initial value of the vq property.</param>
 /// <param name="advd">Initial value of the advd property.</param>
 /// <param name="advr">Initial value of the advr property.</param>
 /// <param name="advt">Initial value of the advt property.</param>
 /// <param name="advn">Initial value of the advn property.</param>
 /// <param name="prer">Initial value of the prer property.</param>
 /// <param name="pred">Initial value of the pred property.</param>
 /// <param name="prere">Initial value of the prere property.</param>
 /// <param name="prepu">Initial value of the prepu property.</param>
 /// <param name="prec">Initial value of the prec property.</param>
 /// <param name="pree">Initial value of the pree property.</param>
 /// <param name="conu">Initial value of the conu property.</param>
 /// <param name="conp">Initial value of the conp property.</param>
 /// <param name="pars">Initial value of the pars property.</param>
 /// <param name="part">Initial value of the part property.</param>
 /// <param name="parm">Initial value of the parm property.</param>
 /// <param name="inth">Initial value of the inth property.</param>
 /// <param name="ints">Initial value of the ints property.</param>
 /// <param name="inta">Initial value of the inta property.</param>
 /// <param name="intsu">Initial value of the intsu property.</param>
 /// <param name="intc">Initial value of the intc property.</param>
 /// <param name="intr">Initial value of the intr property.</param>
 /// <param name="oo">Initial value of the oo property.</param>
 /// <param name="favor">Initial value of the favor property.</param>
 /// <param name="happy">Initial value of the happy property.</param>
 /// <param name="anger">Initial value of the anger property.</param>
 /// <param name="regex">Initial value of the Regex property.</param>
 /// <param name="zhuWei">Initial value of the ZhuWei property.</param>
 /// <param name="dongBin">Initial value of the DongBin property.</param>
 /// <param name="pianZhengDingZhong">Initial value of the PianZhengDingZhong property.</param>
 /// <param name="pianZhengZhuangZhong">Initial value of the PianZhengZhuangZhong property.</param>
 /// <param name="zhongBu">Initial value of the ZhongBu property.</param>
 /// <param name="lianHe">Initial value of the LianHe property.</param>
 /// <param name="lianWei">Initial value of the LianWei property.</param>
 /// <param name="jianYu">Initial value of the JianYu property.</param>
 /// <param name="tongWei">Initial value of the TongWei property.</param>
 /// <param name="fangWei">Initial value of the FangWei property.</param>
 public static Word CreateWord(global::System.Int64 id, global::System.String content, global::System.Int32 length, global::System.Boolean cn, global::System.Boolean an, global::System.Boolean on, global::System.Boolean pp, global::System.Boolean dp, global::System.Boolean qp, global::System.Boolean tv, global::System.Boolean iv, global::System.Boolean cv, global::System.Boolean nv, global::System.Boolean wv, global::System.Boolean dv, global::System.Boolean adjn, global::System.Boolean adjs, global::System.Boolean bno, global::System.Boolean ono, global::System.Boolean cno, global::System.Boolean mno, global::System.Boolean ano, global::System.Boolean nq, global::System.Boolean vq, global::System.Boolean advd, global::System.Boolean advr, global::System.Boolean advt, global::System.Boolean advn, global::System.Boolean prer, global::System.Boolean pred, global::System.Boolean prere, global::System.Boolean prepu, global::System.Boolean prec, global::System.Boolean pree, global::System.Boolean conu, global::System.Boolean conp, global::System.Boolean pars, global::System.Boolean part, global::System.Boolean parm, global::System.Boolean inth, global::System.Boolean ints, global::System.Boolean inta, global::System.Boolean intsu, global::System.Boolean intc, global::System.Boolean intr, global::System.Boolean oo, global::System.Int32 favor, global::System.Int32 happy, global::System.Int32 anger, global::System.String regex, global::System.Boolean zhuWei, global::System.Boolean dongBin, global::System.Boolean pianZhengDingZhong, global::System.Boolean pianZhengZhuangZhong, global::System.Boolean zhongBu, global::System.Boolean lianHe, global::System.Boolean lianWei, global::System.Boolean jianYu, global::System.Boolean tongWei, global::System.Boolean fangWei)
 {
     Word word = new Word();
     word.Id = id;
     word.Content = content;
     word.Length = length;
     word.cn = cn;
     word.an = an;
     word.on = on;
     word.pp = pp;
     word.dp = dp;
     word.qp = qp;
     word.tv = tv;
     word.iv = iv;
     word.cv = cv;
     word.nv = nv;
     word.wv = wv;
     word.dv = dv;
     word.adjn = adjn;
     word.adjs = adjs;
     word.bno = bno;
     word.ono = ono;
     word.cno = cno;
     word.mno = mno;
     word.ano = ano;
     word.nq = nq;
     word.vq = vq;
     word.advd = advd;
     word.advr = advr;
     word.advt = advt;
     word.advn = advn;
     word.prer = prer;
     word.pred = pred;
     word.prere = prere;
     word.prepu = prepu;
     word.prec = prec;
     word.pree = pree;
     word.conu = conu;
     word.conp = conp;
     word.pars = pars;
     word.part = part;
     word.parm = parm;
     word.inth = inth;
     word.ints = ints;
     word.inta = inta;
     word.intsu = intsu;
     word.intc = intc;
     word.intr = intr;
     word.oo = oo;
     word.favor = favor;
     word.happy = happy;
     word.anger = anger;
     word.Regex = regex;
     word.ZhuWei = zhuWei;
     word.DongBin = dongBin;
     word.PianZhengDingZhong = pianZhengDingZhong;
     word.PianZhengZhuangZhong = pianZhengZhuangZhong;
     word.ZhongBu = zhongBu;
     word.LianHe = lianHe;
     word.LianWei = lianWei;
     word.JianYu = jianYu;
     word.TongWei = tongWei;
     word.FangWei = fangWei;
     return word;
 }
Exemple #4
0
        public Word getWord(string word)
        {
            Word w = db.Words.Single(x => x.Word1 == word);

            return(w);
        }
 /// <summary>
 /// Deprecated Method for adding a new object to the Word EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToWord(Word word)
 {
     base.AddObject("Word", word);
 }