Example #1
0
 public void doRegistros(String log)
 {
     lock (this)
     {
         CForm.settxtInfo(log);
     }
 }
Example #2
0
        public void GodanAru(string conjugatedWord, CForm form, Politeness politeness = Politeness.Plain, Polarity polarity = Polarity.Affirmative)
        {
            var word      = "いらっしゃる";
            var wordClass = EdictType.v5aru;

            Assert.AreEqual(conjugatedWord, JpConj.Conjugate(word, wordClass, form, politeness, polarity));
        }
Example #3
0
        public void IrregularNu(string conjugatedWord, CForm form, Politeness politeness = Politeness.Plain, Polarity polarity = Polarity.Affirmative)
        {
            var word      = "死ぬ";
            var wordClass = EdictType.vn;

            Assert.AreEqual(conjugatedWord, JpConj.Conjugate(word, wordClass, form, politeness, polarity));
        }
Example #4
0
        public void GodanIkuYuku(string conjugatedWord, CForm form, Politeness politeness = Politeness.Plain, Polarity polarity = Polarity.Affirmative)
        {
            var word      = "合点がいく"; // also 冴え行く
            var wordClass = EdictType.v5k_s;

            Assert.AreEqual(conjugatedWord, JpConj.Conjugate(word, wordClass, form, politeness, polarity));
        }
Example #5
0
        public ActionResult CreateForm(CForm model)
        {
            DbDataContext ctx = new DbDataContext();

            if (model.Id == 0)
            {
                model.OrganizationId = GetOrganizationId();
                model.CreatedUserId  = GetUserId();
                model.CreatedDate    = DateTime.Now;
                model.ActiveStatus   = EActiveStatus.Active;
                ctx.Forms.Add(model);
                ctx.SaveChanges();
                InsertAlert(new ViewAlert {
                    AlertType = EAlertType.Success, Desc = "Form Başarılı Bir Şekilde Eklendi", Title = "Başarılı"
                });
            }
            else
            {
                var forms = ctx.Forms.FirstOrDefault(e => e.Id == model.Id);
                forms.Name           = model.Name;
                forms.Properties     = model.Properties;
                forms.ViewProperties = model.ViewProperties;
                ctx.SaveChanges();
                InsertAlert(new ViewAlert {
                    AlertType = EAlertType.Success, Desc = "Form Başarılı Bir Şekilde Güncellendi", Title = "Başarılı"
                });
            }

            return(Redirect("/blog/Admin/Form/List?Page=1"));
        }
Example #6
0
        public ActionResult FormList(string id, string page)
        {
            int           realId     = Convert.ToInt32(id);
            DbDataContext db         = new DbDataContext();
            CForm         cf         = db.Forms.FirstOrDefault(s => s.Id == realId);
            List <String> headerList = cf.ViewProperties.Split(',').ToList();

            ViewBag.HeaderList = headerList;
            ViewBag.PageHeader = cf.Name;

            List <FormViewListModel> mdList = new List <FormViewListModel>();
            var cfList = db.FormLists.Where(h => h.FormId == realId && h.ActiveStatus == EActiveStatus.Active);

            ViewBag.ListCount   = cfList.Count();
            ViewBag.CurrentPage = page;
            int intPage = Convert.ToInt32(page);

            foreach (var h in cfList.OrderByDescending(g => g.Id).Skip((intPage - 1) * PageSize).Take(PageSize))
            {
                FormViewListModel md = new FormViewListModel();
                md.Parameters = new List <KeyValuePair <string, string> >();

                dynamic d = JObject.Parse(h.JsonData);
                foreach (var item in headerList)
                {
                    md.Parameters.Add(new KeyValuePair <string, string>(item, d[item].ToString()));
                }
                md.FormListId = h.Id;
                mdList.Add(md);
            }
            return(View(mdList));
        }
Example #7
0
        public void IchidanKureru(string conjugatedWord, CForm form, Politeness politeness = Politeness.Plain, Polarity polarity = Polarity.Affirmative)
        {
            var word      = "くれる";
            var wordClass = EdictType.v1_s;

            Assert.AreEqual(conjugatedWord, JpConj.Conjugate(word, wordClass, form, politeness, polarity));
        }
Example #8
0
        void DesignForm(CForm form)
        {
            LayoutFormDesigner frm = new LayoutFormDesigner();

            frm.Form = form;
            frm.Show();
        }
Example #9
0
        public void SuruSpecial(string conjugatedWord, CForm form, Politeness politeness = Politeness.Plain, Polarity polarity = Polarity.Affirmative)
        {
            var word      = "愛する";
            var wordClass = EdictType.vs_s;

            Assert.AreEqual(conjugatedWord, JpConj.Conjugate(word, wordClass, form, politeness, polarity));
        }
Example #10
0
 public VerbInfo(string verb, CForm form, Polarity polarity = Polarity.Affirmative, Politeness politeness = Politeness.Plain)
 {
     Verb            = verb ?? throw new ArgumentNullException(nameof(verb));
     Form            = form;
     this.polarity   = polarity;
     this.politeness = politeness;
 }
Example #11
0
        private void btnIniciar_Click(object sender, EventArgs e)
        {
            CFilosofo.finalizado = false;

            if (!cBoxRegistro.Checked)
            {
                txtRegistro = null;
            }

            CForm form = new CForm(
                label_Filo01, label_Filo02,
                label_Filo03, label_Filo04,
                label_Filo05, label_Pal01,
                label_Pal02, label_Pal03,
                label_Pal04, label_Pal05,
                txtRegistro, txtConteo01,
                txtConteo02, txtConteo03,
                txtConteo04, txtConteo05);

            CPrincipal principal = new CPrincipal(form);

            this.btnDetener.Enabled   = true;
            this.btnIniciar.Enabled   = false;
            this.cBoxRegistro.Enabled = false;
        }
