public Information()
        {
            InitializeComponent();
            FK.Content = "FindersKeepers - " + FindersKeepers.MainWindow.Version;

            try
            {
                FK.AnimateFade <Label>(0, 1, new Duration(TimeSpan.FromSeconds(4)), TimeSpan.FromSeconds(2), (() =>
                {
                    FK.AnimateFade <Label>(1, 0, new Duration(TimeSpan.FromSeconds(3)), TimeSpan.FromSeconds(3));
                }));

                FKLogo.AnimateFade <Image>(0, 1, new Duration(TimeSpan.FromSeconds(4)), TimeSpan.FromSeconds(2), (() =>
                {
                    FKLogo.AnimateFade <Image>(1, 0, new Duration(TimeSpan.FromSeconds(3)), TimeSpan.FromSeconds(3), (() =>
                    {
                        if (GameManager.Instance.GManager.GRef.Attacher != null)
                        {
                            GameManager.Instance.GManager.GRef.Attacher.CloseInformation();
                        }
                    }));
                }));
            }

            catch {
                // Closed before exit
            }
        }
示例#2
0
        private static async Task TestAsync()
        {
            var cmd = Util.Adapter;

            MEZUNBOL mezunbol = await cmd.QuerySingleAsync(new FluentSelect<MEZUNBOL>('@').SelectAll().Where().Equals(m => m.MEZUNBOLK, 30).AsSelect());

            FK<MEZUNBOL> mezunFK = new FK<MEZUNBOL>(mezunbol, Util.Adapter);

            mezunFK.Join<SICIL>()
                .On(m => m.MEZUNBOLK, s => s.MEZUNBOLK)
                .LoadChildsAsync(m => m.SICILs).Wait();

            SICIL sicil = cmd.SelectSingle<SICIL>();

            FK<SICIL> sicilFK = new FK<SICIL>(sicil, cmd);

            sicilFK = await sicilFK.Join<PERSONELTIP>().On(s => s.PERSONELTIPK, p => p.PERSONELTIPK).SetAsync(s => s.PERSONELTIP);
            sicilFK = await sicilFK.Join<MEZUNBOL>().On(s => s.MEZUNBOLK, m => m.MEZUNBOLK).SetAsync(s => s.MEZUNBOL);


            var sicilList = await cmd.SelectAsync<SICIL>();

            FKs<SICIL> fks = await new FKs<SICIL>(sicilList, cmd)
                            .Join<PERSONELTIP>().On(s => s.PERSONELTIPK, p => p.PERSONELTIPK)
                            .SetAsync(s => s.PERSONELTIP);

            fks.Join<MEZUNBOL>()
            .On(s => s.MEZUNBOLK, m => m.MEZUNBOLK)
            .SetAsync(s => s.MEZUNBOL).Wait();

        }
示例#3
0
        public override void OnInspectorGUI()
        {
            fk = target as FK;
            var bone = EditorGUILayout.ObjectField("Start Bone", fk.StartBone, typeof(Bone), true) as Bone;

            if (bone != fk.StartBone)
            {
                fk.StartBone = bone;
                InitBones();
            }
            bone = EditorGUILayout.ObjectField("End Bone", fk.EndBone, typeof(Bone), true) as Bone;
            if (bone != fk.EndBone)
            {
                fk.EndBone = bone;
                InitBones();
            }
            EditorGUILayout.Space();
            showBones = EditorGUILayout.Foldout(showBones, "Bones");
            if (showBones)
            {
                GUIStyle style = new GUIStyle();
                style.margin.left = 20;
                EditorGUILayout.BeginVertical(style);
                for (var i = 0; i < fk.Bones.Length; i++)
                {
                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.ObjectField(fk.Bones[i], typeof(Bone), true);
                    fk.Rotations[i].eulerAngles = EditorGUILayout.Vector3Field("", fk.Rotations[i].eulerAngles);
                    EditorGUILayout.EndHorizontal();
                }
                EditorGUILayout.EndVertical();
            }
        }
