Exemplo n.º 1
0
        private void actionPreviewRestoredData_CustomizePopupWindowParams(object sender, CustomizePopupWindowParamsEventArgs e)
        {
            ListPropertyEditor editor = (this.View as DetailView).FindItem("DeletedItems") as ListPropertyEditor;

            if (editor != null)
            {
                IObjectSpace space          = Application.CreateObjectSpace();
                RestoredObjectsParameters p = new RestoredObjectsParameters();
                using (AuditTrailRestoreHelper helper = new AuditTrailRestoreHelper(space))
                {
                    foreach (RestoreItemDetails details in editor.ListView.SelectedObjects)
                    {
                        helper.RestoreObject(space.GetObject <AuditDataItemPersistent>(details.AuditTrailItem));
                    }

                    foreach (object obj in helper.RestoredObjects)
                    {
                        p.ObjectsToRestore.Add(new RestoredObjectDetails()
                        {
                            Name = CaptionHelper.GetDisplayText(obj), Type = CaptionHelper.GetClassCaption(XafTypesInfo.Instance.FindTypeInfo(obj.GetType()).Type.FullName)
                        });
                    }
                }

                IObjectSpace previewspace = Application.CreateObjectSpace(typeof(RestoredObjectsParameters));
                e.View = Application.CreateDetailView(previewspace, p);
                e.DialogController.SaveOnAccept = false;
            }
        }
Exemplo n.º 2
0
        protected override void Save(XDocument document)
        {
            var stream = new MemoryStream();

            document.Save(stream);
            HttpContext.Current.Response.ClearHeaders();
            ResponseWriter.WriteFileToResponse(stream, CaptionHelper.GetClassCaption(View.ObjectTypeInfo.Type.FullName) + ".xml");
        }
Exemplo n.º 3
0
 public static String Get_Object(IDCTypePermissions typePermissions)
 {
     if (typePermissions.TargetType != null)
     {
         String classCaption = CaptionHelper.GetClassCaption(typePermissions.TargetType.FullName);
         return(String.IsNullOrEmpty(classCaption) ? typePermissions.TargetType.Name : classCaption);
     }
     return(String.Empty);
 }
        private void RepositoryItemOnCustomItemDisplayText(object sender, CustomItemDisplayTextEventArgs e)
        {
            var typeInfo = XafTypesInfo.Instance.FindTypeInfo($"{e.Item}");

            if (typeInfo != null)
            {
                e.DisplayText = CaptionHelper.GetClassCaption(typeInfo.FullName);
            }
        }
Exemplo n.º 5
0
        protected override void DashbardExportXMLExecute(object sender, SimpleActionExecuteEventArgs e)
        {
            base.DashbardExportXMLExecute(sender, e);
            var stream   = new MemoryStream();
            var document = XDocument.Parse(((IDashboardDefinition)View.CurrentObject).Xml);

            document.Save(stream);
            HttpContext.Current.Response.ClearHeaders();
            ResponseWriter.WriteFileToResponse(stream, CaptionHelper.GetClassCaption(View.ObjectTypeInfo.Type.FullName) + ".xml");
        }
Exemplo n.º 6
0
 private void SetUpFilterAction(bool active)
 {
     _filterSingleChoiceAction.Active["PropertyPath is valid"] = active;
     foreach (var pair in _filtersByPropertyPathWrappers)
     {
         if (pair.Value.BinaryOperatorLastMemberClassType != null)
         {
             var caption = CaptionHelper.GetClassCaption(pair.Value.BinaryOperatorLastMemberClassType.FullName);
             _filterSingleChoiceAction.Items.Add(new ChoiceActionItem(caption, pair.Value));
         }
     }
 }
Exemplo n.º 7
0
        protected override void Save(XDocument document)
        {
            var response = HttpContext.Current.Response;

            response.Clear();
            response.AddHeader("Content-Disposition", "attachment;filename=" + CaptionHelper.GetClassCaption(View.ObjectTypeInfo.Type.FullName) + ".xml");
            var xml = document.ToString(SaveOptions.DisableFormatting);

            response.AddHeader("Content-Length", xml.Length.ToString());
            response.ContentType = "application/octet-stream";
            response.Write(xml);
            response.End();
        }
Exemplo n.º 8
0
        public virtual void SendThresholdCalculationMail(string subjectTemplate, string criteria, int count, Type type, ThresholdSeverity severity, string to)
        {
            var model = new {
                Criteria = criteria,
                Count    = count,
                DataType = CaptionHelper.GetClassCaption(type.FullName),
                Severity = severity
            };
            var mail = TemplateEngine.Execute(_name, model);

            to.Split(';').Each(s => mail.To.Add(s));
            mail.From    = ConfigurationManager.AppSettings["ThresholdEmailJobFrom"];
            mail.Subject = subjectTemplate;
            Sender.Send(mail);
        }
