Beispiel #1
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Hotel_app.Model.VIEW_yj_bak GetModel()
        {
            //该表无主键信息,请自定义主键/条件字段
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 yydh,qymc,id_app,lsbh,krxm,fjrb,fjbh,sktt,xfrq,xfsj,czy,xfdr,xfrb,xfxm,xfbz,xfzy,fkfs,xfje,sjxfje,czy_bc,shsc,syzd,czsj,czzt,id from VIEW_yj_bak ");
            strSql.Append(" where ");
            SqlParameter[] parameters =
            {
            };

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["yydh"] != null && ds.Tables[0].Rows[0]["yydh"].ToString() != "")
                {
                    model.yydh = ds.Tables[0].Rows[0]["yydh"].ToString();
                }
                if (ds.Tables[0].Rows[0]["qymc"] != null && ds.Tables[0].Rows[0]["qymc"].ToString() != "")
                {
                    model.qymc = ds.Tables[0].Rows[0]["qymc"].ToString();
                }
                if (ds.Tables[0].Rows[0]["id_app"] != null && ds.Tables[0].Rows[0]["id_app"].ToString() != "")
                {
                    model.id_app = ds.Tables[0].Rows[0]["id_app"].ToString();
                }
                if (ds.Tables[0].Rows[0]["lsbh"] != null && ds.Tables[0].Rows[0]["lsbh"].ToString() != "")
                {
                    model.lsbh = ds.Tables[0].Rows[0]["lsbh"].ToString();
                }
                if (ds.Tables[0].Rows[0]["krxm"] != null && ds.Tables[0].Rows[0]["krxm"].ToString() != "")
                {
                    model.krxm = ds.Tables[0].Rows[0]["krxm"].ToString();
                }
                if (ds.Tables[0].Rows[0]["fjrb"] != null && ds.Tables[0].Rows[0]["fjrb"].ToString() != "")
                {
                    model.fjrb = ds.Tables[0].Rows[0]["fjrb"].ToString();
                }
                if (ds.Tables[0].Rows[0]["fjbh"] != null && ds.Tables[0].Rows[0]["fjbh"].ToString() != "")
                {
                    model.fjbh = ds.Tables[0].Rows[0]["fjbh"].ToString();
                }
                if (ds.Tables[0].Rows[0]["sktt"] != null && ds.Tables[0].Rows[0]["sktt"].ToString() != "")
                {
                    model.sktt = ds.Tables[0].Rows[0]["sktt"].ToString();
                }
                if (ds.Tables[0].Rows[0]["xfrq"] != null && ds.Tables[0].Rows[0]["xfrq"].ToString() != "")
                {
                    model.xfrq = DateTime.Parse(ds.Tables[0].Rows[0]["xfrq"].ToString());
                }
                if (ds.Tables[0].Rows[0]["xfsj"] != null && ds.Tables[0].Rows[0]["xfsj"].ToString() != "")
                {
                    model.xfsj = DateTime.Parse(ds.Tables[0].Rows[0]["xfsj"].ToString());
                }
                if (ds.Tables[0].Rows[0]["czy"] != null && ds.Tables[0].Rows[0]["czy"].ToString() != "")
                {
                    model.czy = ds.Tables[0].Rows[0]["czy"].ToString();
                }
                if (ds.Tables[0].Rows[0]["xfdr"] != null && ds.Tables[0].Rows[0]["xfdr"].ToString() != "")
                {
                    model.xfdr = ds.Tables[0].Rows[0]["xfdr"].ToString();
                }
                if (ds.Tables[0].Rows[0]["xfrb"] != null && ds.Tables[0].Rows[0]["xfrb"].ToString() != "")
                {
                    model.xfrb = ds.Tables[0].Rows[0]["xfrb"].ToString();
                }
                if (ds.Tables[0].Rows[0]["xfxm"] != null && ds.Tables[0].Rows[0]["xfxm"].ToString() != "")
                {
                    model.xfxm = ds.Tables[0].Rows[0]["xfxm"].ToString();
                }
                if (ds.Tables[0].Rows[0]["xfbz"] != null && ds.Tables[0].Rows[0]["xfbz"].ToString() != "")
                {
                    model.xfbz = ds.Tables[0].Rows[0]["xfbz"].ToString();
                }
                if (ds.Tables[0].Rows[0]["xfzy"] != null && ds.Tables[0].Rows[0]["xfzy"].ToString() != "")
                {
                    model.xfzy = ds.Tables[0].Rows[0]["xfzy"].ToString();
                }
                if (ds.Tables[0].Rows[0]["fkfs"] != null && ds.Tables[0].Rows[0]["fkfs"].ToString() != "")
                {
                    model.fkfs = ds.Tables[0].Rows[0]["fkfs"].ToString();
                }
                if (ds.Tables[0].Rows[0]["xfje"] != null && ds.Tables[0].Rows[0]["xfje"].ToString() != "")
                {
                    model.xfje = decimal.Parse(ds.Tables[0].Rows[0]["xfje"].ToString());
                }
                if (ds.Tables[0].Rows[0]["sjxfje"] != null && ds.Tables[0].Rows[0]["sjxfje"].ToString() != "")
                {
                    model.sjxfje = decimal.Parse(ds.Tables[0].Rows[0]["sjxfje"].ToString());
                }
                if (ds.Tables[0].Rows[0]["czy_bc"] != null && ds.Tables[0].Rows[0]["czy_bc"].ToString() != "")
                {
                    model.czy_bc = ds.Tables[0].Rows[0]["czy_bc"].ToString();
                }
                if (ds.Tables[0].Rows[0]["shsc"] != null && ds.Tables[0].Rows[0]["shsc"].ToString() != "")
                {
                    if ((ds.Tables[0].Rows[0]["shsc"].ToString() == "1") || (ds.Tables[0].Rows[0]["shsc"].ToString().ToLower() == "true"))
                    {
                        model.shsc = true;
                    }
                    else
                    {
                        model.shsc = false;
                    }
                }
                if (ds.Tables[0].Rows[0]["syzd"] != null && ds.Tables[0].Rows[0]["syzd"].ToString() != "")
                {
                    model.syzd = ds.Tables[0].Rows[0]["syzd"].ToString();
                }
                if (ds.Tables[0].Rows[0]["czsj"] != null && ds.Tables[0].Rows[0]["czsj"].ToString() != "")
                {
                    model.czsj = DateTime.Parse(ds.Tables[0].Rows[0]["czsj"].ToString());
                }
                if (ds.Tables[0].Rows[0]["czzt"] != null && ds.Tables[0].Rows[0]["czzt"].ToString() != "")
                {
                    model.czzt = ds.Tables[0].Rows[0]["czzt"].ToString();
                }
                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());
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }
Beispiel #2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(Hotel_app.Model.VIEW_yj_bak model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into VIEW_yj_bak(");
            strSql.Append("yydh,qymc,id_app,lsbh,krxm,fjrb,fjbh,sktt,xfrq,xfsj,czy,xfdr,xfrb,xfxm,xfbz,xfzy,fkfs,xfje,sjxfje,czy_bc,shsc,syzd,czsj,czzt,id)");
            strSql.Append(" values (");
            strSql.Append("@yydh,@qymc,@id_app,@lsbh,@krxm,@fjrb,@fjbh,@sktt,@xfrq,@xfsj,@czy,@xfdr,@xfrb,@xfxm,@xfbz,@xfzy,@fkfs,@xfje,@sjxfje,@czy_bc,@shsc,@syzd,@czsj,@czzt,@id)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@yydh",   SqlDbType.VarChar,    50),
                new SqlParameter("@qymc",   SqlDbType.VarChar,    50),
                new SqlParameter("@id_app", SqlDbType.VarChar,    50),
                new SqlParameter("@lsbh",   SqlDbType.VarChar,    50),
                new SqlParameter("@krxm",   SqlDbType.VarChar,    50),
                new SqlParameter("@fjrb",   SqlDbType.VarChar,    50),
                new SqlParameter("@fjbh",   SqlDbType.VarChar,    50),
                new SqlParameter("@sktt",   SqlDbType.VarChar,    50),
                new SqlParameter("@xfrq",   SqlDbType.DateTime),
                new SqlParameter("@xfsj",   SqlDbType.DateTime),
                new SqlParameter("@czy",    SqlDbType.VarChar,    50),
                new SqlParameter("@xfdr",   SqlDbType.VarChar,    50),
                new SqlParameter("@xfrb",   SqlDbType.VarChar,    50),
                new SqlParameter("@xfxm",   SqlDbType.VarChar,    50),
                new SqlParameter("@xfbz",   SqlDbType.VarChar,   200),
                new SqlParameter("@xfzy",   SqlDbType.VarChar,   200),
                new SqlParameter("@fkfs",   SqlDbType.VarChar,    50),
                new SqlParameter("@xfje",   SqlDbType.Decimal,     9),
                new SqlParameter("@sjxfje", SqlDbType.Decimal,     9),
                new SqlParameter("@czy_bc", SqlDbType.VarChar,    50),
                new SqlParameter("@shsc",   SqlDbType.Bit,         1),
                new SqlParameter("@syzd",   SqlDbType.VarChar,    50),
                new SqlParameter("@czsj",   SqlDbType.DateTime),
                new SqlParameter("@czzt",   SqlDbType.VarChar,    50),
                new SqlParameter("@id",     SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.yydh;
            parameters[1].Value  = model.qymc;
            parameters[2].Value  = model.id_app;
            parameters[3].Value  = model.lsbh;
            parameters[4].Value  = model.krxm;
            parameters[5].Value  = model.fjrb;
            parameters[6].Value  = model.fjbh;
            parameters[7].Value  = model.sktt;
            parameters[8].Value  = model.xfrq;
            parameters[9].Value  = model.xfsj;
            parameters[10].Value = model.czy;
            parameters[11].Value = model.xfdr;
            parameters[12].Value = model.xfrb;
            parameters[13].Value = model.xfxm;
            parameters[14].Value = model.xfbz;
            parameters[15].Value = model.xfzy;
            parameters[16].Value = model.fkfs;
            parameters[17].Value = model.xfje;
            parameters[18].Value = model.sjxfje;
            parameters[19].Value = model.czy_bc;
            parameters[20].Value = model.shsc;
            parameters[21].Value = model.syzd;
            parameters[22].Value = model.czsj;
            parameters[23].Value = model.czzt;
            parameters[24].Value = model.id;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #3
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Hotel_app.Model.VIEW_yj_bak model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update VIEW_yj_bak set ");
            strSql.Append("yydh=@yydh,");
            strSql.Append("qymc=@qymc,");
            strSql.Append("id_app=@id_app,");
            strSql.Append("lsbh=@lsbh,");
            strSql.Append("krxm=@krxm,");
            strSql.Append("fjrb=@fjrb,");
            strSql.Append("fjbh=@fjbh,");
            strSql.Append("sktt=@sktt,");
            strSql.Append("xfrq=@xfrq,");
            strSql.Append("xfsj=@xfsj,");
            strSql.Append("czy=@czy,");
            strSql.Append("xfdr=@xfdr,");
            strSql.Append("xfrb=@xfrb,");
            strSql.Append("xfxm=@xfxm,");
            strSql.Append("xfbz=@xfbz,");
            strSql.Append("xfzy=@xfzy,");
            strSql.Append("fkfs=@fkfs,");
            strSql.Append("xfje=@xfje,");
            strSql.Append("sjxfje=@sjxfje,");
            strSql.Append("czy_bc=@czy_bc,");
            strSql.Append("shsc=@shsc,");
            strSql.Append("syzd=@syzd,");
            strSql.Append("czsj=@czsj,");
            strSql.Append("czzt=@czzt,");
            strSql.Append("id=@id");
            strSql.Append(" where ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@yydh",   SqlDbType.VarChar,    50),
                new SqlParameter("@qymc",   SqlDbType.VarChar,    50),
                new SqlParameter("@id_app", SqlDbType.VarChar,    50),
                new SqlParameter("@lsbh",   SqlDbType.VarChar,    50),
                new SqlParameter("@krxm",   SqlDbType.VarChar,    50),
                new SqlParameter("@fjrb",   SqlDbType.VarChar,    50),
                new SqlParameter("@fjbh",   SqlDbType.VarChar,    50),
                new SqlParameter("@sktt",   SqlDbType.VarChar,    50),
                new SqlParameter("@xfrq",   SqlDbType.DateTime),
                new SqlParameter("@xfsj",   SqlDbType.DateTime),
                new SqlParameter("@czy",    SqlDbType.VarChar,    50),
                new SqlParameter("@xfdr",   SqlDbType.VarChar,    50),
                new SqlParameter("@xfrb",   SqlDbType.VarChar,    50),
                new SqlParameter("@xfxm",   SqlDbType.VarChar,    50),
                new SqlParameter("@xfbz",   SqlDbType.VarChar,   200),
                new SqlParameter("@xfzy",   SqlDbType.VarChar,   200),
                new SqlParameter("@fkfs",   SqlDbType.VarChar,    50),
                new SqlParameter("@xfje",   SqlDbType.Decimal,     9),
                new SqlParameter("@sjxfje", SqlDbType.Decimal,     9),
                new SqlParameter("@czy_bc", SqlDbType.VarChar,    50),
                new SqlParameter("@shsc",   SqlDbType.Bit,         1),
                new SqlParameter("@syzd",   SqlDbType.VarChar,    50),
                new SqlParameter("@czsj",   SqlDbType.DateTime),
                new SqlParameter("@czzt",   SqlDbType.VarChar,    50),
                new SqlParameter("@id",     SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.yydh;
            parameters[1].Value  = model.qymc;
            parameters[2].Value  = model.id_app;
            parameters[3].Value  = model.lsbh;
            parameters[4].Value  = model.krxm;
            parameters[5].Value  = model.fjrb;
            parameters[6].Value  = model.fjbh;
            parameters[7].Value  = model.sktt;
            parameters[8].Value  = model.xfrq;
            parameters[9].Value  = model.xfsj;
            parameters[10].Value = model.czy;
            parameters[11].Value = model.xfdr;
            parameters[12].Value = model.xfrb;
            parameters[13].Value = model.xfxm;
            parameters[14].Value = model.xfbz;
            parameters[15].Value = model.xfzy;
            parameters[16].Value = model.fkfs;
            parameters[17].Value = model.xfje;
            parameters[18].Value = model.sjxfje;
            parameters[19].Value = model.czy_bc;
            parameters[20].Value = model.shsc;
            parameters[21].Value = model.syzd;
            parameters[22].Value = model.czsj;
            parameters[23].Value = model.czzt;
            parameters[24].Value = model.id;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }