Beispiel #1
0
        private void button3_Click(object sender, EventArgs e)
        {
            DivanDataContext.Instance.Properties.DeleteAllOnSubmit(asset.Properties);
            asset.Properties.Clear();
            DivanDataContext.Instance.SubmitChanges();

            DivanDataContext.Instance.Properties.InsertOnSubmit(new Property(Asset.UID_STRING, textBox_UID.Text, asset));
            DivanDataContext.Instance.Properties.InsertOnSubmit(new Property(Asset.NAME_STRING, textBox_Name.Text, asset));

            asset.isHuman = checkBox_isHuman.Checked;
            if (asset.isHuman)
            {
                DivanDataContext.Instance.Properties.InsertOnSubmit(new Property(Asset.FIRST_NAME_STRING, textBox_FirstName.Text, asset));
                DivanDataContext.Instance.Properties.InsertOnSubmit(new Property(Asset.LAST_NAME_STRING, textBox_LastName.Text, asset));
                DivanDataContext.Instance.Properties.InsertOnSubmit(new Property(Asset.NATIONAL_ID_STRING, textBox_NationalID.Text, asset));
                DivanDataContext.Instance.Properties.InsertOnSubmit(new Property(Asset.PERSONNEL_CODE_STRING, textBox_PersonnelCode.Text, asset));
                DivanDataContext.Instance.Properties.InsertOnSubmit(new Property(Asset.HUMAN_DESCRIPTION_STRING, textBox_HumanDescription.Text, asset));
            }
            asset.isPhysical = checkBox_isPhysical.Checked;
            if (asset.isPhysical)
            {
                DivanDataContext.Instance.Properties.InsertOnSubmit(new Property(Asset.PHYSICAL_DESCRIPTION_STRING, textBox_PhysicalDescription.Text, asset));
            }
            asset.isPortable = checkBox_isPortable.Checked;

            for (int i = 0; i < dataGrid_PrimaryInfo.RowCount - 1; i++)
            {
                DivanDataContext.Instance.Properties.InsertOnSubmit(new Property((string)dataGrid_PrimaryInfo.Rows[i].Cells[0].Value, (string)dataGrid_PrimaryInfo.Rows[i].Cells[2].Value, asset, (string)dataGrid_PrimaryInfo.Rows[i].Cells[1].Value));
            }

            foreach (String fileName in attachmentList.Items)
            {
                // TODO: attached files need to be uploaded.
                AttachedFile file = new AttachedFile();
                file.Asset = asset;
                file.path = fileName;
                DivanDataContext.Instance.AttachedFiles.InsertOnSubmit(file);
            }

            DivanDataContext.Instance.SubmitChanges();
        }
Beispiel #2
0
 partial void DeleteAttachedFile(AttachedFile instance);
Beispiel #3
0
 partial void UpdateAttachedFile(AttachedFile instance);
Beispiel #4
0
 partial void InsertAttachedFile(AttachedFile instance);
Beispiel #5
0
		private void detach_AttachedFiles(AttachedFile entity)
		{
			this.SendPropertyChanging();
			entity.Asset = null;
		}
Beispiel #6
0
 private void saveAttachments()
 {
     foreach (String fileName in attachmentList.Items)
     {
         AttachedFile file = new AttachedFile();
         file.Asset = asset;
         file.path = fileName;
         DivanDataContext.Instance.AttachedFiles.InsertOnSubmit(file);
     }
 }