Example #1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string strErr="";
            if(this.txtUname.Text.Trim().Length==0)
            {
                strErr+="查询的用户不能为空!\\n";
            }
            if(!PageValidate.IsDateTime(txtAddDate.Text))
            {
                strErr+="AddDate格式错误!\\n";
            }
            if(!PageValidate.IsDateTime(txtLastQueryDate.Text))
            {
                strErr+="最后一次查询日期格式错误!\\n";
            }
            if(this.txtCode.Text.Trim().Length==0)
            {
                strErr+="查询的条码号不能为空!\\n";
            }
            if(this.txtCodeType.Text.Trim().Length==0)
            {
                strErr+="条码号类型不能为空!\\n";
            }
            if(this.txtQueryType.Text.Trim().Length==0)
            {
                strErr+="查询的数据类型不能为空!\\n";
            }
            if(this.txtQueryResult.Text.Trim().Length==0)
            {
                strErr+="QueryResult不能为空!\\n";
            }

            if(strErr!="")
            {
                MessageBox.Show(this,strErr);
                return;
            }
            string Uname=this.txtUname.Text;
            DateTime AddDate=DateTime.Parse(this.txtAddDate.Text);
            DateTime LastQueryDate=DateTime.Parse(this.txtLastQueryDate.Text);
            string Code=this.txtCode.Text;
            string CodeType=this.txtCodeType.Text;
            string QueryType=this.txtQueryType.Text;
            string QueryResult=this.txtQueryResult.Text;
            bool IsDel=this.chkIsDel.Checked;

            RuRo.Model.QueryRecoder model=new RuRo.Model.QueryRecoder();
            model.Uname=Uname;
            model.AddDate=AddDate;
            model.LastQueryDate=LastQueryDate;
            model.Code=Code;
            model.CodeType=CodeType;
            model.QueryType=QueryType;
            model.QueryResult=QueryResult;
            model.IsDel=IsDel;

            RuRo.BLL.QueryRecoder bll=new RuRo.BLL.QueryRecoder();
            bll.Add(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功!","add.aspx");
        }
Example #2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public RuRo.Model.QueryRecoder DataRowToModel(DataRow row)
 {
     RuRo.Model.QueryRecoder model = new RuRo.Model.QueryRecoder();
     if (row != null)
     {
         if (row["Id"] != null && row["Id"].ToString() != "")
         {
             model.Id = int.Parse(row["Id"].ToString());
         }
         if (row["Uname"] != null)
         {
             model.Uname = row["Uname"].ToString();
         }
         if (row["AddDate"] != null && row["AddDate"].ToString() != "")
         {
             model.AddDate = DateTime.Parse(row["AddDate"].ToString());
         }
         if (row["LastQueryDate"] != null && row["LastQueryDate"].ToString() != "")
         {
             model.LastQueryDate = DateTime.Parse(row["LastQueryDate"].ToString());
         }
         if (row["Code"] != null)
         {
             model.Code = row["Code"].ToString();
         }
         if (row["CodeType"] != null)
         {
             model.CodeType = row["CodeType"].ToString();
         }
         if (row["QueryType"] != null)
         {
             model.QueryType = row["QueryType"].ToString();
         }
         if (row["QueryResult"] != null)
         {
             model.QueryResult = row["QueryResult"].ToString();
         }
         if (row["IsDel"] != null && row["IsDel"].ToString() != "")
         {
             if ((row["IsDel"].ToString() == "1") || (row["IsDel"].ToString().ToLower() == "true"))
             {
                 model.IsDel = true;
             }
             else
             {
                 model.IsDel = false;
             }
         }
     }
     return(model);
 }
