Exemplo n.º 1
0
        public void LoadItemType()
        {
            ItemTypeDAL itemType = new ItemTypeDAL();
            DataTable   result   = new DataTable();

            result = itemType.LoadIemType();
            dlItemType.DataSource = result;
            dlItemType.DataBind();
        }
Exemplo n.º 2
0
        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();
        }
Exemplo n.º 3
0
 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));
     }
 }
Exemplo n.º 4
0
        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));
            }
        }
Exemplo n.º 5
0
        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));
            }
        }
Exemplo n.º 6
0
        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));
            }
        }