示例#4
0
        protected void Page_Init(object sender, EventArgs e)
        {
            ValidationResult.Items.Clear();
            mm = (MinMaster)Master;

            string projectName = Page.RouteData.Values["projectName"] as string;
            int panelId = Int32.Parse(Page.RouteData.Values["panelId"] as string);

            actPanel = mm.SysDriver.Panels[panelId];
            DataColumnCollection cols = mm.Stats.ColumnTypes[actPanel.tableName];
            PanelName.Text = actPanel.panelName;
            _min.Models.Control control = actPanel.controls.Where(x => x is NavTableControl || x is TreeControl).First();
            FKs = mm.Stats.FKs[actPanel.tableName];
            List<string> colNames = (from DataColumn col in cols select col.ColumnName).ToList<string>();

            // a M2NControl to select the columns of the table displayed in the GridView - for a tree we take only the first item
            DisplayCols.SetOptions(colNames);
            DisplayCols.SetIncludedOptions(control.displayColumns);

            // what actions can be triggered from the navigation control
            List<string> possibleAcitons = new List<string>(new string[] { UserAction.Insert.ToString(), UserAction.View.ToString(),
                                           UserAction.Delete.ToString() });
            List<UserAction> originalActions = new List<UserAction>();
            if (control is NavTableControl) {
                foreach(UserAction ua in ((NavTableControl)control).actions)
                    originalActions.Add(ua);
            }
            else{
                foreach (UserAction ua in ((TreeControl)control).actions)
                {
                    originalActions.Add(ua);
                }
            }

            // if the panel contains a NavTable or TreeControl, it is the only control of a complex type and other controls therefore must be
            // simple buttons.
            foreach(_min.Models.Control simpleControl in actPanel.controls){
                if(simpleControl == control) continue;
                originalActions.Add(simpleControl.action);
            }

            List<string> originalActionStrings = new List<string>();
            foreach (UserAction a in originalActions)
                originalActionStrings.Add(a.ToString());

            actionsControl.SetOptions(possibleAcitons);
            actionsControl.SetIncludedOptions(originalActionStrings);

            hierarchy = mm.Stats.SelfRefFKs().Find(x => x.myTable == actPanel.tableName);
            string[] CTypeOptions = hierarchy == null ? new string[] {"Navigation Table"} :
                new string[] {"Navigation Table", "Navigation Tree"};
            // a radio button list - contains navtable and maybe treeview option
            NavControlType.DataSource = CTypeOptions;
            NavControlType.DataBind();
            // let the default be the current
            if (control is TreeControl) NavControlType.SelectedIndex = 1; else NavControlType.SelectedIndex = 0;

            BackButton.PostBackUrl = BackButton.GetRouteUrl("ArchitectShowRoute", new { projectName = projectName });
        }
示例#5
0
        private static void Test()
        {
            var cmd = Util.Adapter;
            MEZUNBOL mezunbol = cmd.SelectSingle<MEZUNBOL>();

            FK<MEZUNBOL> mezunFK = new FK<MEZUNBOL>(mezunbol, Util.Adapter);

            mezunFK.Join<SICIL>()
                .On(m => m.MEZUNBOLK, s => s.MEZUNBOLK)
                .LoadChilds(m => m.SICILs);

            PERSONELTIP personelTip = cmd.SelectSingle<PERSONELTIP>();
            FK<PERSONELTIP> personekTipFK = new FK<PERSONELTIP>(personelTip, Util.Adapter);

            personekTipFK.Join<SICIL>().On(p => p.PERSONELTIPK, s => s.PERSONELTIPK).LoadChilds(p => p.SICILs);



            SICIL sicil = cmd.SelectSingle<SICIL>();

            cmd.Upsert(sicil, new Expression<Func<SICIL, object>>[] { s => s.ADI, s => s.SOYADI }, null);

            FK<SICIL> sicilFK = new FK<SICIL>(sicil, cmd);

            Stopwatch bench = Stopwatch.StartNew();

            sicilFK.Join<PERSONELTIP>().On(s => s.PERSONELTIPK, p => p.PERSONELTIPK).Set(s => s.PERSONELTIP)
                .Join<MEZUNBOL>().On(s => s.MEZUNBOLK, m => m.MEZUNBOLK).Set(s => s.MEZUNBOL);
          
            FK<PERSONELTIP> inner = new FK<PERSONELTIP>(sicil.PERSONELTIP, cmd);
            inner.Join<SICIL>().On(p => p.PERSONELTIPK, s => s.PERSONELTIPK).LoadChilds(p => p.SICILs);

            bench.Stop();

            Console.WriteLine(bench.ElapsedMilliseconds);

            var sicilList = cmd.Select<SICIL>();

            bench = Stopwatch.StartNew();

            for (int j = 0; j < 100; ++j)
            {
                FKs<SICIL> fks = new FKs<SICIL>(sicilList, cmd)
                    .Join<PERSONELTIP>()
                    .On(s => s.PERSONELTIPK, p => p.PERSONELTIPK)
                    .Set(s => s.PERSONELTIP)

                    .Join<MEZUNBOL>()
                    .On(s => s.MEZUNBOLK, m => m.MEZUNBOLK)
                    .Set(s => s.MEZUNBOL);
            }

            bench.Stop();

            Console.WriteLine(bench.ElapsedMilliseconds);

            // fk.Join(m => m.SICILs, s => s.MEZUNBOLK);
            //fk.Join(mezunbol, m => m.SICILs, s => s.MEZUNBOLK);
        }