Example #12
0
        public bool DeleteForm(string id)
        {
            int           realId = Convert.ToInt32(id);
            DbDataContext db     = new DbDataContext();
            CForm         ff     = db.Forms.FirstOrDefault(g => g.Id == realId);

            db.Forms.Remove(ff);
            db.SaveChanges();
            return(true);
        }
Example #13
0
        private void tbtDesign_Click(object sender, EventArgs e)
        {
            if (dataGridView.CurrentRow == null)
            {
                MessageBox.Show("请选择一项!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            CForm obj = (CForm)dataGridView.CurrentRow.Tag;

            DesignForm(obj);
        }
Example #14
0
 public virtual void soltarComensal(int idFilosofo, CLog log)
 {
     lock (this)
     {
         comensal++;
         if (CForm.gettxtLog() != null)
         {
             log.doRegistros(" El Filosofo " + (idFilosofo + 1) + " ya NO es el comensal " + comensal);
         }
         Monitor.Pulse(this);
     }
 }
Example #15
0
        public void soltarPalillo(int idFilosofo, CLog log)
        {
            lock (locker)
            {
                Libre = true;

                if (CForm.gettxtLog() != null)
                {
                    log.doRegistros(" El Filosofo " + (idFilosofo + 1) + " suelta el palillo " + (idPalillo + 1));
                }
                Monitor.Pulse(locker);
            }
        }
Example #16
0
 public virtual void tomarComensal(int idFilosofo, CLog log)
 {
     lock (this)
     {
         while (comensal == 0)
         {
             Monitor.Wait(this);
         }
         if (CForm.gettxtLog() != null)
         {
             log.doRegistros(" El Filosofo " + (idFilosofo + 1) + " es el comensal " + comensal);
         }
         comensal--;
     }
 }
Example #17
0
 public void tomarPalillo(int idFilosofo, CLog log)
 {
     lock (locker)
     {
         while (!Libre)
         {
             Monitor.Wait(locker);
         }
         if (CForm.gettxtLog() != null)
         {
             log.doRegistros(" El Filosofo " + (idFilosofo + 1) + " toma el palillo " + (idPalillo + 1));
         }
         Libre = false;
     }
 }
Example #18
0
        public void uncaughtException(Thread t, Exception e)
        {
            MessageBox.Show("Thread que lanzo la excepcion: {0} \n", t.Name);

            if (CForm.gettxtLog() != null)
            {
                try
                {
                    log.doRegistros("\n Thread que lanzo la excepcion: " + t.Name + "\n");
                    log.doRegistros(e.ToString() + "\n\n");
                }
                catch (ThreadInterruptedException ex)
                {
                    MessageBox.Show(ex.ToString());
                }
            }
        }
Example #19
0
        public bool tomarPalilloIzq(int idFilosofo, CLog log)
        {
            lock (locker)
            {
                while (!Libre)
                {
                    Monitor.Wait(locker, r.Next(1000) + 500);
                    return(false);
                }

                if (CForm.gettxtLog() != null)
                {
                    log.doRegistros(" El Filosofo " + (idFilosofo + 1) + " tomo el palillo " + (idPalillo + 1));
                }
                Libre = false;
                return(true);
            }
        }
Example #20
0
    public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
    {
        IWindowsFormsEditorService editorService;

        if (context == null || context.Instance == null || provider == null)
        {
            return(value);
        }
        editorService = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
        CForm CollectionEditor = new CForm();

        if (editorService.ShowDialog(CollectionEditor) == System.Windows.Forms.DialogResult.OK)
        {
            return(CollectionEditor.Programmed);
        }
        return(value);
        //return base.EditValue(context, provider, value);
    }
Example #21
0
        private void tbtDel_Click(object sender, EventArgs e)
        {
            if (dataGridView.CurrentRow == null)
            {
                MessageBox.Show("请选择一项!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            if (MessageBox.Show("是否确认删除?", "确认", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK)
            {
                return;
            }
            CForm obj = (CForm)dataGridView.CurrentRow.Tag;

            if (!Program.Ctx.FormMgr.Delete(obj, true))
            {
                MessageBox.Show("删除失败!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                return;
            }
            dataGridView.Rows.Remove(dataGridView.CurrentRow);
        }
Example #22
0
        public CPrincipal(CForm cForm)
        {
            this.label_F = cForm.getlabel_F();
            this.label_P = cForm.getlabel_P();
            this.txt_C   = cForm.gettxt_C();

            CPalillo[]  palillo  = new CPalillo[5];
            CFilosofo[] filosofo = new CFilosofo[5];
            CMonitoMesa comensal = new CMonitoMesa();
            CLog        log      = new CLog();

            //CExcepciones excepciones = new CExcepciones(log);

            for (int i = 0; i < palillo.Length; i++)
            {
                palillo[i] = new CPalillo(i);
            }

            //for (int t = 0; t < threads.Length; t++)
            //{

            //    threads[t].Start();
            //}

            for (int i = 0; i < filosofo.Length; i++)
            {
                filosofo[i] = new CFilosofo(i, palillo[i], palillo[(i + 1) % 5],
                                            comensal, label_F[i], label_P[i], label_P[(i + 1) % 5], log,
                                            txt_C[i]);
            }

            for (int i = 0; i < filosofo.Length; i++)
            {
                for (int t = 0; t < threads.Length; t++)
                {
                    threads[t] = new Thread(new ThreadStart(filosofo[i].Run));
                    threads[t].Start();
                }
            }
        }
Example #23
0
        public ActionResult CreateForm(string id)
        {
            DbDataContext ctx = new DbDataContext();

            if (!String.IsNullOrEmpty(id))
            {
                int   realId = Convert.ToInt32(id);
                CForm form   = ctx.Forms.FirstOrDefault(k => k.Id == realId);
                if (form != null)
                {
                    return(View(form));
                }
                else
                {
                    CForm formNull = new CForm();
                    return(View(formNull));
                }
            }
            else
            {
                CForm formNull = new CForm();
                return(View(formNull));
            }
        }
Example #24
0
        public void Run()
        {
            lock (locker)
            {
                while (true)
                {
                    //Monitor.Enter(locker);
                    try
                    {
                        comensal.tomarComensal(idFilosofo, log);
                        this.label_F.BackColor = Color.Pink;

                        der.tomarPalillo(idFilosofo, log);
                        this.label_F.BackColor     = Color.Cyan;
                        this.label_P_der.BackColor = Color.Blue;

                        if (!izq.tomarPalilloIzq(idFilosofo, log))
                        {
                            if (CForm.gettxtLog() != null)
                            {
                                log.doRegistros(" El Filosofo " + (idFilosofo + 1) + " tendra que soltar el palillo " + (idFilosofo + 1) + " por exceso de tiempo y salir a pensar. ");
                            }

                            der.soltarPalillo(idFilosofo, log);
                            this.label_P_der.BackColor = Color.Red;

                            comensal.soltarComensal(idFilosofo, log);
                            if (CForm.gettxtLog() != null)
                            {
                                log.doRegistros(" El Filosofo " + (idFilosofo + 1) + " esta pensando. ");
                            }
                            try
                            {
                                //Thread.Sleep(1000 + 100);
                                Monitor.Wait(locker, r.Next(1000) + 100);
                            }
                            catch (ThreadInterruptedException ex)
                            {
                                if (CForm.gettxtLog() != null)
                                {
                                    log.doRegistros("\n\n Error. Descripcion: " + ex.ToString() + "\n\n");
                                }
                            }
                            //Monitor.Pulse(locker);
                            continue;
                        }

                        this.label_P_izq.BackColor = Color.Blue;
                        this.label_F.BackColor     = Color.Orange;
                        this.label_F.ForeColor     = Color.Blue;

                        if (txt_C.InvokeRequired)
                        {
                            txt_C.Invoke(new Action(() =>
                                                    this.txt_C.Text = (" " + (++CForm.F_Conteo[idFilosofo]))));
                        }
                        //txt_C.Text = (" " + (++CForm.F_Conteo[idFilosofo]));
                        if (CForm.gettxtLog() != null)
                        {
                            log.doRegistros(" El Filosofo " + (idFilosofo + 1) + " esta comiendo. ");
                        }
                        try
                        {
                            Thread.Sleep(1000 + 500);
                            //Monitor.Wait(locker, r.Next(1000 + 500));
                        }
                        catch (ThreadInterruptedException ex)
                        {
                            if (CForm.gettxtLog() != null)
                            {
                                log.doRegistros("\n\n Error. Descripcion: " + ex.ToString() + "\n\n");
                            }
                        }

                        this.label_F.BackColor = Color.Green;
                        this.label_F.ForeColor = Color.Black;

                        izq.soltarPalillo(idFilosofo, log);
                        this.label_P_izq.BackColor = Color.LightGray;

                        der.soltarPalillo(idFilosofo, log);
                        this.label_P_der.BackColor = Color.LightGray;

                        comensal.soltarComensal(idFilosofo, log);
                        if (CForm.gettxtLog() != null)
                        {
                            log.doRegistros(" El Filosofo " + (idFilosofo + 1) + " esta pensando. ");
                        }
                        try
                        {
                            //Thread.Sleep(1000 + 100);
                            Monitor.Wait(locker, r.Next(1000) + 100);
                        }
                        catch (ThreadInterruptedException ex)
                        {
                            if (CForm.gettxtLog() != null)
                            {
                                log.doRegistros("\n\n Error. Descripcion: " + ex.ToString() + "\n\n");
                            }
                        }
                    }
                    catch (ThreadInterruptedException ex)
                    {
                        if (CForm.gettxtLog() != null)
                        {
                            log.doRegistros("\n\n Error. Descripcion: " + ex.ToString() + "\n\n");
                        }
                    }

                    if (finalizado)
                    {
                        break;
                    }
                }
            }

            try
            {
                if (CForm.gettxtLog() != null)
                {
                    log.doRegistros(" La cena ha terminado para todos: El Filosofo " + (idFilosofo + 1) + " se ha puesto a pensar. \n\nPulsar INICIAR para continuar. \n\n");
                }
            }
            catch (ThreadInterruptedException ex)
            {
                if (CForm.gettxtLog() != null)
                {
                    log.doRegistros("\n\n Error. Descripcion: " + ex.ToString() + "\n\n");
                }
            }
        }
Example #25
0
        public static string Conjugate(string verb, EdictType type, CForm form, Politeness polite, Polarity affirmative)
        {
            if (verb.Length < 2)
            {
                return(verb);
            }

            string radical = verb;
            string end     = Utils.Right(verb, 1);

            radical = Utils.Chop(radical, 1);

            string bar = "|";

            switch (form)
            {
            case CForm.TeForm:
                if (affirmative != 0)
                {
                    return(VerbStem.tForm(radical, type) + tEnd(end, true));
                }
                if (type == EdictType.v5r_i)
                {
                    var aru = Utils.Chop(radical, 1);
                    return(aru + "||なくて");
                }

                return(VerbStem.aForm(radical, type) + "|なくて");

            case CForm.Present:
                if (polite != 0)
                {
                    if (affirmative != 0)
                    {
                        return(VerbStem.iForm(radical, type) + "|ます");
                    }
                    return(VerbStem.iForm(radical, type) + "|ません");
                }
                //plain
                if (affirmative != 0)
                {
                    return(VerbStem.uForm(radical, type) + "|");
                }
                if (type == EdictType.v5r_i)
                {
                    var aru = Utils.Chop(radical, 1);
                    return(aru + "||ない");
                }

                return(VerbStem.aForm(radical, type) + "|ない");

            case CForm.Past:
                if (polite != 0)
                {
                    if (affirmative != 0)
                    {
                        return(VerbStem.iForm(radical, type) + "|ました");
                    }
                    return(VerbStem.iForm(radical, type) + "|ませんでした");
                }
                //plain
                if (affirmative != 0)
                {
                    return(VerbStem.tForm(radical, type) + tEnd(end, false));
                }
                return(VerbStem.aForm(radical, type) + "|なかった");

            case CForm.Provision:
                if (polite != 0)
                {
                    if (affirmative != 0)
                    {
                        return(VerbStem.iForm(radical, type) + "|ますれば");
                    }
                    return(VerbStem.iForm(radical, type) + "|ませんならば");
                }
                //plain
                if (affirmative != 0)
                {
                    return(VerbStem.eForm(radical, type) + "|ば");
                }
                return(VerbStem.aForm(radical, type) + "|なければ");

            case CForm.Condition:
                if (polite != 0)
                {
                    if (affirmative != 0)
                    {
                        return(VerbStem.iForm(radical, type) + "|ましたら");
                    }
                    return(VerbStem.iForm(radical, type) + "|ませんでしたら");
                }
                //plain
                if (affirmative != 0)
                {
                    return(VerbStem.tForm(radical, type) + tEnd(end, false) + "ら");
                }
                return(VerbStem.aForm(radical, type) + "|なかったら");

            case CForm.Imperative:
                if (polite != 0)
                {
                    if (affirmative != 0)
                    {
                        return(VerbStem.tForm(radical, type) + tEnd(end, true) + "下さい");
                    }
                    return(VerbStem.aForm(radical, type) + "|ないで下さい");
                }
                //plain
                if (affirmative != 0)
                {
                    return(VerbStem.eImpForm(radical, type) + "|");
                }
                return(VerbStem.uForm(radical, type) + "|な");

            case CForm.Volitional:
                if (polite != 0)
                {
                    if (affirmative != 0)
                    {
                        return(VerbStem.iForm(radical, type) + "|ましょう");
                    }
                    return(VerbStem.uForm(radical, type) + "|のをやめましょう");
                }
                //plain
                if (affirmative != 0)
                {
                    if (type == EdictType.v5r_i)
                    {
                        return("|" + radical + "|ろう");
                    }

                    if (!EdictTypeUtils.IsGodan(type) && type != EdictType.vn)
                    {
                        return(VerbStem.oForm(radical, type) + "|よう");
                    }

                    return(VerbStem.oForm(radical, type) + "|う");
                }

                return(VerbStem.uForm(radical, type) + "|のをやめよう");

            case CForm.PresentContinuous:
                if (polite != 0)
                {
                    if (affirmative != 0)
                    {
                        return(VerbStem.tForm(radical, type) + tEnd(end, true) + "います");
                    }
                    return(VerbStem.tForm(radical, type) + tEnd(end, true) + "いません");
                }
                //plain
                if (affirmative != 0)
                {
                    return(VerbStem.tForm(radical, type) + tEnd(end, true) + "いる");
                }
                return(VerbStem.tForm(radical, type) + tEnd(end, true) + "いない");

            case CForm.PastContinuous:
                if (polite != 0)
                {
                    if (affirmative != 0)
                    {
                        return(VerbStem.tForm(radical, type) + tEnd(end, true) + "いました");
                    }
                    return(VerbStem.tForm(radical, type) + tEnd(end, true) + "いませんでした");
                }
                //plain
                if (affirmative != 0)
                {
                    return(VerbStem.tForm(radical, type) + tEnd(end, true) + "いた");
                }
                return(VerbStem.tForm(radical, type) + tEnd(end, true) + "いなかった");

            case CForm.Potential:

                if (EdictTypeUtils.IsIchidan(type))
                {
                    radical += "||られ";       // radical + られ
                    type     = EdictType.v0; //to prevent changing the radical when using eForm
                    bar      = "";
                }
                else if (type == EdictType.vs_s)
                {
                }
                else if (EdictTypeUtils.IsSuru(type))
                {                               //suru verbs numbers are 27 26 25 24
                    if (type != EdictType.vs_c) // suru verb number 25 ends with su,  no need to chop it
                    {
                        radical = Utils.Chop(radical, 1);
                    }
                    radical += "||でき";
                    type     = EdictType.v0; //to prevent changing the radical when using eForm
                    bar      = "";
                }
                else if (type == EdictType.vk)
                {
                    if (radical.EndsWith("く"))
                    {
                        radical = Utils.Chop(radical, 1) + "こ";
                    }
                    radical += "||られ";
                    type     = EdictType.v0; //to prevent changing the radical when using eForm
                    bar      = "";
                }

                if (polite != 0)
                {
                    if (affirmative != 0)
                    {
                        return(VerbStem.eForm(radical, type) + bar + "ます");
                    }
                    return(VerbStem.eForm(radical, type) + bar + "ません");
                }
                //plain
                if (affirmative != 0)
                {
                    return(VerbStem.eForm(radical, type) + bar + "る");
                }
                return(VerbStem.eForm(radical, type) + bar + "ない");

            case CForm.Passive:
                if (EdictTypeUtils.IsIchidan(type))
                {
                    radical += "||ら";
                    type     = EdictType.v0; //to prevent changing the radical when using eForm
                    bar      = "";
                }
                else if (EdictTypeUtils.IsSuru(type))
                {                               //suru verbs numbers are 27 26 25 24
                    if (type != EdictType.vs_c) // suru verb number 27 ends with su,  no need to chop it
                    {
                        radical = Utils.Chop(radical, 1);
                    }
                    radical += "||さ";
                    type     = EdictType.v0; //to prevent changing the radical when using eForm
                    bar      = "";
                }
                else if (type == EdictType.vk || type == EdictType.vz)
                {
                    bar = "|ら";
                }

                if (polite != 0)
                {
                    if (affirmative != 0)
                    {
                        return(VerbStem.aForm(radical, type) + bar + "れます");
                    }
                    return(VerbStem.aForm(radical, type) + bar + "れません");
                }
                //plain
                if (affirmative != 0)
                {
                    return(VerbStem.aForm(radical, type) + bar + "れる");
                }
                return(VerbStem.aForm(radical, type) + bar + "れない");

            case CForm.Causative:
                if (EdictTypeUtils.IsIchidan(type))
                {
                    radical += "||さ";
                    type     = EdictType.v0; //to prevent changing the radical when using eForm
                    bar      = "";
                }
                else if (EdictTypeUtils.IsSuru(type))
                {                               //suru verbs numbers are 27 26 25 24
                    if (type != EdictType.vs_c) // suru verb number 27 ends with su,  no need to chop it
                    {
                        radical = Utils.Chop(radical, 1);
                    }
                    radical += "||さ";
                    type     = EdictType.v0; //to prevent changing the radical when using eForm
                    bar      = "";
                }
                else if (type == EdictType.vk || type == EdictType.vz)
                {
                    bar = "|さ";
                }

                if (polite != 0)
                {
                    if (affirmative != 0)
                    {
                        return(VerbStem.aForm(radical, type) + bar + "せます");
                    }
                    return(VerbStem.aForm(radical, type) + bar + "せません");
                }
                //plain
                if (affirmative != 0)
                {
                    return(VerbStem.aForm(radical, type) + bar + "せる");
                }
                return(VerbStem.aForm(radical, type) + bar + "せない");

            case CForm.CausativePassive:
                if (EdictTypeUtils.IsIchidan(type))
                {
                    radical += "||さ";
                    type     = EdictType.v0; //to prevent changing the radical when using eForm
                    bar      = "";
                }
                else if (EdictTypeUtils.IsSuru(type))
                {                               //suru verbs numbers are 27 26 25 24
                    if (type != EdictType.vs_c) // suru verb number 27 ends with su,  no need to chop it
                    {
                        radical = Utils.Chop(radical, 1);
                    }
                    radical += "||さ";
                    type     = EdictType.v0; //to prevent changing the radical when using eForm
                    bar      = "";
                }
                else if (type == EdictType.vk || type == EdictType.vz)
                {
                    bar = "|さ";
                }

                if (polite != 0)
                {
                    if (affirmative != 0)
                    {
                        return(VerbStem.aForm(radical, type) + bar + "せられます");
                    }
                    return(VerbStem.aForm(radical, type) + bar + "せられません");
                }
                //plain
                if (affirmative != 0)
                {
                    return(VerbStem.aForm(radical, type) + bar + "せられる");
                }
                return(VerbStem.aForm(radical, type) + bar + "せられない");
            }

            return(verb);
        }
    public void submit_Click(object sender, EventArgs e)
    {
        CForm validateForm = new CForm();

        validateForm.validateEvent(title);
    }
Example #27
0
        private void tbtEdit_Click(object sender, EventArgs e)
        {
            if (dataGridView.CurrentRow == null)
            {
                MessageBox.Show("请选择一项!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            CForm obj = (CForm)dataGridView.CurrentRow.Tag;

            RecordWindow frm = new RecordWindow(Program.Ctx.FormMgr, obj);

            //frm.recordCtrl.m_sortNotShowCol.Add("fw_table_id", Program.Ctx.FormMgr.Table.Id);
            if (frm.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            CBaseObjectMgr  BaseObjectMgr = Program.Ctx.FormMgr;
            DataGridViewRow row           = dataGridView.CurrentRow;

            foreach (DataGridViewColumn column in dataGridView.Columns)
            {
                CColumn col = (CColumn)column.Tag;
                if (col.ColType == ColumnType.object_type)
                {
                    if (obj.GetColValue(col) != null)
                    {
                        row.Cells[column.Name].Value = "long byte";
                    }
                }
                else if (col.ColType == ColumnType.ref_type)
                {
                    CTable table = (CTable)Program.Ctx.TableMgr.Find(col.RefTable);
                    if (table == null)
                    {
                        continue;
                    }
                    CColumn RefCol     = (CColumn)table.ColumnMgr.Find(col.RefCol);
                    CColumn RefShowCol = (CColumn)table.ColumnMgr.Find(col.RefShowCol);
                    object  objVal     = obj.GetColValue(col);


                    Guid guidParentId = Guid.Empty;
                    if (BaseObjectMgr.m_Parent != null && BaseObjectMgr.m_Parent.Id == (Guid)objVal)
                    {
                        row.Cells[column.Name].Value = BaseObjectMgr.m_Parent.GetColValue(RefShowCol);
                    }
                    else
                    {
                        CBaseObjectMgr objMgr = Program.Ctx.FindBaseObjectMgrCache(table.Code, Guid.Empty);
                        if (objMgr != null)
                        {
                            CBaseObject objCache = objMgr.FindByValue(RefCol, objVal);
                            if (objCache != null)
                            {
                                row.Cells[column.Name].Value = objCache.GetColValue(RefShowCol);
                            }
                        }
                        else
                        {
                            objMgr        = new CBaseObjectMgr();
                            objMgr.TbCode = table.Code;
                            objMgr.Ctx    = Program.Ctx;

                            string             sWhere   = string.Format(" {0}=?", RefCol.Code);
                            List <DbParameter> cmdParas = new List <DbParameter>();
                            cmdParas.Add(new DbParameter(RefCol.Code, obj.GetColValue(col)));
                            List <CBaseObject> lstObj2 = objMgr.GetList(sWhere, cmdParas);
                            if (lstObj2.Count > 0)
                            {
                                CBaseObject obj2 = lstObj2[0];
                                row.Cells[column.Name].Value = obj2.GetColValue(RefShowCol);
                            }
                        }
                    }
                }
                else
                {
                    row.Cells[column.Name].Value = obj.GetColValue(col);
                }
            }
        }
Example #28
0
        public void LoadData()
        {
            if (dataGridView == null)
            {
                return;
            }
            if (dataGridView.Columns.Count == 0)
            {
                return;
            }
            dataGridView.Rows.Clear();
            CBaseObjectMgr     BaseObjectMgr = Program.Ctx.FormMgr;
            List <CBaseObject> lstObj        = BaseObjectMgr.GetList();

            if (lstObj.Count == 0)
            {
                return;
            }
            foreach (CBaseObject obj in lstObj)
            {
                CForm form = (CForm)obj;
                if (catalog == null)
                {
                    if (form.UI_FormCatalog_id != Guid.Empty)
                    {
                        continue;
                    }
                }
                else
                {
                    if (form.UI_FormCatalog_id != catalog.Id)
                    {
                        continue;
                    }
                }

                dataGridView.Rows.Add(1);
                DataGridViewRow row = dataGridView.Rows[dataGridView.Rows.Count - 1];
                row.Tag = obj;
                foreach (DataGridViewColumn column in dataGridView.Columns)
                {
                    CColumn col = (CColumn)column.Tag;
                    if (col.ColType == ColumnType.object_type)
                    {
                        if (obj.GetColValue(col) != null)
                        {
                            row.Cells[column.Name].Value = "long byte";
                        }
                    }
                    else if (col.ColType == ColumnType.ref_type)
                    {
                        CTable table = (CTable)Program.Ctx.TableMgr.Find(col.RefTable);
                        if (table == null)
                        {
                            continue;
                        }
                        CColumn RefCol     = (CColumn)table.ColumnMgr.Find(col.RefCol);
                        CColumn RefShowCol = (CColumn)table.ColumnMgr.Find(col.RefShowCol);
                        object  objVal     = obj.GetColValue(col);


                        Guid guidParentId = Guid.Empty;
                        if (BaseObjectMgr.m_Parent != null && BaseObjectMgr.m_Parent.Id == (Guid)objVal)
                        {
                            row.Cells[column.Name].Value = BaseObjectMgr.m_Parent.GetColValue(RefShowCol);
                        }
                        else
                        {
                            CBaseObjectMgr objMgr = Program.Ctx.FindBaseObjectMgrCache(table.Code, Guid.Empty);
                            if (objMgr != null)
                            {
                                CBaseObject objCache = objMgr.FindByValue(RefCol, objVal);
                                if (objCache != null)
                                {
                                    row.Cells[column.Name].Value = objCache.GetColValue(RefShowCol);
                                }
                            }
                            else
                            {
                                objMgr        = new CBaseObjectMgr();
                                objMgr.TbCode = table.Code;
                                objMgr.Ctx    = Program.Ctx;

                                string             sWhere   = string.Format(" {0}=?", RefCol.Code);
                                List <DbParameter> cmdParas = new List <DbParameter>();
                                cmdParas.Add(new DbParameter(RefCol.Code, obj.GetColValue(col)));
                                List <CBaseObject> lstObj2 = objMgr.GetList(sWhere, cmdParas);
                                if (lstObj2.Count > 0)
                                {
                                    CBaseObject obj2 = lstObj2[0];
                                    row.Cells[column.Name].Value = obj2.GetColValue(RefShowCol);
                                }
                            }
                        }
                    }
                    else
                    {
                        row.Cells[column.Name].Value = obj.GetColValue(col);
                    }
                }
            }
        }
Example #29
0
 public static string Conjugate(string verb, EdictType type, CForm form, Politeness polite = Politeness.Plain, Polarity affirmative = Polarity.Affirmative)
 {
     return(Inflection.Conjugate(verb, type, form, polite, affirmative));
 }
Example #30
0
        private void propertyGrid_PropertyValueChanged(object s, PropertyValueChangedEventArgs e)
        {
            if (m_AttrType == AttrType.FormControl)
            {
                CFormControl FormControl = (CFormControl)ControlEl.Tag;
                IDesignEl    designEl    = (IDesignEl)ControlEl;

                if (designEl.GetCtrlType() == ControlType.TableGrid)
                {
                    TableGridFEl te = (TableGridFEl)ControlEl;

                    if (e.ChangedItem.Label == "名称")
                    {
                        FormControl.Name = e.ChangedItem.Value.ToString();
                    }
                    else if (e.ChangedItem.Label == "工具栏显示")
                    {
                        te.ShowToolBar = (bool)e.ChangedItem.Value;
                        te.TableInFormControl.ShowToolBar = te.ShowToolBar;
                        te.TableInFormControl.m_CmdType   = CmdType.Update;
                    }
                    else if (e.ChangedItem.Label == "标题栏显示")
                    {
                        te.ShowTitleBar = (bool)e.ChangedItem.Value;
                        te.TableInFormControl.ShowTitleBar = te.ShowTitleBar;
                        te.TableInFormControl.m_CmdType    = CmdType.Update;
                    }
                    else if (e.ChangedItem.Label == "宽度")
                    {
                        te.Width          = (int)e.ChangedItem.Value;
                        FormControl.Width = te.Width;
                    }
                    else if (e.ChangedItem.Label == "高度")
                    {
                        te.Height          = (int)e.ChangedItem.Value;
                        FormControl.Height = te.Height;
                    }
                }
                else if (designEl.GetCtrlType() == ControlType.TableTree)
                {
                    TableTreeFEl tree = (TableTreeFEl)ControlEl;
                    if (e.ChangedItem.Label == "名称")
                    {
                        FormControl.Name = e.ChangedItem.Value.ToString();
                    }
                    else if (e.ChangedItem.Label == "标题栏显示")
                    {
                        tree.ShowTitleBar        = (bool)e.ChangedItem.Value;
                        FormControl.ShowTitleBar = tree.ShowTitleBar;
                    }
                    else if (e.ChangedItem.Label == "宽度")
                    {
                        tree.Width        = (int)e.ChangedItem.Value;
                        FormControl.Width = tree.Width;
                    }
                    else if (e.ChangedItem.Label == "高度")
                    {
                        tree.Height        = (int)e.ChangedItem.Value;
                        FormControl.Height = tree.Height;
                    }
                }
                else if (designEl.GetCtrlType() == ControlType.ListBox)
                {
                    UIListBoxFEl list = (UIListBoxFEl)ControlEl;
                    if (e.ChangedItem.Label == "名称")
                    {
                        FormControl.Name = e.ChangedItem.Value.ToString();
                    }
                    else if (e.ChangedItem.Label == "标题栏显示")
                    {
                        list.ShowTitleBar        = (bool)e.ChangedItem.Value;
                        FormControl.ShowTitleBar = list.ShowTitleBar;
                    }
                    else if (e.ChangedItem.Label == "宽度")
                    {
                        list.Width        = (int)e.ChangedItem.Value;
                        FormControl.Width = list.Width;
                    }
                    else if (e.ChangedItem.Label == "高度")
                    {
                        list.Height        = (int)e.ChangedItem.Value;
                        FormControl.Height = list.Height;
                    }
                }
                else if (designEl.GetCtrlType() == ControlType.ComboBox)
                {
                    UIComboBoxFEl comb = (UIComboBoxFEl)ControlEl;
                    if (e.ChangedItem.Label == "名称")
                    {
                        FormControl.Name = e.ChangedItem.Value.ToString();
                    }
                    else if (e.ChangedItem.Label == "标题栏显示")
                    {
                        comb.ShowTitleBar        = (bool)e.ChangedItem.Value;
                        FormControl.ShowTitleBar = comb.ShowTitleBar;
                    }
                    else if (e.ChangedItem.Label == "宽度")
                    {
                        comb.Width        = (int)e.ChangedItem.Value;
                        FormControl.Width = comb.Width;
                    }
                    else if (e.ChangedItem.Label == "高度")
                    {
                        comb.Height        = (int)e.ChangedItem.Value;
                        FormControl.Height = comb.Height;
                    }
                }
                else if (designEl.GetCtrlType() == ControlType.TableTab)
                {
                    TableTabFEl tab = (TableTabFEl)ControlEl;

                    if (e.ChangedItem.Label == "名称")
                    {
                        FormControl.Name = e.ChangedItem.Value.ToString();
                    }
                    else if (e.ChangedItem.Label == "工具栏显示")
                    {
                        TableGridFEl grid = tab.GetCurTableGridEl();
                        if (grid != null)
                        {
                            grid.ShowToolBar = (bool)e.ChangedItem.Value;
                            grid.TableInFormControl.ShowToolBar = grid.ShowToolBar;
                            grid.TableInFormControl.m_CmdType   = CmdType.Update;
                        }
                    }
                    else if (e.ChangedItem.Label == "标题栏显示")
                    {
                        tab.ShowTitleBar         = (bool)e.ChangedItem.Value;
                        FormControl.ShowTitleBar = tab.ShowTitleBar;
                    }
                    else if (e.ChangedItem.Label == "宽度")
                    {
                        tab.Width         = (int)e.ChangedItem.Value;
                        FormControl.Width = tab.Width;
                    }
                    else if (e.ChangedItem.Label == "高度")
                    {
                        tab.Height         = (int)e.ChangedItem.Value;
                        FormControl.Height = tab.Height;
                    }
                }
                else if (designEl.GetCtrlType() == ControlType.TextBox)
                {
                    ExTextBoxEl ctrl = (ExTextBoxEl)ControlEl;
                    if (e.ChangedItem.Label == "名称")
                    {
                        FormControl.Name = e.ChangedItem.Value.ToString();
                    }
                    else if (e.ChangedItem.Label == "标题")
                    {
                        ctrl.lbCaption.Text = e.ChangedItem.Value.ToString();
                        FormControl.Caption = ctrl.lbCaption.Text;
                    }
                    else if (e.ChangedItem.Label == "最大长度")
                    {
                        ctrl.textBox.MaxLength = Convert.ToInt32(e.ChangedItem.Value);
                        CColumn col = (CColumn)m_Table.ColumnMgr.Find(FormControl.FW_Column_id);
                        if (col != null)
                        {
                            col.ColLen = ctrl.textBox.MaxLength;
                            m_Table.ColumnMgr.Update(col);
                        }
                    }
                    else if (e.ChangedItem.Label == "长度")
                    {
                        CColumn col = (CColumn)m_Table.ColumnMgr.Find(FormControl.FW_Column_id);
                        if (col != null)
                        {
                            col.ColLen = Convert.ToInt32(e.ChangedItem.Value);
                            m_Table.ColumnMgr.Update(col);
                        }
                    }
                    else if (e.ChangedItem.Label == "小数位数")
                    {
                        CColumn col = (CColumn)m_Table.ColumnMgr.Find(FormControl.FW_Column_id);
                        if (col != null)
                        {
                            col.ColDecimal = Convert.ToInt32(e.ChangedItem.Value);
                            m_Table.ColumnMgr.Update(col);
                        }
                    }
                    else if (e.ChangedItem.Label == "宽度")
                    {
                        ctrl.Width        = (int)e.ChangedItem.Value;
                        FormControl.Width = ctrl.Width;
                    }
                    else if (e.ChangedItem.Label == "高度")
                    {
                        ctrl.Height        = (int)e.ChangedItem.Value;
                        FormControl.Height = ctrl.Height;
                    }
                }
                else if (designEl.GetCtrlType() == ControlType.CheckBox)
                {
                    ExCheckBoxEl ctrl = (ExCheckBoxEl)ControlEl;
                    if (e.ChangedItem.Label == "名称")
                    {
                        FormControl.Name = e.ChangedItem.Value.ToString();
                    }
                    else if (e.ChangedItem.Label == "标题")
                    {
                        ctrl.lbCaption.Text = e.ChangedItem.Value.ToString();
                        FormControl.Caption = ctrl.lbCaption.Text;
                    }
                    else if (e.ChangedItem.Label == "宽度")
                    {
                        ctrl.Width        = (int)e.ChangedItem.Value;
                        FormControl.Width = ctrl.Width;
                    }
                    else if (e.ChangedItem.Label == "高度")
                    {
                        ctrl.Height        = (int)e.ChangedItem.Value;
                        FormControl.Height = ctrl.Height;
                    }
                }
                else if (designEl.GetCtrlType() == ControlType.DateTimePicker)
                {
                    ExCheckBoxEl ctrl = (ExCheckBoxEl)ControlEl;
                    if (e.ChangedItem.Label == "名称")
                    {
                        FormControl.Name = e.ChangedItem.Value.ToString();
                    }
                    else if (e.ChangedItem.Label == "标题")
                    {
                        ctrl.lbCaption.Text = e.ChangedItem.Value.ToString();
                        FormControl.Caption = ctrl.lbCaption.Text;
                    }
                    else if (e.ChangedItem.Label == "宽度")
                    {
                        ctrl.Width        = (int)e.ChangedItem.Value;
                        FormControl.Width = ctrl.Width;
                    }
                    else if (e.ChangedItem.Label == "高度")
                    {
                        ctrl.Height        = (int)e.ChangedItem.Value;
                        FormControl.Height = ctrl.Height;
                    }
                }
                else if (designEl.GetCtrlType() == ControlType.RefComboBox)
                {
                    ExComboBoxEl ctrl = (ExComboBoxEl)ControlEl;
                    if (e.ChangedItem.Label == "名称")
                    {
                        FormControl.Name = e.ChangedItem.Value.ToString();
                    }
                    else if (e.ChangedItem.Label == "标题")
                    {
                        ctrl.lbCaption.Text = e.ChangedItem.Value.ToString();
                        FormControl.Caption = ctrl.lbCaption.Text;
                    }
                    else if (e.ChangedItem.Label == "宽度")
                    {
                        ctrl.Width        = (int)e.ChangedItem.Value;
                        FormControl.Width = ctrl.Width;
                    }
                    else if (e.ChangedItem.Label == "高度")
                    {
                        ctrl.Height        = (int)e.ChangedItem.Value;
                        FormControl.Height = ctrl.Height;
                    }
                    else if (e.ChangedItem.Label == "引用表")
                    {
                        UpdateRefTable(e.ChangedItem.Value.ToString());
                        CColumn col = (CColumn)m_Table.ColumnMgr.Find(FormControl.FW_Column_id);
                        m_Table.ColumnMgr.Update(col);
                    }
                    else if (e.ChangedItem.Label == "引用字段")
                    {
                        CColumn col = (CColumn)m_Table.ColumnMgr.Find(FormControl.FW_Column_id);
                        m_Table.ColumnMgr.Update(col);
                    }
                    else if (e.ChangedItem.Label == "引用显示字段")
                    {
                        CColumn col = (CColumn)m_Table.ColumnMgr.Find(FormControl.FW_Column_id);
                        m_Table.ColumnMgr.Update(col);
                    }
                }
                FormControl.m_ObjectMgr.Update(FormControl);
            }
            else
            {
                CForm form = (CForm)FormEl.Form;
                if (e.ChangedItem.Label == "名称")
                {
                    FormEl.Name = e.ChangedItem.Value.ToString();
                    form.Name   = FormEl.Name;
                }
                else if (e.ChangedItem.Label == "宽度")
                {
                    FormEl.Width = (int)e.ChangedItem.Value;
                    form.Width   = FormEl.Width;
                }
                else if (e.ChangedItem.Label == "高度")
                {
                    FormEl.Height = (int)e.ChangedItem.Value;
                    form.Height   = FormEl.Height;
                }
                form.m_ObjectMgr.Update(form);
            }
        }