Example #3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public RuRo.Model.QueryRecoder DataRowToModel(DataRow row)
 {
     RuRo.Model.QueryRecoder model=new RuRo.Model.QueryRecoder();
     if (row != null)
     {
         if(row["Id"]!=null && row["Id"].ToString()!="")
         {
             model.Id=int.Parse(row["Id"].ToString());
         }
         if(row["Uname"]!=null)
         {
             model.Uname=row["Uname"].ToString();
         }
         if(row["AddDate"]!=null && row["AddDate"].ToString()!="")
         {
             model.AddDate=DateTime.Parse(row["AddDate"].ToString());
         }
         if(row["LastQueryDate"]!=null && row["LastQueryDate"].ToString()!="")
         {
             model.LastQueryDate=DateTime.Parse(row["LastQueryDate"].ToString());
         }
         if(row["Code"]!=null)
         {
             model.Code=row["Code"].ToString();
         }
         if(row["CodeType"]!=null)
         {
             model.CodeType=row["CodeType"].ToString();
         }
         if(row["QueryType"]!=null)
         {
             model.QueryType=row["QueryType"].ToString();
         }
         if(row["QueryResult"]!=null)
         {
             model.QueryResult=row["QueryResult"].ToString();
         }
         if(row["IsDel"]!=null && row["IsDel"].ToString()!="")
         {
             if((row["IsDel"].ToString()=="1")||(row["IsDel"].ToString().ToLower()=="true"))
             {
                 model.IsDel=true;
             }
             else
             {
                 model.IsDel=false;
             }
         }
     }
     return model;
 }
Example #4
0
 private void ShowInfo(int Id)
 {
     RuRo.BLL.QueryRecoder   bll   = new RuRo.BLL.QueryRecoder();
     RuRo.Model.QueryRecoder model = bll.GetModel(Id);
     this.lblId.Text            = model.Id.ToString();
     this.txtUname.Text         = model.Uname;
     this.txtAddDate.Text       = model.AddDate.ToString();
     this.txtLastQueryDate.Text = model.LastQueryDate.ToString();
     this.txtCode.Text          = model.Code;
     this.txtCodeType.Text      = model.CodeType;
     this.txtQueryType.Text     = model.QueryType;
     this.txtQueryResult.Text   = model.QueryResult;
     this.chkIsDel.Checked      = model.IsDel;
 }
Example #5
0
 private void ShowInfo(int Id)
 {
     RuRo.BLL.QueryRecoder   bll   = new RuRo.BLL.QueryRecoder();
     RuRo.Model.QueryRecoder model = bll.GetModel(Id);
     this.lblId.Text            = model.Id.ToString();
     this.lblUname.Text         = model.Uname;
     this.lblAddDate.Text       = model.AddDate.ToString();
     this.lblLastQueryDate.Text = model.LastQueryDate.ToString();
     this.lblCode.Text          = model.Code;
     this.lblCodeType.Text      = model.CodeType;
     this.lblQueryType.Text     = model.QueryType;
     this.lblQueryResult.Text   = model.QueryResult;
     this.lblIsDel.Text         = model.IsDel?"是":"否";
 }
