private static clsCostCenter Cargar(DataRow fila) { clsCostCenter objProxy = new clsCostCenter(); objProxy.ICostCenter_id = Convert.ToInt32(fila["iCostCenter_id"]); objProxy.SCostCente_name = fila["sCostCenter_name"].ToString(); objProxy.SCostCenter_desc = fila["sCostCenter_desc"].ToString(); objProxy.DGestion_time = Convert.ToInt32(fila["iCostCenter_gestion"]); return objProxy; }
public static int Insert(clsCostCenter objProxy) { ValidationException x = new ValidationException(); if (string.IsNullOrEmpty(objProxy.SCostCente_name)) x.AgregarError("Ingrese el nombre del centro de costo"); if (x.Cantidad > 0) throw x; DAOCostCenter daoProxy = new DAOCostCenter(); return daoProxy.Insert(objProxy.SCostCente_name, objProxy.SCostCenter_desc, objProxy.DGestion_time); }
public static bool Update(clsCostCenter objProxy) { ValidationException x = new ValidationException(); if (objProxy.ICostCenter_id <= 0) x.AgregarError("Ingrese el código"); if (string.IsNullOrEmpty(objProxy.SCostCente_name)) x.AgregarError("Ingrese el nombre del centro"); if (x.Cantidad > 0) throw x; DAOCostCenter daoProxy = new DAOCostCenter(); return daoProxy.Update(objProxy.ICostCenter_id, objProxy.SCostCente_name, objProxy.SCostCenter_desc, objProxy.DGestion_time); }
protected void btguardar_Click(object sender, EventArgs e) { clsCostCenter cc = new clsCostCenter(); cc.SCostCente_name = txtNombrecc.Text; cc.SCostCenter_desc = txtDesccc.Text; cc.DGestion_time = Convert.ToInt32(txtGestioncc.Text); if (string.IsNullOrEmpty(txtCodigocc.Text)) { /* int codigo = CCostCenter.Insert(cc); txtCodigo.Text = codigo.ToString(); pnlBuscar.Visible = true; CargarGrid(); grdCostCenter.Enabled = true;*/ int codigo = CCostCenter.Insert(cc); CargarGrid(); this.pnlBuscar.Visible = true; } else { cc.ICostCenter_id = Convert.ToInt32(txtCodigocc.Text); CCostCenter.Update(cc); CargarGrid(); pnlNuevo.Visible = false; grdCostCenter.Enabled = true; /* clsCostCenter c = new clsCostCenter(); c.SCostCente_name = txtNombrecc.Text; c.SCostCenter_desc = txtDesccc.Text; c.DGestion_time = Convert.ToInt16(txtGestioncc.Text); c.ICostCenter_id = Convert.ToInt32(txtCodigocc.Text); bool codigo = CCostCenter.Update(c); txtNombrecc.Text = codigo.ToString();*/ CargarGrid(); this.pnlBuscar.Visible = true; } }