public static int Add(string inKey, string inDescription, Xy.Data.DataBase DB = null) { Xy.Data.Procedure item = XiaoYang.User.PowerList.GetProcedure(R("Add")); item.SetItem("Key", inKey); item.SetItem("Description", inDescription); return Convert.ToInt32(item.InvokeProcedureResult(DB)); }
public static int EditPassword(long inID, string inPassword, Xy.Data.DataBase DB = null) { Xy.Data.Procedure item = XiaoYang.User.User.GetProcedure(R("EditPassword")); item.SetItem("ID", inID); item.SetItem("Password", inPassword); return item.InvokeProcedure(DB); }
public static int EditWebRelated(short inID, bool inIsWebRelated, Xy.Data.DataBase DB = null) { Xy.Data.Procedure item = XiaoYang.Entity.EntityType.GetProcedure(R("EditWebRelated")); item.SetItem("ID", inID); item.SetItem("IsWebRelated", inIsWebRelated); return item.InvokeProcedure(DB); }
public static string GetCacheFilePath(string PageID, string ControlID, Xy.WebSetting.WebSettingItem websetting, Xy.Tools.Web.UrlAnalyzer url, bool cacheUrlParam = false) { StringBuilder _sb = new StringBuilder(); _sb.Append(websetting.CacheDir); _sb.Append(url.Path.Replace('/', '\\')); if (cacheUrlParam) _sb.Append(url.Param.Replace('?', '#')); //_sb.Append('#'); //int index = 0; //int inindex = 0; //int temp = 0; //foreach (System.Text.RegularExpressions.Group itemGroup in urlitem.Regex.Match(url.Path).Groups) { // string tempName = urlitem.Regex.GroupNameFromNumber(index++); // if (!int.TryParse(tempName, out temp)) { // if (inindex++ != 0) _sb.Append('&'); // _sb.Append(tempName); // _sb.Append('='); // _sb.Append(itemGroup.Value); // } //} if(!string.IsNullOrEmpty(PageID)) _sb.Append("-" + PageID); if (!string.IsNullOrEmpty(ControlID)) _sb.Append("-" + ControlID); _sb.Append(".cache"); return _sb.ToString(); }
public static int EditUserGroup(long inID, int inUserGroup, Xy.Data.DataBase DB = null) { Xy.Data.Procedure item = XiaoYang.User.User.GetProcedure(R("EditUserGroup")); item.SetItem("ID", inID); item.SetItem("UserGroup", inUserGroup); return item.InvokeProcedure(DB); }
public static int EditDisplay(short inID, bool inIsDisplay, Xy.Data.DataBase DB = null) { Xy.Data.Procedure item = XiaoYang.Entity.EntityType.GetProcedure(R("EditDisplay")); item.SetItem("ID", inID); item.SetItem("IsDisplay", inIsDisplay); return item.InvokeProcedure(DB); }
public static EntityTypeCacheItem GetInstance(short TypeID, Xy.Data.DataBase DB = null) { if (!_store.ContainsKey(TypeID)) { _store.Add(TypeID, new EntityTypeCacheItem(TypeID, DB)); } return _store[TypeID]; }
public static long Add(short inTypeID, bool inIsActive, Xy.Data.DataBase DB = null) { Xy.Data.Procedure item = XiaoYang.Entity.EntityBase.GetProcedure(R("Add")); item.SetItem("TypeID", inTypeID); item.SetItem("IsActive", inIsActive); return Convert.ToInt64(item.InvokeProcedureResult(DB)); }
static void EntityType_BeforeDel(Xy.Data.Procedure procedure, Xy.Data.DataBase DB) { short inID = Convert.ToInt16(procedure.GetItem("ID")); EntityType _type = GetInstance(inID); System.Data.DataTable _childTypies = GetChildType(inID); foreach (System.Data.DataRow _childTypeRow in _childTypies.Rows) { EntityType _childType = new EntityType(); _childType.Fill(_childTypeRow); Del(_childType.ID); } StringBuilder _dropTableProcedure = new StringBuilder(); foreach (System.Data.DataRow _multiAttrsRow in EntityAttribute.GetByTypeID(inID).Rows) { EntityAttribute _attr = new EntityAttribute(); _attr.Fill(_multiAttrsRow); if (_attr.IsMultiple) { _dropTableProcedure.AppendLine(string.Format(_commandPartern_Del, "Entity_" + _type.Key + "_" + _attr.Key)); } } _dropTableProcedure.AppendLine(string.Format(_commandPartern_Del, "Entity_" + _type.Key)); Xy.Data.Procedure _deleteRelativeTable = new Xy.Data.Procedure("DeleteRelativeTable", _dropTableProcedure.ToString()); Xy.Data.Procedure _deleteRelativeEntityBase = new Xy.Data.Procedure("DeleteRelativeEntityBase", "Delete from [EntityBase] where [TypeID] = @ID", new Xy.Data.ProcedureParameter[] { new Xy.Data.ProcedureParameter("ID", System.Data.DbType.Int64) }); _deleteRelativeEntityBase.SetItem("ID", inID); _deleteRelativeTable.InvokeProcedure(DB); _deleteRelativeEntityBase.InvokeProcedure(DB); }
/// <summary> /// Get the bounds for the <paramref name="color"/> rectangle on the <paramref name="image"/> /// </summary> /// <param name="image"></param> /// <param name="color"></param> public static Rectangle GetBounds(Bitmap image, string color = "FFFF0000") { var tl = new Xy { X = -1, Y = -1 }; var br = new Xy { X = -1, Y = -1 }; //check src image to see if it's the escape color var actualColor = int.Parse(color, NumberStyles.AllowHexSpecifier, CultureInfo.InvariantCulture); var expectedColor = Color.FromArgb(actualColor); for (int x = 0; x < image.Width; x++) { for (int y = 0; y < image.Height; y++) { var pix = image.GetPixel(x, y); //ensure we're not dealing in a ignore zone if (Color.FromArgb(pix.ToArgb()) == expectedColor) { //sets the lower bounds if (tl.X == -1) tl.X = x; if (tl.Y == -1) tl.Y = y; //update lower bounds if (x > br.X) br.X = x; if (x > br.Y) br.Y = y; } } } return new Rectangle(tl.X,tl.Y,(br.X - tl.X)+1,(br.Y - tl.Y)+1); }
public static int EditActive(long inID, bool inIsActive, Xy.Data.DataBase DB = null) { Xy.Data.Procedure item = XiaoYang.Entity.EntityBase.GetProcedure(R("EditActive")); item.SetItem("ID", inID); item.SetItem("IsActive", inIsActive); return item.InvokeProcedure(DB); }
public static int Add(string inName, string inKey, Xy.Data.DataBase DB = null) { Xy.Data.Procedure item = XiaoYang.User.UserGroup.GetProcedure(R("Add")); item.SetItem("Name", inName); item.SetItem("Key", inKey); return Convert.ToInt32(item.InvokeProcedureResult(DB)); }
public static int Add(int inPowerList, int inUserGroup, Xy.Data.DataBase DB = null) { Xy.Data.Procedure item = XiaoYang.User.PowerShip.GetProcedure(R("Add")); item.SetItem("PowerList", inPowerList); item.SetItem("UserGroup", inUserGroup); return Convert.ToInt32(item.InvokeProcedureResult(DB)); }
public static int Del(int inPowerList, int inUserGroup, Xy.Data.DataBase DB = null) { Xy.Data.Procedure item = XiaoYang.User.PowerShip.GetProcedure(R("Del")); item.SetItem("PowerList", inPowerList); item.SetItem("UserGroup", inUserGroup); return item.InvokeProcedure(DB); }
public static int EditNickname(long inID, string inNickname, Xy.Data.DataBase DB = null) { Xy.Data.Procedure item = XiaoYang.User.User.GetProcedure(R("EditNickname")); item.SetItem("ID", inID); item.SetItem("Nickname", inNickname); return item.InvokeProcedure(DB); }
public static long Add(string inName, string inResource, string inTemplate, Xy.Data.DataBase DB = null) { Xy.Data.Procedure item = XiaoYang.Entity.EntityAttributeDisplay.GetProcedure(R("Add")); item.SetItem("Name", inName); item.SetItem("Resource", inResource); item.SetItem("Template", inTemplate); return Convert.ToInt64(item.InvokeProcedureResult(DB)); }
public void AddSplitedXyDataModel(string name, Xy.Data.IDataModelDisplay XyDataModel) { string[] _attrs = XyDataModel.GetAttributesName(); for (int i = 0; i < _attrs.Length; i++) { string _attrName = _attrs[i]; inAdd(name + "." + _attrName, new PageDataItem(name + "." + _attrName, Convert.ToString(XyDataModel.GetAttributesValue(_attrName)))); } }
public ThreadEntity(System.Web.HttpContext webApp, WebSetting.WebSettingItem webSetting, URLManage.URLItem urlItem, Xy.Tools.Web.UrlAnalyzer currentURL) { _webContext = webApp; _webSetting = webSetting; _urlItem = urlItem; _url = currentURL; _content = new HTMLContainer(_webSetting.Encoding); }
public static int Edit(long inID, string inName, string inResource, string inTemplate, Xy.Data.DataBase DB = null) { Xy.Data.Procedure item = XiaoYang.Entity.EntityAttributeDisplay.GetProcedure(R("Edit")); item.SetItem("ID", inID); item.SetItem("Name", inName); item.SetItem("Resource", inResource); item.SetItem("Template", inTemplate); return item.InvokeProcedure(DB); }
public static short Add(string inName, string inKey, short inParentTypeID, string inDescription, Xy.Data.DataBase DB = null) { Xy.Data.Procedure item = XiaoYang.Entity.EntityType.GetProcedure(R("Add")); item.SetItem("Name", inName); item.SetItem("Key", inKey); item.SetItem("ParentTypeID", inParentTypeID); item.SetItem("Description", inDescription); return Convert.ToInt16(item.InvokeProcedureResult(DB)); }
public EntityHelper(short inEntityID, bool inApplyToChild = false, Xy.Data.DataBase DB = null) { if (inEntityID <= 0) throw new Exception("Type ID is incorrect"); _db = DB; if (_db == null) _db = new Xy.Data.DataBase(); _cache = EntityTypeCache.GetInstance(inEntityID, _db); _applyToChild = inApplyToChild; _childQueryWhere = "[TypeID] = " + _cache.TypeInstance.ID + " and "; if (!_cache.TypeInstance.IsActive) throw new Exception("Type is not available"); }
public static PowerList GetInstance(int inID, Xy.Data.DataBase DB = null) { System.Data.DataTable result = Get(inID, DB); if (result.Rows.Count > 0) { PowerList temp = new PowerList(); temp.Fill(result.Rows[0]); return temp; } return null; }
public static UserExtra GetInstance(long inUserID, Xy.Data.DataBase DB = null) { System.Data.DataTable result = Get(inUserID, DB); if (result.Rows.Count > 0) { UserExtra temp = new UserExtra(); temp.Fill(result.Rows[0]); return temp; } return null; }
public static long Add(string inName, string inNickname, string inPassword, string inEmail, int inUserGroup, Xy.Data.DataBase DB = null) { Xy.Data.Procedure item = XiaoYang.User.User.GetProcedure(R("Add")); item.SetItem("Name", inName); item.SetItem("Nickname", inNickname); item.SetItem("Password", inPassword); item.SetItem("Email", inEmail); item.SetItem("UserGroup", inUserGroup); return Convert.ToInt64(item.InvokeProcedureResult(DB)); }
public static UserGroup GetInstance(int inID, Xy.Data.DataBase DB = null) { System.Data.DataTable result = Get(inID, DB); if (result.Rows.Count > 0) { UserGroup temp = new UserGroup(); temp.Fill(result.Rows[0]); return temp; } return null; }
public static EntityBase GetInstance(long inID, Xy.Data.DataBase DB = null) { System.Data.DataTable result = Get(inID, DB); if (result.Rows.Count > 0) { EntityBase temp = new EntityBase(); temp.Fill(result.Rows[0]); return temp; } return null; }
static void EntityType_AfterAdd(Xy.Data.ProcedureResult result, Xy.Data.Procedure procedure, Xy.Data.DataBase DB) { string _tableName = Convert.ToString(procedure.GetItem("Key")); short _parentTypeID = Convert.ToInt16(procedure.GetItem("ParentTypeID")); if (string.IsNullOrEmpty(_tableName)) throw new Exception("Empty type name"); StringBuilder _addTableProcedure = new StringBuilder(); _addTableProcedure.AppendLine(string.Format(_commandPartern_Add, "Entity_" + _tableName)); Xy.Data.Procedure _addBaseTable = new Xy.Data.Procedure("AddBaseTable", _addTableProcedure.ToString()); _addBaseTable.InvokeProcedure(DB); }
public static long Add(string inName, string inVersion, string inDepend, string inSQL, string inCode, string inMessage, Xy.Data.DataBase DB = null) { Xy.Data.Procedure item = XiaoYang.Installation.Installation.GetProcedure(R("Add")); item.SetItem("Name", inName); item.SetItem("Version", inVersion); item.SetItem("Depend", inDepend); item.SetItem("SQL", inSQL); item.SetItem("Code", inCode); item.SetItem("Message", inMessage); return Convert.ToInt64(item.InvokeProcedureResult(DB)); }
public static System.Data.DataTable GetList(int inPageIndex, int inPageSize, short inTypeID, string inOutWhere, ref int inTotalCount, Xy.Data.DataBase DB = null) { Xy.Data.Procedure item = XiaoYang.Entity.EntityBase.GetProcedure(R("GetList")); item.SetItem("PageIndex", inPageIndex); item.SetItem("PageSize", inPageSize); item.SetItem("TypeID", inTypeID); item.SetItem("OutWhere", inOutWhere); item.SetItem("TotalCount", inTotalCount); System.Data.DataTable result = item.InvokeProcedureFill(DB); inTotalCount = Convert.ToInt32(item.GetItem("TotalCount")); return result; }
static void EntityType_AfterEditWebRelated(Xy.Data.ProcedureResult result, Xy.Data.Procedure procedure, Xy.Data.DataBase DB) { short _ID = Convert.ToInt16(procedure.GetItem("ID")); bool _isRelated = Convert.ToBoolean(procedure.GetItem("IsWebRelated")); EntityTypeCacheItem _cache = EntityTypeCache.GetInstance(_ID, DB); Xy.Data.Procedure _webRelatedProcedure; if (_isRelated) { _webRelatedProcedure = new Xy.Data.Procedure("AddWebRelated", string.Format(_commandPartern_AddWebRelated, "Entity_" + _cache.TypeInstance.Key)); } else { _webRelatedProcedure = new Xy.Data.Procedure("DelWebRelated", string.Format(_commandPartern_DelWebRelated, "Entity_" + _cache.TypeInstance.Key)); } _webRelatedProcedure.InvokeProcedure(DB); }
public HitLine3D(Vertex3D v1, Vertex3D v2, ItemType itemType, IItem item) : base(new Vertex2D(), itemType, item) { var vLine = v2.Clone().Sub(v1); vLine.Normalize(); // Axis of rotation to make 3D cylinder a cylinder along the z-axis var transAxis = new Vertex3D(vLine.Y, -vLine.X, 0); var l = transAxis.LengthSq(); if (l <= 1e-6) { // line already points in z axis? transAxis.Set(1, 0, 0); // choose arbitrary rotation vector } else { transAxis.DivideScalar(MathF.Sqrt(l)); } // Angle to rotate the line into the z-axis var dot = vLine.Z; //vLine.Dot(&vup); Matrix.RotationAroundAxis(transAxis, -MathF.Sqrt(1 - dot * dot), dot); var vTrans1 = v1.Clone().ApplyMatrix2D(Matrix); var vTrans2 = v2.Clone().ApplyMatrix2D(Matrix); var vTrans2Z = vTrans2.Z; // set up HitLineZ parameters Xy.Set(vTrans1.X, vTrans1.Y); ZLow = MathF.Min(vTrans1.Z, vTrans2Z); ZHigh = MathF.Max(vTrans1.Z, vTrans2Z); V1 = v1; V2 = v2; HitBBox.Left = MathF.Min(v1.X, v2.X); HitBBox.Right = MathF.Max(v1.X, v2.X); HitBBox.Top = MathF.Min(v1.Y, v2.Y); HitBBox.Bottom = MathF.Max(v1.Y, v2.Y); HitBBox.ZLow = MathF.Min(v1.Z, v2.Z); HitBBox.ZHigh = MathF.Max(v1.Z, v2.Z); }
public double Calc(IGenome genome) { var _endNode = genome.Map.EndNode; var lastnode = genome.ListNodes.Last(); var startnode = genome.ListNodes.First(); var HeuristicMaxDistance = Heuristic.Calc(Abs(startnode.X - _endNode.X), Abs(startnode.Y - _endNode.Y)); var HeuristicValue = Heuristic.Calc(Abs(lastnode.X - _endNode.X), Abs(lastnode.Y - _endNode.Y)); var penalty = (double)0; if (lastnode.Collision) { var xy = new Xy { x = lastnode.X, y = lastnode.Y }; var badPath = 0; if (FinessHelper.RepeatControl.ContainsKey(xy)) { FinessHelper.RepeatControl[xy]++; badPath = FinessHelper.RepeatControl[xy]; } else { FinessHelper.RepeatControl.Add(xy, 1); } penalty += (Penalty * (HeuristicValue / HeuristicMaxDistance)) + (badPath * 100); } var IsCirclic = genome .ListNodes .GroupBy(e => new { e.X, e.Y }) .Select(e => new { e.Key.X, e.Key.Y, qtd = e.Count() }) .Any(e => e.qtd > 1); if (IsCirclic) { penalty += Penalty * (HeuristicValue / HeuristicMaxDistance); } return(penalty + HeuristicValue); }