Ejemplo n.º 1
0
 public DisarmTimeEditViewModel(DisarmTimeListViewModel _vm, DisarmTimeEditView _mw)
 {
     _DisarmTimeListVM = _vm;
     _Window = _mw;
     OperationType = OpType.Add;
     DisarmTimeObj = new DisarmTimeOR();
     //UpdatetxtSource(_Window.gridContent);
 }
Ejemplo n.º 2
0
        public DisarmTimeEditViewModel(DisarmTimeListViewModel _vm, DisarmTimeEditView _mw, DisarmTimeOR _DisarmTimeObj)
        {
            _DisarmTimeListVM = _vm;
            _Window = _mw;
            _SourceObj = _DisarmTimeObj;

            OperationType = OpType.Alert;
            DisarmTimeObj = new DisarmTimeOR();
            DisarmTimeObj.Clone(_DisarmTimeObj);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// 插入t_DisarmTime
 /// </summary>
 public virtual bool Insert(DisarmTimeOR disarmTime)
 {
     string sql = "insert into t_DisarmTime (DisarmName, DisarmStartTime, DisarmEndTime) values(@DisarmName, @DisarmStartTime, @DisarmEndTime)";
     SqlParameter[] parameters = new SqlParameter[]
     {
         //new SqlParameter("@DisarmID", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "DisarmID", DataRowVersion.Default, disarmTime.Disarmid),
         new SqlParameter("@DisarmName", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "DisarmName", DataRowVersion.Default, disarmTime.Disarmname),
         new SqlParameter("@DisarmStartTime", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "DisarmStartTime", DataRowVersion.Default, disarmTime.Disarmstarttime),
         new SqlParameter("@DisarmEndTime", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "DisarmEndTime", DataRowVersion.Default, disarmTime.Disarmendtime)
     };
     return db.ExecuteNoQuery(sql, parameters) > -1;
 }
Ejemplo n.º 4
0
        public ObservableCollection<DisarmTimeOR> selectAllDate()
        {
            string sql = "select * from t_DisarmTime";

            DataTable dt = null;
            try
            {
                dt = db.ExecuteQuery(sql);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            ObservableCollection<DisarmTimeOR> _List = new ObservableCollection<DisarmTimeOR>();
            foreach (DataRow dr in dt.Rows)
            {
                DisarmTimeOR obj = new DisarmTimeOR(dr);
                _List.Add(obj);
            }
            return _List;
        }
Ejemplo n.º 5
0
 public void Clone(DisarmTimeOR obj)
 {
     //
     Disarmid = obj.Disarmid;
     //撤防名称
     Disarmname = obj.Disarmname;
     //撤防开始时间
     Disarmstarttime = obj.Disarmstarttime;
     //撤防结束时间
     Disarmendtime = obj.Disarmendtime;
 }
Ejemplo n.º 6
0
 public DisarmTimeEditView(DisarmTimeListViewModel _List, DisarmTimeOR _DisarmTime)
 {
     InitializeComponent();
     this.DataContext = new DisarmTimeEditViewModel(_List, this, _DisarmTime);
 }
Ejemplo n.º 7
0
 public DisarmTimeEditViewModel(DisarmTimeOR _Sta)
 {
     OperationType = OpType.Alert;
     DisarmTimeObj = _Sta;
 }
Ejemplo n.º 8
0
 public DisarmTimeOR selectARowDate(string m_id)
 {
     string sql = string.Format("select * from t_DisarmTime where  Disarmid='{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];
     DisarmTimeOR m_Disa = new DisarmTimeOR(dr);
     return m_Disa;
 }
Ejemplo n.º 9
0
 /// <summary>
 /// 更新t_DisarmTime
 /// </summary>
 public virtual bool Update(DisarmTimeOR disarmTime)
 {
     string sql = "update t_DisarmTime set  DisarmName = @DisarmName,  DisarmStartTime = @DisarmStartTime,  DisarmEndTime = @DisarmEndTime where  DisarmID = @DisarmID";
     SqlParameter[] parameters = new SqlParameter[]
     {
         new SqlParameter("@DisarmID", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "DisarmID", DataRowVersion.Default, disarmTime.Disarmid),
         new SqlParameter("@DisarmName", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "DisarmName", DataRowVersion.Default, disarmTime.Disarmname),
         new SqlParameter("@DisarmStartTime", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "DisarmStartTime", DataRowVersion.Default, disarmTime.Disarmstarttime),
         new SqlParameter("@DisarmEndTime", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "DisarmEndTime", DataRowVersion.Default, disarmTime.Disarmendtime)
     };
     return db.ExecuteNoQuery(sql, parameters) > -1;
 }