Ejemplo n.º 1
0
        public static InventoryCommandDim GetDefault(Session session, InventoryCommandDimEnum code)
        {
            InventoryCommandDim ret = null;

            try
            {
                ret = session.FindObject <InventoryCommandDim>(
                    new BinaryOperator("Code", Enum.GetName(typeof(InventoryCommandDimEnum), code)));
                return(ret);
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 2
0
        public static void Populate()
        {
            Session session = null;

            try
            {
                session = XpoHelper.GetNewSession();
                //insert default data into Organization table
                if (!Util.isExistXpoObject <InventoryCommandDim>("Code", Enum.GetName(typeof(InventoryCommandDimEnum), InventoryCommandDimEnum.NAAN_DEFAULT)))
                {
                    InventoryCommandDim command = new InventoryCommandDim(session)
                    {
                        Description = "Default inventory command",
                        Name        = "Default inventory command",
                        RowStatus   = 1,
                        Code        = Enum.GetName(typeof(InventoryCommandDimEnum), InventoryCommandDimEnum.NAAN_DEFAULT),
                        IssueDate   = DateTime.MinValue
                    };

                    command.Save();
                }

                if (!Util.isExistXpoObject <InventoryCommandDim>("Code", Enum.GetName(typeof(InventoryCommandDimEnum), InventoryCommandDimEnum.UNKNOWN)))
                {
                    InventoryCommandDim command = new InventoryCommandDim(session)
                    {
                        Description = "Unknown inventory command",
                        Name        = "Unknown inventory command",
                        RowStatus   = 1,
                        Code        = Enum.GetName(typeof(InventoryCommandDimEnum), InventoryCommandDimEnum.UNKNOWN),
                        IssueDate   = DateTime.MinValue
                    };

                    command.Save();
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                if (session != null)
                {
                    session.Dispose();
                }
            }
        }