public virtual bool UpdatePropert(t_ElementProperty elementProperty) { string sql = @"update t_ElementProperty SET PropertyValue=@PropertyValue WHERE ElementID=@ElementID AND PropertyNo=@PropertyNo"; SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@ElementID", elementProperty.ElementID), new SqlParameter("@PropertyNo", elementProperty.PropertyNo), new SqlParameter("@PropertyValue", elementProperty.PropertyValue) //new SqlParameter("@Caption", elementProperty.Caption), //new SqlParameter("@PropertyName", elementProperty.PropertyName) }; CmdList.Add(new CommandList() { strCommandText = sql, Params = parameters }); return true; }
public void Clone(t_ElementProperty obj) { // ElementID = obj.ElementID; // PropertyNo = obj.PropertyNo; // PropertyValue = obj.PropertyValue; // Caption = obj.Caption; // PropertyName = obj.PropertyName; }
public virtual bool InsertPropert(t_ElementProperty elementProperty) { string sql = "insert into t_ElementProperty (ElementID, PropertyNo, PropertyValue, Caption, PropertyName) values (@ElementID, @PropertyNo, @PropertyValue, @Caption, @PropertyName)"; SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@ElementID", elementProperty.ElementID), new SqlParameter("@PropertyNo", elementProperty.PropertyNo), new SqlParameter("@PropertyValue", elementProperty.PropertyValue), new SqlParameter("@Caption", elementProperty.Caption), new SqlParameter("@PropertyName", elementProperty.PropertyName) }; CmdList.Add(new CommandList() { strCommandText = sql, Params = parameters }); return true; }
//public DataTable selectAllDateByWhere(int pageCrrent, int pageSize, out int pageCount, string where) //{ // string sql = "select * from t_ElementProperty"; // if (!string.IsNullOrEmpty(where)) // { // sql = string.Format(" {0} where {1}", sql, where); // } // DataTable dt = null; // int returnC = 0; try // { // dt = db.ExecuteQuery(sql, pageCrrent, pageSize, out returnC); // } // catch (Exception ex) // { // throw ex; // } // pageCount = returnC; // return dt; //} //public t_ElementProperty selectARowDate(string m_id) //{ // string sql = string.Format("select * from t_ElementProperty where Elementid='{0}'", m_id); // DataTable dt = null; // try // { // dt = db.ExecuteQueryDataSet(sql).Tables[0]; // } // catch (Exception ex) // { // throw ex; // } // if (dt == null) // return null; // if (dt.Rows.Count == 0) // return null; // DataRow dr = dt.Rows[0]; // t_ElementProperty m_Elem = new t_ElementProperty(dr); // return m_Elem; //} public List<t_ElementProperty> selectByScreenID(int screenID) { string sql = "select * from t_ElementProperty where exists(select 0 from t_element where t_element.ScreenID=" + screenID.ToString() + ")"; DataTable dt = null; try { dt = db.ExecuteQuery(sql); } catch (Exception ex) { throw ex; } List<t_ElementProperty> _List = new List<t_ElementProperty>(); foreach (DataRow dr in dt.Rows) { t_ElementProperty obj = new t_ElementProperty(dr); _List.Add(obj); } return _List; }
//private void LoadControlsByTypeCallback(LoadOperation<t_Control> result) //{ // if (!result.HasError) // { // _t_toolTipControl = result.Entities.FirstOrDefault(); // CreateToolTip(_t_toolTipControl); // } //} private void CreateToolTip(t_Control t_control) { var target = _associatedElement as MonitorControl; if (null != target) { if (t_control != null) { target.IsToolTipLoaded = true; var toolTipControl = new ToolTipControl(target); toolTipControl.SetValue(Canvas.ZIndexProperty, 10000); var listElementProperties = new List<t_ElementProperty>(); var toolTipControlElement = MonitorControl.OnInitControl(t_control); toolTipControlElement.Transparent = 100; toolTipControlElement.ControlID = -9999; toolTipControlElement.ElementType = "ToolTip"; toolTipControlElement.ElementName = t_control.ControlName; toolTipControl.ScreenElement = toolTipControlElement; toolTipControlElement.Width = 300; toolTipControlElement.Height = 200; var elementProperties = new ControlPropertyDA().SelectByControlId(t_control.ControlID); foreach (t_ControlProperty property in elementProperties) { t_ElementProperty tt = new t_ElementProperty(); tt.Caption = property.Caption; tt.ElementID = toolTipControlElement.ElementID; tt.PropertyNo = property.PropertyNo; tt.PropertyValue = property.DefaultValue; tt.PropertyName = property.PropertyName; listElementProperties.Add(tt); } toolTipControl.ScreenElement = toolTipControlElement; toolTipControl.ListElementProp = listElementProperties; toolTipControl.ElementState = ElementSate.New; toolTipControl.SetPropertyValue(); toolTipControl.SetCommonPropertyValue(); _parent.Children.Add(toolTipControl); toolTipControl.DesignMode(); toolTipControl.SetPosition(); target.ToolTipControl = toolTipControl; if (null != CurrenttoolTipControl) { CurrenttoolTipControl.IsOpen = false; Adorner.RemoveMutiSelected(CurrenttoolTipControl.AdornerLayer); } CurrenttoolTipControl = toolTipControl; toolTipControl.IsOpen = true; } } }
/// <summary> /// 复制对象 /// </summary> /// <param name="obj"></param> public void ElementClone(MonitorControl obj, int mWidth, int mHeight) { this.ParentControl = obj.ParentControl; m_Element = new t_Element(); t_Element m_Older= obj.ScreenElement; //ElementID m_Element.ElementName = m_Older.ElementName; m_Element.ControlID = m_Older.ControlID; //m_Element.ScreenX = m_Older.ScreenX; m_Element.ScreenX = Convert.ToInt32(obj.GetValue(Canvas.LeftProperty)); m_Element.ScreenY = Convert.ToInt32(obj.GetValue(Canvas.TopProperty)); // m_Element.ScreenY = m_Older.ScreenY; m_Element.ScreenY += Convert.ToInt16(obj.Height); m_Element.TxtInfo = m_Older.TxtInfo; m_Element.Width = mWidth; m_Element.Height = mHeight; m_Element.ImageURL = m_Older.ImageURL; m_Element.ForeColor = m_Older.ForeColor; m_Element.Font = m_Older.Font; m_Element.ChildScreenID = m_Older.ChildScreenID; m_Element.DeviceID = m_Older.DeviceID; m_Element.ChannelNo = m_Older.ChannelNo; m_Element.ScreenID = m_Older.ScreenID; m_Element.BackColor = m_Older.BackColor; m_Element.Transparent = m_Older.Transparent; m_Element.oldX = m_Older.oldX; m_Element.oldY = m_Older.oldY; m_Element.Method = m_Older.Method; m_Element.MinFloat = m_Older.MinFloat; m_Element.MaxFloat = m_Older.MaxFloat; m_Element.SerialNum = m_Older.SerialNum; m_Element.TotalLength = m_Older.TotalLength; m_Element.LevelNo = m_Older.LevelNo; m_Element.ComputeStr = m_Older.ComputeStr; m_ListElementProperty = new List<t_ElementProperty>(); foreach(t_ElementProperty elePro in obj.ListElementProp) { t_ElementProperty m_elePro = new t_ElementProperty(); m_elePro.PropertyNo = elePro.PropertyNo; m_elePro.PropertyValue = elePro.PropertyValue; m_elePro.Caption = elePro.Caption; m_elePro.PropertyName = elePro.PropertyName; m_ListElementProperty.Add(m_elePro); } }
public void SetAttrByName(string name, object value) { if (null == ScreenElement || !ScreenElement.ControlID.HasValue) { return; } if (ListElementProp == null) { ListElementProp = new ElementPropertyDA().SelectBy(ScreenElement.ElementID); if (ListElementProp.Count == 0) { var elementProperties = new ControlPropertyDA().SelectByControlId(ScreenElement.ControlID.Value); foreach (t_ControlProperty elementProperty in elementProperties) { t_ElementProperty tt = new t_ElementProperty(); tt.Caption = elementProperty.Caption; tt.ElementID = ScreenElement.ElementID; tt.PropertyNo = elementProperty.PropertyNo; tt.PropertyValue = elementProperty.DefaultValue; tt.PropertyName = elementProperty.PropertyName; ListElementProp.Add(tt); } } } var property = ListElementProp.FirstOrDefault(p => string.Equals(p.PropertyName, name, StringComparison.CurrentCultureIgnoreCase)); if (null != property) { property.PropertyValue =( null == value ? string.Empty : value.ToString()); } }
public MonitorControl CreateControl(Canvas canvas, t_Control t, double width, double height, double x, double y) { if (t != null && t.ControlID > 0) { t_Element mElement = InitElement(t); mElement.Width = (int)width; mElement.Height = (int)height; mElement.ScreenX = (int)x; mElement.ScreenY = (int)y; mElement.ScreenID = _CurrentScreen.ScreenID; IEnumerable<t_ControlProperty> listObj = this._controlsPeoperties. Where(a => a.ControlID == t.ControlID); List<t_ElementProperty> listElementPro = new List<t_ElementProperty>(); foreach (t_ControlProperty cp in listObj) { t_ElementProperty tt = new t_ElementProperty(); tt.Caption = cp.Caption; tt.ElementID = mElement.ElementID; tt.PropertyNo = cp.PropertyNo; tt.PropertyValue = cp.DefaultValue; tt.PropertyName = cp.PropertyName; listElementPro.Add(tt); } var monitorControl = ShowElement(canvas, mElement, ElementSate.New, listElementPro); monitorControl.DesignMode(); return monitorControl; } return null; }