示例#6
0
 public void OnSceneGUI()
 {
     fk = target as FK;
     fk.StartBone._showAsActive = true;
     fk.EndBone._showAsActive   = true;
     foreach (var b in fk.Bones)
     {
         b._showAsActive = true;
     }
     fk = target as FK;
 }
示例#7
0
 private void Update()
 {
     /*var r = Quaternion.Euler(45, 0, 0);
      * Quaternion.*/
     if (Bones.Length != Weights.Length || Bones.Length != InitialRotation.Length)
     {
         var lengthOld = Weights.Length;
         Array.Resize(ref Weights, Bones.Length);
         Array.Resize(ref InitialRotation, Bones.Length);
         for (var i = lengthOld; i < Bones.Length; i++)
         {
             Weights[i] = 1;
         }
     }
     if (Enable)
     {
         Quaternion[] rotations;
         if (UseInitial)
         {
             rotations = InverseKinematics(Bones, Weights, transform.position, Iteration, InitialRotation);
         }
         else
         {
             rotations = InverseKinematics(Bones, Weights, transform.position, Iteration);
         }
         for (var i = 0; i < this.Bones.Length; i++)
         {
             if (i == 0)
             {
                 Bones[i].transform.rotation = rotations[i];
             }
             else
             {
                 Bones[i].transform.localRotation = rotations[i];
             }
             Bones[i].ApplyAngularLimit();
             //Bones[i].ApplyAngularLimit();
         }
     }
     else
     {
         transform.position = FK.ForwardKinematics(this.Bones, Bones.Select(bone => bone.transform.localRotation).ToArray());
     }
 }
示例#8
0
        public static void FKEquality()
        {
            var fk1 = new FK <Simple>(Mapper.CreateIncompleteKey <Simple>());
            var fk2 = new FK <Simple>(Mapper.CreateIncompleteKey <Simple>());
            var fk3 = new FK <Simple>(fk1.Key);
            var fk4 = new FK <Simple>(new Simple {
                Baz = "Baz"
            });
            var fk5 = new FK <Simple>(new Simple {
                Baz = "Hello"
            });
            var fk6 = new FK <Simple>(fk4.Value);

            Assert.Equal(fk1, fk3);
            Assert.NotEqual(fk1, fk2);
            Assert.NotEqual(fk3, fk2);
            Assert.NotEqual(fk1, fk4);
            Assert.NotEqual(fk2, fk4);
            Assert.NotEqual(fk3, fk4);
            Assert.NotEqual(fk5, fk4);
            Assert.NotEqual(fk5, fk6);
            Assert.Equal(fk4, fk6);
        }
