Пример #1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(ForKids.DB.Model.KIDPAYMENT model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into KIDPAYMENT(");
            strSql.Append("KIDID,CHARGEID,PAYMENT,PAYDATE)");
            strSql.Append(" values (");
            strSql.Append("@KIDID,@CHARGEID,@PAYMENT,@PAYDATE)");
            OleDbParameter[] parameters =
            {
                new OleDbParameter("@KIDID",    OleDbType.Integer, 4),
                new OleDbParameter("@CHARGEID", OleDbType.Integer, 4),
                new OleDbParameter("@PAYMENT",  OleDbType.Double),
                new OleDbParameter("@PAYDATE",  OleDbType.Date)
            };
            parameters[0].Value = model.KIDID;
            parameters[1].Value = model.CHARGEID;
            parameters[2].Value = model.PAYMENT;
            parameters[3].Value = model.PAYDATE;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #2
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(ForKids.DB.Model.KIDPAYMENT model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update KIDPAYMENT set ");
            strSql.Append("KIDID=@KIDID,");
            strSql.Append("CHARGEID=@CHARGEID,");
            strSql.Append("PAYMENT=@PAYMENT,");
            strSql.Append("PAYDATE=@PAYDATE");
            strSql.Append(" where ID=@ID");
            OleDbParameter[] parameters =
            {
                new OleDbParameter("@KIDID",    OleDbType.Integer, 4),
                new OleDbParameter("@CHARGEID", OleDbType.Integer, 4),
                new OleDbParameter("@PAYMENT",  OleDbType.Double),
                new OleDbParameter("@PAYDATE",  OleDbType.Date),
                new OleDbParameter("@ID",       OleDbType.Integer, 4)
            };
            parameters[0].Value = model.KIDID;
            parameters[1].Value = model.CHARGEID;
            parameters[2].Value = model.PAYMENT;
            parameters[3].Value = model.PAYDATE;
            parameters[4].Value = model.ID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #3
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public ForKids.DB.Model.KIDPAYMENT GetModel(int ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select ID,KIDID,CHARGEID,PAYMENT,PAYDATE from KIDPAYMENT ");
            strSql.Append(" where ID=@ID");
            OleDbParameter[] parameters =
            {
                new OleDbParameter("@ID", OleDbType.Integer, 4)
            };
            parameters[0].Value = ID;

            ForKids.DB.Model.KIDPAYMENT model = new ForKids.DB.Model.KIDPAYMENT();
            DataSet ds = DbHelperOleDb.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["ID"] != null && ds.Tables[0].Rows[0]["ID"].ToString() != "")
                {
                    model.ID = int.Parse(ds.Tables[0].Rows[0]["ID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["KIDID"] != null && ds.Tables[0].Rows[0]["KIDID"].ToString() != "")
                {
                    model.KIDID = int.Parse(ds.Tables[0].Rows[0]["KIDID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["CHARGEID"] != null && ds.Tables[0].Rows[0]["CHARGEID"].ToString() != "")
                {
                    model.CHARGEID = int.Parse(ds.Tables[0].Rows[0]["CHARGEID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["PAYMENT"] != null && ds.Tables[0].Rows[0]["PAYMENT"].ToString() != "")
                {
                    model.PAYMENT = double.Parse(ds.Tables[0].Rows[0]["PAYMENT"].ToString());
                }
                if (ds.Tables[0].Rows[0]["PAYDATE"] != null && ds.Tables[0].Rows[0]["PAYDATE"].ToString() != "")
                {
                    model.PAYDATE = DateTime.Parse(ds.Tables[0].Rows[0]["PAYDATE"].ToString());
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }
Пример #4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public ForKids.DB.Model.KIDPAYMENT GetModel(int ID)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select ID,KIDID,CHARGEID,PAYMENT,PAYDATE from KIDPAYMENT ");
            strSql.Append(" where ID=@ID");
            OleDbParameter[] parameters = {
                    new OleDbParameter("@ID", OleDbType.Integer,4)
            };
            parameters[0].Value = ID;

            ForKids.DB.Model.KIDPAYMENT model=new ForKids.DB.Model.KIDPAYMENT();
            DataSet ds=DbHelperOleDb.Query(strSql.ToString(),parameters);
            if(ds.Tables[0].Rows.Count>0)
            {
                if(ds.Tables[0].Rows[0]["ID"]!=null && ds.Tables[0].Rows[0]["ID"].ToString()!="")
                {
                    model.ID=int.Parse(ds.Tables[0].Rows[0]["ID"].ToString());
                }
                if(ds.Tables[0].Rows[0]["KIDID"]!=null && ds.Tables[0].Rows[0]["KIDID"].ToString()!="")
                {
                    //model.KIDID=ds.Tables[0].Rows[0]["KIDID"].ToString();
                }
                if(ds.Tables[0].Rows[0]["CHARGEID"]!=null && ds.Tables[0].Rows[0]["CHARGEID"].ToString()!="")
                {
                    //model.CHARGEID=ds.Tables[0].Rows[0]["CHARGEID"].ToString();
                }
                if(ds.Tables[0].Rows[0]["PAYMENT"]!=null && ds.Tables[0].Rows[0]["PAYMENT"].ToString()!="")
                {
                    //model.PAYMENT=ds.Tables[0].Rows[0]["PAYMENT"].ToString();
                }
                if(ds.Tables[0].Rows[0]["PAYDATE"]!=null && ds.Tables[0].Rows[0]["PAYDATE"].ToString()!="")
                {
                    model.PAYDATE=DateTime.Parse(ds.Tables[0].Rows[0]["PAYDATE"].ToString());
                }
                return model;
            }
            else
            {
                return null;
            }
        }