Example #1
0
 public static bool CheckMetaClassIsPublic(MetaClass mc)
 {
     if (mc.Name == OrganizationEntity.GetAssignedMetaClassName()
         || mc.Name == ContactEntity.GetAssignedMetaClassName())
         return true;
     return false;
 }
 public static void Clear()
 {
     cachedType = null;
     cachedClass = null;
     cachedVariable = null;
     cachedMethod = null;
 }
Example #3
0
        public void BindData(MetaClass mc, string FieldType)
        {
            ViewState[this.ClientID + "_TypeName"] = FieldType;

            MetaFieldType mft = DataContext.Current.MetaModel.RegisteredTypes[FieldType];
            if (mft == null)
            {
                txtEnumName.Visible = true;
                txtEnumName.Attributes.Add("onblur", "SetName('" + txtEnumName.ClientID + "','" + txtFriendlyName.ClientID + "','" + vldFriendlyName_Required.ClientID + "')");
                chkPublic.Enabled = true;
                trName.Visible = true;
            }
            else
            {
                trName.Visible = false;
                txtFriendlyName.Text = mft.FriendlyName;

                if (mft.Attributes.ContainsKey(McDataTypeAttribute.EnumPrivate) &&
                    mft.Attributes[McDataTypeAttribute.EnumPrivate].ToString() == mc.Name)
                    chkPublic.Checked = false;
                else
                    chkPublic.Checked = true;

                chkPublic.Enabled = false;
            }
        }
 public void BindData(MetaClass mc, string FieldType)
 {
     if (ddlDefaultValue.Items.Count == 0)
     {
         ddlDefaultValue.Items.Add(new ListItem(GetGlobalResourceObject("IbnFramework.GlobalFieldManageControls", "Yes").ToString(), "1"));
         ddlDefaultValue.Items.Add(new ListItem(GetGlobalResourceObject("IbnFramework.GlobalFieldManageControls", "No").ToString(), "0"));
     }
 }
Example #5
0
 public void BindData(MetaClass mc, string FieldType)
 {
     LoadData(mc.Name);
     if (mc != null && BusinessObjectServiceManager.IsServiceInstalled(mc, SecurityService.ServiceName))
         chkUseObjectRoles.Visible = true;
     else
         chkUseObjectRoles.Visible = false;
 }
Example #6
0
        public void BindData(MetaClass mc, string FieldType)
        {
            double minValue = 0.00;
            double maxValue = 100.00;
            double defaultValue = 0.00;

            txtMinValue.Text = minValue.ToString("f");
            txtMaxValue.Text = maxValue.ToString("f");
            txtDefaultValue.Text = defaultValue.ToString("f");
        }
Example #7
0
 public static bool CheckCardField(MetaClass _class, MetaField cardField)
 {
     string CardPKeyName = string.Format(CultureInfo.InvariantCulture, "{0}Id", cardField.Owner.Name);
     string CardRefKeyName = string.Format(CultureInfo.InvariantCulture, "{0}Id", _class.Name);
     return (cardField.Name != CardRefKeyName &&
             cardField.Name != CardPKeyName &&
             !(cardField.GetOriginalMetaType().McDataType == McDataType.ReferencedField &&
             cardField.Attributes.GetValue<string>(McDataTypeAttribute.ReferencedFieldMetaClassName) == _class.Name)
             );
 }
Example #8
0
 public void BindData(MetaClass mc, string FieldType)
 {
     using (SkipSecurityCheckScope scope = Mediachase.Ibn.Data.Services.Security.SkipSecurityCheck())
     {
         int count = (mc == null) ? 0 : MetaObject.GetTotalCount(mc);
         if (count > 1)
         {
             chkUnique.Checked = false;
             chkUnique.Visible = false;
         }
     }
 }
 public VariableUpdate(Repository repository, MetaClass oldClass, MetaClass newClass)
 {
     InitializeComponent();
     this.repository = repository;
     this.oldClass = oldClass;
     this.newClass = newClass;
     this.mismatchedVariables = new MetaList<MetaVariable>();
     this.lbNewVariables.DataSource = new MetaList<MetaVariable>(newClass.Variables);
     this.Text = string.Format("{0} : {1}", this.oldClass.GetNameWithModule(), this.newClass.GetNameWithModule());
     this.refreshing = false;
     this.RefreshData();
 }
Example #10
0
        public void BindData(MetaClass mc, string FieldType)
        {
            if(mc != null)
                foreach (MetaField field in mc.FindReferencesWithoutBack())
                {
                    string RefClassName = field.Owner.Name;
                    string RefFieldName = field.Name;

                    ddlClass.Items.Add(
                        new ListItem(
                            String.Format("{0} ({1})", RefClassName, RefFieldName),
                            String.Format("{0},{1}", RefClassName, RefFieldName))
                        );
                }
        }
Example #11
0
        /// <summary>
        /// Creates the maping by friendly name comparison.
        /// </summary>
        /// <param name="column">The column.</param>
        /// <param name="dstClass">The DST class.</param>
        /// <param name="builder">The builder.</param>
        public static void CreateMapingByFriendlyNameComparison(DataColumn column, MetaClass dstClass, 
																MappingElementBuilder builder)
        {
            if (column == null)
                throw new ArgumentNullException("column");
            if (dstClass == null)
                throw new ArgumentNullException("dstClass");
            if (builder == null)
                throw new ArgumentNullException("builder");

            FieldMathResult matchResult = CreateMapingByFriendlyNameComparison(column, dstClass, string.Empty, null, builder);
            if (matchResult != null)
            {
                builder.AssignCopyValueRule(column.ColumnName, matchResult.Tag);
            }
        }
Example #12
0
        public void BindData(MetaClass mc, string FieldType)
        {
            if (ddlClass.Items.Count == 0 && mc != null)
            {
                foreach (MetaField field in mc.GetReferences())
                {
                    string RefClassName = field.Attributes[McDataTypeAttribute.ReferenceMetaClassName].ToString();
                    string RefFieldName = field.Name;
                    MetaClass refmc = MetaDataWrapper.GetMetaClassByName(RefClassName);

                    ddlClass.Items.Add(
                        new ListItem(
                            String.Format("{0} ({1})", CHelper.GetResFileString(field.FriendlyName), CHelper.GetResFileString(refmc.FriendlyName)),
                            String.Format("{0},{1}", RefClassName, RefFieldName))
                        );
                }
                BindFields();
            }
        }
Example #13
0
 private void openMenuItem_Click(object sender, EventArgs e)
 {
     DialogResult result = this.showSaveChangesDialog(SAVE_PROMPT_OPEN);
     if (result != DialogResult.Cancel)
     {
         this.ofdDatabase.FileName = string.Empty;
         result = this.ofdDatabase.ShowDialog();
         if (result == DialogResult.OK)
         {
             Stream stream = this.ofdDatabase.OpenFile();
             this.repository = Serializer.Deserialize(stream, this.repository);
             stream.Close();
             this.lastFilename = this.ofdDatabase.FileName;
             this.model = repository.Model;
             repository.Update(this.model);
             this.lastRepository = Serializer.Clone(this.repository);
             this.lastRepository.Update(this.model);
             InternalClipboard.Clear();
             this.listIndices.Clear();
             this.lastSelectedClass = null;
             this.RefreshData();
         }
     }
 }
Example #14
0
        public void LoadMetaClasses()
        {
            var t1   = Support.Time.HighPrecision_GetTickCount();
            var dirs = CEngine.Instance.FileManager.GetDirectories(MetaDirectory.Address);

            if (dirs == null)
            {
                Profiler.Log.WriteLine(Profiler.ELogTag.Error, "MetaData", $"MetaDirectory.Address is null:{MetaDirectory.Address}");
                return;
            }
            foreach (var i in dirs)
            {
                if (false == CEngine.Instance.FileManager.FileExists(i + "/typename.txt"))
                {
                    continue;
                }

                //System.IO.StreamReader sr = new System.IO.StreamReader(i + "/typename.txt", System.Text.Encoding.ASCII);
                //string className = sr.ReadLine();
                //sr.Close();

                byte[] bytes     = IO.FileManager.ReadFile(i + "/typename.txt");
                string className = System.Text.Encoding.ASCII.GetString(bytes);
                className = className.Replace("\r\n", "");

                ///////////////////////////////////////////////////////////////////
                //if (className.Contains("enginecore"))
                //{
                //    using (var sw = new System.IO.StreamWriter(i + "/typename.txt", false, System.Text.Encoding.ASCII))
                //    {
                //        className = className.Replace("enginecore", "EngineCore");
                //        sw.WriteLine(className);
                //    }
                //}
                //if (className.Contains("Common|EngineCore"))
                //{
                //    using (var sw = new System.IO.StreamWriter(i + "/typename.txt", false, System.Text.Encoding.ASCII))
                //    {
                //        className = className.Replace("Common|EngineCore", "Client|EngineCore");
                //        sw.WriteLine(className);
                //    }
                //}
                ///////////////////////////////////////////////////////////////////
                bool isRedirection;
                var  type = RttiHelper.GetTypeFromSaveString(className, out isRedirection);
                if (type == null)
                {
                    continue;
                }

                if (CIPlatform.Instance.PlayMode != CIPlatform.enPlayMode.Game)
                {
                    var noUsedFile = i + "/" + type.FullName + ".noused";
                    if (CEngine.Instance.FileManager.FileExists(noUsedFile) == false)
                    {
                        CEngine.Instance.FileManager.CreateFile(noUsedFile);
                    }
                }

                MetaClass klass = new MetaClass();
                klass.MetaType = type;
                var csIdx   = className.IndexOf('|');
                var fileStr = className;
                if (csIdx >= 0)
                {
                    fileStr = className.Substring(csIdx + 1);
                }
                klass.ClassName = RName.GetRName(MetaDirectory.Name + "/" + fileStr);
                bool hasRedirection = false;
                klass.LoadXnd(out hasRedirection);
#if PWindow
                //if (hasRedirection)
                //    klass.Save2Xnd(false);
#endif

                // 重定向后由于原来的类型已不存在,不再进行当前版本的处理
                if (!isRedirection)
                {
                    MetaData curVer = new MetaData();
                    curVer.BuildMetaData(type);

                    MetaData data = klass.FindMetaData(curVer.MetaHash);
                    if (data == null)
                    {
                        klass.RegMetaData(curVer.MetaHash, curVer);

#if PWindow
                        var xnd = IO.XndHolder.NewXNDHolder();
                        curVer.Save2Xnd(xnd.Node);
                        var hash = klass.GetFolderHash();
                        var file = klass.ClassName.GetRootFolder() + "MetaClasses/" + hash.ToString() + "/" + curVer.MetaHash + ".MetaData";
                        IO.XndHolder.SaveXND(file, xnd);
                        klass.CurrentVersion = curVer;
#endif
                    }
                    else
                    {
                        klass.CurrentVersion = data;
                    }
                }

                Klasses.Add(className, klass);
            }

            var t2 = Support.Time.HighPrecision_GetTickCount();
            Profiler.Log.WriteLine(Profiler.ELogTag.Info, "MetaData", $"LoadMetaClasses Time:{t2-t1}");
            //MetaDatas.Clear();
            //foreach (var i in Klasses)
            //{
            //    foreach (var j in i.Value.Metas)
            //    {
            //        MetaDatas.Add(j.Key, j.Value);
            //    }
            //}
        }
Example #15
0
 /// <summary>
 /// Gets the list.
 /// </summary>
 /// <param name="MetaClassId">The meta class id.</param>
 /// <returns></returns>
 public static MetaFieldCollection GetList(int metaClassId)
 {
     return(GetList(MetaClass.Load(metaClassId)));
 }
        /// <summary>
        /// Creates the filter expression node.
        /// </summary>
        /// <param name="pattern">The pattern.</param>
        /// <param name="displayName">The display name.</param>
        /// <param name="metaClass">The meta class.</param>
        /// <returns></returns>
        protected virtual IEnumerable <ElementDefs> GetElementDefsByMetaClass(string pattern, MetaClass metaClass)
        {
            if (metaClass == null)
            {
                throw new ArgumentNullException("metaClass");
            }

            foreach (MetaField field in metaClass.MetaFields)
            {
                if (customFieldFiter.All(x => x(field)))
                {
                    IEnumerable <ElementDefs> conditonDef;
                    if (MetaDataType2ElDefMap.TryGetValue(field.DataType, out conditonDef))
                    {
                        string      codeExpr   = string.IsNullOrEmpty(pattern) ? field.Name : string.Format(pattern, field.Name);
                        string      dynamicKey = ElementDefs.GetDynamicKey(metaClass.Name + "." + field.Name + "." + codeExpr);
                        ElementDefs retVal     = new ElementDefs()
                        {
                            Key   = dynamicKey, Name = codeExpr,
                            Descr = field.FriendlyName, Conditions = conditonDef
                        };
                        yield return(retVal);
                    }
                }
            }
        }
Example #17
0
 public void BindData(MetaClass mc, string FieldType)
 {
 }
Example #18
0
        /// <summary>
        /// Creates the attributes.
        /// </summary>
        /// <param name="metaAttributes">The meta attributes.</param>
        /// <param name="row">The row.</param>
        public static void CreateAttributes(ItemAttributes metaAttributes, DataRow row)
        {
            ArrayList attributes = new ArrayList();
            ArrayList files      = new ArrayList();
            ArrayList images     = new ArrayList();

            // Make sure we don't loose someone elses data
            if (metaAttributes != null && metaAttributes.Attribute != null)
            {
                foreach (ItemAttribute attr in metaAttributes.Attribute)
                {
                    attributes.Add(attr);
                }
            }

            // Make sure we don't loose someone elses data
            if (metaAttributes != null && metaAttributes.Files != null && metaAttributes.Files.File != null)
            {
                foreach (ItemFile file in metaAttributes.Files.File)
                {
                    files.Add(file);
                }
            }

            // Make sure we don't loose someone elses data
            if (metaAttributes != null && metaAttributes.Images != null)
            {
                //Changed this loop from a foreach to a for loop because metaAttributes.Image
                //was originally used but has been deprecated. metaAttributes.Images.Image
                //used instead
                for (int i = 0; i < metaAttributes.Images.Image.Length; i++)
                {
                    images.Add(metaAttributes.Images.Image[i]);
                }
            }


            // Get meta class id
            int metaClassId = (int)row["MetaClassId"];

            if (metaClassId == 0)
            {
                return;
            }



            // load list of MetaFields for MetaClass
            MetaClass metaClass = MetaHelper.LoadMetaClassCached(CatalogContext.MetaDataContext, metaClassId);

            if (metaClass == null)
            {
                return;
            }

            MetaFieldCollection mfs = metaClass.MetaFields;

            if (mfs == null)
            {
                return;
            }

            Hashtable hash = GetMetaFieldValues(row, metaClass, ref metaAttributes);

            /*
             * Hashtable hash = null;
             *
             * // try loading from serialized binary field first
             * if (row.Table.Columns.Contains(MetaObjectSerialized.SerializedFieldName) && row[MetaObjectSerialized.SerializedFieldName] != DBNull.Value)
             * {
             *  IFormatter formatter = null;
             *  try
             *  {
             *      formatter = new BinaryFormatter();
             *      MetaObjectSerialized metaObjSerialized = (MetaObjectSerialized)formatter.Deserialize(new MemoryStream((byte[])row[MetaObjectSerialized.SerializedFieldName]));
             *      if (metaObjSerialized != null)
             *      {
             *          metaAttributes.CreatedBy = metaObjSerialized.CreatorId;
             *          metaAttributes.CreatedDate = metaObjSerialized.Created;
             *          metaAttributes.ModifiedBy = metaObjSerialized.ModifierId;
             *          metaAttributes.ModifiedDate = metaObjSerialized.Modified;
             *          hash = metaObjSerialized.GetValues(CatalogContext.MetaDataContext.Language);
             *      }
             *  }
             *  finally
             *  {
             *      formatter = null;
             *  }
             * }
             *
             * // Load from database
             * if (hash == null)
             * {
             *  MetaObject metaObj = MetaObject.Load(CatalogContext.MetaDataContext, (int)row[0], metaClass);
             *  if (metaObj != null)
             *  {
             *      metaAttributes.CreatedBy = metaObj.CreatorId;
             *      metaAttributes.CreatedDate = metaObj.Created;
             *      metaAttributes.ModifiedBy = metaObj.ModifierId;
             *      metaAttributes.ModifiedDate = metaObj.Modified;
             *      hash = metaObj.GetValues();
             *  }
             * }
             * */

            if (hash == null)
            {
                return;
            }

            // fill in MetaField DataSet
            foreach (MetaField mf in mfs)
            {
                // skip system MetaFields
                if (!mf.IsUser)
                {
                    continue;
                }

                // get meta field's value
                object value = null;
                if (hash.ContainsKey(mf.Name))
                {
                    value = MetaHelper.GetMetaFieldValue(mf, hash[mf.Name]);
                }

                // create row in dataset for current meta field
                switch (mf.DataType)
                {
                case MetaDataType.File:
                    MetaFile metaFile = value as MetaFile;

                    if (metaFile != null)
                    {
                        ItemFile file = new ItemFile();
                        file.ContentType  = metaFile.ContentType;
                        file.FileContents = metaFile.Buffer;
                        file.FileName     = metaFile.Name;
                        file.Name         = mf.Name;
                        file.Type         = mf.DataType.ToString();
                        file.FriendlyName = mf.FriendlyName;

                        files.Add(file);
                    }
                    break;

                case MetaDataType.Image:
                case MetaDataType.ImageFile:

                    string fileName = String.Format("{0}-{1}-{2}", metaClassId, (int)row[0], mf.Name);

                    bool createThumbnail = false;
                    int  imageWidth      = 0;
                    int  imageHeight     = 0;
                    int  thumbWidth      = 0;
                    int  thumbHeight     = 0;
                    bool thumbStretch    = false;

                    object createThumbnaleObj = mf.Attributes["CreateThumbnail"];
                    if (createThumbnaleObj != null && Boolean.Parse(createThumbnaleObj.ToString()))
                    {
                        createThumbnail = true;

                        object var = mf.Attributes["AutoResize"];

                        if (var != null && Boolean.Parse(var.ToString()))
                        {
                            var = mf.Attributes["ImageHeight"];
                            if (var != null)
                            {
                                imageHeight = Int32.Parse(var.ToString());
                            }

                            var = mf.Attributes["ImageWidth"];
                            if (var != null)
                            {
                                imageHeight = Int32.Parse(var.ToString());
                            }
                        }

                        var = mf.Attributes["CreateThumbnail"];

                        if (var != null && Boolean.Parse(var.ToString()))
                        {
                            var = mf.Attributes["ThumbnailHeight"];
                            if (var != null)
                            {
                                thumbHeight = Int32.Parse(var.ToString());
                            }

                            var = mf.Attributes["ThumbnailWidth"];
                            if (var != null)
                            {
                                thumbWidth = Int32.Parse(var.ToString());
                            }

                            var = mf.Attributes["StretchThumbnail"];
                            if (var != null && Boolean.Parse(var.ToString()))
                            {
                                thumbStretch = true;
                            }
                        }
                    }

                    //string[] val = MetaHelper.GetCachedImageUrl((MetaFile)hash[mf.Name], mf, fileName, createThumbnail, thumbHeight, thumbWidth, thumbStretch);

                    string imageUrl      = ImageService.RetrieveImageUrl(fileName);
                    string imageThumbUrl = ImageService.RetrieveThumbnailImageUrl(fileName);

                    //if (val != null)
                    {
                        Image attr = CreateImage(mf.Name, imageUrl);

                        if (createThumbnail)
                        {
                            attr.ThumbnailUrl = imageThumbUrl;
                        }

                        if (imageHeight != 0)
                        {
                            attr.Height = imageHeight.ToString();
                        }

                        if (imageWidth != 0)
                        {
                            attr.Width = imageWidth.ToString();
                        }

                        if (thumbHeight != 0)
                        {
                            attr.ThumbnailHeight = thumbHeight.ToString();
                        }

                        if (thumbWidth != 0)
                        {
                            attr.ThumbnailWidth = thumbWidth.ToString();
                        }

                        images.Add(attr);
                    }
                    break;

                case MetaDataType.BigInt:
                case MetaDataType.Bit:
                case MetaDataType.Boolean:
                case MetaDataType.Char:
                case MetaDataType.Date:
                case MetaDataType.DateTime:
                case MetaDataType.Decimal:
                case MetaDataType.Email:
                case MetaDataType.Float:
                case MetaDataType.Int:
                case MetaDataType.Integer:
                case MetaDataType.LongHtmlString:
                case MetaDataType.LongString:
                case MetaDataType.Money:
                case MetaDataType.NChar:
                case MetaDataType.NText:
                case MetaDataType.Numeric:
                case MetaDataType.NVarChar:
                case MetaDataType.Real:
                case MetaDataType.ShortString:
                case MetaDataType.SmallDateTime:
                case MetaDataType.SmallInt:
                case MetaDataType.SmallMoney:
                case MetaDataType.Sysname:
                case MetaDataType.Text:
                case MetaDataType.Timestamp:
                case MetaDataType.TinyInt:
                case MetaDataType.UniqueIdentifier:
                case MetaDataType.URL:
                case MetaDataType.VarChar:
                case MetaDataType.Variant:
                case MetaDataType.DictionarySingleValue:
                case MetaDataType.EnumSingleValue:
                    attributes.Add(ObjectHelper.CreateAttribute(mf.Name, mf.FriendlyName, mf.DataType.ToString(), new string[] { value == null ? String.Empty : value.ToString() }));
                    break;

                case MetaDataType.EnumMultiValue:
                case MetaDataType.DictionaryMultiValue:
                    attributes.Add(ObjectHelper.CreateAttribute(mf.Name, mf.FriendlyName, "string[]", (string[])value));
                    break;

                case MetaDataType.StringDictionary:
                    MetaStringDictionary stringDictionary = value as MetaStringDictionary;
                    ArrayList            strvals          = new ArrayList();
                    if (stringDictionary != null)
                    {
                        foreach (string key in stringDictionary.Keys)
                        {
                            strvals.Add(String.Format("{0};{1}", key, stringDictionary[key]));
                        }
                    }
                    attributes.Add(ObjectHelper.CreateAttribute(mf.Name, mf.FriendlyName, "string[]", stringDictionary == null ? null : (string[])strvals.ToArray(typeof(string))));
                    break;

                default:
                    break;
                }
            }

            metaAttributes.Attribute    = (ItemAttribute[])attributes.ToArray(typeof(ItemAttribute));
            metaAttributes.Files        = new ItemFiles();
            metaAttributes.Files.File   = (ItemFile[])files.ToArray(typeof(ItemFile));
            metaAttributes.Images       = new Images();
            metaAttributes.Images.Image = (Image[])images.ToArray(typeof(Image));
        }
Example #19
0
        void imbtnSave_ServerClick(object sender, EventArgs e)
        {
            Page.Validate();
            if (!Page.IsValid)
                return;

            if (mc == null)
            {
                try
                {
                    mc = MetaDataWrapper.CreateBridgeClass(
                    txtClassName.Text.Trim(), txtClassFriendlyName.Text.Trim(), txtClassPluralName.Text.Trim(),
                    ddlClass1.SelectedValue, txtField1Name.Text.Trim(), txtField1FriendlyName.Text.Trim(),
                    ddlClass2.SelectedValue, txtField2Name.Text.Trim(), txtField2FriendlyName.Text.Trim());

                    Response.Redirect(String.Format(CultureInfo.InvariantCulture, "{0}?class={1}", CHelper.MetaClassAdminPage, mc.Name), true);
                }
                catch (MetaClassAlreadyExistsException)
                {
                    lbError.Text = string.Format(GetGlobalResourceObject("IbnFramework.GlobalMetaInfo", "BridgeExistsErrorMessage").ToString(), "'" + txtClassName.Text.Trim() + "'");
                    lbError.Visible = true;
                }
                catch (MetaFieldAlreadyExistsException)
                {
                    lbError.Text = string.Format(GetGlobalResourceObject("IbnFramework.GlobalMetaInfo", "FieldExistsErrorMessage").ToString(), "'" + txtField1Name.Text.Trim() + "' or '" + txtField2Name.Text.Trim() + "'");
                    lbError.Visible = true;
                }
            }
            else
            {
                MetaDataWrapper.UpdateBridge(mc, txtClassFriendlyName.Text.Trim(), txtClassPluralName.Text.Trim(),
                  txtField1FriendlyName.Text.Trim(), txtField2FriendlyName.Text.Trim());

                if (Back == "list")
                    Response.Redirect("~/Apps/MetaDataBase/Pages/Admin/MetaClassList.aspx", true);
                else
                    Response.Redirect(String.Format(CultureInfo.InvariantCulture, "{0}?class={1}", CHelper.MetaClassAdminPage, mc.Name), true);
            }
        }
Example #20
0
        /// <summary>
        /// Creates the default by mapping element.
        /// </summary>
        public static void CreateMapingByPatternComparision(DataTable srcData, MetaClass dstMetaClass, MappingElementBuilder builder)
        {
            if (srcData == null)
            {
                throw new ArgumentNullException("srcData");
            }
            if (dstMetaClass == null)
            {
                throw new ArgumentNullException("dstMetaClass");
            }
            if (builder == null)
            {
                throw new ArgumentNullException("builder");
            }

            //MappingDocument enDefaultMappingDoc = MappingDocument.LoadFromXml(VCardType.LocRM.GetString("DefaultMapping",
            //                                                                   CultureInfo.GetCultureInfo("en-US")));
            MappingDocument enDefaultMappingDoc = MappingDocument.LoadFromXml(GetWebResourceString("{IbnFramework.OutlookMappingPattern:Outlook2007}",
                                                                                                   CultureInfo.GetCultureInfo("en-US")));

            //MappingDocument ruDefaultMappingDoc = MappingDocument.LoadFromXml(VCardType.LocRM.GetString("DefaultMapping",
            //                                                                  CultureInfo.GetCultureInfo("ru-RU")));
            MappingDocument ruDefaultMappingDoc = MappingDocument.LoadFromXml(GetWebResourceString("{IbnFramework.OutlookMappingPattern:Outlook2007}",
                                                                                                   CultureInfo.GetCultureInfo("ru-RU")));

            MappingElement srcEl = null;
            MappingElement dstEl = null;
            //Recognize source lang and type
            DataColumnCollection dataColl = srcData.Columns;

            //Recognize language pattern
            if (enDefaultMappingDoc != null && enDefaultMappingDoc.Count != 0)
            {
                if (DataColumnSourceIsMatch(dataColl, enDefaultMappingDoc[0]))
                {
                    srcEl = enDefaultMappingDoc[0];
                    if (FieldDestinationIsMatch(dstMetaClass.Fields, enDefaultMappingDoc[0]))
                    {
                        dstEl = enDefaultMappingDoc[0];
                    }
                }
            }

            if (ruDefaultMappingDoc != null && ruDefaultMappingDoc.Count != 0)
            {
                if (DataColumnSourceIsMatch(dataColl, ruDefaultMappingDoc[0]))
                {
                    srcEl = ruDefaultMappingDoc[0];
                    if (FieldDestinationIsMatch(dstMetaClass.Fields, ruDefaultMappingDoc[0]))
                    {
                        dstEl = ruDefaultMappingDoc[0];
                    }
                }
            }

            //Pattern found, build mapping by pattern
            if (srcEl != null && dstEl != null)
            {
                for (int i = 0; i < srcEl.Count; i++)
                {
                    builder.AssignCopyValueRule(srcEl[i].ColumnName, dstEl[i].FieldName);
                }
            }
            else
            {
                //Pattern not found, build mapping by field friendly names comparison
                foreach (DataColumn dataCol in srcData.Columns)
                {
                    CreateMapingByFriendlyNameComparison(dataCol, dstMetaClass, builder);
                }
            }
        }
        private void BindCustomFields()
        {
            MetaObject obj = null;

            if (ObjectId > 0)
            {
                obj = MetaDataWrapper.LoadMetaObject(ObjectId, MetaClassName);
            }
            if (obj == null)
            {
                obj = MetaDataWrapper.NewMetaObject(ObjectId, MetaClassName);
            }

            MetaClass mc = obj.MetaClass;

            SortedList <int, MetaField> userMetaFields = new SortedList <int, MetaField>();

            foreach (MetaField field in mc.UserMetaFields)
            {
                if (ContainsMetaField(field.Name))
                {
                    int cur_weight = _mflist.IndexOf(field.Name);
                    userMetaFields.Add(cur_weight, field);
                }
            }

            foreach (MetaField field in userMetaFields.Values)
            {
                HtmlTableRow  row       = new HtmlTableRow();
                HtmlTableCell cellTitle = new HtmlTableCell();
                HtmlTableCell cellValue = new HtmlTableCell();

                cellTitle.VAlign    = "middle";
                cellTitle.InnerHtml = String.Format("<b>{0}</b>:", field.FriendlyName);
                object fieldValue = obj[field.Name];
                System.Web.UI.UserControl control = null;

                switch (field.DataType)
                {
                case MetaDataType.Binary:
                    cellValue.InnerText = "[BinaryData]";
                    break;

                case MetaDataType.File:
                    cellTitle.VAlign = "top";
                    control          = (System.Web.UI.UserControl)Page.LoadControl("~/Modules/EditControls/FileValue.ascx");
                    break;

                case MetaDataType.ImageFile:
                    cellTitle.VAlign = "top";
                    control          = (System.Web.UI.UserControl)Page.LoadControl("~/Modules/EditControls/ImageFileValue.ascx");
                    break;

                case MetaDataType.DateTime:
                    //control = (System.Web.UI.UserControl)Page.LoadControl("~/Modules/EditControls/DateTimeValue.ascx");
                    Mediachase.UI.Web.Modules.EditControls.DateTimeValue control_datetime = (Mediachase.UI.Web.Modules.EditControls.DateTimeValue)Page.LoadControl("~/Modules/EditControls/DateTimeValue.ascx");
                    control_datetime.Path_JS = "../../Scripts/";
                    control = (System.Web.UI.UserControl)control_datetime;
                    break;

                case MetaDataType.Money:
                    control = (System.Web.UI.UserControl)Page.LoadControl("~/Modules/EditControls/MoneyValue.ascx");
                    break;

                case MetaDataType.Float:
                    control = (System.Web.UI.UserControl)Page.LoadControl("~/Modules/EditControls/FloatValue.ascx");
                    break;

                case MetaDataType.Integer:
                    control = (System.Web.UI.UserControl)Page.LoadControl("~/Modules/EditControls/IntValue.ascx");
                    break;

                case MetaDataType.Boolean:
                    control = (System.Web.UI.UserControl)Page.LoadControl("~/Modules/EditControls/BooleanValue.ascx");
                    break;

                case MetaDataType.Date:
                    //control = (System.Web.UI.UserControl)Page.LoadControl("~/Modules/EditControls/DateValue.ascx");
                    Mediachase.UI.Web.Modules.EditControls.DateValue control_date = (Mediachase.UI.Web.Modules.EditControls.DateValue)Page.LoadControl("~/Modules/EditControls/DateValue.ascx");
                    control_date.Path_JS = "../../Scripts/";
                    control = (System.Web.UI.UserControl)control_date;
                    break;

                case MetaDataType.Email:
                    control = (System.Web.UI.UserControl)Page.LoadControl("~/Modules/EditControls/EmailValue.ascx");
                    break;

                case MetaDataType.Url:
                    control = (System.Web.UI.UserControl)Page.LoadControl("~/Modules/EditControls/URLValue.ascx");
                    break;

                case MetaDataType.ShortString:
                    control = (System.Web.UI.UserControl)Page.LoadControl("~/Modules/EditControls/ShortStringValue.ascx");
                    break;

                case MetaDataType.LongString:
                    cellTitle.VAlign = "top";
                    control          = (System.Web.UI.UserControl)Page.LoadControl("~/Modules/EditControls/LongStringValue.ascx");
                    break;

                case MetaDataType.LongHtmlString:
                    cellTitle.VAlign = "top";
                    control          = (System.Web.UI.UserControl)Page.LoadControl("~/Modules/EditControls/LongHTMLStringValue.ascx");
                    break;

                case MetaDataType.DictionarySingleValue:
                case MetaDataType.EnumSingleValue:
                    control = (System.Web.UI.UserControl)Page.LoadControl("~/Modules/EditControls/DictionarySingleValue.ascx");
                    ((DictionarySingleValue)control).InitControl(field.Id, (field.AllowNulls ? !field.IsRequired : field.AllowNulls));
                    break;

                case MetaDataType.DictionaryMultivalue:
                case MetaDataType.EnumMultivalue:
                    cellTitle.VAlign = "top";
                    control          = (System.Web.UI.UserControl)Page.LoadControl("~/Modules/EditControls/DictionaryMultivalue.ascx");
                    ((DictionaryMultivalue)control).InitControl(field.Id);
                    break;

                default:
                    if (fieldValue != null)
                    {
                        cellValue.InnerText = fieldValue.ToString();
                    }
                    break;
                }

                if (control != null)
                {
                    cellValue.Controls.Add(control);
                }

                row.Cells.Add(cellTitle);
                row.Cells.Add(cellValue);

                tblCustomFields.Rows.Add(row);

                if (control != null)
                {
                    ICustomField iCustomField = ((ICustomField)control);
                    iCustomField.FieldName = field.Name;
                    if (fieldValue != null)
                    {
                        iCustomField.Value = fieldValue;
                    }
                    iCustomField.AllowEmptyValues = !mc.GetFieldIsRequired(field);
                }
            }
        }