示例#9
0
        protected void SaveButton_Click(object sender, EventArgs e)
        {
            // extract the data for fields from the table
            List <IField> fields = new List <IField>();
            int           i      = 1;

            Dictionary <DataColumn, Dictionary <string, object> > customs = new Dictionary <DataColumn, Dictionary <string, object> >();

            foreach (DataColumn col in mm.Stats.ColumnTypes[actPanel.tableName])
            {       // standard fields
                TableRow r = tbl.Rows[i++];
                if (!((CheckBox)r.Cells[1].Controls[0]).Checked)
                {
                    continue;
                }
                // label, present, type, valid, caption

                IColumnFieldFactory factory = factories[Int32.Parse(((DropDownList)r.Cells[2].Controls[0]).SelectedValue)];


                // cell 3 is there for FK display column dropList

                bool required = false;
                bool unique   = false;
                if (r.Cells[4].Controls.Count == 4)
                {
                    CheckBox reqChb = (CheckBox)r.Cells[4].Controls[1];
                    CheckBox uniChb = (CheckBox)r.Cells[4].Controls[3];
                    required = reqChb.Checked;
                    unique   = uniChb.Checked;
                }

                string caption = ((TextBox)r.Cells[5].Controls[0]).Text;
                if (caption == "")
                {
                    caption = null;
                }

                if (factory is ICustomizableColumnFieldFactory)
                {
                    customs[col]             = new Dictionary <string, object>();
                    customs[col]["factory"]  = factory.Clone();     // so that each field gets its factory even if there more custom fields of the same type
                    customs[col]["required"] = required;
                    customs[col]["unique"]   = unique;
                    customs[col]["caption"]  = caption;
                    continue;
                }

                IField newField;

                //PBPR

                // react to the changes to the displaycolumn for the FK
                if (col.ExtendedProperties.Contains("FK"))
                {
                    FK colFK = (FK)(col.ExtendedProperties["FK"]);
                    colFK.displayColumn          = ((DropDownList)(r.Cells[3].Controls[0])).SelectedValue;
                    col.ExtendedProperties["FK"] = colFK;
                }
                newField          = factory.Create(col);
                newField.Caption  = caption;
                newField.Required = required;
                if (newField is IColumnField)
                {
                    ((IColumnField)newField).Unique = unique;
                }
                fields.Add(newField);
            }

            i = 1;
            foreach (M2NMapping mapping in mappings)
            {                // mappings
                TableRow r = mappingsTbl.Rows[i++];
                // label, present, type (mappingType), valid (req?), caption
                if (!((CheckBox)r.Cells[1].Controls[0]).Checked)
                {
                    continue;
                }

                // must be mappingType...

                List <ValidationRules> rules = new List <ValidationRules>();
                // no validation for a mapping

                mapping.displayColumn = ((DropDownList)(r.Cells[3].Controls[0])).SelectedValue;

                string caption = ((TextBox)r.Cells[5].Controls[0]).Text;

                M2NMappingField m2nf = new M2NMappingField(mapping, caption);
                fields.Add(m2nf);
            }

            // crate a control for each checked action
            List <_min.Models.Control> controls = new List <_min.Models.Control>();           // controls

            bool          valid     = true;
            List <string> errorMsgs = new List <string>();

            if (actions.RetrieveStringData().Count == 0)
            {
                valid = false;
                errorMsgs.Add("Choose at least one action for the panel, please.");
            }

            foreach (string actionString in actions.RetrieveStringData())
            {
                _min.Models.Control c = new _min.Models.Control(0, actionString,
                                                                (UserAction)Enum.Parse(typeof(UserAction), actionString));
                c.targetPanel = actPanel.controls[0].targetPanel;

                c.targetPanelId = actPanel.controls[0].targetPanelId;       //  a miserable way to find out the target panel...really

                controls.Add(c);
            }

            MPanel resPanel = new MPanel(actPanel.tableName, actPanel.panelId, PanelTypes.Editable, new List <MPanel>(),
                                         fields, controls, actPanel.PKColNames, null, actPanel.parent);

            resPanel.panelName = panelName.Text;


            valid = valid && mm.Architect.checkPanelProposal(resPanel, out errorMsgs, customs);

            // validate the Panel using Architect`s validator - don`t edit PKs, unique columns must have the constraint, must contain all collumns except Nullable
            // and AI and more rules
            validationResult.Items.Clear();
            if (valid)
            {
                if (customs.Count == 0)
                {
                    validationResult.Items.Add(new ListItem("Valid"));

                    actPanel = resPanel;
                    mm.SysDriver.BeginTransaction();
                    mm.SysDriver.UpdatePanel(actPanel);
                    Session.Clear();
                    mm.SysDriver.IncreaseVersionNumber();
                    mm.SysDriver.CommitTransaction();

                    validationResult.Items.Add(new ListItem("Saved"));
                    Response.Redirect(Page.Request.RawUrl);
                }
                else
                {
                    Session["interPanel"] = resPanel;
                    Session["customs"]    = customs;
                    Response.RedirectToRoute("ArchitectEditEditableCustomRoute", new { projectName = CE.project.Name, panelId = actPanel.panelId });
                    // for the sake of unity (and SysDriver)
                }
            }
            else
            {
                foreach (string s in errorMsgs)
                {
                    validationResult.Items.Add(new ListItem(s));
                }
            }
        }
