public ActionResult ComboBoxPartial(string name, string lookup, object selected, bool setreadonly, string cascadeField = null, string cascadeFilter = null) { LookupListModel <dynamic> lkpList = (LookupListModel <dynamic>)Session[name]; if (lkpList == null && lookup != null) { lkpList = UtilitySystem.GetLookupList(lookup); lkpList.BoundFieldName = name; lkpList.MultiSelect = false; Session[name] = lkpList; } if (lkpList != null) { lkpList.Selected = selected; lkpList.ReadOnly = setreadonly; //HttpContext.Session["cbo" + name] = selected; //if(cascadeField != null && cascadeField.Length > 0) //{ // object selitem = HttpContext.Session["cbo" + cascadeField]; // if (selitem != null) // { // IQueryable<dynamic> list = lkpList.Items.AsQueryable(); // list = list.Where(string.Format("{0}={1}", cascadeFilter, (int)selitem)); // lkpList.Items = list.Cast<dynamic>().ToList(); // } //} } return(PartialView("ComboBoxPartial", lkpList)); }
public ActionResult RigAdminUserRoleAdd(AdminModel model) { RigAdminManageModel manageRigModel = (RigAdminManageModel)Session["manageRigModel"]; if (ModelState.IsValid) { LookupListModel <dynamic> lkpList = UtilitySystem.GetLookupList("Position"); UserModel user = ServiceSystem.GetUser(model.Passport); model.Name = user.DisplayName; model.UserId = user.Passport; model.dt = DateTime.Now; DataTable dt = this.GetIaType(); if (model.Position == null || dt.Select("Name='" + model.Position + "'").Length == 0) { model.Position = (string)lkpList.GetDisplayValue(user.Position); } IIrmaServiceDataModel dataModel = IrmaServiceSystem.GetServiceModel(IrmaConstants.IrmaPobModels.Admin); AdminModel item = dataModel.GetItem(string.Format("UserId=\"{0}\" and RoleId={1} and Position=\"{2}\" ", model.UserId, model.RoleId, model.Position), "id"); if (item == null) { model = IrmaServiceSystem.Add(IrmaConstants.IrmaPobModels.Admin, model, true); } } return(PartialView("RigAdminUserRolePartial", manageRigModel.AdminUsers)); }
protected void Application_Start() { // Load Web.Config AppSettings LoadConfigSettings(); // Initialize Utilities UtilitySystem.Initialize(); // Initialize Services ServiceSystem.Initialize(); ServiceSystem.InitializeApplication(); // Initialize Irma Services IrmaServiceSystem.Initialize(); // Initialize Tlc LookupLists TlcManageLookupLists.InitLookupLists(); AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); // DevExpress Model Binder System.Web.Mvc.ModelBinders.Binders.DefaultBinder = new DevExpress.Web.Mvc.DevExpressEditorsBinder(); //DevExpress.Web.BinaryStorageConfigurator.Mode = DevExpress.Web.BinaryStorageMode.Session; //Localization ModelMetadataProviders.Current = new EnscoLocalizationProvider(); ASPxWebControl.CallbackError += Application_Error; }
public ActionResult GridLookupPartial(string name, string lookup, bool multi, object selected, string focusRowChangedEvent = null, string selectionChangedEvent = null, string rowClick = null, bool?IsRequired = null, bool?readOnly = false) { if (multi && (new string[] { "PassportEmail", "Passport" }).Contains(lookup)) { return(this.GridMultiLookupPartial(name, lookup, multi, selected, focusRowChangedEvent, selectionChangedEvent, rowClick, IsRequired, readOnly)); } LookupListModel <dynamic> lkpList = (LookupListModel <dynamic>)Session[name]; if (lkpList == null && lookup != null) { lkpList = UtilitySystem.GetLookupList(lookup); lkpList.BoundFieldName = name; lkpList.MultiSelect = multi; lkpList.FocusedRowChanged = focusRowChangedEvent; lkpList.RowClick = rowClick; lkpList.SelectionChanged = selectionChangedEvent; Session[name] = lkpList; } if (IsRequired != null && IsRequired.Value) { this.ViewBag.IsRequired = true; } if (lkpList != null) { lkpList.Selected = selected; } lkpList.ReadOnly = (readOnly == null ? false : readOnly.Value); return(PartialView("GridLookupPartial", lkpList)); }
public ActionResult TreeLookupPartial(string name, string lookup, bool multi, object selected, string focusRowChangedEvent = null, string selectionChangedEvent = null) { LookupListModel <dynamic> lkpList = (LookupListModel <dynamic>)Session[name]; if (lkpList == null && lookup != null) { lkpList = UtilitySystem.GetLookupList(lookup); if (lkpList == null) { lkpList.Name = lookup; lkpList.BoundFieldName = name; lkpList.MultiSelect = multi; lkpList.FocusedRowChanged = focusRowChangedEvent; lkpList.SelectionChanged = selectionChangedEvent; Session[name] = lkpList; return(new EmptyResult()); } } if (lkpList != null) { lkpList.Selected = selected; } return(PartialView("TreeLookupPartial", lkpList)); }
/// <summary> /// Creates a copy of this <see cref="UtilityNode"/> /// </summary> /// <param name="args"></param> /// <returns></returns> public override GUIElement CopyElement(params object[] args) { UtilitySystem parent = (UtilitySystem)args[0]; UtilityNode result = CreateInstance <UtilityNode>(); result.identificator = this.identificator; result.nodeName = this.nodeName; result.parent = parent; result.windowRect = new Rect(this.windowRect); result.type = this.type; result.fusionType = this.fusionType; result.curveType = this.curveType; result.variableMax = this.variableMax; result.variableMin = this.variableMin; result.slope = this.slope; result.exp = this.exp; result.displX = this.displX; result.displY = this.displY; result.points = this.points; if (this.subElem) { result.subElem = (ClickableElement)this.subElem.CopyElement(parent); } return(result); }
/// <summary> /// Creates and returns the <see cref="StateNode"/> corresponding to this <see cref="XMLElement"/> /// </summary> /// <returns></returns> public UtilityNode ToUtilityNode(UtilitySystem parent) { UtilityNode node = ScriptableObject.CreateInstance <UtilityNode>(); node.InitUtilityNodeFromXML(parent, (utilityType)Enum.Parse(typeof(utilityType), this.secondType), (fusionType)Enum.Parse(typeof(fusionType), this.thirdType), (curveType)Enum.Parse(typeof(curveType), this.fourthType), this.windowPosX, this.windowPosY, this.Id, this.name, this.variableMax, this.variableMin, this.slope, this.exp, this.displX, this.displY, this.points); return(node); }
public JsonResult GetUserInfo() { string info = ""; UserSession userInfo = UtilitySystem.CurrentUser; if (userInfo != null) { LookupListModel <dynamic> lkpList = UtilitySystem.GetLookupList("Position"); string position = (lkpList != null) ? (string)lkpList.GetDisplayValue(userInfo.PositionId) : ""; info = string.Format("{0}:{1}:{2}:{3}", userInfo.Passport, userInfo.UserName, userInfo.Email, position); } return(Json(new { Info = info })); }
public ActionResult RigAdminIsolationLockAdd(LockModel model) { RigAdminManageModel manageRigModel = (RigAdminManageModel)Session["manageRigModel"]; if (ModelState.IsValid) { LookupListModel <dynamic> lkpList = UtilitySystem.GetLookupList("YesNoList"); int listId = 0; if (!int.TryParse(model.Available, out listId)) { listId = 0; } model.Available = (string)lkpList.GetDisplayValue(listId); model = IrmaServiceSystem.Add(IrmaConstants.IrmaPobModels.IsolationLock, model, true); } return(PartialView("RigAdminIsolationLockPartial", manageRigModel.IsolationLocks)); }
/// <summary> /// Creates a copy of this <see cref="UtilitySystem"/> /// </summary> /// <param name="args"></param> /// <returns></returns> public override GUIElement CopyElement(params object[] args) { ClickableElement parent = (ClickableElement)args[0]; UtilitySystem result = CreateInstance <UtilitySystem>(); result.identificator = this.identificator; result.elementNamer = CreateInstance <UniqueNamer>(); result.elementName = this.elementName; result.parent = parent; result.windowRect = new Rect(this.windowRect); result.nodes = this.nodes.Select(o => (BaseNode)o.CopyElement(result)).ToList(); result.transitions = this.transitions.Select(o => (TransitionGUI)o.CopyElement(result.nodes.Find(n => n.identificator == o.fromNode.identificator), result.nodes.Find(n => n.identificator == o.toNode.identificator))).ToList(); return(result); }
///<summary> Установить нотификацию на иконке главного окна </summary> public static void IconNotification(int countNotification) { if (countNotification > 0) { if (countNotification == _countNotification) { return; } if (countNotification > _countNotification && !ViewModelCallActive.ExistCall && !_soundNotificationPlaying) { _soundNotificationPlaying = true; new Task(PlaySoundNotification).Start(); } _countNotification = countNotification; var bitmap = (Bitmap)_bitmapIcon.Clone(); var graphics = Graphics.FromImage(bitmap); var text = countNotification > 99 ? "99" : countNotification.ToString(); graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SingleBitPerPixel; var stringFormat = new StringFormat { Alignment = StringAlignment.Near, LineAlignment = StringAlignment.Center }; graphics.DrawString(text, new Font("Segoe UI", _fontSize, System.Drawing.FontStyle.Regular), System.Drawing.Brushes.White, new RectangleF(0, _y, 20, 13), stringFormat); var memoryStream = new MemoryStream(); if (UtilitySystem.GetVersionOS() == EnumVersionOS.Window10) { var hicon = bitmap.GetHicon(); var newIcon = Icon.FromHandle(hicon); newIcon.Save(memoryStream); WindowMain.CurrentMainWindow.Icon = BitmapFrame.Create(memoryStream); } else { bitmap.Save(memoryStream, ImageFormat.Png); var result = new BitmapImage(); result.BeginInit(); memoryStream.Seek(0, SeekOrigin.Begin); result.StreamSource = memoryStream; result.EndInit(); WindowMain.CurrentMainWindow.Icon = result; } } else { if (UtilitySystem.GetVersionOS() == EnumVersionOS.Window10) { var memoryStream = new MemoryStream(); var hicon = _bitmapIcon.GetHicon(); var newIcon = Icon.FromHandle(hicon); newIcon.Save(memoryStream); WindowMain.CurrentMainWindow.Icon = BitmapFrame.Create(memoryStream); } else { WindowMain.CurrentMainWindow.Icon = _bitmapImageIcon; } } }
/// <summary> /// Creates and returns the <see cref="FSM"/> corresponding to this <see cref="XMLElement"/> /// </summary> /// <param name="parent"></param> /// <param name="selectedNode"></param> /// <returns></returns> public UtilitySystem ToUtilitySystem(ClickableElement parent, BaseNode selectedNode = null) { UtilitySystem utilSystem = ScriptableObject.CreateInstance <UtilitySystem>(); utilSystem.InitUtilitySystemFromXML(parent, this.windowPosX, this.windowPosY, this.Id, this.name); foreach (XMLElement node in this.nodes) { switch (node.elemType) { case nameof(FSM): node.ToFSM(utilSystem, null); break; case nameof(BehaviourTree): node.ToBehaviourTree(utilSystem, null); break; case nameof(UtilitySystem): node.ToUtilitySystem(utilSystem, null); break; case nameof(UtilityNode): UtilityNode state = node.ToUtilityNode(utilSystem); utilSystem.nodes.Add(state); break; default: Debug.LogError("Wrong content in saved data"); break; } } foreach (XMLElement trans in this.transitions) { BaseNode node1 = utilSystem.nodes.Where(n => n.identificator == trans.fromId || n.subElem?.identificator == trans.fromId).FirstOrDefault(); BaseNode node2 = utilSystem.nodes.Where(n => n.identificator == trans.toId || n.subElem?.identificator == trans.toId).FirstOrDefault(); if (node1 != null && node2 != null) { utilSystem.transitions.Add(trans.ToTransitionGUI(utilSystem, node1, node2)); } } if (parent) { switch (parent.GetType().ToString()) { case nameof(FSM): StateNode state = ScriptableObject.CreateInstance <StateNode>(); state.InitStateNodeFromXML(parent, stateType.Unconnected, utilSystem.windowRect.position.x, utilSystem.windowRect.position.y, this.Id, this.name, utilSystem); if (this.secondType.Equals(stateType.Entry.ToString())) { ((FSM)parent).AddEntryState(state); } else { parent.nodes.Add(state); } break; case nameof(BehaviourTree): BehaviourNode node = ScriptableObject.CreateInstance <BehaviourNode>(); node.InitBehaviourNode(parent, behaviourType.Leaf, utilSystem.windowRect.x, utilSystem.windowRect.y, utilSystem); parent.nodes.Add(node); if (selectedNode != null) { TransitionGUI transition = ScriptableObject.CreateInstance <TransitionGUI>(); transition.InitTransitionGUI(parent, selectedNode, node); parent.transitions.Add(transition); selectedNode = node; } break; case nameof(UtilitySystem): UtilityNode utilNode = ScriptableObject.CreateInstance <UtilityNode>(); utilNode.InitUtilityNode(parent, utilityType.Action, utilSystem.windowRect.position.x, utilSystem.windowRect.position.y, utilSystem); parent.nodes.Add(utilNode); break; } } return(utilSystem); }