Exemplo n.º 9
0
 private static void AddNewDataSources(IDashboardDefinition dashboardDefinition, DevExpress.DashboardCommon.Dashboard dashboard)
 {
     foreach (var typeWrapper in dashboardDefinition.DashboardTypes)
     {
         var exists = dashboard.DataSources.OfType <DashboardObjectDataSource>()
                      .Any(source => Equals(source.DataSource, typeWrapper.Type));
         if (!exists)
         {
             var dataSource = new DashboardObjectDataSource {
                 DataSourceType = typeWrapper.Type,
                 Name           = CaptionHelper.GetClassCaption(typeWrapper.Type.FullName),
                 ComponentName  = typeWrapper.Type.Name
             };
             dashboard.DataSources.Add(dataSource);
         }
     }
 }
Exemplo n.º 10
0
        public virtual void SendThresholdCalculationMail(string subjectTemplate, string criteria, int count, Type type, ThresholdSeverity severity, string to)
        {
            var model = new {
                Criteria = criteria,
                Count    = count,
                DataType = CaptionHelper.GetClassCaption(type.FullName),
                Severity = severity
            };
            MailMessage mail = new MailMessage();

            to.Split(';').Each(s => mail.To.Add(s));
            var emailTemplate = _jobDataMap.GetString <SendEmailJobDataMap>(map => map.EmailTemplate);

            mail.Body    = _razorEngineService.RunCompile(emailTemplate, Guid.NewGuid().ToString(), null, model);
            mail.From    = new MailAddress(ConfigurationManager.AppSettings["ThresholdEmailJobFrom"]);
            mail.Subject = subjectTemplate;
            Sender.Send(mail);
        }
Exemplo n.º 11
0
        private void InitSearchObjectActionItems()
        {
            SearchObjectAction.BeginUpdate();
            SearchObjectAction.Items.Clear();
            Type   genericType = typeof(SearchObjectBase <>).MakeGenericType(View.ObjectTypeInfo.Type);
            string imageName   = View.Model.ImageName;

            foreach (ITypeInfo typeInfo in XafTypesInfo.Instance.PersistentTypes)
            {
                if (genericType.IsAssignableFrom(typeInfo.Type) && !typeInfo.IsAbstract)
                {
                    ChoiceActionItem item = new ChoiceActionItem(CaptionHelper.GetClassCaption(typeInfo.FullName), typeInfo.Type);
                    item.ImageName = imageName;
                    SearchObjectAction.Items.Add(item);
                }
            }
            SearchObjectAction.EndUpdate();
        }
Exemplo n.º 12
0
        protected override void PopulateTypes()
        {
            base.PopulateTypes();
            var grid = ((ASPxGridListEditor)View.Editor).Grid;
            var dataComboBoxColumn = grid.Columns
                                     .OfType <GridViewDataComboBoxColumn>()
                                     .First(column => column.FieldName == nameof(ExcelColumnMapMemberTypeValue.Type));
            var comboBox = dataComboBoxColumn.PropertiesComboBox;

            comboBox.AllowNull     = false;
            comboBox.DropDownStyle = DropDownStyle.DropDownList;
            comboBox.Items.Clear();
            var types   = GetTypes();
            var sources = types
                          .Select(type => new ListEditItem(CaptionHelper.GetClassCaption(type.FullName), type)).ToArray();

            comboBox.Items.AddRange(sources);
        }
Exemplo n.º 13
0
        public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object val)
        {
            Type result = null;

            if (val != null)
            {
                var caption = val.ToString();
                foreach (var classInfo in XafTypesInfo.Instance.PersistentTypes)
                {
                    if (classInfo.IsVisible && CaptionHelper.GetClassCaption(classInfo.FullName) == caption)
                    {
                        result = classInfo.Type;
                        break;
                    }
                }
            }

            return(result);
        }
Exemplo n.º 14
0
        protected override void UpdateActionState(object objectToOpen)
        {
            base.UpdateActionState(objectToOpen);

            if ((Application.Model.Options as IModelOpenObjectOptions).ShowTypeNameInOpenObject)
            {
                string caption    = Application.Model.ActionDesign.Actions["OpenObject"].Caption;
                string altcaption = CaptionHelper.GetLocalizedText("Texts", "OpenObjectWithCaption");
                OpenObjectAction.Caption = objectToOpen == null ? caption : String.Format(altcaption, CaptionHelper.GetClassCaption(objectToOpen.GetType().FullName));
            }
        }
        public override string ToString()
        {
            var enumDescriptor = new EnumDescriptor(typeof(ApplicationModelCombineModifier));

            return(CaptionHelper.GetClassCaption(GetType().FullName) + " (" + enumDescriptor.GetCaption(Modifier) + "," + Difference + ")");
        }