示例#10
0
		public void TableFKs(
			out FK[] fks_out,
			out System.Collections.Generic.Dictionary<string, FK> fks_dic_out
		) {
			System.Collections.Generic.List<FK> _output 
				= new System.Collections.Generic.List<FK>();
			System.Collections.Generic.Dictionary<string, FK> _output2
				= new System.Collections.Generic.Dictionary<string, FK>();

			XS_objectType _table_a;
			string _tableName_a;
			string _tableFieldName_a;

			XS_objectType _table_b;
			string _tableName_b;
			string _tableFieldName_b;

			string _direction;

			XS_objectTypeCollection _objecttypecollection = (XS_objectTypeCollection)this.parent_ref;
			XS_layerType _layertype = (XS_layerType)_objecttypecollection.parent_ref;
			XS_layerTypeCollection _layertypecollection = (XS_layerTypeCollection)_layertype.parent_ref;
			XS__diagram _root_ref = (XS__diagram)_layertypecollection.parent_ref;
			FK _aux;

			for (int l = 0; l < _root_ref.LayerCollection.Count; l++) {
				for (int o = 0; o < _root_ref.LayerCollection[l].ObjectCollection.Count; o++) {
					switch (_root_ref.LayerCollection[l].ObjectCollection[o].Type) {
						case "UML - Association":
							if (_root_ref.LayerCollection[l].ObjectCollection[o].Connections.ConnectionCollection.Count != 2)
								break;

							_table_a = null;
							_tableName_a = "";
							_tableFieldName_a = "";

							_table_b = null;
							_tableName_b = "";
							_tableFieldName_b = "";

							_direction = "";

							for (int a = 0; a < _root_ref.LayerCollection[l].ObjectCollection[o].AttributeCollection.Count; a++) {
								switch (_root_ref.LayerCollection[l].ObjectCollection[o].AttributeCollection[a].Name) {
									case "direction":
										_direction = _root_ref.LayerCollection[l].ObjectCollection[o].AttributeCollection[a].Enum.Val;
										break;
									case "role_a":
										_table_a = _root_ref.Table_search(
											_root_ref.LayerCollection[l].ObjectCollection[o].Connections.ConnectionCollection[0].To
										);
										_tableName_a = _table_a.TableName;
										_tableFieldName_a = _root_ref.LayerCollection[l].ObjectCollection[o].AttributeCollection[a].String.Replace("#", "");
										break;
									case "role_b":
										_table_b = _root_ref.Table_search(
											_root_ref.LayerCollection[l].ObjectCollection[o].Connections.ConnectionCollection[1].To
										);
										_tableName_b = _table_b.TableName;
										_tableFieldName_b = _root_ref.LayerCollection[l].ObjectCollection[o].AttributeCollection[a].String.Replace("#", "");
										break;
								}
							}

							if (
								(_table_a == this)
								&&
								(_direction == "1")
							) {
								_output2.Add(
									_tableFieldName_a,
									_aux = new FK(
										_tableFieldName_a,
										_tableName_b,
										_tableFieldName_b
									)
								);
								_output.Add(_aux);
							}
							if (
								(_table_b == this)
								&&
								(_direction == "2")
							) {
								_output2.Add(
									_tableFieldName_b,
									_aux = new FK(
										_tableFieldName_b,
										_tableName_a,
										_tableFieldName_a
									)
								);
								_output.Add(_aux);
							}
							break;
					}
				}
			}

			fks_dic_out = _output2;
			fks_out = _output.ToArray();

			//return _output.ToArray();
		}
示例#11
0
 private SortedDictionary<int, string> FetchFKOptions(FK fk)
 {
     DataTable tbl = driver.fetchAll("SELECT ", dbe.Cols(new string[] {fk.refColumn, fk.displayColumn}), " FROM ", dbe.Table(fk.refTable));
     SortedDictionary<int, string> res = new SortedDictionary<int, string>();
     foreach (DataRow r in tbl.Rows)
     {
         if (r[0] == DBNull.Value || r[0].ToString() == "") continue;
         res.Add(Int32.Parse(r[0].ToString()), r[1].ToString());     // awful... obj to int through int - find a better way
     }
     return res;
 }
示例#12
0
文件: Field.cs 项目: rjankovic/Webmin
 public FKField(string columnName, string caption, FK FK)
     : base(columnName, caption)
 {
     this.FK = FK;
 }
示例#13
0
 public static float FKDistance(Bone[] bones, Quaternion[] rotations, Vector3 target)
 {
     return((FK.ForwardKinematics(bones, rotations) - target).magnitude);
 }
示例#14
0
 public InnerJoin(FK fk)
 {
     this.fk = fk;
 }
