protected void btnGuardarFamilies_Click(object sender, EventArgs e) { clsFamilies Family = new clsFamilies(); Family.SFamily_name = txtFamily_name.Text; Family.SFamily_desc = txtFamily_desc.Text; Family.IDepreciation_time = Convert.ToInt32(txtDepreciation.Text); if (string.IsNullOrEmpty(txtCodigo.Text)) { int iFamily_id = CFamilies.Insert(Family); txtCodigo.Text = iFamily_id.ToString(); pnlBuscar.Visible = true; LoadFamilies(); grdFamilies.Enabled = true; } else { Family.IFamily_id = Convert.ToInt32(txtCodigo.Text); CFamilies.Update(Family); LoadFamilies(); pnlNuevo.Visible = false; grdFamilies.Enabled = true; } }
public static int Insert(clsFamilies objProxy) { ValidationException x = new ValidationException(); if (string.IsNullOrEmpty(objProxy.SFamily_name)) x.AgregarError("Ingrese el nombre de la Familia"); if (x.Cantidad > 0) throw x; DAOFamilies daoProxy = new DAOFamilies(); return daoProxy.Insert(objProxy.SFamily_name,objProxy.SFamily_desc,objProxy.IDepreciation_time); }
private static clsFamilies Load(DataRow fila) { clsFamilies objProxy = new clsFamilies(); objProxy.IFamily_id = Convert.ToInt32(fila["iFamily_id"]); objProxy.SFamily_name = fila["sFamily_name"].ToString(); objProxy.SFamily_desc = fila["sFamily_desc"].ToString(); objProxy.IDepreciation_time = Convert.ToInt32(fila["iDepreciation_time"]); return objProxy; }