Exemplo n.º 16
0
        protected override string GetPermissionInfoCaption()
        {
            var enumDescriptor = new EnumDescriptor(typeof(ApplicationModelCombineModifier));

            return(CaptionHelper.GetClassCaption(GetType().FullName) + " (" + enumDescriptor.GetCaption(Modifier) + ")");
        }
Exemplo n.º 17
0
 protected string GetFileName(bool isZipped)
 {
     return(CaptionHelper.GetClassCaption(View.ObjectTypeInfo.Type.FullName) + (isZipped ? ".zip" : ".xml"));
 }
        private void actionViewAuditTrail_CustomizePopupWindowParams(object sender, CustomizePopupWindowParamsEventArgs e)
        {
            IObjectSpace space = Application.CreateObjectSpace();

            if (space is XPObjectSpace)
            {
                object            audit   = this.View.CurrentObject;
                AuditTrailDetails details = new AuditTrailDetails((space as XPObjectSpace).Session, audit);
                details.Name = String.Format(CaptionHelper.GetLocalizedText("Texts", "AuditTrailTitle"), CaptionHelper.GetClassCaption(XafTypesInfo.Instance.FindTypeInfo(audit.GetType()).Type.FullName));
                e.View       = Application.CreateDetailView(space, details);
            }
        }
Exemplo n.º 19
0
 public AuditTrailDetails(Session session, object audit)
 {
     _name      = String.Format("Audit trail for {0}", CaptionHelper.GetClassCaption(audit.GetType().FullName));
     AuditTrail = AuditedObjectWeakReference.GetAuditTrail(session, audit);
 }
Exemplo n.º 20
0
        private ActionExecutePermissionDescriptor CreateNewActionOperationPermissionDescriptor(Type type, String targetAction, bool executeFromType)
        {
            string reason = "";

            if (executeFromType)
            {
                reason = string.Concat(reason, executeFromType ? string.Format(CaptionHelper.GetLocalizedText("Messages", "Execute") + CaptionHelper.GetLocalizedText("Messages", "IsInheritedFrom") + CaptionHelper.GetLocalizedText("Messages", "TargetAction"), CaptionHelper.GetClassCaption(type.FullName)) : "");
            }
            ActionExecutePermissionDescriptor newPermissionDescriptor = new ActionExecutePermissionDescriptor(this, type, targetAction, executeFromType, reason);

            return(newPermissionDescriptor);
        }
Exemplo n.º 21
0
        public static String Get_InheritedFrom(IDCObjectPermissions objectPermissions)
        {
            String result = "";

            if (objectPermissions.Owner != null)
            {
                if (objectPermissions.Owner.AllowRead)
                {
                    result = String.Concat(result, String.Format(CaptionHelper.GetLocalizedText("Messages", "Read") + CaptionHelper.GetLocalizedText("Messages", "IsInheritedFrom"), CaptionHelper.GetClassCaption(objectPermissions.Owner.TargetType.FullName)));
                }
                if (objectPermissions.Owner.AllowWrite)
                {
                    result = String.Concat(result, String.Format(CaptionHelper.GetLocalizedText("Messages", "Write") + CaptionHelper.GetLocalizedText("Messages", "IsInheritedFrom"), CaptionHelper.GetClassCaption(objectPermissions.Owner.TargetType.FullName)));
                }
                if (objectPermissions.Owner.AllowDelete)
                {
                    result = String.Concat(result, String.Format(CaptionHelper.GetLocalizedText("Messages", "Delete") + CaptionHelper.GetLocalizedText("Messages", "IsInheritedFrom"), CaptionHelper.GetClassCaption(objectPermissions.Owner.TargetType.FullName)));
                }
                if (objectPermissions.Owner.AllowNavigate)
                {
                    result = String.Concat(result, String.Format(CaptionHelper.GetLocalizedText("Messages", "Navigate") + CaptionHelper.GetLocalizedText("Messages", "IsInheritedFrom"), CaptionHelper.GetClassCaption(objectPermissions.Owner.TargetType.FullName)));
                }
            }
            return(result);
        }
Exemplo n.º 22
0
 void AddChoiceItem(DataMapTypeAttribute obj)
 {
     _assignDataMapAction.Items.Add(new ChoiceActionItem(CaptionHelper.GetClassCaption(obj.Type.FullName), obj.Type));
 }