示例#15
0
        /// <summary>
        /// loads the whole project from database (in 3 queries)
        /// </summary>
        public void FullProjectLoad()
        {
            Panels = new Dictionary<int, Panel>();

            driver.BeginTransaction();
            FK control_panel = new FK("controls", "id_panel", "panels", "id_panel", null);
            FK field_panel = new FK("fields", "id_panel", "panels", "id_panel", null);
            DataTable panels = driver.fetchAll("SELECT * FROM ", dbe.Table("panels"), "WHERE id_project =", CE.project.Id);
            DataTable controls = driver.fetchAll("SELECT controls.* FROM ", dbe.Table("controls"), dbe.Join(control_panel), "WHERE id_project =", CE.project.Id);
            DataTable fields = driver.fetchAll("SELECT fields.* FROM ", dbe.Table("fields"), dbe.Join(field_panel), "WHERE id_project =", CE.project.Id);
            driver.CommitTransaction();

            panels.TableName = "panels";
            controls.TableName = "controls";
            fields.TableName = "fields";

            DataSet ds = new DataSet();
            /*
            panels.PrimaryKey = new DataColumn[] { panels.Columns["id_panel"] };
            controls.PrimaryKey = new DataColumn[] { panels.Columns["id_control"] };
            fields.PrimaryKey = new DataColumn[] { panels.Columns["id_field"] };
            */
            if(panels.DataSet is DataSet)
                panels.DataSet.Tables.Clear();
            if(controls.DataSet is DataSet)
                controls.DataSet.Tables.Clear();
            if(fields.DataSet is DataSet)
                fields.DataSet.Tables.Clear();
            ds.Tables.Add(panels);
            ds.Tables.Add(controls);
            ds.Tables.Add(fields);

            ds.Relations.Add(new DataRelation(CC.SYSDRIVER_FK_CONTROL_PANEL, ds.Tables["panels"].Columns["id_panel"], ds.Tables["controls"].Columns["id_panel"], true));
            ds.Relations.Add(new DataRelation(CC.SYSDRIVER_FK_FIELD_PANEL, ds.Tables["panels"].Columns["id_panel"], ds.Tables["fields"].Columns["id_panel"], true));
            ds.Relations.Add(new DataRelation(CC.SYSDRIVER_FK_PANEL_PARENT, ds.Tables["panels"].Columns["id_panel"], ds.Tables["panels"].Columns["id_parent"], true));
            DataSet2Architecture(ds);
        }
示例#16
0
        protected void Page_Init(object sender, EventArgs e)
        {
            ValidationResult.Items.Clear();
            mm = (MinMaster)Master;

            string projectName = Page.RouteData.Values["projectName"] as string;
            int    panelId     = Int32.Parse(Page.RouteData.Values["panelId"] as string);

            actPanel = mm.SysDriver.Panels[panelId];
            DataColumnCollection cols = mm.Stats.ColumnTypes[actPanel.tableName];

            PanelName.Text = actPanel.panelName;
            _min.Models.Control control = actPanel.controls.Where(x => x is NavTableControl || x is TreeControl).First();
            FKs = mm.Stats.FKs[actPanel.tableName];
            List <string> colNames = (from DataColumn col in cols select col.ColumnName).ToList <string>();

            // a M2NControl to select the columns of the table displayed in the GridView - for a tree we take only the first item
            DisplayCols.SetOptions(colNames);
            DisplayCols.SetIncludedOptions(control.displayColumns);

            // what actions can be triggered from the navigation control
            List <string> possibleAcitons = new List <string>(new string[] { UserAction.Insert.ToString(), UserAction.View.ToString(),
                                                                             UserAction.Delete.ToString() });
            List <UserAction> originalActions = new List <UserAction>();

            if (control is NavTableControl)
            {
                foreach (UserAction ua in ((NavTableControl)control).actions)
                {
                    originalActions.Add(ua);
                }
            }
            else
            {
                foreach (UserAction ua in ((TreeControl)control).actions)
                {
                    originalActions.Add(ua);
                }
            }


            // if the panel contains a NavTable or TreeControl, it is the only control of a complex type and other controls therefore must be
            // simple buttons.
            foreach (_min.Models.Control simpleControl in actPanel.controls)
            {
                if (simpleControl == control)
                {
                    continue;
                }
                originalActions.Add(simpleControl.action);
            }

            List <string> originalActionStrings = new List <string>();

            foreach (UserAction a in originalActions)
            {
                originalActionStrings.Add(a.ToString());
            }

            actionsControl.SetOptions(possibleAcitons);
            actionsControl.SetIncludedOptions(originalActionStrings);


            hierarchy = mm.Stats.SelfRefFKs().Find(x => x.myTable == actPanel.tableName);
            string[] CTypeOptions = hierarchy == null ? new string[] { "Navigation Table" } :
            new string[] { "Navigation Table", "Navigation Tree" };
            // a radio button list - contains navtable and maybe treeview option
            NavControlType.DataSource = CTypeOptions;
            NavControlType.DataBind();
            // let the default be the current
            if (control is TreeControl)
            {
                NavControlType.SelectedIndex = 1;
            }
            else
            {
                NavControlType.SelectedIndex = 0;
            }

            BackButton.PostBackUrl = BackButton.GetRouteUrl("ArchitectShowRoute", new { projectName = projectName });
        }
示例#17
0
 public InnerJoin(FK fk, string alias)
 {
     this.fk = fk;
     this.alias = alias;
 }
示例#18
0
 public IDbJoin Join(FK fk, string alias)
 {
     return new InnerJoin(fk, alias);
 }
