예제 #1
0
        public void T50_Enterprise_Dump_With_Factory()
        {
            Enterprise ent = new Enterprise();

            ent.Name = "UO Soft Company";
            NamedObjectMaint mt = new NamedObjectMaint();

            Assert.IsTrue(mt.Dump(ent));
        }
예제 #2
0
        public void T60_Factory_Dump()
        {
            Factory f = new Factory();

            f.Name = "Factory 1";
            NamedObjectMaint mt = new NamedObjectMaint();

            Assert.IsTrue(mt.Dump(f));
        }
예제 #3
0
        public void T30_Enterprise_Delete()
        {
            Enterprise ent = new Enterprise();

            ent.Name = "Eric";
            NamedObjectMaint mt = new NamedObjectMaint();

            Assert.IsTrue(mt.Remove(ent));
        }
예제 #4
0
        public void T80_Enterprise_Delete()
        {
            Enterprise ent = new Enterprise();

            ent.Name = "UO Soft Company";
            NamedObjectMaint mt = new NamedObjectMaint();

            Assert.IsTrue(mt.Remove(ent));
        }
예제 #5
0
        public void T20_Enterprise_Update()
        {
            Enterprise ent = new Enterprise();

            ent.Name          = "Eric";
            ent.ReportHeading = "Eric Guo Reporting Heading Updated at " + DateTime.Now.ToString();
            NamedObjectMaint mt = new NamedObjectMaint();

            Assert.IsTrue(mt.Update(ent));
        }
예제 #6
0
        public void T10_Enterprise_Add()
        {
            Enterprise ent = new Enterprise();

            ent.Name          = "Eric";
            ent.Description   = DateTime.Now.ToString();
            ent.ReportHeading = "Eric Guo Reporting Heading";
            NamedObjectMaint mt = new NamedObjectMaint();

            Assert.IsTrue(mt.Add(ent));
        }
예제 #7
0
        public void T90_Factories_Delete()
        {
            Factory f1 = new Factory();

            f1.Name = "Factory 1";
            Factory f2 = new Factory();

            f2.Name = "Factory 2";
            Factory f2u = new Factory();

            f2u.Name = "Updated Factory 2";
            NamedObjectMaint mt = new NamedObjectMaint();

            Assert.IsTrue(mt.Remove(f1));
            Assert.IsTrue(mt.Remove(f2));
            Assert.IsTrue(mt.Remove(f2u));
        }
예제 #8
0
        private void ImportNamedObjects(Cells cls, string ndoClassName)
        {
            Type classType = model_dll.GetType(ndoClassName);

            using (NamedObjectMaint mt = GetNamedObjectMaint(ndoClassName))
            {
                Cell firstExecuteCell = cls.FindString("Execute", null);
                int  startRow         = firstExecuteCell.Row + 1;
                do
                {
                    Cell executeActionCell = cls[startRow, 0];
                    if (executeActionCell.Value == null)
                    {
                        break;
                    }
                    string executeAction   = executeActionCell.Value.ToString();
                    Cell   completeMsgCell = cls[startRow, 1];
                    int    startColumn     = 2; // Column 0 is Execute Action, 1 is CompleteMsg
                    switch (executeAction.ToUpper())
                    {
                    case "INSERT":
                        object o_insert = Activator.CreateInstance(classType);
                        fillClassTypeProperty(cls, firstExecuteCell, startRow, startColumn, classType, ref o_insert, mt);
                        UpdateRecordStatus(executeActionCell, completeMsgCell, mt.Add(o_insert as UO_Model.Base.NamedObject));
                        break;

                    case "UPDATE":
                        object o_update = Activator.CreateInstance(classType);
                        fillClassTypeProperty(cls, firstExecuteCell, startRow, startColumn, classType, ref o_update, mt);
                        UpdateRecordStatus(executeActionCell, completeMsgCell, mt.Update(o_update as UO_Model.Base.NamedObject));
                        break;

                    case "REMOVE":
                    case "DELETE":
                        object o_remove = Activator.CreateInstance(classType);
                        fillClassTypeProperty(cls, firstExecuteCell, startRow, startColumn, classType, ref o_remove, mt);
                        UpdateRecordStatus(executeActionCell, completeMsgCell, mt.Remove(o_remove as UO_Model.Base.NamedObject));
                        break;

                    case "IGNORE":
                    default:
                        break;
                    }
                } while (cls[++startRow, 0].Value != null);
            }
        }
예제 #9
0
        public void T70_Enterprise_Update_With_Factory()
        {
            Enterprise ent = new Enterprise();

            ent.Name          = "UO Soft Company";
            ent.ReportHeading = "Updated UO Soft Reporting Heading";
            Factory f1 = new Factory();

            f1.Name        = "Factory 1";
            f1.Description = "Description for Updated Factory 1"; // Exist NDO will only add, not update it's description
            Factory f2 = new Factory();

            f2.Name        = "Updated Factory 2";
            f2.Description = "Description for Updated Factory 2";
            ent.Factories.Add(f1);
            ent.Factories.Add(f2);
            NamedObjectMaint mt = new NamedObjectMaint();

            Assert.IsTrue(mt.Update(ent));
        }
예제 #10
0
        public void T40_Enterprise_Add_With_Factory()
        {
            Enterprise ent = new Enterprise();

            ent.Name          = "UO Soft Company";
            ent.Description   = DateTime.Now.ToString();
            ent.ReportHeading = "UO Soft Reporting Heading";
            Factory f1 = new Factory();

            f1.Name        = "Factory 1";
            f1.Description = "Description for Factory 1";
            Factory f2 = new Factory();

            f2.Name        = "Factory 2";
            f2.Description = "Description for Factory 2";
            ent.Factories.Add(f1);
            ent.Factories.Add(f2);
            NamedObjectMaint mt = new NamedObjectMaint();

            Assert.IsTrue(mt.Add(ent));
        }