private void btnChoose_Click(object sender, EventArgs e) { if (dtgList.SelectedRows.Count > 0) { var row = dtgList.SelectedRows[0]; unionRelationship = row.DataBoundItem as DataAccess.UnionRelationshipType; if (UnionRelationshipSelected != null) { UnionRelationshipSelected(this, new UnionRelationshipSelectedArg() { UnionRelationship = unionRelationship }); } this.Close(); //txtName.Text = unionRelationship.Name; //if (unionRelationship.IsGeneralization == true) // optIsGeneralization.Checked = true; //else if (unionRelationship.IsSpecialization == true) // optIsSpecialization.Checked = true; //if (unionRelationship.IsTolatParticipation == true) // optIsTolatParticipation.Checked = true; //else if (unionRelationship.IsPartialParticipation == true) // optIsPartialParticipation.Checked = true; //if (unionRelationship.IsDisjoint == true) // optIsDisjoint.Checked = true; //else if (unionRelationship.IsOverlap == true) // optIsOverlap.Checked = true; } }
private void btnSave_Click_1(object sender, EventArgs e) { if (txtName.Text == "") { MessageBox.Show("نام رابطه مشخص نشده است"); return; } if (optIsTolatParticipation.Checked == false && optIsPartialParticipation.Checked == false) { MessageBox.Show("نوع " + "TolatParticipation/PartialParticipation" + "مشخص نشده است"); return; } using (var projectContext = new DataAccess.MyProjectEntities()) { if (unionRelationship == null) { unionRelationship = new DataAccess.UnionRelationshipType(); } unionRelationship.Name = txtName.Text; unionRelationship.IsTolatParticipation = optIsTolatParticipation.Checked == true; unionRelationship.UnionHoldsKeys = chkUnionHoldsKeys.Checked; if (unionRelationship.ID == 0) { projectContext.UnionRelationshipType.Add(unionRelationship); } projectContext.SaveChanges(); if (UnionRelationshipSelected != null) { UnionRelationshipSelected(this, new UnionRelationshipSelectedArg() { UnionRelationship = unionRelationship }); } this.Close(); } }