Example #22
0
        private void BindData(MetaClass mc)
        {
            MoreInfoRow.Visible = false;

            // Labels
            ClassNameLabel.Text = mc.Name;

            FriendlyNameLabel.Text = CHelper.GetResFileString(mc.FriendlyName);

            FriendlyNameLink.Text        = CHelper.GetResFileString(mc.FriendlyName);
            FriendlyNameLink.NavigateUrl = String.Format(CultureInfo.InvariantCulture,
                                                         "~/Apps/MetaUIEntity/Pages/EntityList.aspx?ClassName={0}",
                                                         mc.Name);

            // Ibn 4.7 fix
            if (mc.Name.ToLower().IndexOf("timetracking") >= 0)
            {
                FriendlyNameLabel.Visible = true;
                FriendlyNameLink.Visible  = false;
            }
            else
            {
                FriendlyNameLabel.Visible = false;
                FriendlyNameLink.Visible  = true;
            }

            PluralNameLabel.Text = CHelper.GetResFileString(mc.PluralName);
            if (mc.Attributes.ContainsKey(MetaClassAttribute.IsBridge))
            {
                TypeLabel.Text          = GetGlobalResourceObject("IbnFramework.GlobalMetaInfo", "Bridge").ToString();
                ClassTypeImage.ImageUrl = "~/images/IbnFramework/metainfo/bridge.gif";
                if (mc.Attributes.ContainsKey(MetaClassAttribute.IsSystem))
                {
                    ClassTypeImage.ImageUrl = "~/images/IbnFramework/metainfo/bridge_sys.gif";
                }
            }
            else if (mc.Attributes.ContainsKey(MetaClassAttribute.IsCard))
            {
                TypeLabel.Text          = GetGlobalResourceObject("IbnFramework.GlobalMetaInfo", "BusinessObjectExtension").ToString();
                ClassTypeImage.ImageUrl = "~/images/IbnFramework/metainfo/card.gif";
                if (mc.Attributes.ContainsKey(MetaClassAttribute.IsSystem))
                {
                    ClassTypeImage.ImageUrl = "~/images/IbnFramework/metainfo/card_sys.gif";
                }
            }
            else
            {
                TypeLabel.Text          = GetGlobalResourceObject("IbnFramework.GlobalMetaInfo", "Info").ToString();
                ClassTypeImage.ImageUrl = "~/images/IbnFramework/metainfo/metaclass.gif";
                if (mc.Attributes.ContainsKey(MetaClassAttribute.IsSystem))
                {
                    ClassTypeImage.ImageUrl = "~/images/IbnFramework/metainfo/metaclass_sys.gif";
                }
            }

            // O.R.: we don't use this attribute

            /*
             * // Public or Private (Department or User)
             * if (mc.Attributes.ContainsKey(MetaDataWrapper.OwnerTypeAttr))
             *      TypeLabel.Text += String.Format(" ({0})", mc.Attributes[MetaDataWrapper.OwnerTypeAttr].ToString());
             */

            // Owner class for Card
            MetaClass ownerClass = MetaDataWrapper.GetOwnerClass(mc);

            if (ownerClass != null)
            {
                MoreInfoValue.Text = String.Format("<a href='MetaClassView.aspx?class={0}'>{1}</a>", ownerClass.Name, CHelper.GetResFileString(ownerClass.FriendlyName));

                MoreInfoRow.Visible = true;
                MoreInfoLabel.Text  = GetGlobalResourceObject("IbnFramework.GlobalMetaInfo", "TableOwner").ToString() + ":";
            }

            // Cards for owner class
            if (mc.SupportsCards)
            {
                MetaClass[] cards = mc.GetCards();
                if (cards.Length > 0)
                {
                    MoreInfoRow.Visible = true;
                    MoreInfoLabel.Text  = GetGlobalResourceObject("IbnFramework.GlobalMetaInfo", "Cards").ToString() + ":";

                    string sCards = "";
                    foreach (MetaClass card in cards)
                    {
                        if (sCards != "")
                        {
                            sCards += ", ";
                        }

                        sCards += String.Format("<a href='MetaClassView.aspx?class={0}'>{1}</a>", card.Name, CHelper.GetResFileString(card.FriendlyName));
                    }
                    MoreInfoValue.Text = sCards;
                }
            }
        }
