Example #1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Bsam.Core.Model.Models.Model.PasswordLib model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update PasswordLib set ");
            strSql.Append("IsDeleted=@IsDeleted,");
            strSql.Append("plURL=@plURL,");
            strSql.Append("plPWD=@plPWD,");
            strSql.Append("plAccountName=@plAccountName,");
            strSql.Append("plStatus=@plStatus,");
            strSql.Append("plErrorCount=@plErrorCount,");
            strSql.Append("plHintPwd=@plHintPwd,");
            strSql.Append("plHintquestion=@plHintquestion,");
            strSql.Append("plCreateTime=@plCreateTime,");
            strSql.Append("plUpdateTime=@plUpdateTime,");
            strSql.Append("plLastErrTime=@plLastErrTime,");
            strSql.Append("test=@test");
            strSql.Append(" where PLID=@PLID");
            SQLiteParameter[] parameters =
            {
                new SQLiteParameter("@IsDeleted",      DbType.bit,       1),
                new SQLiteParameter("@plURL",          DbType.String),
                new SQLiteParameter("@plPWD",          DbType.String),
                new SQLiteParameter("@plAccountName",  DbType.String),
                new SQLiteParameter("@plStatus",       DbType.Int32,     8),
                new SQLiteParameter("@plErrorCount",   DbType.Int32,     8),
                new SQLiteParameter("@plHintPwd",      DbType.String),
                new SQLiteParameter("@plHintquestion", DbType.String),
                new SQLiteParameter("@plCreateTime",   DbType.DateTime),
                new SQLiteParameter("@plUpdateTime",   DbType.DateTime),
                new SQLiteParameter("@plLastErrTime",  DbType.DateTime),
                new SQLiteParameter("@test",           DbType.String),
                new SQLiteParameter("@PLID",           DbType.Int32, 8)
            };
            parameters[0].Value  = model.IsDeleted;
            parameters[1].Value  = model.plURL;
            parameters[2].Value  = model.plPWD;
            parameters[3].Value  = model.plAccountName;
            parameters[4].Value  = model.plStatus;
            parameters[5].Value  = model.plErrorCount;
            parameters[6].Value  = model.plHintPwd;
            parameters[7].Value  = model.plHintquestion;
            parameters[8].Value  = model.plCreateTime;
            parameters[9].Value  = model.plUpdateTime;
            parameters[10].Value = model.plLastErrTime;
            parameters[11].Value = model.test;
            parameters[12].Value = model.PLID;

            int rows = DbHelperSQLite.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Bsam.Core.Model.Models.Model.PasswordLib model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into PasswordLib(");
            strSql.Append("IsDeleted,plURL,plPWD,plAccountName,plStatus,plErrorCount,plHintPwd,plHintquestion,plCreateTime,plUpdateTime,plLastErrTime,test)");
            strSql.Append(" values (");
            strSql.Append("@IsDeleted,@plURL,@plPWD,@plAccountName,@plStatus,@plErrorCount,@plHintPwd,@plHintquestion,@plCreateTime,@plUpdateTime,@plLastErrTime,@test)");
            strSql.Append(";select LAST_INSERT_ROWID()");
            SQLiteParameter[] parameters =
            {
                new SQLiteParameter("@IsDeleted",      DbType.bit,       1),
                new SQLiteParameter("@plURL",          DbType.String),
                new SQLiteParameter("@plPWD",          DbType.String),
                new SQLiteParameter("@plAccountName",  DbType.String),
                new SQLiteParameter("@plStatus",       DbType.Int32,     8),
                new SQLiteParameter("@plErrorCount",   DbType.Int32,     8),
                new SQLiteParameter("@plHintPwd",      DbType.String),
                new SQLiteParameter("@plHintquestion", DbType.String),
                new SQLiteParameter("@plCreateTime",   DbType.DateTime),
                new SQLiteParameter("@plUpdateTime",   DbType.DateTime),
                new SQLiteParameter("@plLastErrTime",  DbType.DateTime),
                new SQLiteParameter("@test",           DbType.String)
            };
            parameters[0].Value  = model.IsDeleted;
            parameters[1].Value  = model.plURL;
            parameters[2].Value  = model.plPWD;
            parameters[3].Value  = model.plAccountName;
            parameters[4].Value  = model.plStatus;
            parameters[5].Value  = model.plErrorCount;
            parameters[6].Value  = model.plHintPwd;
            parameters[7].Value  = model.plHintquestion;
            parameters[8].Value  = model.plCreateTime;
            parameters[9].Value  = model.plUpdateTime;
            parameters[10].Value = model.plLastErrTime;
            parameters[11].Value = model.test;

            object obj = DbHelperSQLite.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Example #3
0
 private void ShowInfo(int PLID)
 {
     Bsam.Core.Model.Models.BLL.PasswordLib   bll   = new Bsam.Core.Model.Models.BLL.PasswordLib();
     Bsam.Core.Model.Models.Model.PasswordLib model = bll.GetModel(PLID);
     this.lblPLID.Text           = model.PLID.ToString();
     this.lblIsDeleted.Text      = model.IsDeleted?"是":"否";
     this.lblplURL.Text          = model.plURL;
     this.lblplPWD.Text          = model.plPWD;
     this.lblplAccountName.Text  = model.plAccountName;
     this.lblplStatus.Text       = model.plStatus.ToString();
     this.lblplErrorCount.Text   = model.plErrorCount.ToString();
     this.lblplHintPwd.Text      = model.plHintPwd;
     this.lblplHintquestion.Text = model.plHintquestion;
     this.lblplCreateTime.Text   = model.plCreateTime.ToString();
     this.lblplUpdateTime.Text   = model.plUpdateTime.ToString();
     this.lblplLastErrTime.Text  = model.plLastErrTime.ToString();
     this.lbltest.Text           = model.test;
 }
Example #4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Bsam.Core.Model.Models.Model.PasswordLib GetModel(int PLID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select PLID,IsDeleted,plURL,plPWD,plAccountName,plStatus,plErrorCount,plHintPwd,plHintquestion,plCreateTime,plUpdateTime,plLastErrTime,test from PasswordLib ");
            strSql.Append(" where PLID=@PLID");
            SQLiteParameter[] parameters =
            {
                new SQLiteParameter("@PLID", DbType.Int32, 4)
            };
            parameters[0].Value = PLID;

            Bsam.Core.Model.Models.Model.PasswordLib model = new Bsam.Core.Model.Models.Model.PasswordLib();
            DataSet ds = DbHelperSQLite.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Example #5
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (this.txtplURL.Text.Trim().Length == 0)
            {
                strErr += "plURL不能为空!\\n";
            }
            if (this.txtplPWD.Text.Trim().Length == 0)
            {
                strErr += "plPWD不能为空!\\n";
            }
            if (this.txtplAccountName.Text.Trim().Length == 0)
            {
                strErr += "plAccountName不能为空!\\n";
            }
            if (!PageValidate.IsNumber(txtplStatus.Text))
            {
                strErr += "plStatus格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtplErrorCount.Text))
            {
                strErr += "plErrorCount格式错误!\\n";
            }
            if (this.txtplHintPwd.Text.Trim().Length == 0)
            {
                strErr += "plHintPwd不能为空!\\n";
            }
            if (this.txtplHintquestion.Text.Trim().Length == 0)
            {
                strErr += "plHintquestion不能为空!\\n";
            }
            if (!PageValidate.IsDateTime(txtplCreateTime.Text))
            {
                strErr += "plCreateTime格式错误!\\n";
            }
            if (!PageValidate.IsDateTime(txtplUpdateTime.Text))
            {
                strErr += "plUpdateTime格式错误!\\n";
            }
            if (!PageValidate.IsDateTime(txtplLastErrTime.Text))
            {
                strErr += "plLastErrTime格式错误!\\n";
            }
            if (this.txttest.Text.Trim().Length == 0)
            {
                strErr += "test不能为空!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            bool     IsDeleted      = this.chkIsDeleted.Checked;
            string   plURL          = this.txtplURL.Text;
            string   plPWD          = this.txtplPWD.Text;
            string   plAccountName  = this.txtplAccountName.Text;
            int      plStatus       = int.Parse(this.txtplStatus.Text);
            int      plErrorCount   = int.Parse(this.txtplErrorCount.Text);
            string   plHintPwd      = this.txtplHintPwd.Text;
            string   plHintquestion = this.txtplHintquestion.Text;
            DateTime plCreateTime   = DateTime.Parse(this.txtplCreateTime.Text);
            DateTime plUpdateTime   = DateTime.Parse(this.txtplUpdateTime.Text);
            DateTime plLastErrTime  = DateTime.Parse(this.txtplLastErrTime.Text);
            string   test           = this.txttest.Text;

            Bsam.Core.Model.Models.Model.PasswordLib model = new Bsam.Core.Model.Models.Model.PasswordLib();
            model.IsDeleted      = IsDeleted;
            model.plURL          = plURL;
            model.plPWD          = plPWD;
            model.plAccountName  = plAccountName;
            model.plStatus       = plStatus;
            model.plErrorCount   = plErrorCount;
            model.plHintPwd      = plHintPwd;
            model.plHintquestion = plHintquestion;
            model.plCreateTime   = plCreateTime;
            model.plUpdateTime   = plUpdateTime;
            model.plLastErrTime  = plLastErrTime;
            model.test           = test;

            Bsam.Core.Model.Models.BLL.PasswordLib bll = new Bsam.Core.Model.Models.BLL.PasswordLib();
            bll.Add(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "add.aspx");
        }
Example #6
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Bsam.Core.Model.Models.Model.PasswordLib DataRowToModel(DataRow row)
 {
     Bsam.Core.Model.Models.Model.PasswordLib model = new Bsam.Core.Model.Models.Model.PasswordLib();
     if (row != null)
     {
         if (row["PLID"] != null && row["PLID"].ToString() != "")
         {
             model.PLID = int.Parse(row["PLID"].ToString());
         }
         if (row["IsDeleted"] != null && row["IsDeleted"].ToString() != "")
         {
             if ((row["IsDeleted"].ToString() == "1") || (row["IsDeleted"].ToString().ToLower() == "true"))
             {
                 model.IsDeleted = true;
             }
             else
             {
                 model.IsDeleted = false;
             }
         }
         if (row["plURL"] != null)
         {
             model.plURL = row["plURL"].ToString();
         }
         if (row["plPWD"] != null)
         {
             model.plPWD = row["plPWD"].ToString();
         }
         if (row["plAccountName"] != null)
         {
             model.plAccountName = row["plAccountName"].ToString();
         }
         if (row["plStatus"] != null && row["plStatus"].ToString() != "")
         {
             model.plStatus = int.Parse(row["plStatus"].ToString());
         }
         if (row["plErrorCount"] != null && row["plErrorCount"].ToString() != "")
         {
             model.plErrorCount = int.Parse(row["plErrorCount"].ToString());
         }
         if (row["plHintPwd"] != null)
         {
             model.plHintPwd = row["plHintPwd"].ToString();
         }
         if (row["plHintquestion"] != null)
         {
             model.plHintquestion = row["plHintquestion"].ToString();
         }
         if (row["plCreateTime"] != null && row["plCreateTime"].ToString() != "")
         {
             model.plCreateTime = DateTime.Parse(row["plCreateTime"].ToString());
         }
         if (row["plUpdateTime"] != null && row["plUpdateTime"].ToString() != "")
         {
             model.plUpdateTime = DateTime.Parse(row["plUpdateTime"].ToString());
         }
         if (row["plLastErrTime"] != null && row["plLastErrTime"].ToString() != "")
         {
             model.plLastErrTime = DateTime.Parse(row["plLastErrTime"].ToString());
         }
         if (row["test"] != null)
         {
             model.test = row["test"].ToString();
         }
     }
     return(model);
 }