public PropertyStorageInfo SaveOrUpdateMerge(PropertyStorageInfo propertyStorageInfo)
        {
            object mergedObj = Session.Merge(propertyStorageInfo);

            HibernateTemplate.SaveOrUpdate(mergedObj);
            return((PropertyStorageInfo)mergedObj);
        }
 public PropertyStorageInfo Save(PropertyStorageInfo propertyStorageInfo)
 {
     if (propertyStorageInfo.Id == Guid.Empty)
     {
         propertyStorageInfo.Id = Guid.NewGuid();
     }
     HibernateTemplate.Save(propertyStorageInfo);
     return(propertyStorageInfo);
 }
 public void Delete(PropertyStorageInfo propertyStorageInfo)
 {
     HibernateTemplate.Delete(propertyStorageInfo);
 }
 public PropertyStorageInfo SaveOrUpdate(PropertyStorageInfo propertyStorageInfo)
 {
     HibernateTemplate.SaveOrUpdate(propertyStorageInfo);
     return(propertyStorageInfo);
 }
Esempio n. 5
0
        private void PopulateRequestList()
        {
            if (RequestMap != null)
            {
                lvRequest.Items.Clear();

                foreach (MappedProperty prop in RequestMap.MappedProperties)
                {
                    ListViewItem item = new ListViewItem();
                    item.Text = prop.Id.ToString();
                    item.SubItems.Add(prop.Sequence.ToString());
                    item.SubItems.Add(prop.Name);
                    item.SubItems.Add(prop.Type.ToString());

                    if (!string.IsNullOrEmpty(prop.DefaultValue))
                    {
                        item.SubItems.Add(prop.DefaultValue);
                    }
                    else if (prop.DefaultSessionProperty != null)
                    {
                        item.SubItems.Add(string.Format("[{0}]", prop.DefaultSessionProperty.Name));
                    }
                    else
                    {
                        item.SubItems.Add(string.Empty);
                    }

                    item.SubItems.Add(prop.IsSearchable.ToString());
                    item.SubItems.Add(prop.IsCustom.ToString());

                    if (prop.Target != null)
                    {
                        if (prop.Target is Property)
                        {
                            PropertyStorageInfo info = ((Property)prop.Target).StorageInfo;

                            if (info != null &&
                                !string.IsNullOrEmpty(info.TableName) &&
                                !string.IsNullOrEmpty(info.ColumnName))
                            {
                                item.SubItems.Add(string.Format("{0}.{1}", info.TableName, info.ColumnName));
                            }
                            else
                            {
                                item.SubItems.Add(string.Empty);
                            }
                        }
                        else
                        {
                            item.SubItems.Add(string.Empty);
                        }
                    }
                    else
                    {
                        item.SubItems.Add(string.Empty);
                    }

                    item.Tag = prop;
                    lvRequest.Items.Add(item);
                }
            }
        }
Esempio n. 6
0
        private void PopulateResponseList()
        {
            if (ResponseMap != null)
            {
                lvResponse.Items.Clear();

                foreach (MappedProperty prop in ResponseMap.MappedProperties)
                {
                    ListViewItem item = new ListViewItem();
                    item.Text = prop.Id.ToString();
                    item.SubItems.Add(prop.Sequence.ToString());
                    item.SubItems.Add(prop.Name);
                    item.SubItems.Add(prop.Type.ToString());

                    if (!string.IsNullOrEmpty(prop.DefaultValue))
                    {
                        item.SubItems.Add(prop.DefaultValue);
                    }
                    else if (prop.DefaultSessionProperty != null)
                    {
                        item.SubItems.Add(string.Format("[{0}]", prop.DefaultSessionProperty.Name));
                    }
                    else
                    {
                        item.SubItems.Add(string.Empty);
                    }

                    item.SubItems.Add(prop.DisplayFormat);
                    item.SubItems.Add(prop.IsCustom.ToString());

                    if (prop.RequestMappedProperty != null)
                    {
                        MappedProperty reqMP = modelService.GetDomainObject <MappedProperty>(prop.RequestMappedProperty.Id);
                        if (reqMP != null)
                        {
                            item.SubItems.Add(string.Format("{0} - {1}", reqMP.Name, reqMP.ToString()));
                        }
                        else
                        {
                            item.SubItems.Add(string.Format("{0} - {1}", prop.RequestMappedProperty.Name, prop.RequestMappedProperty.ToString()));
                        }
                    }
                    else
                    {
                        item.SubItems.Add(string.Empty);
                    }

                    if (prop.Target != null)
                    {
                        if (prop.Target is Property)
                        {
                            PropertyStorageInfo info = ((Property)prop.Target).StorageInfo;

                            if (info != null &&
                                !string.IsNullOrEmpty(info.TableName) &&
                                !string.IsNullOrEmpty(info.ColumnName))
                            {
                                item.SubItems.Add(string.Format("{0}.{1}", info.TableName, info.ColumnName));
                            }
                            else
                            {
                                item.SubItems.Add(string.Empty);
                            }
                        }
                        else
                        {
                            item.SubItems.Add(string.Empty);
                        }
                    }
                    else
                    {
                        item.SubItems.Add(string.Empty);
                    }

                    item.Tag = prop;
                    lvResponse.Items.Add(item);
                }
            }
        }
Esempio n. 7
0
        private void UpdateListItem(ListViewItem item)
        {
            MappedProperty property = item.Tag as MappedProperty;

            if (property.Source != null)
            {
                item.SubItems[1].Text = string.Format("{0}", property.Source.Name);
                item.SubItems[2].Text = property.Source.Type != null ? property.Source.Type.Name : string.Empty;
            }
            else if (property.IsCustom)
            {
                item.SubItems[1].Text = "[Custom]";
                item.SubItems[2].Text = string.Empty;
            }

            if (property.RequestMappedProperty != null)
            {
                item.SubItems[1].Text = string.Format("[Request] {0}", property.RequestMappedProperty.Name);
            }

            if (property.Target != null)
            {
                item.SubItems[3].Text = property.Name;
                item.SubItems[4].Text = property.Type != null ? property.Type.Name : string.Empty;
            }
            else
            {
                item.SubItems[3].Text = string.Empty;
                item.SubItems[4].Text = string.Empty;
            }

            if (!string.IsNullOrEmpty(property.DefaultValue))
            {
                item.SubItems[5].Text = property.DefaultValue;
            }
            else if (property.DefaultSessionProperty != null)
            {
                item.SubItems[5].Text = string.Format("[{0}]", property.DefaultSessionProperty.Name);
            }
            else
            {
                item.SubItems[5].Text = string.Empty;
            }

            if (property.Target != null)
            {
                if (property.Target is Property)
                {
                    PropertyStorageInfo info = ((Property)property.Target).StorageInfo;

                    if (info != null &&
                        !string.IsNullOrEmpty(info.TableName) &&
                        !string.IsNullOrEmpty(info.ColumnName))
                    {
                        item.SubItems[6].Text = string.Format("{0}.{1}", info.TableName, info.ColumnName);
                    }
                    else
                    {
                        item.SubItems[6].Text = string.Empty;
                    }
                }
                else
                {
                }
            }
            else
            {
                item.SubItems[6].Text = string.Empty;
            }

            if (property.IsEnabled)
            {
                item.ForeColor = Color.Black;
            }
            else
            {
                item.ForeColor = Color.Silver;
            }

            if (item.Selected)
            {
                sourceGrid.SelectedObject = property;
            }
        }