Exemplo n.º 1
0
        public string Xyhsz_add_edit(string id, string yydh, string qymc, string yhbl, string yh, string add_edit_delete, string xxzs)
        {
            string s = common_file.common_app.get_failure;

            BLL.Xyhsz   B_Xyhsz = new Hotel_app.BLL.Xyhsz();
            Model.Xyhsz M_Xyhsz = new Hotel_app.Model.Xyhsz();
            if (xxzs == common_file.common_app.xxzs_xxvalue)
            {
            }
            if (xxzs == common_file.common_app.xxzs_zsvalue)
            {
            }
            if (add_edit_delete == common_file.common_app.get_add)
            {
                M_Xyhsz.yydh = yydh;

                M_Xyhsz.qymc = qymc;


                M_Xyhsz.yhbl = common_file_server.common_app.ValideStringCheck(yhbl, 1);  // decimal.Parse(yhbl);
                M_Xyhsz.yh   = yh;
                //M_Xyxzj.is_top =is_top;
                //M_Xyxzj.is_select =is_select;


                //int ss = B_Xyxzj.Add(M_Xyxzj);

                if (B_Xyhsz.Add(M_Xyhsz) > 0)
                {
                    s = common_file.common_app.get_suc;
                }
            }
            else
            if (add_edit_delete == common_file.common_app.get_edit)
            {
                M_Xyhsz      = B_Xyhsz.GetModel(Convert.ToInt32(id));
                M_Xyhsz.yydh = yydh;
                M_Xyhsz.qymc = qymc;
                M_Xyhsz.yhbl = decimal.Parse(yhbl);
                M_Xyhsz.yh   = yh;
                //M_Xyxzj.is_top = is_top;
                //M_Xyxzj.is_select = is_select;
                M_Xyhsz.ID = int.Parse(id);
                if (B_Xyhsz.Update(M_Xyhsz))
                {
                    s = common_file.common_app.get_suc;
                }
            }
            else
            if (add_edit_delete == common_file.common_app.get_delete)
            {
                if (id != "")
                {
                    B_Xyhsz.Delete(Convert.ToInt32(id));
                    s = common_file.common_app.get_suc;
                }
            }
            return(s);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Hotel_app.Model.Xyhsz model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update Xyhsz set ");
            strSql.Append("yydh=@yydh,");
            strSql.Append("qymc=@qymc,");
            strSql.Append("yhbl=@yhbl,");
            strSql.Append("yh=@yh,");
            strSql.Append("istop=@istop,");
            strSql.Append("isselect=@isselect");
            strSql.Append(" where ID=@ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@yydh",     SqlDbType.VarChar, 50),
                new SqlParameter("@qymc",     SqlDbType.VarChar, 50),
                new SqlParameter("@yhbl",     SqlDbType.Decimal,  9),
                new SqlParameter("@yh",       SqlDbType.VarChar, 50),
                new SqlParameter("@istop",    SqlDbType.Bit,      1),
                new SqlParameter("@isselect", SqlDbType.Bit,      1),
                new SqlParameter("@ID",       SqlDbType.Int, 4)
            };
            parameters[0].Value = model.yydh;
            parameters[1].Value = model.qymc;
            parameters[2].Value = model.yhbl;
            parameters[3].Value = model.yh;
            parameters[4].Value = model.istop;
            parameters[5].Value = model.isselect;
            parameters[6].Value = model.ID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Hotel_app.Model.Xyhsz model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into Xyhsz(");
            strSql.Append("yydh,qymc,yhbl,yh,istop,isselect)");
            strSql.Append(" values (");
            strSql.Append("@yydh,@qymc,@yhbl,@yh,@istop,@isselect)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@yydh",     SqlDbType.VarChar, 50),
                new SqlParameter("@qymc",     SqlDbType.VarChar, 50),
                new SqlParameter("@yhbl",     SqlDbType.Decimal,  9),
                new SqlParameter("@yh",       SqlDbType.VarChar, 50),
                new SqlParameter("@istop",    SqlDbType.Bit,      1),
                new SqlParameter("@isselect", SqlDbType.Bit, 1)
            };
            parameters[0].Value = model.yydh;
            parameters[1].Value = model.qymc;
            parameters[2].Value = model.yhbl;
            parameters[3].Value = model.yh;
            parameters[4].Value = model.istop;
            parameters[5].Value = model.isselect;

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

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Hotel_app.Model.Xyhsz GetModel(int ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 ID,yydh,qymc,yhbl,yh,istop,isselect from Xyhsz ");
            strSql.Append(" where ID=@ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ID", SqlDbType.Int, 4)
            };
            parameters[0].Value = ID;

            Hotel_app.Model.Xyhsz model = new Hotel_app.Model.Xyhsz();
            DataSet ds = DbHelperSQL.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]["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]["yhbl"] != null && ds.Tables[0].Rows[0]["yhbl"].ToString() != "")
                {
                    model.yhbl = decimal.Parse(ds.Tables[0].Rows[0]["yhbl"].ToString());
                }
                if (ds.Tables[0].Rows[0]["yh"] != null && ds.Tables[0].Rows[0]["yh"].ToString() != "")
                {
                    model.yh = ds.Tables[0].Rows[0]["yh"].ToString();
                }
                if (ds.Tables[0].Rows[0]["istop"] != null && ds.Tables[0].Rows[0]["istop"].ToString() != "")
                {
                    if ((ds.Tables[0].Rows[0]["istop"].ToString() == "1") || (ds.Tables[0].Rows[0]["istop"].ToString().ToLower() == "true"))
                    {
                        model.istop = true;
                    }
                    else
                    {
                        model.istop = false;
                    }
                }
                if (ds.Tables[0].Rows[0]["isselect"] != null && ds.Tables[0].Rows[0]["isselect"].ToString() != "")
                {
                    if ((ds.Tables[0].Rows[0]["isselect"].ToString() == "1") || (ds.Tables[0].Rows[0]["isselect"].ToString().ToLower() == "true"))
                    {
                        model.isselect = true;
                    }
                    else
                    {
                        model.isselect = false;
                    }
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }