public KeyWordEditViewModel(KeyWordListViewModel _vm, KeyWordEditView _mw)
        {
            _KeyWordListVM = _vm;
            _Window = _mw;
            OperationType = OpType.Add;
            KeyWordObj = new KeyWordOR();

            Init();
        }
        public KeyWordEditViewModel(KeyWordListViewModel _vm, KeyWordEditView _mw, KeyWordOR _KeyWordObj)
        {
            _KeyWordListVM = _vm;
            _Window = _mw;
            _SourceObj = _KeyWordObj;

            OperationType = OpType.Alert;
            KeyWordObj = new KeyWordOR();
            KeyWordObj.Clone(_KeyWordObj);

            Init();
        }
Example #3
0
 /// <summary>
 /// 插入t_KeyWord
 /// </summary>
 public virtual bool Insert(KeyWordOR keyWord)
 {
     //string sql = "insert into t_KeyWord (KeyWordID, KeyWord, KeyWordName, Replace, IsCustomize) values (@KeyWordID, @KeyWord, @KeyWordName, @Replace, @IsCustomize)";
     string sql = "insert into t_KeyWord (KeyWord, KeyWordName, Replace, IsCustomize) values (@KeyWord, @KeyWordName, @Replace, @IsCustomize)";
     SqlParameter[] parameters = new SqlParameter[]
     {
         //new SqlParameter("@KeyWordID", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "KeyWordID", DataRowVersion.Default, keyWord.Keywordid),
         new SqlParameter("@KeyWord", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "KeyWord", DataRowVersion.Default, keyWord.Keyword),
         new SqlParameter("@KeyWordName", SqlDbType.Char, 10, ParameterDirection.Input, false, 0, 0, "KeyWordName", DataRowVersion.Default, keyWord.Keywordname),
         new SqlParameter("@Replace", SqlDbType.VarChar, 4000, ParameterDirection.Input, false, 0, 0, "Replace", DataRowVersion.Default, keyWord.Replace),
         new SqlParameter("@IsCustomize", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "IsCustomize", DataRowVersion.Default, keyWord.Iscustomize)
     };
     return db.ExecuteNoQuery(sql, parameters) > -1;
 }
Example #4
0
        public ObservableCollection<KeyWordOR> selectAllDate()
        {
            string sql = "select * from t_KeyWord";

            DataTable dt = null;
            try
            {
                dt = db.ExecuteQuery(sql);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            ObservableCollection<KeyWordOR> _List = new ObservableCollection<KeyWordOR>();
            foreach (DataRow dr in dt.Rows)
            {
                KeyWordOR obj = new KeyWordOR(dr);
                _List.Add(obj);
            }
            return _List;
        }
 public KeyWordEditViewModel(KeyWordOR _Sta)
 {
     OperationType = OpType.Alert;
     KeyWordObj = _Sta;
 }
Example #6
0
 public KeyWordOR selectARowDate(string m_id)
 {
     string sql = string.Format("select * from t_KeyWord where  Keywordid='{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];
     KeyWordOR m_KeyW = new KeyWordOR(dr);
     return m_KeyW;
 }
Example #7
0
 /// <summary>
 /// 更新t_KeyWord
 /// </summary>
 public virtual bool Update(KeyWordOR keyWord)
 {
     string sql = "update t_KeyWord set  KeyWord = @KeyWord,  KeyWordName = @KeyWordName,  Replace = @Replace,  IsCustomize = @IsCustomize where  KeyWordID = @KeyWordID";
     SqlParameter[] parameters = new SqlParameter[]
     {
         new SqlParameter("@KeyWordID", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "KeyWordID", DataRowVersion.Default, keyWord.Keywordid),
         new SqlParameter("@KeyWord", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "KeyWord", DataRowVersion.Default, keyWord.Keyword),
         new SqlParameter("@KeyWordName", SqlDbType.Char, 10, ParameterDirection.Input, false, 0, 0, "KeyWordName", DataRowVersion.Default, keyWord.Keywordname),
         new SqlParameter("@Replace", SqlDbType.VarChar, 4000, ParameterDirection.Input, false, 0, 0, "Replace", DataRowVersion.Default, keyWord.Replace),
         new SqlParameter("@IsCustomize", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "IsCustomize", DataRowVersion.Default, keyWord.Iscustomize)
     };
     return db.ExecuteNoQuery(sql, parameters) > -1;
 }
Example #8
0
 public void Clone(KeyWordOR obj)
 {
     //
     Keywordid = obj.Keywordid;
     //关键字
     Keyword = obj.Keyword;
     //关键字名称
     Keywordname = obj.Keywordname;
     //替换值
     Replace = obj.Replace;
     //是否自定义
     Iscustomize = obj.Iscustomize;
 }
 public KeyWordEditView(KeyWordListViewModel _List, KeyWordOR _KeyWord)
 {
     InitializeComponent();
     this.DataContext = new KeyWordEditViewModel(_List, this, _KeyWord);
 }