Exemple #1
0
 public InventoryCommandDim CreateInventoryCommandDim(Session session, Guid RefId)
 {
     try
     {
         NAS.DAL.Inventory.Command.InventoryCommand command = session.GetObjectByKey <NAS.DAL.Inventory.Command.InventoryCommand>(RefId);
         if (command == null)
         {
             return(null);
         }
         InventoryCommandDim commandDim = new InventoryCommandDim(session);
         commandDim.Code        = command.Code;
         commandDim.Description = command.Description;
         commandDim.RefId       = RefId;
         commandDim.Name        = command.Name;
         commandDim.IssueDate   = command.IssueDate;
         commandDim.CommandType = command.CommandType;
         commandDim.RowStatus   = Constant.ROWSTATUS_ACTIVE;
         commandDim.Save();
         return(commandDim);
     }
     catch (Exception)
     {
         return(null);
     }
 }
        public CustomFieldDataPreDefinitionData GetData(Guid objectCustomFieldId)
        {
            CustomFieldDataPreDefinitionData ret = null;
            Session session = null;

            try
            {
                session = XpoHelper.GetNewSession();

                ObjectCustomField objectCustomField = session.GetObjectByKey <ObjectCustomField>(objectCustomFieldId);

                if (objectCustomField.ObjectCustomFieldDatas != null)
                {
                    ret = new CustomFieldDataPreDefinitionData();

                    foreach (var data in objectCustomField.ObjectCustomFieldDatas)
                    {
                        PredefinitionData predefinitionData = (PredefinitionData)data.CustomFieldDataId;

                        NAS.DAL.Inventory.Command.InventoryCommand Command =
                            session.GetObjectByKey <NAS.DAL.Inventory.Command.InventoryCommand>(predefinitionData.RefId);

                        if (Command != null)
                        {
                            CustomFieldDataPreDefinitionDataItem item = new CustomFieldDataPreDefinitionDataItem()
                            {
                                CustomFieldDataId = predefinitionData.CustomFieldDataId,
                                PredefinitionType = predefinitionData.PredefinitionType,
                                RefId             = predefinitionData.RefId,
                                DisplayText       = Command.Name
                            };
                            ret.Add(item);
                        }
                    }
                }
                return(ret);
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                if (session != null)
                {
                    session.Dispose();
                }
            }
        }