public frmEntityOrganizationSecurityIndirect(int entityID) { InitializeComponent(); EntityID = entityID; Message = bizOrganizationSecurity.GetEntityOrganizationSecurityInDirect(EntityID, false); SetRelationshipTails(); SetEntityOrganizationSecurityDirects(); ShowMessage(); }
private EntityOrganizationSecurityInDirectDTO ToEntityOrganizationSecurityInDirectDTO(EntityOrganizationSecurityInDirect item, bool withDetails) { EntityOrganizationSecurityInDirectDTO result = new EntityOrganizationSecurityInDirectDTO(); result.ID = item.ID; result.DirectOrganizationSecurityID = item.EntityOrganizationSecurityDirectID; result.RelationshipTailID = item.EntityRelationshipTailID; result.TableDrivedEntityID = item.TableDrivedEntityID; if (withDetails) { BizEntityRelationshipTail bizEntityRelationshipTail = new BizEntityRelationshipTail(); result.RelationshipTail = bizEntityRelationshipTail.ToEntityRelationshipTailDTO(item.EntityRelationshipTail); result.DirectOrganizationSecurity = ToEntityOrganizationSecurityDirectDTO(item.EntityOrganizationSecurityDirect); } return(result); }
public EntityOrganizationSecurityInDirectDTO GetEntityOrganizationSecurityInDirect(int entityID, bool withDetails) { EntityOrganizationSecurityInDirectDTO result = new EntityOrganizationSecurityInDirectDTO(); using (var projectContext = new DataAccess.MyProjectEntities()) { var item = projectContext.EntityOrganizationSecurityInDirect.FirstOrDefault(x => x.TableDrivedEntityID == entityID); if (item != null) { return(ToEntityOrganizationSecurityInDirectDTO(item, withDetails)); } else { return(null); } } }
public void UpdateEntityOrganizationSecurityInDirect(EntityOrganizationSecurityInDirectDTO message) { using (var projectContext = new DataAccess.MyProjectEntities()) { var dbItem = projectContext.EntityOrganizationSecurityInDirect.FirstOrDefault(x => x.ID == message.ID); if (dbItem == null) { dbItem = new DataAccess.EntityOrganizationSecurityInDirect(); projectContext.EntityOrganizationSecurityInDirect.Add(dbItem); } dbItem.TableDrivedEntityID = message.TableDrivedEntityID; dbItem.EntityOrganizationSecurityDirectID = message.DirectOrganizationSecurityID; dbItem.EntityRelationshipTailID = message.RelationshipTailID; projectContext.SaveChanges(); } }
private void btnSave_Click(object sender, RoutedEventArgs e) { if (cmbDirectOrganizationSecurity.SelectedItem == null) { MessageBox.Show("امنیت سازمان معادل انتخاب نشده است"); return; } if (cmbRelationshipTail.SelectedItem == null) { MessageBox.Show("زنجیره رابطه معادل انتخاب نشده است"); return; } if (Message == null) { Message = new EntityOrganizationSecurityInDirectDTO(); } Message.TableDrivedEntityID = EntityID; Message.DirectOrganizationSecurityID = (int)cmbDirectOrganizationSecurity.SelectedValue; Message.RelationshipTailID = (int)cmbRelationshipTail.SelectedValue; bizOrganizationSecurity.UpdateEntityOrganizationSecurityInDirect(Message); MessageBox.Show("اطلاعات ثبت شد"); }