public int UpdateOrderNum(int requestID, int userID, List <string> ids) { string str = ""; int count = ids.Count; for (int i = 0; i < count; i++) { str = str + ids[i]; if (i != (count - 1)) { str = str + ","; } } IndicatorLayout layout = new IndicatorLayout(); layout.m_layoutID = str; layout.m_userID = userID; List <IndicatorLayout> layouts = new List <IndicatorLayout>(); layouts.Add(layout); int num3 = this.Send(4, requestID, layouts); layouts.Clear(); return((num3 > 0) ? 1 : 0); }
/// <summary> /// 新建 /// </summary> public void Create() { IndicatorLayout layout = new IndicatorLayout(); layout.m_name = "新的布局"; layout.m_text = m_chart.GetIndicatorLayout(); layout.m_userID = DataCenter.UserID; m_indicatorLayoutService.AddLayout(m_indicatorLayoutService.OperatorRequestID, layout); }
public int GetLayouts(int requestID, IndicatorLayout layout) { List <IndicatorLayout> layouts = new List <IndicatorLayout>(); layouts.Add(layout); int num = this.Send(2, requestID, layouts); layouts.Clear(); return((num > 0) ? 1 : 0); }
/// <summary> /// 保存布局 /// </summary> public void Save() { IndicatorLayout layout = new IndicatorLayout(); GetLayout(ref layout); if (layout.m_layoutID != null && layout.m_layoutID.Length > 0) { m_indicatorLayoutService.UpdateLayout(m_indicatorLayoutService.OperatorRequestID, layout); } }
/// <summary> /// 获取布局信息 /// </summary> /// <param name="template">布局信息</param> public void GetLayout(ref IndicatorLayout layout) { TextBoxA txtLayoutName = GetTextBox("txtLayoutName"); LayoutScaleDiv layoutScaleDiv = FindControl("divLayoutScale") as LayoutScaleDiv; if (m_layout.m_layoutID != null && m_layout.m_layoutID.Length > 0) { layout.m_layoutID = m_layout.m_layoutID; } layout.m_name = txtLayoutName.Text; layout.m_text = layoutScaleDiv.LayoutStr; layout.m_userID = DataCenter.UserID; }
/// <summary> /// 删除 /// </summary> public void Delete() { List <GridRow> selectedRows = m_gridLayouts.SelectedRows; int selectedRowsSize = selectedRows.Count; if (selectedRowsSize > 0) { String layoutID = selectedRows[0].GetCell(0).Text; IndicatorLayout layout = new IndicatorLayout(); m_indicatorLayoutService.GetLayoutByID(layoutID, ref layout); m_indicatorLayoutService.DeleteLayout(m_indicatorLayoutService.OperatorRequestID, layout); } }
/// <summary> /// 根据名称获取布局 /// </summary> /// <param name="layoutName">布局名称</param> /// <param name="layout">布局</param> /// <returns>状态</returns> public bool GetLayoutByName(String layoutName, ref IndicatorLayout layout) { int layoutsSize = m_layouts.Count; for (int i = 0; i < layoutsSize; i++) { if (m_layouts[i].m_name == layoutName) { layout = m_layouts[i]; return(true); } } return(false); }
/// <summary> /// 表格选中行改变方法 /// </summary> public void OnGridSelectedRowsChanged() { String layoutID = ""; List <GridRow> selectedRows = m_gridLayouts.SelectedRows; int selectedRowsSize = selectedRows.Count; if (selectedRowsSize > 0) { layoutID = selectedRows[0].GetCell(0).Text; } IndicatorLayout layout = new IndicatorLayout(); m_indicatorLayoutService.GetLayoutByID(layoutID, ref layout); m_layout = layout; LoadLayout(m_layout); m_window.Invalidate(); }
/// <summary> /// 加载布局 /// </summary> /// <param name="layout">布局信息</param> private void LoadLayout(IndicatorLayout layout) { TextBoxA txtLayoutName = GetTextBox("txtLayoutName"); LayoutScaleDiv layoutScaleDiv = FindControl("divLayoutScale") as LayoutScaleDiv; ButtonA btnDelete = GetButton("btnDelete"); ButtonA btnApply = GetButton("btnApply"); ButtonA btnCreate = GetButton("btnCreate"); ButtonA btnSave = GetButton("btnSave"); txtLayoutName.Text = layout.m_name; layoutScaleDiv.LayoutStr = layout.m_text; bool btnEnabled = (layout.m_layoutID != null && layout.m_layoutID.Length > 0); btnDelete.Enabled = btnEnabled; btnApply.Enabled = btnEnabled; btnSave.Enabled = btnEnabled; }
/// <summary> /// 应用 /// </summary> private void Apply() { String layoutID = ""; List <GridRow> selectedRows = m_gridLayouts.SelectedRows; int selectedRowsSize = selectedRows.Count; if (selectedRowsSize > 0) { layoutID = selectedRows[0].GetCell(0).Text; } IndicatorLayout indicatorLayout = new IndicatorLayout(); if (m_indicatorLayoutService.GetLayoutByID(layoutID, ref indicatorLayout)) { m_chart.SetIndicatorLayout(indicatorLayout.m_layoutID, indicatorLayout.m_text); } }
/// <summary> /// 调用控件线程方法 /// </summary> /// <param name="args">参数</param> public void OnInvoke(object args) { CMessage message = (CMessage)args; List <IndicatorLayout> layouts = new List <IndicatorLayout>(); IndicatorLayoutService.GetLayouts(layouts, message.m_body, message.m_bodyLength); int layoutsSize = layouts.Count; switch (message.m_functionID) { case IndicatorLayoutService.FUNCTIONID_INDICATORLAYOUT_ADDLAYOUTS: AddLayoutsToGrid(layouts); break; case IndicatorLayoutService.FUNCTIONID_INDICATORLAYOUT_DELETELAYOUTS: { Dictionary <String, GridRow> ilRowsMap = GetIndicatorLayoutsRows(); for (int i = 0; i < layoutsSize; i++) { IndicatorLayout layout = layouts[i]; if (ilRowsMap.ContainsKey(layout.m_layoutID)) { m_gridLayouts.RemoveRow(ilRowsMap[layout.m_layoutID]); } } m_gridLayouts.Update(); break; } case IndicatorLayoutService.FUNCTIONID_INDICATORLAYOUT_UPDATELAYOUTS: { Dictionary <String, GridRow> ilRowsMap = GetIndicatorLayoutsRows(); for (int i = 0; i < layoutsSize; i++) { IndicatorLayout layout = layouts[i]; if (ilRowsMap.ContainsKey(layout.m_layoutID)) { ilRowsMap[layout.m_layoutID].GetCell(1).Text = layout.m_name; } } break; } } m_window.Invalidate(); }
/// <summary> /// 加载数据 /// </summary> /// <param name="state">状态</param> /// <returns>加载状态</returns> public static int LoadData(int state) { ChatData chatData = new ChatData(); m_chatService.Enter(m_chatService.RequestID, chatData); Indicator indicator = new Indicator(); indicator.m_userID = m_userID; m_indicatorService.GetIndicators(m_indicatorService.GetListRequestID, indicator); SecurityFilterTemplate template = new SecurityFilterTemplate(); template.m_userID = m_userID; m_securityFilterService.GetTemplates(m_securityFilterService.GetListRequestID, template); UserSecurityVisitsCount visitsCount = new UserSecurityVisitsCount(); visitsCount.m_userID = DataCenter.UserID; m_userSecurityService.GetVisitsCount(m_userSecurityService.GetListRequestID, visitsCount); UserSecurityCategory category = new UserSecurityCategory(); category.m_userID = m_userID; m_userSecurityService.GetCategories(m_userSecurityService.GetListRequestID, category); IndicatorLayout indicatorLayout = new IndicatorLayout(); indicatorLayout.m_userID = m_userID; m_indicatorLayoutService.GetLayouts(m_indicatorLayoutService.GetListRequestID, indicatorLayout); Macro macro = new Macro(); macro.m_userID = m_userID; m_macroService.GetMacros(m_macroService.GetListRequestID, macro); UserSession userSession = new UserSession(); userSession.m_userID = m_userID; m_userSessionService.GetSessions(m_userSessionService.GetListRequestID, userSession); if (state == 1) { m_securityService.LoadSecurities(); } if (m_mainUI != null) { m_mainUI.LoadData(); } return(0); }
public int Send(int functionID, int requestID, List <IndicatorLayout> layouts) { Binary binary = new Binary(); int count = layouts.Count; binary.WriteInt(count); for (int i = 0; i < count; i++) { IndicatorLayout layout = layouts[i]; binary.WriteString(layout.m_layoutID); binary.WriteInt(layout.m_userID); binary.WriteString(layout.m_name); binary.WriteString(layout.m_text); binary.WriteInt(layout.m_type); binary.WriteInt(layout.m_orderNum); } byte[] bytes = binary.GetBytes(); int num3 = this.Send(new CMessage(base.GroupID, base.ServiceID, functionID, base.SessionID, requestID, this.m_socketID, 0, base.CompressType, bytes.Length, bytes)); binary.Close(); return(num3); }
public static int GetLayouts(List <IndicatorLayout> layouts, byte[] body, int bodyLength) { Binary binary = new Binary(); binary.Write(body, bodyLength); int num = binary.ReadInt(); if (num > 0) { for (int i = 0; i < num; i++) { IndicatorLayout item = new IndicatorLayout(); item.m_layoutID = binary.ReadString(); item.m_userID = binary.ReadInt(); item.m_name = binary.ReadString(); item.m_text = binary.ReadString(); item.m_type = binary.ReadInt(); item.m_orderNum = binary.ReadInt(); layouts.Add(item); } } binary.Close(); return(1); }
/// <summary> /// 添加布局到表格控件中 /// </summary> /// <param name="layouts">布局列表</param> private void AddLayoutsToGrid(List <IndicatorLayout> layouts) { m_gridLayouts.BeginUpdate(); int layoutsSize = layouts.Count; for (int i = 0; i < layoutsSize; i++) { IndicatorLayout layout = layouts[i]; GridRow row = new GridRow(); row.Grid = m_gridLayouts; GridStringCell idCell = new GridStringCell(); idCell.Grid = m_gridLayouts; idCell.Column = m_gridLayouts.GetColumn(0); idCell.Text = layout.m_layoutID; row.AddCell(0, idCell); GridStringCell textCell = new GridStringCell(); textCell.Grid = m_gridLayouts; textCell.Column = m_gridLayouts.GetColumn(1); textCell.Text = layout.m_name; row.AddCell(1, textCell); m_gridLayouts.AddRow(row); } m_gridLayouts.EndUpdate(); }
/// <summary> /// 接收消息方法 /// </summary> /// <param name="message">消息</param> public override void OnReceive(CMessage message) { if (message.m_functionID != FUNCTIONID_INDICATORLAYOUT_GETLAYOUTS) { message.m_requestID = m_operatorRequestID; } List <IndicatorLayout> layouts = new List <IndicatorLayout>(); GetLayouts(layouts, message.m_body, message.m_bodyLength); int layoutsSize = layouts.Count; switch (message.m_functionID) { case FUNCTIONID_INDICATORLAYOUT_GETLAYOUTS: { m_layouts = layouts; m_loaded = true; break; } case FUNCTIONID_INDICATORLAYOUT_ADDLAYOUTS: { bool add = false; for (int i = 0; i < layoutsSize; i++) { IndicatorLayout layout = null; if (!GetLayoutByID(layouts[i].m_layoutID, ref layout)) { m_layouts.Add(layouts[i]); add = true; } } if (!add) { return; } break; } case FUNCTIONID_INDICATORLAYOUT_DELETELAYOUTS: { for (int i = 0; i < layoutsSize; i++) { IndicatorLayout layout = null; if (GetLayoutByID(layouts[i].m_layoutID, ref layout)) { m_layouts.Remove(layout); } } break; } case FUNCTIONID_INDICATORLAYOUT_UPDATELAYOUTS: { for (int i = 0; i < layoutsSize; i++) { IndicatorLayout updateLayout = layouts[i]; int curLayoutsSize = m_layouts.Count; for (int j = 0; j < curLayoutsSize; j++) { IndicatorLayout layout = m_layouts[j]; if (layout.m_layoutID == updateLayout.m_layoutID) { m_layouts[j] = updateLayout; break; } } } break; } } base.OnReceive(message); }