示例#1
0
        private void CloseJobApplicationToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //Close Job Application
            string         strFilePath = Array.FindAll(records, x => x.Contains(mainTreeView.SelectedNode.Name))[0];
            DataStoreLayer ds          = new DataStoreLayer();
            jobApplication jApp        = ds.LoadJobApplication(strFilePath);

            jApp.closedOn = DateTime.Now;
            File.Delete(Array.FindAll(records, x => x.Contains(mainTreeView.SelectedNode.Name))[0]);
            ds.InsertApplication(jApp);

            System.IO.File.Move(strFilePath, strFilePath.Replace(Path.GetFileNameWithoutExtension(strFilePath), "closed_" + Path.GetFileNameWithoutExtension(strFilePath)));
            drawTree();
        }
        private void btnSave_Click(object sender, EventArgs e)
        {
            //generate XML
            jobApplication jb = new jobApplication();

            jb.createdOn       = DateTime.Now;
            jb.modifiedOn      = DateTime.Now;
            jb.applicationDate = dateTimePickerAppliedOn.Value;
            jb.closedOn        = new DateTime(1981, 1, 1);
            jb.advertisement   = txtBody.Text;
            jb.advertiser      = txtContact.Text;

            // Read docx of my CV
            try
            {
                jb.AppliedCVBinary = File.ReadAllBytes(txtCV.Text);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error is occured", MessageBoxButtons.OK);
            }

            jb.company = txtCompany.Text;
            jb.title   = txtTitle.Text;
            jb.url     = txtURL.Text;

            DataStoreLayer ds = new DataStoreLayer();

            ds.InsertApplication(jb);

            MessageBox.Show("Record has been added successfully");

            if (this.MdiParent.MdiChildren.Length > 0 && this.MdiParent.MdiChildren[0] is TreeViewForm)
            {
                ((TreeViewForm)this.MdiParent.MdiChildren[0]).drawTree();
            }

            this.Close();
        }