示例#19
0
 public IDbJoin Join(FK fk)
 {
     return new InnerJoin(fk);
 }
示例#20
0
        protected void Page_Init(object sender, EventArgs e)
        {
            mm        = (MinMaster)Master;
            factories = (List <IColumnFieldFactory>)Application["ColumnFieldFactories"];

            int panelId = Int32.Parse(Page.RouteData.Values["panelId"] as string);

            actPanel = mm.SysDriver.Panels[panelId];
            DataColumnCollection cols = mm.Stats.ColumnTypes[actPanel.tableName];

            // the field types - default and special subsets allowed for special data types - i.e. a foereign key cannot be edited via nothing but
            // a FKFiels
            string[] fieldTypes = new string[] { FieldTypes.ShortText.ToString(), FieldTypes.Bool.ToString(),
                     FieldTypes.Date.ToString(), FieldTypes.DateTime.ToString(), FieldTypes.Text.ToString() };
            string[] EnumType        = new string[] { FieldTypes.Enum.ToString() };
            string[] FKtype          = new string[] { FieldTypes.FK.ToString() };
            string[] mappingType     = new string[] { FieldTypes.M2NMapping.ToString() };
            string[] validationRules = Enum.GetNames(typeof(ValidationRules));

            //possible bugpoing (see repo)

            // a  FKField can be only required - let referential integrity take care of the rest
            string[] requiredRule = new string[] { Enum.GetName(typeof(ValidationRules), ValidationRules.Required) };
            FKs      = mm.Stats.FKs[actPanel.tableName];
            mappings = new List <M2NMapping>();
            mappings = mm.Stats.Mappings[actPanel.tableName];

            panelName.Text = actPanel.panelName;

            // create a datarow for each column, specifiing...
            foreach (DataColumn col in cols)            // std. fields (incl. FKs)

            {
                IColumnField cf = (IColumnField)actPanel.fields.Find(x => x is IColumnField && ((IColumnField)x).ColumnName == col.ColumnName);

                TableRow r = new TableRow();
                r.ID = col.ColumnName;

                //...the name,...
                TableCell nameCell  = new TableCell();
                Label     nameLabel = new Label();
                nameLabel.Text = col.ColumnName;
                nameCell.Controls.Add(nameLabel);
                r.Cells.Add(nameCell);

                //...whether the column will be accessible to editation at all,...
                TableCell presentCell = new TableCell();
                CheckBox  present     = new CheckBox();
                present.Checked = cf != null;
                presentCell.Controls.Add(present);
                r.Cells.Add(presentCell);


                FK fk = FKs.Find(x => x.myColumn == col.ColumnName);
                if (cf != null && cf is FKField)
                {
                    fk = ((FKField)cf).FK;
                }
                //...the FieldType,...
                TableCell                typeCell    = new TableCell();
                DropDownList             dl          = new DropDownList();
                Dictionary <int, string> typeOptions = new Dictionary <int, string>();

                int current = -1;
                for (int i = 0; i < factories.Count; i++)
                {
                    if (factories[i].CanHandle(col))
                    {
                        typeOptions.Add(i, factories[i].UIName);
                    }
                    if (cf != null && cf.GetType() == (factories[i].ProductionType))
                    {
                        current = typeOptions.Count - 1;
                    }
                }

                dl.DataSource     = typeOptions;
                dl.DataValueField = "Key";
                dl.DataTextField  = "Value";
                dl.DataBind();

                dl.SelectedIndex = current;
                typeCell.Controls.Add(dl);
                r.Cells.Add(typeCell);

                //...what column of the referred table to display in the dropdown
                TableCell FKDisplayCell = new TableCell();
                // set default value if the field was originally present in the editation form
                if (fk != null)
                {
                    DropDownList fkddl = new DropDownList();
                    fkddl.DataSource = mm.Stats.ColumnsToDisplay[fk.refTable];
                    fkddl.DataBind();
                    if (cf != null)
                    {
                        fkddl.SelectedIndex = fkddl.Items.IndexOf(fkddl.Items.FindByValue(((FKField)cf).FK.displayColumn));
                    }
                    FKDisplayCell.Controls.Add(fkddl);
                }
                r.Cells.Add(FKDisplayCell);

                //PBPR

                //...the validation rules...
                TableCell validCell = new TableCell();

                CheckBox requiredCb    = new CheckBox();
                Label    requiredlabel = new Label();
                requiredlabel.Text = "required ";
                CheckBox uniCheck = new CheckBox();
                Label    uniLabel = new Label();
                uniLabel.Text = "unique";

                if (cf != null)
                {
                    requiredCb.Checked = cf.Required;
                    uniCheck.Checked   = cf.Unique;
                }

                if (!(cf is CheckBoxField))
                {
                    validCell.Controls.Add(requiredlabel);
                    validCell.Controls.Add(requiredCb);
                    validCell.Controls.Add(uniLabel);
                    validCell.Controls.Add(uniCheck);
                }

                r.Cells.Add(validCell);

                //...and the caption
                TableCell captionCell = new TableCell();
                TextBox   caption     = new TextBox();
                captionCell.Controls.Add(caption);
                r.Cells.Add(captionCell);

                if (cf != null)
                {
                    caption.Text = cf.Caption;
                }
                // index 6

                tbl.Rows.Add(r);
            }


            // mappings will get a similiar table, but some collumns (like validation) will just be left empty
            foreach (M2NMapping mapping in mappings)
            {
                M2NMappingField f = actPanel.fields.Find(
                    x => x is M2NMappingField && ((M2NMappingField)x).Mapping.myColumn == mapping.myColumn) as M2NMappingField;

                TableRow r = new TableRow();

                TableCell nameCell  = new TableCell();
                Label     nameLabel = new Label();
                nameLabel.Text = mapping.myTable + " to " + mapping.refTable + " via " + mapping.mapTable;
                nameCell.Controls.Add(nameLabel);
                r.Cells.Add(nameCell);

                TableCell presentCell = new TableCell();
                CheckBox  present     = new CheckBox();
                present.Checked = f != null;
                presentCell.Controls.Add(present);
                r.Cells.Add(presentCell);

                TableCell    typeCell = new TableCell();
                DropDownList dl       = new DropDownList();
                dl.DataSource = mappingType;
                dl.DataBind();
                typeCell.Controls.Add(dl);
                r.Cells.Add(typeCell);

                TableCell    displayCell = new TableCell();
                DropDownList displayDrop = new DropDownList();
                displayDrop.DataSource = mm.Stats.ColumnsToDisplay[mapping.refTable];
                displayDrop.DataBind();
                if (f != null)
                {
                    displayDrop.SelectedIndex = displayDrop.Items.IndexOf(displayDrop.Items.FindByValue(f.Mapping.displayColumn));
                }
                displayCell.Controls.Add(displayDrop);
                r.Cells.Add(displayCell);

                TableCell validCell = new TableCell();  // leave it empty
                r.Cells.Add(validCell);


                TableCell captionCell = new TableCell();
                TextBox   caption     = new TextBox();
                captionCell.Controls.Add(caption);
                r.Cells.Add(captionCell);

                if (f != null)
                {
                    caption.Text = f.Caption;
                }

                mappingsTbl.Rows.Add(r);
            }

            // what can be done with the panel
            string[] actionTypes = new string[] { UserAction.Insert.ToString(),
                     UserAction.Update.ToString(),
                     UserAction.Delete.ToString() };                  // controls
            List <string> activeActions = (from _min.Models.Control control in actPanel.controls
                                           select Enum.GetName(typeof(UserAction), control.action)).ToList <string>();

            actions.SetOptions(new List <string>(actionTypes));
            actions.SetIncludedOptions(activeActions);

            backButton.PostBackUrl = backButton.GetRouteUrl("ArchitectShowRoute", new { projectName = mm.ProjectName });
        }
示例#21
0
        /// <summary>
        /// Gets the names of project that the user is administrator / architect of, IGNORING the
        /// global rights
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="adminOf"></param>
        /// <param name="architectOf"></param>
        public void UserMenuOptions(object userId, out List<string> adminOf, out List<string> architectOf)
        {
            FK access_project = new FK("access_rights", "id_project", "projects", "id_project", null);
            DataTable admin = driver.fetchAll("SELECT", dbe.Col("projects", "name", null), "FROM", dbe.Table("access_rights"),
                dbe.Join(access_project), "WHERE", dbe.Col("id_user"), " = ", dbe.InObj(userId.ToString()), " AND " , dbe.Col("access_rights", "access", null), " % 100 >= 10");
            adminOf = (from DataRow r in admin.Rows select r[0] as string).ToList<string>();

            DataTable architect = driver.fetchAll("SELECT", dbe.Col("projects", "name", null), "FROM ", dbe.Table("access_rights"),
                dbe.Join(access_project), "WHERE", dbe.Col("id_user"), " = ", dbe.InObj(userId.ToString()), " AND ", dbe.Col("access_rights", "access", null), " % 1000 >= 100");
            architectOf = (from DataRow r in architect.Rows select r[0] as string).ToList<string>();
        }