Example #23
0
        public void btnLoadMapFile_Click(object sender, EventArgs e)
        {
            if (this.ddlMappingFiles.SelectedIndex > 0)
            {
                if (!File.Exists(this.ddlMappingFiles.SelectedValue))
                {
                    //DisplayErrorMessage(String.Format("The file \"{0}\" does not exist.", this.ddlExMappingFiles.SelectedValue));
                    return;
                }

                MetaDataPlus.Import.Rule mapping = MetaDataPlus.Import.Rule.XmlDeserialize(CatalogContext.MetaDataContext, ddlMappingFiles.SelectedValue);
                this.ClassRule = mapping;

                string sTypeName = mapping.Attribute["TypeName"];
                if (sTypeName != null)
                {
                    for (int i = 0; i < this.ddlTypeData.Items.Count; i++)
                    {
                        if (this.ddlTypeData.Items[i].Value == sTypeName)
                        {
                            this.ddlTypeData.SelectedIndex = i;
                            break;
                        }
                    }
                }

                if (ddlTypeData.SelectedValue.Equals("Category"))
                {
                    BindMetaclass("CatalogNode");
                    this.ddlMetaClass.Enabled = true;
                }
                else if (ddlTypeData.SelectedValue.Equals("Entry"))
                {
                    BindMetaclass("CatalogEntry");
                    this.ddlMetaClass.Enabled = true;
                }
                else if (ddlTypeData.SelectedValue.Equals("EntryRelation") ||
                         ddlTypeData.SelectedValue.Equals("EntryAssociation") ||
                         ddlTypeData.SelectedValue.Equals("Variation") ||
                         ddlTypeData.SelectedValue.Equals("SalePrice"))
                {
                    this.ddlMetaClass.SelectedIndex = 0;
                    this.ddlMetaClass.Enabled       = false;
                }

                for (int i = 0; i < this.ddlMetaClass.Items.Count; i++)
                {
                    if (mapping.ClassName.Equals(this.ddlMetaClass.Items[i].Value, StringComparison.OrdinalIgnoreCase))
                    {
                        this.ddlMetaClass.SelectedIndex = i;
                        break;
                    }
                }

                if (this.ddlMetaClass.SelectedIndex == 0)
                {
                    MetaClass _metaClass = MetaClass.Load(CatalogContext.MetaDataContext, mapping.ClassName);
                    if (_metaClass == null)
                    {
                        DisplayErrorMessage(String.Format("The metaclass '{0}' does not exists.", mapping.ClassName));
                    }
                }

                if (mapping.Attribute["Language"] != null)
                {
                    string language = mapping.Attribute["Language"];
                    if (!String.IsNullOrEmpty(language))
                    {
                        for (int i = 0; i < this.ddlLanguage.Items.Count; i++)
                        {
                            if (this.ddlLanguage.Items[i].Value.Equals(language, StringComparison.OrdinalIgnoreCase))
                            {
                                this.ddlLanguage.SelectedIndex = i;
                                break;
                            }
                        }
                    }
                }

                this.ddlDataFiles.SelectedIndex = 0;
                string sDataFile = Path.Combine(SourcePath, Path.GetFileName(mapping.Attribute["DataFile"]));
                if (sDataFile != null)
                {
                    for (int i = 0; i < this.ddlDataFiles.Items.Count; i++)
                    {
                        if (Path.Equals(this.ddlDataFiles.Items[i].Value, sDataFile))
                        {
                            this.ddlDataFiles.SelectedIndex = i;
                            break;
                        }
                    }
                    if (this.ddlDataFiles.SelectedIndex == 0)
                    {
                        DisplayErrorMessage(String.Format("The file \"{0}\" does not exist in a folder \"{1}\".", Path.GetFileName(sDataFile), SourcePath));
                        return;
                    }
                }
                else
                {
                    DisplayErrorMessage("The wrong version of a mapping file. Required attribute is missed.");
                }


                string sDelimiter = mapping.Attribute["Delimiter"];
                if (sDelimiter != null)
                {
                    for (int i = 0; i < this.ddlDelimiter.Items.Count; i++)
                    {
                        if (this.ddlDelimiter.Items[i].Value == sDelimiter)
                        {
                            this.ddlDelimiter.SelectedIndex = i;
                            break;
                        }
                    }
                }

                string sTextQualifier = mapping.Attribute["TextQualifier"];
                if (sTextQualifier != null)
                {
                    for (int i = 0; i < this.ddlTextQualifier.Items.Count; i++)
                    {
                        if (this.ddlTextQualifier.Items[i].Value == sTextQualifier)
                        {
                            this.ddlTextQualifier.SelectedIndex = i;
                            break;
                        }
                    }
                }

                string sEncoding = "Default";
                try
                {
                    sEncoding = mapping.Attribute["Encoding"];
                }
                catch { }
                if (sEncoding != null)
                {
                    for (int i = 0; i < this.ddlEncoding.Items.Count; i++)
                    {
                        if (this.ddlDelimiter.Items[i].Value == sEncoding)
                        {
                            this.ddlEncoding.SelectedIndex = i;
                            break;
                        }
                    }
                }

                if (this.ddlDataFiles.SelectedIndex > 0)
                {
                    this.tbMappingFileName.Text        = Path.GetFileNameWithoutExtension(this.ddlMappingFiles.SelectedValue);
                    this.ddlMappingFiles.SelectedIndex = 0;
                }
                BindDataType();
                RestoreValues(mapping);
                MappingFill();
            }
        }
 public void BindData(MetaClass mc, string fieldType)
 {
     FillItems(true);
 }
Example #25
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MetaStorageBase"/> class.
 /// </summary>
 /// <param name="metaClass">The meta class.</param>
 internal MetaStorageBase(MetaClass metaClass)
 {
     // Load base meta object data
     base.Init(-1, metaClass, null, DateTime.UtcNow, metaClass.MetaFields);
 }
Example #26
0
 public void RefreshData()
 {
     if (this.refreshing)
     {
         return;
     }
     this.refreshing = true;
     if (this.model != null)
     {
         this.newMenuItem.Enabled = true;
         this.updateModelMenuItem.Enabled = true;
         this.saveMenuItem.Enabled = true;
         this.saveAsMenuItem.Enabled = true;
         this.bOrganize.Enabled = true;
     }
     MetaList<MetaClass> classes = this.repository.VisibleClasses;
     Utility.ApplyNewDataSource(this.lbClasses, classes, classes.Count);
     if (classes.Count > 0)
     {
         if (this.lbClasses.SelectedIndex < 0)
         {
             this.lbClasses.SelectedIndex = 0;
         }
     }
     if (this.repository != null)
     {
         this.vlValues.ClearData();
         MetaClass metaClass = (MetaClass)this.lbClasses.SelectedItem;
         if (metaClass != null)
         {
             if (!this.listIndices.ContainsKey(metaClass))
             {
                 this.listIndices[metaClass] = 0;
             }
             if (this.listIndices[metaClass] >= this.repository.Values[metaClass].Count)
             {
                 this.listIndices[metaClass] = this.repository.Values[metaClass].Count - 1;
             }
             this.lastSelectedClass = metaClass;
             this.vlValues.SetData(this, this.repository, metaClass, this.repository.Values[metaClass], this.listIndices[metaClass]);
             this.vlValues.RefreshData();
         }
     }
     this.refreshing = false;
 }
Example #27
0
        protected void Page_Load(object sender, EventArgs e)
        {
            mc = Mediachase.Ibn.Data.Services.RoleManager.GetObjectRoleMetaClass(ClassName);

            GenerateStructure();
            if (!IsPostBack)
            {
                BindData();
            }
        }
Example #28
0
        /// <summary>
        /// Creates the default name of the mapping by.
        /// </summary>
        private static FieldMathResult CreateMapingByFriendlyNameComparison(DataColumn column, MetaClass dstClass,
                                                                            string prefix, FieldMathResult prevMatchResult,
                                                                            MappingElementBuilder builder)
        {
            FieldMathResult retVal = prevMatchResult;

            foreach (MetaField metaField in dstClass.Fields)
            {
                string mappedFieldName = prefix + metaField.Name;
                // Skip always maped metaField
                if (builder.GetRuleByMetaField(mappedFieldName) != null)
                {
                    continue;
                }
                // Skip Back Aggregation References
                if (metaField.Attributes.ContainsKey(McDataTypeAttribute.AggregationMark))
                {
                    continue;
                }
                //Skip referenses
                if (metaField.IsReference)
                {
                    continue;
                }

                // Process Aggregation
                if (metaField.IsAggregation)
                {
                    // Find Aggr meta class
                    MetaClass aggrMetaClass = DataContext.Current.GetMetaClass((string)metaField.Attributes[McDataTypeAttribute.AggregationMetaClassName]);
                    // Find rules
                    retVal = CreateMapingByFriendlyNameComparison(column, aggrMetaClass, metaField.Name + ".", retVal, builder);
                    continue;
                }

                //Получаем имя в русской локализации
                string enName = GetWebResourceString(metaField.FriendlyName, CultureInfo.GetCultureInfo("en-US"));

                //получаем имя в английской локализации
                string ruName = GetWebResourceString(metaField.FriendlyName, CultureInfo.GetCultureInfo("ru-RU"));
                //Find best match for pattern
                foreach (string searchPattern in new string[] { enName, ruName })
                {
                    if (column.ColumnName.Contains(searchPattern))
                    {
                        FieldMathResult newResult = new FieldMathResult(column.ColumnName, searchPattern, mappedFieldName);
                        if (retVal != null)
                        {
                            retVal = retVal.Weight < newResult.Weight ? retVal : newResult;
                        }
                        else
                        {
                            retVal = newResult;
                        }
                        break;
                    }
                }
            }

            return(retVal);
        }
Example #29
0
     /// <summary>
 	/// Implements the constructor: MetaClass()
 	/// Direct superclasses: global::MetaDslx.Core.MetaType, global::MetaDslx.Core.MetaDeclaration
 	/// All superclasses: global::MetaDslx.Core.MetaType, global::MetaDslx.Core.MetaDeclaration, global::MetaDslx.Core.MetaNamedElement, global::MetaDslx.Core.MetaDocumentedElement, global::MetaDslx.Core.MetaAnnotatedElement
     /// </summary>
     public virtual void MetaClass(MetaClass @this)
     {
         this.MetaType(@this);
         this.MetaDeclaration(@this);
     }
 public TimeTrackingBlockType(MetaClass metaType, PrimaryKeyId primaryKeyId, MetaObjectOptions options)
     : base(metaType, primaryKeyId, options)
 {
 }
