Esempio n. 1
0
        public bool createXmlFile(string filename, int roomNo)
        {
            try
            {
                LimsDoc l;
                l = new LimsDoc(textUserName.Text, textPassword.Text, "system");

                LimsDocEntity entity       = l.createEntity("SAMPLE", "RESULT_ENTRY");
                LimsDocEntity entity2      = l.createEntity("TEST", null);
                LimsDocEntity entity1_time = l.createEntity("RESULT", null);
                LimsDocEntity entity1_res  = l.createEntity("RESULT", null);
                LimsDocEntity entity2_time = l.createEntity("RESULT", null);
                LimsDocEntity entity2_res  = l.createEntity("RESULT", null);
                LimsDocEntity entity3_time = l.createEntity("RESULT", null);
                LimsDocEntity entity3_res  = l.createEntity("RESULT", null);
                LimsDocEntity entity4_time = l.createEntity("RESULT", null);
                LimsDocEntity entity4_res  = l.createEntity("RESULT", null);

                entity2.addFields("ANALYSIS", "in", textAnalysis.Text);

                entity.addFields("ID_NUMERIC", "in", textID.Text);


                entity1_time.addFields("NAME", "in", "初次冷浴温度1");
                entity1_time.addFields("TEXT", "in", textBox1.Text);
                entity2.addChild(entity1_time.getElement());

                entity1_res.addFields("NAME", "in", "初次观察温度1");
                entity1_res.addFields("TEXT", "in", textBox2.Text);
                entity2.addChild(entity1_res.getElement());

                entity2_time.addFields("NAME", "in", "冷浴温度1");
                entity2_time.addFields("TEXT", "in", textBox3.Text);
                entity2.addChild(entity2_time.getElement());

                entity2_res.addFields("NAME", "in", "冷滤点1");
                entity2_res.addFields("TEXT", "in", textBox4.Text);
                entity2.addChild(entity2_res.getElement());

                entity3_time.addFields("NAME", "in", "初次冷浴温度2");
                entity3_time.addFields("TEXT", "in", textBox5.Text);
                entity2.addChild(entity3_time.getElement());

                entity3_res.addFields("NAME", "in", "初次观察温度2");
                entity3_res.addFields("TEXT", "in", textBox6.Text);
                entity2.addChild(entity3_res.getElement());

                entity4_time.addFields("NAME", "in", "冷浴温度2");
                entity4_time.addFields("TEXT", "in", textBox7.Text);
                entity2.addChild(entity4_time.getElement());

                entity4_res.addFields("NAME", "in", "冷滤点2");
                entity4_res.addFields("TEXT", "in", textBox8.Text);
                entity2.addChild(entity4_res.getElement());

                entity.addChild(entity2.getElement());
                l.getBody().addEntity(entity.getElement());

                return(l.createdoc(filename));
            }
            catch (Exception ex)
            {
                LogClass.GetInstance().WriteExceptionLog(ex);
                //MessageBox.Show(ex.ToString(), "Error - No Ports available", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            return(false);
        }
Esempio n. 2
0
        public bool createXmlFile(string filename, int roomNo)
        {
            try
            {
                Configure cfg     = null;
                string    cfgfile = System.IO.Path.Combine(Application.StartupPath, "cfg.json");
                if (File.Exists(cfgfile))
                {
                    cfg = JsonConvert.DeserializeObject <Configure>(File.ReadAllText(cfgfile));
                    if (cfg != null)
                    {
                        LimsDoc l;
                        l = new LimsDoc(cfg.username, cfg.userpassword, "system");

                        LimsDocEntity entity  = l.createEntity("SAMPLE", "RESULT_ENTRY");
                        LimsDocEntity entity2 = l.createEntity("TEST", null);
                        LimsDocEntity entity3 = l.createEntity("RESULT", null);

                        LimsDocEntity entity1_time = l.createEntity("RESULT", null);
                        LimsDocEntity entity1_res  = l.createEntity("RESULT", null);
                        LimsDocEntity entity2_time = l.createEntity("RESULT", null);
                        LimsDocEntity entity2_res  = l.createEntity("RESULT", null);
                        LimsDocEntity entity3_time = l.createEntity("RESULT", null);
                        LimsDocEntity entity3_res  = l.createEntity("RESULT", null);
                        LimsDocEntity entity4_time = l.createEntity("RESULT", null);
                        LimsDocEntity entity4_res  = l.createEntity("RESULT", null);
                        entity2.addFields("ANALYSIS", "in", cfg.analysis);

                        if (roomNo == ROOMNUM_LEFT)
                        {
                            entity1_time.addFields("NAME", "in", "初次冷浴温度1");
                            entity1_time.addFields("TEXT", "in", "0");
                            entity2.addChild(entity1_time.getElement());

                            entity1_res.addFields("NAME", "in", "初次观察温度1");
                            entity1_res.addFields("TEXT", "in", "0");
                            entity2.addChild(entity1_res.getElement());

                            entity2_time.addFields("NAME", "in", "冷浴温度1");
                            entity2_time.addFields("TEXT", "in", "0");
                            entity2.addChild(entity2_time.getElement());

                            entity2_res.addFields("NAME", "in", "冷滤点1");
                            entity2_res.addFields("TEXT", "in", "0");
                            entity2.addChild(entity2_res.getElement());

                            entity3_time.addFields("NAME", "in", "初次冷浴温度2");
                            entity3_time.addFields("TEXT", "in", "0");
                            entity2.addChild(entity3_time.getElement());

                            entity3_res.addFields("NAME", "in", "初次观察温度2");
                            entity3_res.addFields("TEXT", "in", "0");
                            entity2.addChild(entity3_res.getElement());

                            entity4_time.addFields("NAME", "in", "冷浴温度2");
                            entity4_time.addFields("TEXT", "in", "0");
                            entity2.addChild(entity4_time.getElement());

                            entity4_res.addFields("NAME", "in", "冷滤点2");
                            entity4_res.addFields("TEXT", "in", "0");
                            entity2.addChild(entity4_res.getElement());
                        }
                        else if (roomNo == ROOMNUM_RIGHT)
                        {
                            entity1_time.addFields("NAME", "in", "初次冷浴温度1");
                            entity1_time.addFields("TEXT", "in", "1");
                            entity2.addChild(entity1_time.getElement());

                            entity1_res.addFields("NAME", "in", "初次观察温度1");
                            entity1_res.addFields("TEXT", "in", "1");
                            entity2.addChild(entity1_res.getElement());

                            entity2_time.addFields("NAME", "in", "冷浴温度1");
                            entity2_time.addFields("TEXT", "in", "1");
                            entity2.addChild(entity2_time.getElement());

                            entity2_res.addFields("NAME", "in", "冷滤点1");
                            entity2_res.addFields("TEXT", "in", "1");
                            entity2.addChild(entity2_res.getElement());

                            entity3_time.addFields("NAME", "in", "初次冷浴温度2");
                            entity3_time.addFields("TEXT", "in", "1");
                            entity2.addChild(entity3_time.getElement());

                            entity3_res.addFields("NAME", "in", "初次观察温度2");
                            entity3_res.addFields("TEXT", "in", "1");
                            entity2.addChild(entity3_res.getElement());

                            entity4_time.addFields("NAME", "in", "冷浴温度2");
                            entity4_time.addFields("TEXT", "in", "1");
                            entity2.addChild(entity4_time.getElement());

                            entity4_res.addFields("NAME", "in", "冷滤点2");
                            entity4_res.addFields("TEXT", "in", "1");
                            entity2.addChild(entity4_res.getElement());
                        }
                        else
                        {
                            return(false);
                        }

                        entity.addChild(entity2.getElement());
                        l.getBody().addEntity(entity.getElement());

                        return(l.createdoc(filename));
                    }
                }
            }
            catch (Exception ex)
            {
                LogClass.GetInstance().WriteExceptionLog(ex);
                //MessageBox.Show(ex.ToString(), "Error - No Ports available", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            return(false);
        }
Esempio n. 3
0
        public LimsDocEntity createEntity(string type, string command)
        {
            LimsDocEntity entity = new LimsDocEntity(xmldoc, type, command);

            return(entity);
        }