Example #6
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(RuRo.Model.QueryRecoder model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update QueryRecoder set ");
            strSql.Append("Uname=@Uname,");
            strSql.Append("AddDate=@AddDate,");
            strSql.Append("LastQueryDate=@LastQueryDate,");
            strSql.Append("Code=@Code,");
            strSql.Append("CodeType=@CodeType,");
            strSql.Append("QueryType=@QueryType,");
            strSql.Append("QueryResult=@QueryResult,");
            strSql.Append("IsDel=@IsDel");
            strSql.Append(" where Id=@Id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Uname",         SqlDbType.NVarChar,  50),
                new SqlParameter("@AddDate",       SqlDbType.DateTime),
                new SqlParameter("@LastQueryDate", SqlDbType.DateTime),
                new SqlParameter("@Code",          SqlDbType.NVarChar,  50),
                new SqlParameter("@CodeType",      SqlDbType.NVarChar,  50),
                new SqlParameter("@QueryType",     SqlDbType.NVarChar,  50),
                new SqlParameter("@QueryResult",   SqlDbType.NVarChar),
                new SqlParameter("@IsDel",         SqlDbType.Bit,        1),
                new SqlParameter("@Id",            SqlDbType.Int, 4)
            };
            parameters[0].Value = model.Uname;
            parameters[1].Value = model.AddDate;
            parameters[2].Value = model.LastQueryDate;
            parameters[3].Value = model.Code;
            parameters[4].Value = model.CodeType;
            parameters[5].Value = model.QueryType;
            parameters[6].Value = model.QueryResult;
            parameters[7].Value = model.IsDel;
            parameters[8].Value = model.Id;

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

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

            strSql.Append("insert into QueryRecoder(");
            strSql.Append("Uname,AddDate,LastQueryDate,Code,CodeType,QueryType,QueryResult,IsDel)");
            strSql.Append(" values (");
            strSql.Append("@Uname,@AddDate,@LastQueryDate,@Code,@CodeType,@QueryType,@QueryResult,@IsDel)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Uname",         SqlDbType.NVarChar,  50),
                new SqlParameter("@AddDate",       SqlDbType.DateTime),
                new SqlParameter("@LastQueryDate", SqlDbType.DateTime),
                new SqlParameter("@Code",          SqlDbType.NVarChar,  50),
                new SqlParameter("@CodeType",      SqlDbType.NVarChar,  50),
                new SqlParameter("@QueryType",     SqlDbType.NVarChar,  50),
                new SqlParameter("@QueryResult",   SqlDbType.NVarChar),
                new SqlParameter("@IsDel",         SqlDbType.Bit, 1)
            };
            parameters[0].Value = model.Uname;
            parameters[1].Value = model.AddDate;
            parameters[2].Value = model.LastQueryDate;
            parameters[3].Value = model.Code;
            parameters[4].Value = model.CodeType;
            parameters[5].Value = model.QueryType;
            parameters[6].Value = model.QueryResult;
            parameters[7].Value = model.IsDel;

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

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Example #8
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public RuRo.Model.QueryRecoder GetModel(int Id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 Id,Uname,AddDate,LastQueryDate,Code,CodeType,QueryType,QueryResult,IsDel from QueryRecoder ");
            strSql.Append(" where Id=@Id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Id", SqlDbType.Int, 4)
            };
            parameters[0].Value = Id;

            RuRo.Model.QueryRecoder model = new RuRo.Model.QueryRecoder();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Example #9
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public RuRo.Model.QueryRecoder GetModel(int Id)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select  top 1 Id,Uname,AddDate,LastQueryDate,Code,CodeType,QueryType,QueryResult from QueryRecoder ");
            strSql.Append(" where Id=@Id");
            SqlParameter[] parameters = {
                    new SqlParameter("@Id", SqlDbType.Int,4)
            };
            parameters[0].Value = Id;

            RuRo.Model.QueryRecoder model=new RuRo.Model.QueryRecoder();
            DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters);
            if(ds.Tables[0].Rows.Count>0)
            {
                return DataRowToModel(ds.Tables[0].Rows[0]);
            }
            else
            {
                return null;
            }
        }
Example #10
0
        public void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (this.txtUname.Text.Trim().Length == 0)
            {
                strErr += "查询的用户不能为空!\\n";
            }
            if (!PageValidate.IsDateTime(txtAddDate.Text))
            {
                strErr += "AddDate格式错误!\\n";
            }
            if (!PageValidate.IsDateTime(txtLastQueryDate.Text))
            {
                strErr += "最后一次查询日期格式错误!\\n";
            }
            if (this.txtCode.Text.Trim().Length == 0)
            {
                strErr += "查询的条码号不能为空!\\n";
            }
            if (this.txtCodeType.Text.Trim().Length == 0)
            {
                strErr += "条码号类型不能为空!\\n";
            }
            if (this.txtQueryType.Text.Trim().Length == 0)
            {
                strErr += "查询的数据类型不能为空!\\n";
            }
            if (this.txtQueryResult.Text.Trim().Length == 0)
            {
                strErr += "QueryResult不能为空!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            int      Id            = int.Parse(this.lblId.Text);
            string   Uname         = this.txtUname.Text;
            DateTime AddDate       = DateTime.Parse(this.txtAddDate.Text);
            DateTime LastQueryDate = DateTime.Parse(this.txtLastQueryDate.Text);
            string   Code          = this.txtCode.Text;
            string   CodeType      = this.txtCodeType.Text;
            string   QueryType     = this.txtQueryType.Text;
            string   QueryResult   = this.txtQueryResult.Text;
            bool     IsDel         = this.chkIsDel.Checked;


            RuRo.Model.QueryRecoder model = new RuRo.Model.QueryRecoder();
            model.Id            = Id;
            model.Uname         = Uname;
            model.AddDate       = AddDate;
            model.LastQueryDate = LastQueryDate;
            model.Code          = Code;
            model.CodeType      = CodeType;
            model.QueryType     = QueryType;
            model.QueryResult   = QueryResult;
            model.IsDel         = IsDel;

            RuRo.BLL.QueryRecoder bll = new RuRo.BLL.QueryRecoder();
            bll.Update(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx");
        }
Example #11
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(RuRo.Model.QueryRecoder model)
 {
     return(dal.Update(model));
 }
Example #12
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(RuRo.Model.QueryRecoder model)
 {
     return(dal.Add(model));
 }