Example #31
0
        private void ProcessControl(Control c, EntityObject _obj)
        {
            IEditControl editControl = c as IEditControl;

            if (editControl != null)
            {
                string fieldName = editControl.FieldName;

                #region MyRegion
                string    ownFieldName  = fieldName;
                string    aggrFieldName = String.Empty;
                string    aggrClassName = String.Empty;
                MetaField ownField      = null;
                MetaField aggrField     = null;
                MetaClass ownClass      = MetaDataWrapper.GetMetaClassByName(_obj.MetaClassName);
                if (ownFieldName.Contains("."))
                {
                    string[] mas = ownFieldName.Split(new string[] { "." }, StringSplitOptions.RemoveEmptyEntries);
                    if (mas.Length > 1)
                    {
                        ownFieldName  = mas[0];
                        aggrFieldName = mas[1];

                        ownField      = MetaDataWrapper.GetMetaFieldByName(ownClass, ownFieldName);
                        aggrClassName = ownField.Attributes.GetValue <string>(McDataTypeAttribute.AggregationMetaClassName);
                        aggrField     = MetaDataWrapper.GetMetaFieldByName(aggrClassName, aggrFieldName);
                    }
                }
                if (ownField == null)
                {
                    ownField = ownClass.Fields[ownFieldName];
                    if (ownField == null)
                    {
                        ownField = ownClass.CardOwner.Fields[ownFieldName];
                    }
                }
                #endregion

                object eValue = editControl.Value;

                bool makeChange = true;

                MetaField field = (aggrField == null) ? ownField : aggrField;
                if (!field.IsNullable && eValue == null)
                {
                    makeChange = false;
                }

                if (makeChange)
                {
                    if (aggrField == null)
                    {
                        _obj[ownFieldName] = eValue;
                    }
                    else
                    {
                        EntityObject aggrObj = null;
                        if (_obj[ownFieldName] != null)
                        {
                            aggrObj = (EntityObject)_obj[ownFieldName];
                        }
                        else
                        {
                            aggrObj = BusinessManager.InitializeEntity(ClassName);
                        }
                        aggrObj[aggrFieldName] = eValue;
                    }
                }
            }
        }
Example #32
0
    /// <summary>
    /// Loads the specified node uid.
    /// </summary>
    /// <param name="NodeUid">The node uid.</param>
    /// <param name="ControlUid">The control uid.</param>
    void IPropertyPage.Load(string NodeUid, string ControlUid)
    {
        ControlSettings settings = new ControlSettings();

        DynamicNode dNode = PageDocument.Current.DynamicNodes.LoadByUID(NodeUid);

        if (dNode != null)
        {
            settings = dNode.GetSettings(NodeUid);
        }

        // Bind Meta Types
        // Bind Meta classes
        // MetaDataContext.Current = CatalogContext.MetaDataContext;
        MetaClass catalogEntry = MetaClass.Load(CatalogContext.MetaDataContext, "CatalogEntry");

        MetaClassList.Items.Clear();
        if (catalogEntry != null)
        {
            MetaClassCollection metaClasses = catalogEntry.ChildClasses;
            foreach (MetaClass metaClass in metaClasses)
            {
                MetaClassList.Items.Add(new ListItem(metaClass.FriendlyName, metaClass.Name));
            }
            MetaClassList.DataBind();
        }

        // Bind templates
        DisplayTemplate.Items.Clear();
        DisplayTemplate.Items.Add(new ListItem("(use default)", ""));
        TemplateDto templates = DictionaryManager.GetTemplateDto();

        if (templates.main_Templates.Count > 0)
        {
            DataView view = templates.main_Templates.DefaultView;
            view.RowFilter = "TemplateType = 'search-index'";

            foreach (DataRowView row in view)
            {
                DisplayTemplate.Items.Add(new ListItem(row["FriendlyName"].ToString(), row["Name"].ToString()));
            }

            DisplayTemplate.DataBind();
        }

        // Bind Types
        EntryTypeList.Items.Clear();
        EntryTypeList.Items.Add(new ListItem(EntryType.Product, EntryType.Product));
        EntryTypeList.Items.Add(new ListItem(EntryType.Package, EntryType.Package));
        EntryTypeList.Items.Add(new ListItem(EntryType.Bundle, EntryType.Bundle));
        EntryTypeList.Items.Add(new ListItem(EntryType.DynamicPackage, EntryType.DynamicPackage));
        EntryTypeList.Items.Add(new ListItem(EntryType.Variation, EntryType.Variation));
        EntryTypeList.DataBind();

        // Bind catalogs
        CatalogList.Items.Clear();
        CatalogDto catalogs = CatalogContext.Current.GetCatalogDto(CMSContext.Current.SiteId);

        if (catalogs.Catalog.Count > 0)
        {
            foreach (CatalogDto.CatalogRow row in catalogs.Catalog)
            {
                if (row.IsActive && row.StartDate <= FrameworkContext.Current.CurrentDateTime && row.EndDate >= FrameworkContext.Current.CurrentDateTime)
                {
                    CatalogList.Items.Add(new ListItem(row.Name, row.Name));
                }
            }

            CatalogList.DataBind();
        }


        if (settings != null && settings.Params != null)
        {
            Param prm = settings.Params;

            CommonHelper.LoadTextBox(settings, "NodeCode", NodeCode);
            CommonHelper.LoadTextBox(settings, "RecordsPerPage", NumberOfRecords);

            /*
             * CommonHelper.LoadTextBox(settings, "FTSPhrase", FTSPhrase);
             * CommonHelper.LoadTextBox(settings, "AdvancedFTSPhrase", AdvancedFTSPhrase);
             * CommonHelper.LoadTextBox(settings, "MetaSQLClause", MetaSQLClause);
             * CommonHelper.LoadTextBox(settings, "SQLClause", SQLClause);
             * */

            if ((prm["DisplayTemplate"] != null) && (prm["DisplayTemplate"] is string))
            {
                CommonHelper.SelectListItem(DisplayTemplate, prm["DisplayTemplate"].ToString());
            }

            CommonHelper.SelectList(settings, "Catalogs", CatalogList);
            CommonHelper.SelectList(settings, "EntryClasses", MetaClassList);
            CommonHelper.SelectList(settings, "EntryTypes", EntryTypeList);

            // Orderby
            if ((prm["OrderBy"] != null) && (prm["OrderBy"] is string))
            {
                string orderBy = prm["OrderBy"].ToString();
                bool   isDesc  = orderBy.Contains("DESC");

                string listOrderBy = orderBy.Replace(" DESC", "");
                listOrderBy = listOrderBy.Replace(" ASC", "");

                CommonHelper.SelectListItem(OrderByList, listOrderBy);

                if (!String.IsNullOrEmpty(OrderByList.SelectedValue))
                {
                    if (OrderByList.SelectedValue == "custom")
                    {
                        OrderBy.Text = orderBy;
                    }
                    else
                    {
                        OrderDesc.Checked = isDesc;
                    }
                }
            }
        }
    }
