Beispiel #1
0
        private void Bai2_Load(object sender, EventArgs e)
        {
            Microsoft.Office.Interop.Word.ApplicationClass wordApplication = new ApplicationClass();
            object o_nullobject = System.Reflection.Missing.Value;
            object o_filePath = System.IO.Directory.GetCurrentDirectory() + "\\Resources\\PhepNhan.doc";
            object o_format = Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatHTML;
            object o_encoding = Microsoft.Office.Core.MsoEncoding.msoEncodingUTF8;
            object o_endings = Microsoft.Office.Interop.Word.WdLineEndingType.wdCRLF;
            object o_Readonly = true;
            Microsoft.Office.Interop.Word.Document doc = wordApplication.Documents.Open(ref o_filePath,
            ref o_nullobject, ref o_Readonly, ref o_nullobject, ref o_nullobject, ref o_nullobject,
            ref o_nullobject, ref o_nullobject, ref o_nullobject, ref o_nullobject, ref o_nullobject, ref o_nullobject, ref o_nullobject, ref o_nullobject,
            ref o_nullobject, ref o_nullobject);

            doc.ActiveWindow.Selection.WholeStory();

            doc.ActiveWindow.Selection.Copy();

            IDataObject data = Clipboard.GetDataObject();

            txtLyThuyet.Text = data.GetData(DataFormats.UnicodeText).ToString();

            doc.Close(ref o_nullobject, ref o_nullobject, ref o_nullobject);
            wordApplication.Quit(ref o_nullobject, ref o_nullobject, ref o_nullobject);

            PhepTinhDAO phepTinhDAO = new PhepTinhDAO();
            PhepTinhDTO phepTinhDTO = new PhepTinhDTO();

            arrPhepTinh = phepTinhDAO.getPhepTinhNhan();
            sizeOfXML = arrPhepTinh.Count;
            phepTinhDTO = (PhepTinhDTO)arrPhepTinh[0];
            tbTemp1.Text = phepTinhDTO.SoThuNhat.ToString();
            tbTemp2.Text = phepTinhDTO.SoThuHai.ToString();
        }
 public void ConstructorInitialization()
 {
     PhepTinhDTO part = new PhepTinhDTO(11111,5, 55555);
     Assert.AreEqual(part.SoThuNhat, 11111);
     Assert.AreEqual(part.SoThuHai, 5);
     Assert.AreEqual(part.KetQua, 55555);
 }
        public ArrayList getPhepTinhNhan()
        {
            ArrayList listSo = new ArrayList();
            DataSet dataSet = new DataSet();
            PhepTinhDTO phepTinh = null;
            string database = Application.StartupPath + "\\Resources\\PhepNhan.xml";
            string schema = Application.StartupPath + "\\Resources\\PhepNhan.xsd";
            dataSet.ReadXmlSchema(schema);
            dataSet.ReadXml(database);
            DataRow[] drs = dataSet.Tables["Number"].Select("Ma > 0");
            foreach (DataRow dr in drs)
            {
                phepTinh = new PhepTinhDTO(Int32.Parse(dr["SH1"].ToString()), Int32.Parse(dr["SH2"].ToString()), Int32.Parse(dr["KQ"].ToString()));
                listSo.Add(phepTinh);
            }

            return listSo;
        }
 public void PhepTinhDTOSetup()
 {
     phepTinhDTO = new PhepTinhDTO();
 }