public static LIType Find(IType objiTypeValues, IType iType, string namePropertyId, string namePropertyName) { var tipoTabelaColuna = new TipoTabelaColuna(iType); tipoTabelaColuna.Get(); var tiposCType = new LIType(); if (tipoTabelaColuna.IDTipoTabelaColuna != null) { var tipoFind = new Tipo(); tipoFind.TipoTabelaColuna = tipoTabelaColuna; var tipos = tipoFind.Find(); foreach (var t in tipos) { var tipo = (Tipo)t; var cType = (IType)Activator.CreateInstance(objiTypeValues.GetType()); var pTipo = cType.GetType().GetProperty(namePropertyId); var pName = cType.GetType().GetProperty(namePropertyName); pTipo.SetValue(cType, cType.PrepareValueProperty(tipo.IDTipo, pTipo.PropertyType), null); pName.SetValue(cType, cType.PrepareValueProperty(tipo.Nome, pName.PropertyType), null); tiposCType.Add(cType); } } return(tiposCType); }
public static void Save(IType objiTypeValues, IType iType, string namePropertyId, string namePropertyName) { var tipoTabelaColuna = new TipoTabelaColuna(iType); try { tipoTabelaColuna.IsTransaction = true; tipoTabelaColuna.Get(); tipoTabelaColuna.Save(); var tipo = new Tipo(); tipo.Transaction = tipoTabelaColuna.Transaction; tipo.IDTipo = (int?)objiTypeValues.GetType().GetProperty(namePropertyId).GetValue(objiTypeValues, null); tipo.Nome = (string)objiTypeValues.GetType().GetProperty(namePropertyName).GetValue(objiTypeValues, null); tipo.TipoTabelaColuna = tipoTabelaColuna; tipo.Save(); tipoTabelaColuna.Commit(); } catch (Exception err) { tipoTabelaColuna.Rollback(); throw err; } }
public static void Get(IType objiTypeValues, IType iType, string namePropertyId, string namePropertyName) { var pTipo = objiTypeValues.GetType().GetProperty(namePropertyId); var pName = objiTypeValues.GetType().GetProperty(namePropertyName); if (pTipo.GetValue(objiTypeValues, null) == null) { throw new TradeVisionValidationError("IDTipo obrigatório para a ação GET"); } var tipoTabelaColuna = new TipoTabelaColuna(iType); tipoTabelaColuna.Get(); if (tipoTabelaColuna.IDTipoTabelaColuna != null) { var tipo = new Tipo(); tipo.TipoTabelaColuna = tipoTabelaColuna; tipo.IDTipo = (int?)pTipo.GetValue(objiTypeValues, null); tipo.Get(); if (tipo.IDTipo != null) { pName.SetValue(objiTypeValues, objiTypeValues.PrepareValueProperty(tipo.Nome, pName.PropertyType), null); } } }
public static void Delete(IType objiTypeValues, IType iType, string namePropertyId) { var pTipo = objiTypeValues.GetType().GetProperty(namePropertyId); if (pTipo.GetValue(objiTypeValues, null) == null) { throw new TradeVisionValidationError("IDTipo obrigatório para a ação GET"); } var tipoTabelaColuna = new TipoTabelaColuna(iType); tipoTabelaColuna.Get(); if (tipoTabelaColuna.IDTipoTabelaColuna != null) { var tipo = new Tipo(); tipo.TipoTabelaColuna = tipoTabelaColuna; tipo.IDTipo = (int?)pTipo.GetValue(objiTypeValues, null); tipo.Delete(); } }
protected void btnSalvar_Click(object sender, EventArgs e) { var TipoTabelaColuna = new TipoTabelaColuna(); try { if (txtId.Text != "") { TipoTabelaColuna.IDTipoTabelaColuna = int.Parse(txtId.Text); TipoTabelaColuna.Get(); } TipoTabelaColuna.Tabela = txtTabela.Text; TipoTabelaColuna.Coluna = txtColuna.Text; TipoTabelaColuna.Save(); GetTipoTabelaColuna((int)TipoTabelaColuna.IDTipoTabelaColuna); Page.ClientScript.RegisterStartupScript(this.GetType(), "script", "<script>alert('Registro salvo.')</script>"); } catch (Exception err) { Page.ClientScript.RegisterStartupScript(this.GetType(), "script", "<script>alert('" + FormatError.FormatMessageForJAlert(err.Message) + "')</script>"); } }
private void GetTipoTabelaColuna(int idTipoTabelaColuna) { dvSalvarTipoTabelaColuna.Visible = true; dvListarTipoTabelaColunas.Visible = false; var TipoTabelaColuna = new TipoTabelaColuna(); TipoTabelaColuna.IDTipoTabelaColuna = idTipoTabelaColuna; TipoTabelaColuna.Get(); txtId.Text = TipoTabelaColuna.IDTipoTabelaColuna.ToString(); txtTabela.Text = TipoTabelaColuna.Tabela.ToString(); txtColuna.Text = TipoTabelaColuna.Coluna.ToString(); }
public static void Delete(IType objiTypeValues, IType iType, string namePropertyId) { var pTipo = objiTypeValues.GetType().GetProperty(namePropertyId); if (pTipo.GetValue(objiTypeValues, null) == null) throw new TradeVisionValidationError("IDTipo obrigatório para a ação GET"); var tipoTabelaColuna = new TipoTabelaColuna(iType); tipoTabelaColuna.Get(); if (tipoTabelaColuna.IDTipoTabelaColuna != null) { var tipo = new Tipo(); tipo.TipoTabelaColuna = tipoTabelaColuna; tipo.IDTipo = (int?)pTipo.GetValue(objiTypeValues, null); tipo.Delete(); } }
public static void Save(IType objiTypeValues, IType iType, string namePropertyId, string namePropertyName) { var tipoTabelaColuna = new TipoTabelaColuna(iType); try { tipoTabelaColuna.IsTransaction = true; tipoTabelaColuna.Get(); tipoTabelaColuna.Save(); var tipo = new Tipo(); tipo.Transaction = tipoTabelaColuna.Transaction; tipo.IDTipo = (int?)objiTypeValues.GetType().GetProperty(namePropertyId).GetValue(objiTypeValues, null); tipo.Nome = (string)objiTypeValues.GetType().GetProperty(namePropertyName).GetValue(objiTypeValues, null); tipo.TipoTabelaColuna = tipoTabelaColuna; tipo.Save(); tipoTabelaColuna.Commit(); } catch (Exception err) { tipoTabelaColuna.Rollback(); throw err; } }
public static LIType Find(IType objiTypeValues, IType iType, string namePropertyId, string namePropertyName) { var tipoTabelaColuna = new TipoTabelaColuna(iType); tipoTabelaColuna.Get(); var tiposCType = new LIType(); if (tipoTabelaColuna.IDTipoTabelaColuna != null) { var tipoFind = new Tipo(); tipoFind.TipoTabelaColuna = tipoTabelaColuna; var tipos = tipoFind.Find(); foreach (var t in tipos) { var tipo = (Tipo)t; var cType = (IType)Activator.CreateInstance(objiTypeValues.GetType()); var pTipo = cType.GetType().GetProperty(namePropertyId); var pName = cType.GetType().GetProperty(namePropertyName); pTipo.SetValue(cType, cType.PrepareValueProperty(tipo.IDTipo, pTipo.PropertyType), null); pName.SetValue(cType, cType.PrepareValueProperty(tipo.Nome, pName.PropertyType), null); tiposCType.Add(cType); } } return tiposCType; }