Esempio n. 1
0
 private void View_CreateCustomCurrentObjectDetailView(object sender,
                                                       CreateCustomCurrentObjectDetailViewEventArgs e)
 {
     if (e.ListViewCurrentObject is ThinResult currentRec)
     {
         currentRec.FatResults = HandyFunctions.MakeFatResults(currentRec.Id, View.ObjectSpace);
     }
 }
 private void View_CreateCustomCurrentObjectDetailView(object sender, CreateCustomCurrentObjectDetailViewEventArgs e)
 {
     //当前有选中的对象
     if (e.ListViewCurrentObject != null)
     {
         //当前详细视图不为空,或 当前详细视图类型与当前对象类型不符
         if (string.IsNullOrEmpty(e.DetailViewId) || e.CurrentDetailView.Model.ModelClass.TypeInfo.Type != e.ListViewCurrentObject.GetType())
         {
             e.DetailViewId = Application.FindDetailViewId(e.ListViewCurrentObject.GetType());
         }
     }
 }
Esempio n. 3
0
 private void View_CreateCustomCurrentObjectDetailView(object sender,
                                                       CreateCustomCurrentObjectDetailViewEventArgs e)
 {
     if (e.ListViewCurrentObject == null)
     {
         return;
     }
     if (!(e.ListViewCurrentObject is Cat currentRec))
     {
         throw new Exception("Unexpected");
     }
     //  var os = Application.CreateObjectSpace(typeof(Cat));
     currentRec.CatShow = MakeCatShow();
 }
Esempio n. 4
0
        private void View_CreateCustomCurrentObjectDetailView(object sender, CreateCustomCurrentObjectDetailViewEventArgs e)
        {
            if (e.ListViewCurrentObject == null)
            {
                return;
            }
            if (!(e.ListViewCurrentObject is XMyClass currentRec))
            {
                throw new Exception("Unexpected");
            }
            // var os = Application.CreateObjectSpace(typeof(JobExt));

            //var connectionString = ConfigurationManager.ConnectionStrings["ConnectionJobTalk"].ConnectionString;
            //switch (currentRec.TemplateId)
            //{
            //    case 50:
            //    {
            //        if (currentRec.Pricing == null)
            //        {
            //            var snapInController = new VivUniversalController(connectionString);

            //            // var jobId = 127264;
            //            snapInController.Load(currentRec.JobId);
            //            currentRec.Pricing = snapInController.modelSpecLine.uniModel.PricingViv;
            //        }

            //        break;
            //    }
            //    case 61:
            //    {
            //        if (currentRec.QtyBreakPricing == null)
            //        {
            //            var snapInController = new VivQtyBreakController(connectionString);
            //            int staffId;
            //            using (var db = new JobTalkDbContext())
            //            {
            //                staffId = HandyBusinessFunctions.GetStaffIdForLoggedInUser(db, true);
            //            }

            //            snapInController.Load(currentRec.JobId, staffId);
            //            currentRec.QtyBreakPricing = snapInController.Model.ModelBo;
            //        }

            //        break;
            //    }
            //}
            // var os = Application.CreateObjectSpace(typeof(JobExt));
        }
Esempio n. 5
0
 private void CategoryListViewController_CreateCustomCurrentObjectDetailView(object sender, CreateCustomCurrentObjectDetailViewEventArgs arg)
 {
     if (arg.ListViewCurrentObject != null)
     {
         arg.DetailViewId = Application.GetDetailViewId(arg.ListViewCurrentObject.GetType());
     }
 }
Esempio n. 6
0
        private void NonPersistentController_CreateCustomCurrentObjectDetailView(object sender, CreateCustomCurrentObjectDetailViewEventArgs e)
        {
            UpdateCacheFromObjectSpace();
            //var gridEditor = View.Editor as GridListEditor;
            //var objects = gridEditor.GetSelectedObjects();
            //var focussedObj = gridEditor.FocusedObject as INonPersistent;
            //var curObj = View.CurrentObject as INonPersistent;
            //if (focussedObj?.Id != curObj?.Id)
            //{

            //    Trace.WriteLine($"focus:{focussedObj?.Id} cur:{curObj?.Id}");
            //}
            //Trace.WriteLine($"Focussed obj is {focussedObj?.Id}");
            //foreach (INonPersistent npObj in objects)
            //{

            //    gridEditor.FocusedObject = npObj;
            //    Trace.WriteLine($"obj id:{npObj.Id} index {npObj.CacheIndex}");
            //    View.CurrentObject = npObj;
            //}

            var obj     = View.CurrentObject as IXafEntityObject;
            var objAsnp = obj as INonPersistentBusinessObject;

            Trace.WriteLine($"objAsNp id:{objAsnp?.Id} index {objAsnp?.CacheIndex}");
            obj?.OnLoaded();
            Trace.WriteLine("");
        }
 // Кастомизация редактора элемента
 private void ListView_CreateCustomCurrentObjectDetailView(object sender, CreateCustomCurrentObjectDetailViewEventArgs e)
 {
     if (e.ListViewCurrentObject != null)
         e.DetailView = Application.CreateDetailView(ObjectSpaceInMemory.CreateNew(), e.ListViewCurrentObject);
 }