Ejemplo n.º 1
0
 public PaperInfoForm(TestPaper testpaper,string okbtntext="确认")
 {
     this.testPaper = testpaper;
     InitializeComponent();
     ClassListAttrible cla = new ClassListAttrible();
     xuekeComboBox.Items.AddRange(cla.lists);
     this.paperNameTextBox.Text= testPaper.试卷名称;
     this.tagTextBox.Text= testPaper.标签 ;
     this.xuekeComboBox.Text= testPaper.学科;
     this.okButton.Text = okbtntext;
 }
Ejemplo n.º 2
0
        private void InitializeForm()
        {
            XmlDocument xmldoc = new XmlDocument();
            xmldoc.Load(Application.StartupPath + "/LoginConfig.xml");
            XmlNode address = xmldoc.SelectSingleNode("//address");

            //XmlNodeList xnlist = xmldoc.SelectNodes("//Template");
            //List<string> classiten = new List<string>();
            //for (int i = 0; i < xnlist.Count; i++)
            //{
            //    XmlElement xmle = (XmlElement)xnlist[i];
            //    //string id = xmle.GetAttribute("id");
            //    string text = xmle.GetAttribute("text");
            //    this.toolStripComboBoxClass.Items.Add(text);
            //    //classiten.Add(text);
            //}
            try
            {
                HttpHelper httphelper = new HttpHelper();
                string stagexml = httphelper.getHttpRespone("http://" + address.InnerText + "/api/Item/get?token=stage");
                XmlDocument xmldocstage = new XmlDocument();
                xmldocstage.LoadXml(stagexml.Trim());
                xmldocstage.Save(Application.StartupPath + stagefilename);

                string sourcexml = httphelper.getHttpRespone("http://" + address.InnerText + "/api/Item/get?token=source");
                XmlDocument xmldocsource = new XmlDocument();
                xmldocsource.LoadXml(sourcexml.Trim());
                xmldocsource.Save(Application.StartupPath + sourcefilename);

                string xuekexml = httphelper.getHttpRespone("http://" + address.InnerText + "/api/Item/get?token=xueke");
                XmlDocument xmldocxueke = new XmlDocument();
                xmldocxueke.LoadXml(xuekexml.Trim());
                xmldocxueke.Save(Application.StartupPath + xuekefilename);
            }
            catch(Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            testpaper = new TestPaper();//初始化试卷属性

            foreach (string st in Enum.GetNames(typeof(Subject.SubjecttypeEnum)))
            {
                System.Windows.Forms.TreeNode treeNode = new System.Windows.Forms.TreeNode(st);
                treeNode.Text = st;
                this.treeViewSubject.Nodes.Add(treeNode);
            }
        }
Ejemplo n.º 3
0
        public void InsertTFrom(TestPaper testPaper)
        {
            if (this.OpenConnection() == true)
            {

                string query = "INSERT INTO pd_tfrom (id,f_name,txueke_id,f_desc,f_stage,f_year,f_count,f_testcount,f_status,f_entering,f_source,f_number,create_person,created,update_person,f_isdelete,updated) VALUES(?id,?f_name,?txueke_id,?f_desc,?f_stage,?f_year,?f_count,?f_testcount,?f_status,?f_entering,?f_source,?f_number,?create_person,?created,?update_person,?f_isdelete,?updated)";

                //create command and assign the query and connection from the constructor
                MySqlCommand cmd = new MySqlCommand(query,connection);
                cmd.Parameters.AddWithValue("?id",Guid.NewGuid().ToString());
                cmd.Parameters.AddWithValue("?f_desc", testPaper.��ǩ);
                cmd.Parameters.AddWithValue("?f_name", testPaper.�Ծ�����);
                cmd.Parameters.AddWithValue("?txueke_id", testPaper.ѧ��);
                cmd.Parameters.AddWithValue("?f_count", testPaper.ѧ��);
                cmd.Parameters.AddWithValue("?f_testcount", testPaper.ѧ��);
                cmd.Parameters.AddWithValue("?f_status", testPaper.ѧ��);
                cmd.Parameters.AddWithValue("?f_entering", testPaper.ѧ��);
                cmd.Parameters.AddWithValue("?f_number", testPaper.ѧ��);
                cmd.Parameters.AddWithValue("?create_person", testPaper.ѧ��);
                cmd.Parameters.AddWithValue("?created", testPaper.ѧ��);
                cmd.Parameters.AddWithValue("?f_isdelete", testPaper.ѧ��);
                cmd.Parameters.AddWithValue("?updated", testPaper.ѧ��);
                cmd.Parameters.AddWithValue("?update_person", testPaper.ѧ��);
                    //Execute command
                cmd.ExecuteNonQuery();
                //close connection
                this.CloseConnection();
            }
        }
Ejemplo n.º 4
0
 private bool SetPaperInfo(string okbtnstr = "确认")
 {
     using (PaperInfoForm paperinfo = new PaperInfoForm(testpaper, okbtnstr))
     {
         DialogResult dialogresult = paperinfo.ShowDialog();
         testpaper = paperinfo.testPaper;
         if (dialogresult.Equals(DialogResult.Cancel))
         {
             return false;
         }
     }
     if (string.IsNullOrEmpty(testpaper.学科) || string.IsNullOrEmpty(testpaper.试卷名称) || string.IsNullOrEmpty(testpaper.标签))
     {
         return false;
     }
     return true;
 }