public void LoadItemType() { ItemTypeDAL itemType = new ItemTypeDAL(); DataTable result = new DataTable(); result = itemType.LoadIemType(); dlItemType.DataSource = result; dlItemType.DataBind(); }
protected void btnTypeName_Click(object sender, EventArgs e) { LinkButton btn = (LinkButton)sender; string itemType = btn.Text; ItemTypeDAL itemList = new ItemTypeDAL(); itemInfo = (DataTable)itemList.GetItemFromItemType(itemType); itemInfoView = new DataView(itemInfo); BindListFordlItem(); }
public ResultBM GetItemTypes() { try { ItemTypeDAL itemTypeDal = new ItemTypeDAL(); List <ItemTypeDTO> itemTypeDtos = itemTypeDal.GetItemTypes(); List <ItemTypeBM> itemTypesBm = ConvertIntoBusinessModel(itemTypeDtos); return(new ResultBM(ResultBM.Type.OK, "Recuperación de registros exitosa.", itemTypesBm)); } catch (Exception exception) { return(new ResultBM(ResultBM.Type.EXCEPTION, SessionHelper.GetTranslation("RETRIEVING_ERROR") + " " + exception.Message, exception)); } }
public ResultBM GetItemType(int itemTypeId) { try { ItemTypeDAL itemTypeDal = new ItemTypeDAL(); ItemTypeBM itemTypeBm = null; ItemTypeDTO itemTypeDto = itemTypeDal.GetItemType(itemTypeId); if (itemTypeDto != null) { itemTypeBm = new ItemTypeBM(itemTypeDto); } return(new ResultBM(ResultBM.Type.OK, "Operación exitosa.", itemTypeBm)); } catch (Exception exception) { return(new ResultBM(ResultBM.Type.EXCEPTION, SessionHelper.GetTranslation("RETRIEVING_ERROR") + " " + exception.Message, exception)); } }
public ResultBM Delete(object entity) { try { ItemTypeDAL itemTypeDal = new ItemTypeDAL(); ItemTypeBM itemTypeBm = entity as ItemTypeBM; if (!itemTypeDal.IsInUse(itemTypeBm.id)) { itemTypeDal.DeleteItemType(itemTypeBm.id); return(new ResultBM(ResultBM.Type.OK, "Se ha eliminado el registro.", itemTypeBm)); } else { return(new ResultBM(ResultBM.Type.FAIL, SessionHelper.GetTranslation("ARTICLE_TYPE_UNDELETEABLE_ERROR"), itemTypeBm)); } } catch (Exception exception) { return(new ResultBM(ResultBM.Type.EXCEPTION, SessionHelper.GetTranslation("DELETING_ERROR") + " " + exception.Message, exception)); } }
public ResultBM UpdateItemType(ItemTypeBM itemTypeBm) { try { ItemTypeDAL itemTypeDal = new ItemTypeDAL(); ItemTypeDTO itemTypeDto = null; ResultBM validationResult = IsValid(itemTypeBm); if (!validationResult.IsValid()) { return(validationResult); } itemTypeDto = new ItemTypeDTO(itemTypeBm.id, itemTypeBm.Name, itemTypeBm.category, itemTypeBm.Comment, itemTypeBm.Perishable); itemTypeDal.UpdateItemType(itemTypeDto); return(new ResultBM(ResultBM.Type.OK, "Se ha creado el ítem " + itemTypeBm.Name + ".", itemTypeBm)); } catch (Exception exception) { return(new ResultBM(ResultBM.Type.EXCEPTION, SessionHelper.GetTranslation("UPDATING_ERROR") + " " + exception.Message, exception)); } }