Ejemplo n.º 1
0
        public AlarmGroupsEditViewModel(AlarmGroupsListViewModel _vm, AlarmGroupsEditView _mw)
        {
            _AlarmGroupsListVM = _vm;
            _Window = _mw;
            OperationType = OpType.Add;
            AlarmGroupsObj = new AlarmGroupsOR();
            //UpdatetxtSource(_Window.gridContent);

            Init();
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 插入t_AlarmGroups
 /// </summary>
 public virtual bool Insert(AlarmGroupsOR alarmGroups)
 {
     string sql = "insert into t_AlarmGroups (StationID, GroupName) values (@StationID, @GroupName)";
     SqlParameter[] parameters = new SqlParameter[]
     {
         //new SqlParameter("@AlarmGroupsID", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "AlarmGroupsID", DataRowVersion.Default, alarmGroups.Alarmgroupsid),
         new SqlParameter("@StationID", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "StationID", DataRowVersion.Default, alarmGroups.Stationid),
         new SqlParameter("@GroupName", SqlDbType.NVarChar, 100, ParameterDirection.Input, false, 0, 0, "GroupName", DataRowVersion.Default, alarmGroups.Groupname)
     };
     return db.ExecuteNoQuery(sql, parameters) > -1;
 }
Ejemplo n.º 3
0
        public AlarmGroupsEditViewModel(AlarmGroupsListViewModel _vm, AlarmGroupsEditView _mw, AlarmGroupsOR _AlarmGroupsObj)
        {
            _AlarmGroupsListVM = _vm;
            _Window = _mw;
            _SourceObj = _AlarmGroupsObj;

            OperationType = OpType.Alert;
            AlarmGroupsObj = new AlarmGroupsOR();
            AlarmGroupsObj.Clone(_AlarmGroupsObj);

            Init();
        }
Ejemplo n.º 4
0
        public ObservableCollection<AlarmGroupsOR> selectAllDate()
        {
            string sql = @"select ag.*,s.StationName from t_AlarmGroups ag
            inner join t_Station s on s.StationID=ag.StationID";

            DataTable dt = null;
            try
            {
                dt = db.ExecuteQuery(sql);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            ObservableCollection<AlarmGroupsOR> _List = new ObservableCollection<AlarmGroupsOR>();
            foreach (DataRow dr in dt.Rows)
            {
                AlarmGroupsOR obj = new AlarmGroupsOR(dr);
                _List.Add(obj);
            }
            return _List;
        }
Ejemplo n.º 5
0
 /// <summary>
 /// 更新t_AlarmGroups
 /// </summary>
 public virtual bool Update(AlarmGroupsOR alarmGroups)
 {
     string sql = "update t_AlarmGroups set  StationID = @StationID,  GroupName = @GroupName where  AlarmGroupsID = @AlarmGroupsID";
     SqlParameter[] parameters = new SqlParameter[]
     {
         new SqlParameter("@AlarmGroupsID", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "AlarmGroupsID", DataRowVersion.Default, alarmGroups.Alarmgroupsid),
         new SqlParameter("@StationID", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "StationID", DataRowVersion.Default, alarmGroups.Stationid),
         new SqlParameter("@GroupName", SqlDbType.NVarChar, 100, ParameterDirection.Input, false, 0, 0, "GroupName", DataRowVersion.Default, alarmGroups.Groupname)
     };
     return db.ExecuteNoQuery(sql, parameters) > -1;
 }
Ejemplo n.º 6
0
 public AlarmGroupsOR selectARowDate(string m_id)
 {
     string sql = string.Format("select * from t_AlarmGroups where  Alarmgroupsid='{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];
     AlarmGroupsOR m_Alar = new AlarmGroupsOR(dr);
     return m_Alar;
 }
Ejemplo n.º 7
0
 public AlarmGroupsEditView(AlarmGroupsListViewModel _List, AlarmGroupsOR _AlarmGroups)
 {
     InitializeComponent();
     this.DataContext = new AlarmGroupsEditViewModel(_List, this, _AlarmGroups);
 }
Ejemplo n.º 8
0
        public void Clone(AlarmGroupsOR obj)
        {
            //
            Alarmgroupsid = obj.Alarmgroupsid;
            //站点
            Stationid = obj.Stationid;
            //名称
            Groupname = obj.Groupname;

            StationName = obj.StationName;
        }
Ejemplo n.º 9
0
 public AlarmGroupsEditViewModel(AlarmGroupsOR _Sta)
 {
     OperationType = OpType.Alert;
     AlarmGroupsObj = _Sta;
 }