Esempio n. 1
0
        public void T40_ProductT_r1_Delete()
        {
            Product pt = new Product();

            pt.RevBase.Name = "ProductT";
            pt.Revision     = "r1";
            RevisionedObjectMaint mt = new RevisionedObjectMaint();

            Assert.IsTrue(mt.Remove(pt));
        }
Esempio n. 2
0
        private void ImportRevisionedObjects(Cells cls, string rdoClassName)
        {
            Type classType = model_dll.GetType(rdoClassName);

            using (RevisionedObjectMaint mt = GetRevisionedObjectMaint(rdoClassName))
            {
                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     = 3; // Column 0 is Execute Action, 1 is CompleteMsg, 2 is Name
                    switch (executeAction.ToUpper())
                    {
                    case "INSERT":
                        object o_insert = Activator.CreateInstance(classType);
                        SetRevBase(cls[startRow, 2].Value.ToString(), rdoClassName, classType, ref o_insert);
                        fillClassTypeProperty(cls, firstExecuteCell, startRow, startColumn, classType, ref o_insert, mt);
                        UpdateRecordStatus(executeActionCell, completeMsgCell, mt.Add(o_insert as UO_Model.Base.RevisionedObject));
                        break;

                    case "UPDATE":
                        object o_update = Activator.CreateInstance(classType);
                        SetRevBase(cls[startRow, 2].Value.ToString(), rdoClassName, classType, ref o_update);
                        fillClassTypeProperty(cls, firstExecuteCell, startRow, startColumn, classType, ref o_update, mt);
                        UpdateRecordStatus(executeActionCell, completeMsgCell, mt.Update(o_update as UO_Model.Base.RevisionedObject));
                        break;

                    case "REMOVE":
                    case "DELETE":
                        object o_remove = Activator.CreateInstance(classType);
                        SetRevBase(cls[startRow, 2].Value.ToString(), rdoClassName, classType, ref o_remove);
                        fillClassTypeProperty(cls, firstExecuteCell, startRow, startColumn, classType, ref o_remove, mt);
                        UpdateRecordStatus(executeActionCell, completeMsgCell, mt.Remove(o_remove as UO_Model.Base.RevisionedObject));
                        break;

                    case "IGNORE":
                    default:
                        break;
                    }
                } while (cls[++startRow, 0].Value != null);
            }
        }