Example #33
0
        static void Generate(string apiPath)
        {
            try
            {
                // Enumerate through all *.json files in the provided path and generate classes
                if (Directory.Exists(apiPath))
                {
                    Log("Scanning {0}...", apiPath);
                    var jsonFiles = Directory.EnumerateFiles(apiPath, "*.json").ToList();
                    Log("Found {0} objects.", jsonFiles.Count);

                    if (jsonFiles.Count > 0)
                    {
                        // Parse JSON into metadata classes
                        var generatedPath = Path.Combine(apiPath, "generated");
                        if (!Directory.Exists(generatedPath))
                        {
                            Directory.CreateDirectory(generatedPath);
                        }

                        Log("Parsing JSON files...");
                        var metaClasses = new List <MetaClass>();
                        foreach (var jsonFile in jsonFiles)
                        {
                            Log("Parsing {0}...", Path.GetFileName(jsonFile));
                            var node = JsonConvert.DeserializeObject <Node>(File.ReadAllText(jsonFile));
                            if (node.Attributes != null)
                            {
                                var metaClass = new MetaClass(node);
                                if (!String.IsNullOrWhiteSpace(metaClass.Name))
                                {
                                    metaClasses.Add(metaClass);
                                }
                            }
                        }

                        // Generate classes from the metadata
                        Log("Generating classes...");
                        foreach (var metaClass in metaClasses)
                        {
                            Log("Generating {0}...", metaClass.FullName);
                            // Add properties from mixins to the classes
                            metaClass.AddMixins(metaClasses);
                            // Add class interfaces
                            metaClass.AddInterfaces(metaClasses);

                            // Generate class/interface from T4 template
                            string content = null;
                            if (!metaClass.IsInterface)
                            {
                                var template = new ClassTemplate {
                                    Session = new Dictionary <string, object> {
                                        { "Model", metaClass }
                                    }
                                };
                                content = template.TransformText();
                            }
                            else if (metaClass.IsInterface)
                            {
                                var template = new InterfaceTemplate {
                                    Session = new Dictionary <string, object> {
                                        { "Model", metaClass }
                                    }
                                };
                                content = template.TransformText();
                            }

                            // Write output class to .cs file
                            if (content != null)
                            {
                                var relOutputFile = metaClass.OriginalFullName.Replace(".", @"\") + ".cs";
                                if (!relOutputFile.StartsWith(@"qx\"))
                                {
                                    relOutputFile = @"qx\" + relOutputFile;
                                }
                                var outputFile = Path.Combine(generatedPath, relOutputFile);
                                var outputPath = Path.GetDirectoryName(outputFile);
                                if (!Directory.Exists(outputPath))
                                {
                                    Directory.CreateDirectory(outputPath);
                                }
                                File.WriteAllText(outputFile, content);
                            }
                        }
                    }
                    Log("Generation completed.");
                }
                else
                {
                    Log("Path not found: " + apiPath);
                }
            }
            catch (Exception e)
            {
                Log(e);
            }
        }
Example #34
0
 public TimeTrackingEntry(MetaClass metaType, PrimaryKeyId primaryKeyId, MetaObjectOptions options)
     : base(metaType, primaryKeyId, options)
 {
 }
        /// <summary>
        /// Gets the new elements.
        /// </summary>
        /// <param name="collection">The collection.</param>
        /// <param name="metaClass">The meta class.</param>
        /// <param name="keyPrefix">The key prefix.</param>
        /// <param name="namePrefix">The name prefix.</param>
        protected virtual void GetNewElements(List <FilterExpressionNode> collection, MetaClass metaClass, string keyPrefix, string namePrefix)
        {
            foreach (MetaField field in metaClass.MetaFields)
            {
                string key = String.Format("{0}(\"{1}\")", keyPrefix, field.Name);
                FilterExpressionNode node = new FilterExpressionNode(key,
                                                                     namePrefix + field.FriendlyName);

                collection.Add(node);
            }
        }
Example #36
0
 public Folder(MetaClass metaType, PrimaryKeyId primaryKeyId, MetaObjectOptions options)
     : base(metaType, primaryKeyId, options)
 {
 }
Example #37
0
 public ListPublication(MetaClass metaType, CustomTableRow row, MetaObjectOptions options)
     : base(metaType, row, options)
 {
 }
 public TimeTrackingBlockType(MetaClass metaType, CustomTableRow row, MetaObjectOptions options)
     : base(metaType, row, options)
 {
 }
Example #39
0
        private void BindData()
        {
            using (IDataReader reader = MetaClass.GetDataReader())
            {
                while (reader.Read())
                {
                    int    metaClassId = (int)reader["MetaClassId"];
                    bool   isSystem    = (bool)reader["IsSystem"];
                    string tableName   = reader["TableName"].ToString().ToLower();
                    if ((tableName == "projects" || tableName == "taskex" || tableName == "portfolioex") &&
                        !Configuration.ProjectManagementEnabled)
                    {
                        continue;
                    }
                    if (tableName == "incidentsex" && !Configuration.HelpDeskEnabled)
                    {
                        continue;
                    }
                    string friendlyName       = reader["FriendlyName"].ToString();
                    string parentTableName    = "";
                    string parentFriendlyName = "";
                    if (reader["ParentTableName"] != DBNull.Value)
                    {
                        parentTableName = reader["ParentTableName"].ToString().ToLower();
                    }
                    if (reader["ParentFriendlyName"] != DBNull.Value)
                    {
                        parentFriendlyName = reader["ParentFriendlyName"].ToString();
                    }
                    bool isAbstract = false;
                    if (reader["IsAbstract"] != DBNull.Value)
                    {
                        isAbstract = (bool)reader["IsAbstract"];
                    }
                    string namespaceName = reader["namespace"].ToString();
                    if (!isSystem && parentTableName != "projects" && parentTableName != "list_items" && !isAbstract && namespaceName == MetaDataWrapper.UserRoot)
                    {
                        ddlSelectedElement.Items.Add(new ListItem(parentFriendlyName, metaClassId.ToString()));
                    }
                    else if (tableName == "projects")
                    {
                        ddlSelectedElement.Items.Add(new ListItem(friendlyName, metaClassId.ToString()));
                    }
                }
            }

            // Current Element
            if (_pc["cust_SelectedElement"] != null)
            {
                int       curClassId = int.Parse(_pc["cust_SelectedElement"]);
                MetaClass mc         = MetaClass.Load(curClassId);
                if (mc != null)
                {
                    if (mc.Parent != null && mc.Parent.TableName.ToLower() == "projects")
                    {
                        Util.CommonHelper.SafeSelect(ddlSelectedElement, mc.Parent.Id.ToString());
                    }
                    else
                    {
                        Util.CommonHelper.SafeSelect(ddlSelectedElement, curClassId.ToString());
                    }
                }
            }

            BindSelectedType();
            BindAvailableType();
        }
Example #40
0
        /// <summary>
        /// Loads the request variables.
        /// </summary>
        private void LoadRequestVariables()
        {
            // Class
            if (Request.QueryString["class"] != null)
            {
                ClassName = Request.QueryString["class"];
                mc = MetaDataWrapper.GetMetaClassByName(ClassName);
            }

            // Bridge
            if (Request.QueryString["bridge"] != null)
            {
                BridgeName = Request.QueryString["bridge"];
                mcBridge = MetaDataWrapper.GetMetaClassByName(BridgeName);
            }

            // Current Field
            if (mcBridge != null && Request.QueryString["field"] != null)
            {
                FieldName = Request.QueryString["field"];
                mf = mcBridge.Fields[FieldName];
            }

            // Another field
            if (mf != null)
            {
                if (mf.Name == mcBridge.Attributes.GetValue<string>(MetaClassAttribute.BridgeRef1Name, string.Empty))
                    mfRef = mcBridge.Fields[mcBridge.Attributes[MetaClassAttribute.BridgeRef2Name].ToString()];
                else
                    mfRef = mcBridge.Fields[mcBridge.Attributes[MetaClassAttribute.BridgeRef1Name].ToString()];
            }

            // Another Class
            if (mfRef != null)
            {
                RefClassName = mfRef.Attributes.GetValue<string>(McDataTypeAttribute.ReferenceMetaClassName, string.Empty);
                if (!String.IsNullOrEmpty(RefClassName))
                    mcRef = MetaDataWrapper.GetMetaClassByName(RefClassName);
            }
        }
Example #41
0
 public Principal(MetaClass metaType, CustomTableRow row, MetaObjectOptions options)
     : base(metaType, row, options)
 {
 }
Example #42
0
 public static Rule[] GetList(MetaClass metaClass)
 {
     return((metaClass != null) ? GetList(metaClass.Id) : null);
 }
Example #43
0
        private void UpdateRelation(
			MetaClass bridgeClass,
			string friendlyName,
			string currentFieldName,
			string currentSectionName, 
			string currentDisplayText, 
			string currentDisplayOrder,
			string relatedFieldName,
			string relatedSectionName,
			string relatedDisplayText,
			string relatedDisplayOrder)
        {
            string currentFieldFiendlyName = currentDisplayText;
            string relatedFieldFiendlyName = relatedDisplayText;

            if (currentSectionName == notSetValue || ListManager.MetaClassIsList(ClassName))
            {
                currentSectionName = string.Empty;
                currentDisplayText = string.Empty;
                currentDisplayOrder = string.Empty;
            }

            if (relatedSectionName == notSetValue || ListManager.MetaClassIsList(RefClassName))
            {
                relatedSectionName = string.Empty;
                relatedDisplayText = string.Empty;
                relatedDisplayOrder = string.Empty;
            }

            MetaDataWrapper.UpdateBridge(
                bridgeClass,
                friendlyName,
                currentFieldName,
                currentFieldFiendlyName,
                currentSectionName,
                currentDisplayText,
                currentDisplayOrder,
                relatedFieldName,
                relatedFieldFiendlyName,
                relatedSectionName,
                relatedDisplayText,
                relatedDisplayOrder);
        }
Example #44
0
 public static Rule[] GetList(string metaClassName)
 {
     return(GetList(MetaClass.Load(metaClassName)));
 }
Example #45
0
 public TimeTrackingEntry(MetaClass metaType, CustomTableRow row, MetaObjectOptions options)
     : base(metaType, row, options)
 {
 }
Example #46
0
 public CalendarFolder(MetaClass metaType, int primaryKeyId, MetaObjectOptions options)
     : base(metaType, primaryKeyId, options)
 {
 }
Example #47
0
 public ListPublication(MetaClass metaType, PrimaryKeyId primaryKeyId, MetaObjectOptions options)
     : base(metaType, primaryKeyId, options)
 {
 }
Example #48
0
 public CalendarFolder(MetaClass metaType, CustomTableRow row, MetaObjectOptions options)
     : base(metaType, row, options)
 {
 }
Example #49
0
 private void newMenuItem_Click(object sender, EventArgs e)
 {
     DialogResult result = this.showSaveChangesDialog(SAVE_PROMPT_NEW);
     if (result != DialogResult.Cancel)
     {
         this.repository = new Repository(this.model);
         this.lastRepository = new Repository(this.model);
         InternalClipboard.Clear();
         this.lastFilename = string.Empty;
         this.listIndices.Clear();
         this.lastSelectedClass = null;
         this.RefreshData();
     }
 }
Example #50
0
        private void BindGrid()
        {
            DataTable dt = new DataTable();

            dt.Columns.Add("Id", typeof(int));
            dt.Columns.Add("Title", typeof(string));
            dt.Columns.Add("SuperType", typeof(string));
            dt.Columns.Add("StateMachine", typeof(string));
            dt.Columns.Add("BlockCard", typeof(string));
            dt.Columns.Add("EntryCard", typeof(string));
            dt.Columns.Add("EditLink", typeof(string));

            foreach (MetaObject mo in TimeTrackingManager.GetBlockTypeList())
            {
                DataRow row = dt.NewRow();
                row["Id"]    = mo.PrimaryKeyId;
                row["Title"] = mo.Properties["Title"].Value.ToString();
                if ((bool)mo.Properties["IsProject"].Value)
                {
                    row["SuperType"] = GetGlobalResourceObject("IbnFramework.TimeTracking", "ProjectType").ToString();
                }
                else
                {
                    row["SuperType"] = GetGlobalResourceObject("IbnFramework.TimeTracking", "GlobalType").ToString();
                }

                int stateMachineId = (Mediachase.Ibn.Data.PrimaryKeyId)mo.Properties["StateMachineId"].Value;
                Mediachase.Ibn.Data.Services.StateMachine sm = StateMachineManager.GetStateMachine(TimeTrackingManager.BlockMetaClassName, stateMachineId);
                row["StateMachine"] = CHelper.GetResFileString(sm.Name);

                if (mo.Properties["BlockCard"].Value != null)
                {
                    string    cardName = mo.Properties["BlockCard"].Value.ToString();
                    MetaClass mcCard   = MetaDataWrapper.GetMetaClassByName(cardName);
                    if (mcCard != null)
                    {
                        row["BlockCard"] = CHelper.GetResFileString(mcCard.FriendlyName);
                    }
                }
                if (mo.Properties["EntryCard"].Value != null)
                {
                    string    cardName = mo.Properties["EntryCard"].Value.ToString();
                    MetaClass mcCard   = MetaDataWrapper.GetMetaClassByName(cardName);
                    if (mcCard != null)
                    {
                        row["EntryCard"] = CHelper.GetResFileString(mcCard.FriendlyName);
                    }
                }

                dt.Rows.Add(row);
            }

            grdMain.DataSource = dt;
            grdMain.DataBind();

            foreach (GridViewRow row in grdMain.Rows)
            {
                ImageButton ib = (ImageButton)row.FindControl("ibDelete");
                if (ib != null)
                {
                    ib.Attributes.Add("onclick", "return confirm('" + GetGlobalResourceObject("IbnFramework.GlobalMetaInfo", "Delete").ToString() + "?')");
                }
            }
        }
Example #51
0
 private void updateModelMenuItem_Click(object sender, EventArgs e)
 {
     DialogResult result = this.showSaveChangesDialog(SAVE_PROMPT_OPEN);
     if (result != DialogResult.Cancel)
     {
         this.ofdModel.FileName = string.Empty;
         result = this.ofdModel.ShowDialog();
         if (result == DialogResult.OK)
         {
             Stream stream = this.ofdModel.OpenFile();
             Model newModel = Serializer.Deserialize(stream, this.model);
             stream.Close();
             if (!this.repository.Model.Equals(newModel))
             {
                 Repository newRepository = Serializer.Clone(this.repository);
                 result = this.updateTypes(newRepository, newModel);
                 if (result == DialogResult.OK)
                 {
                     this.repository = newRepository;
                 }
             }
             if (result == DialogResult.OK)
             {
                 this.model = newModel;
                 this.repository.Update(this.model);
                 this.lastRepository = Serializer.Clone(this.repository);
                 this.lastRepository.Update(this.model);
                 InternalClipboard.Clear();
                 this.listIndices.Clear();
                 this.lastSelectedClass = null;
                 this.RefreshData();
             }
         }
     }
 }
Example #52
0
        /// <summary>
        /// Binds the values.
        /// </summary>
        private void BindValues()
        {
            FormLabel lbl = null;

            foreach (FormLabel temp in FormItemData.Labels)
            {
                if (temp.Code.ToLower().Equals(Thread.CurrentThread.CurrentUICulture.Name.ToLower()))
                {
                    lbl = temp;
                }
            }

            if (lbl != null)
            {
                if (lbl.Title == "[MC_DefaultLabel]" || !FormItemData.ShowLabel)
                {
                    MetaClass temp = MetaDataWrapper.GetMetaClassByName(FormDocumentData.MetaClassName);
                    if (!temp.Fields.Contains(FormItemData.Control.Source))
                    {
                        temp = temp.CardOwner;
                    }

                    txtTitle.Text = CHelper.GetResFileString(temp.Fields[FormItemData.Control.Source].FriendlyName) + ":";
                }
                else
                {
                    txtTitle.Text = lbl.Title;
                }

                if (lbl.Title == "[MC_DefaultLabel]")
                {
                    rbDefault.Checked = true;
                }
            }
            if (!rbDefault.Checked)
            {
                if (FormItemData.ShowLabel)
                {
                    rbCustom.Checked = true;
                }
                else
                {
                    rbNone.Checked = true;
                }
            }
            this.Page.ClientScript.RegisterStartupScript(this.GetType(), Guid.NewGuid().ToString("N"),
                                                         String.Format("ModifyTxt({0});", rbCustom.Checked ? "1" : "0"), true);

            txtLabelWidth.Text = Unit.Parse(FormItemData.LabelWidth).Value.ToString();

            ddRows.SelectedValue = FormItemData.RowSpan.ToString();
            switch (FormItemData.ColSpan)
            {
            case 1:
                rb1.Checked = true;
                break;

            case 2:
                rb2.Checked = true;
                break;

            default:
                rb1.Disabled = true;
                rb2.Disabled = true;

                rb1.Checked = false;
                break;
            }
            FormController fc = new FormController(FormDocumentData);

            if (!fc.CanChangeColspan(FormItemData))
            {
                rb1.Disabled = true;
                rb2.Disabled = true;
            }

            lblControl.Text = String.Format("&lt;{0}&gt;", GetGlobalResourceObject("MetaForm", "NoControl").ToString());
            if (FormItemData.Control != null && !String.IsNullOrEmpty(FormItemData.Control.Type))
            {
                lblControl.Text = CHelper.GetResFileString(String.Format("{{MetaForm:{0}}}", FormItemData.Control.Type));
            }

            BindPropertiesControl(FormItemData.Control == null ? "" : FormItemData.Control.Type);
        }
Example #53
0
 public void BindData(MetaClass mc, string fieldType)
 {
     FillItems(true);
 }
Example #54
0
 private static bool MetaFieldIsNotConnected(MetaField field, MetaClass cls)
 {
     return(cls != null && !cls.MetaFields.Contains(field));
 }
Example #55
0
 public void BindData(MetaClass mc, string FieldType)
 {
 }
Example #56
0
        public void Initialize(InitializationEngine context)
        {
            MetaDataContext mdContext = CatalogContext.MetaDataContext;

            var itemSizeKeyField = CreateMetaField(mdContext, Constants.Metadata.Namespace.Order, Constants.Metadata.LineItem.Size, MetaDataType.ShortString, 255, true, false);

            JoinField(mdContext, itemSizeKeyField, Constants.Metadata.LineItem.ClassName);

            var itemUrl = CreateMetaField(mdContext, Constants.Metadata.Namespace.Order,
                                          Constants.Metadata.LineItem.ImageUrl, MetaDataType.URL, 255, true, false);

            JoinField(mdContext, itemUrl, Constants.Metadata.LineItem.ClassName);

            //var description = CreateMetaField(mdContext, Constants.Metadata.Namespace.Order,
            //    Constants.Metadata.LineItem.Description, MetaDataType.LongString, 255, true, false);
            //JoinField(mdContext, description, Constants.Metadata.LineItem.ClassName);

            var color = CreateMetaField(mdContext, Constants.Metadata.Namespace.Order,
                                        Constants.Metadata.LineItem.Color, MetaDataType.ShortString, 255, true, false);

            JoinField(mdContext, color, Constants.Metadata.LineItem.ClassName);

            var colorImage = CreateMetaField(mdContext, Constants.Metadata.Namespace.Order,
                                             Constants.Metadata.LineItem.ColorImageUrl, MetaDataType.URL, 255, true, false);

            JoinField(mdContext, colorImage, Constants.Metadata.LineItem.ClassName);

            var articleNumber = CreateMetaField(mdContext, Constants.Metadata.Namespace.Order,
                                                Constants.Metadata.LineItem.ArticleNumber, MetaDataType.ShortString, 255, true, false);

            JoinField(mdContext, articleNumber, Constants.Metadata.LineItem.ClassName);

            MetaClass dibsPaymentClass = CreatePaymentMetaClass(mdContext, Constants.Metadata.Namespace.Order, "DibsPayment");

            var cardNumberMasked = CreateMetaField(mdContext, Constants.Metadata.Namespace.Order, "CardNumberMasked",
                                                   MetaDataType.ShortString, 255, true, false);

            JoinField(mdContext, cardNumberMasked, dibsPaymentClass.Name);

            var cardTypeName = CreateMetaField(mdContext, Constants.Metadata.Namespace.Order, "CardTypeName",
                                               MetaDataType.ShortString, 255, true, false);

            JoinField(mdContext, cardTypeName, dibsPaymentClass.Name);

            var backEndOrderNumber = CreateMetaField(mdContext, Constants.Metadata.Namespace.Order, Constants.Metadata.PurchaseOrder.BackendOrderNumber, MetaDataType.LongString, Int32.MaxValue, true, false);

            JoinField(mdContext, backEndOrderNumber, Constants.Metadata.PurchaseOrder.ClassName);

            var postNordTrackingId = CreateMetaField(mdContext, Constants.Metadata.Namespace.Order, Constants.Metadata.PurchaseOrder.PostNordTrackingId, MetaDataType.LongString, Int32.MaxValue, true, false);

            JoinField(mdContext, postNordTrackingId, Constants.Metadata.PurchaseOrder.ClassName);

            var deliveryServicePoint = CreateMetaField(mdContext, Constants.Metadata.Namespace.Order, Constants.Metadata.Address.DeliveryServicePoint, MetaDataType.LongString, Int32.MaxValue, true, false);

            JoinField(mdContext, deliveryServicePoint, Constants.Metadata.Address.ClassName);

            var customerClub = CreateMetaField(mdContext, Constants.Metadata.Namespace.Order, Constants.Metadata.OrderForm.CustomerClub, MetaDataType.Boolean, 1, true, false);

            JoinField(mdContext, customerClub, Constants.Metadata.OrderForm.ClassName);

            var selectedCategories = CreateMetaField(mdContext, Constants.Metadata.Namespace.Order, Constants.Metadata.OrderForm.SelectedCategories, MetaDataType.ShortString, 8000, true, false);

            JoinField(mdContext, selectedCategories, Constants.Metadata.OrderForm.ClassName);
        }
Example #57
0
        private void LoadRequestVariables()
        {
            if (Request.QueryString["class"] != null)
            {
                ClassName = Request.QueryString["class"];
                mc = MetaDataWrapper.GetMetaClassByName(ClassName);
            }

            if (Request.QueryString["back"] != null)
                Back = Request.QueryString["back"].ToLower();
        }
Example #58
0
 /// <summary>
 /// Initializes a new instance of the <see cref="OrderGroup"/> class.
 /// </summary>
 /// <param name="metaClass">The meta class.</param>
 /// <param name="reader">The reader.</param>
 internal OrderGroup(MetaClass metaClass, IDataReader reader)
     : base(metaClass, reader)
 {
     Logger = LogManager.GetLogger(GetType());
     Initialize(Guid.Empty);
 }
Example #59
0
        protected void Page_Load(object sender, EventArgs e)
        {
            mc = Mediachase.Ibn.Data.Services.Security.GetGlobalAclMetaClass(ClassName);

            GenerateStructure();
            if (!IsPostBack)
            {
                BindData();
            }
        }
Example #60
0
 /// <summary>
 /// Initializes a new instance of the <see cref="OrderGroup"/> class.
 /// </summary>
 /// <param name="CustomerId">The customer id.</param>
 /// <param name="metaClass">The meta class.</param>
 internal OrderGroup(Guid CustomerId, MetaClass metaClass)
     : base(metaClass)
 {
     Logger = LogManager.GetLogger(GetType());
     Initialize(CustomerId);
 }