public void InserirSocio() { if ((vTP_Modo.Equals(TTpModo.tm_Insert) || vTP_Modo.Equals(TTpModo.tm_Edit)) && (BS_CadEmpresa.Current != null)) { using (TFSociosEmpresa fSocio = new TFSociosEmpresa()) { if (fSocio.ShowDialog() == DialogResult.OK) { if (fSocio.rSocio != null) { if ((BS_CadEmpresa.Current as TRegistro_CadEmpresa).lSocios.Exists(p => p.Cd_clifor.Trim().Equals(fSocio.rSocio.Cd_clifor.Trim()))) { (BS_CadEmpresa.Current as TRegistro_CadEmpresa).lSocios.Find(p => p.Cd_clifor.Trim().Equals(fSocio.rSocio.Cd_clifor.Trim())).Ds_funcao = fSocio.rSocio.Ds_funcao; (BS_CadEmpresa.Current as TRegistro_CadEmpresa).lSocios.Find(p => p.Cd_clifor.Trim().Equals(fSocio.rSocio.Cd_clifor.Trim())).Dt_inclusao = fSocio.rSocio.Dt_inclusao; (BS_CadEmpresa.Current as TRegistro_CadEmpresa).lSocios.Find(p => p.Cd_clifor.Trim().Equals(fSocio.rSocio.Cd_clifor.Trim())).Dt_saida = fSocio.rSocio.Dt_saida; (BS_CadEmpresa.Current as TRegistro_CadEmpresa).lSocios.Find(p => p.Cd_clifor.Trim().Equals(fSocio.rSocio.Cd_clifor.Trim())).St_responsavel = fSocio.rSocio.St_responsavel; } else { (BS_CadEmpresa.Current as TRegistro_CadEmpresa).lSocios.Add(fSocio.rSocio); } BS_CadEmpresa.ResetCurrentItem(); } } } } }
public void AlterarSocio() { if ((vTP_Modo.Equals(TTpModo.tm_Insert) || vTP_Modo.Equals(TTpModo.tm_Edit)) && (bsSocios.Current != null)) { using (TFSociosEmpresa fSocio = new TFSociosEmpresa()) { string funcao = (bsSocios.Current as TRegistro_SociosEmpresa).Ds_funcao; DateTime?dt_inc = (bsSocios.Current as TRegistro_SociosEmpresa).Dt_inclusao; DateTime?dt_sai = (bsSocios.Current as TRegistro_SociosEmpresa).Dt_saida; string st_res = (bsSocios.Current as TRegistro_SociosEmpresa).St_responsavel; fSocio.rSocio = bsSocios.Current as TRegistro_SociosEmpresa; if (fSocio.ShowDialog() != DialogResult.OK) { (bsSocios.Current as TRegistro_SociosEmpresa).Ds_funcao = funcao; (bsSocios.Current as TRegistro_SociosEmpresa).Dt_inclusao = dt_inc; (bsSocios.Current as TRegistro_SociosEmpresa).Dt_saida = dt_sai; (bsSocios.Current as TRegistro_SociosEmpresa).St_responsavel = st_res; } BS_CadEmpresa.ResetCurrentItem(); } } }