예제 #1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Hotel_app.Model.Fwx_other model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into Fwx_other(");
            strSql.Append("yydh,qymc,lsbh,fjrb,fjbh,ddsj,lksj,bz,zyzt,czsj,cznr,czy,is_top,is_select,shsc)");
            strSql.Append(" values (");
            strSql.Append("@yydh,@qymc,@lsbh,@fjrb,@fjbh,@ddsj,@lksj,@bz,@zyzt,@czsj,@cznr,@czy,@is_top,@is_select,@shsc)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@yydh",      SqlDbType.VarChar,   50),
                new SqlParameter("@qymc",      SqlDbType.VarChar,   50),
                new SqlParameter("@lsbh",      SqlDbType.VarChar,   50),
                new SqlParameter("@fjrb",      SqlDbType.VarChar,   50),
                new SqlParameter("@fjbh",      SqlDbType.VarChar,   50),
                new SqlParameter("@ddsj",      SqlDbType.DateTime),
                new SqlParameter("@lksj",      SqlDbType.DateTime),
                new SqlParameter("@bz",        SqlDbType.VarChar,   50),
                new SqlParameter("@zyzt",      SqlDbType.VarChar,   50),
                new SqlParameter("@czsj",      SqlDbType.DateTime),
                new SqlParameter("@cznr",      SqlDbType.VarChar,   50),
                new SqlParameter("@czy",       SqlDbType.VarChar,   50),
                new SqlParameter("@is_top",    SqlDbType.Bit,        1),
                new SqlParameter("@is_select", SqlDbType.Bit,        1),
                new SqlParameter("@shsc",      SqlDbType.Bit, 1)
            };
            parameters[0].Value  = model.yydh;
            parameters[1].Value  = model.qymc;
            parameters[2].Value  = model.lsbh;
            parameters[3].Value  = model.fjrb;
            parameters[4].Value  = model.fjbh;
            parameters[5].Value  = model.ddsj;
            parameters[6].Value  = model.lksj;
            parameters[7].Value  = model.bz;
            parameters[8].Value  = model.zyzt;
            parameters[9].Value  = model.czsj;
            parameters[10].Value = model.cznr;
            parameters[11].Value = model.czy;
            parameters[12].Value = model.is_top;
            parameters[13].Value = model.is_select;
            parameters[14].Value = model.shsc;

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

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
예제 #2
0
        public string set_wx_other(int id, string yydh, string qymc, string lsbh, string fjrb, string fjbh, DateTime ddsj, DateTime lksj, string bz, string zyzt, string czy, string czsj, bool is_top, bool is_select, string add_edit_delete, string xxzs)
        {
            string   s        = common_file.common_app.get_failure;
            DateTime yd_ddsj0 = DateTime.Parse(common_file.common_app.cssj);
            DateTime yd_lksj0 = DateTime.Parse(common_file.common_app.cssj);

            BLL.Fwx_other  B_Fwx_other  = new Hotel_app.BLL.Fwx_other();
            BLL.Qskyd_fjrb B_Qskyd_fjrb = new Hotel_app.BLL.Qskyd_fjrb();
            BLL.Ffjzt      B_Ffjzt      = new Hotel_app.BLL.Ffjzt();

            Model.Fwx_other      M_Fwx_other        = new Hotel_app.Model.Fwx_other();
            Ffjzt.Ffjzt_add_edit Ffjzt_add_edit_new = new Hotel_app.Server.Ffjzt.Ffjzt_add_edit();
            if (add_edit_delete == common_file.common_app.get_add)
            {
                s = common_file.common_app.get_failure;
                M_Fwx_other.yydh      = yydh; M_Fwx_other.qymc = qymc; M_Fwx_other.lsbh = lsbh;
                M_Fwx_other.fjrb      = fjrb; M_Fwx_other.fjbh = fjbh; M_Fwx_other.ddsj = ddsj;
                M_Fwx_other.lksj      = lksj; M_Fwx_other.bz = bz; M_Fwx_other.zyzt = zyzt;
                M_Fwx_other.czy       = czy; M_Fwx_other.czsj = DateTime.Now; M_Fwx_other.cznr = common_file.common_app.chinese_add;
                M_Fwx_other.is_top    = false;
                M_Fwx_other.is_select = false;
                if (B_Fwx_other.Add(M_Fwx_other) > 0)
                {
                    s = common_file.common_app.get_suc;

                    if (ddsj >= DateTime.Now.Date && ddsj < DateTime.Now.Date.AddDays(1))
                    //当天维修才去修改房态
                    {
                        s = common_file.common_app.get_failure;
                        s = Ffjzt_add_edit_new.set_yd_ft(zyzt, fjbh, ddsj, lksj, czsj, "修改房态成" + zyzt, czy, xxzs);
                        s = common_file.common_app.get_suc;
                    }
                }
            }
            else
            if (add_edit_delete == common_file.common_app.get_edit)
            {
                s           = common_file.common_app.get_failure;
                M_Fwx_other = B_Fwx_other.GetModel(id);
                //先修改原来如果有占用房态的房间要先清除掉
                DateTime ddsj_temp = M_Fwx_other.ddsj;
                DateTime lksj_temp = M_Fwx_other.lksj;
                DataSet  ds_temp0  = B_Ffjzt.GetList("zyzt='" + zyzt + "' and ddsj='" + ddsj_temp.ToString() + "' and lksj='" + lksj_temp.ToString() + "'");
                if ((ddsj < DateTime.Now.Date || ddsj >= DateTime.Now.Date.AddDays(1)) && (ds_temp0.Tables[0].Rows.Count > 0))
                {
                    s = Ffjzt_add_edit_new.set_yd_ft(common_file.common_fjzt.zf, fjbh, DateTime.Parse(common_file.common_app.cssj), DateTime.Parse(common_file.common_app.cssj), czsj, zyzt + "自动修改房态成" + common_file.common_fjzt.zf, czy, xxzs);
                }
                ds_temp0.Dispose();
                M_Fwx_other.ddsj = ddsj;
                M_Fwx_other.lksj = lksj; M_Fwx_other.bz = bz; M_Fwx_other.zyzt = zyzt;
                M_Fwx_other.czy  = czy; M_Fwx_other.czsj = DateTime.Now; M_Fwx_other.cznr = common_file.common_app.chinese_edit;
                if (B_Fwx_other.Update(M_Fwx_other) == true)
                {
                    s = common_file.common_app.get_suc;

                    if ((ddsj >= DateTime.Now.Date && ddsj < DateTime.Now.Date.AddDays(1)))
                    //不能限制当天维修才去修改房态,因为有可能离开时间延长或变短了!
                    {
                        s = common_file.common_app.get_failure;
                        s = Ffjzt_add_edit_new.set_yd_ft(zyzt, fjbh, ddsj, lksj, czsj, "修改房态成" + zyzt, czy, xxzs);
                        s = common_file.common_app.get_suc;
                    }
                }
            }
            else
            if (add_edit_delete == common_file.common_app.get_delete)
            {
                s           = common_file.common_app.get_failure;
                M_Fwx_other = B_Fwx_other.GetModel(id);
                //先修改原来如果有占用房态的房间要先清除掉
                DateTime ddsj_temp = M_Fwx_other.ddsj;
                DateTime lksj_temp = M_Fwx_other.lksj;
                DataSet  ds_temp0  = B_Ffjzt.GetList("zyzt='" + zyzt + "' and fjbh='" + fjbh + "' and ddsj='" + ddsj_temp.ToString() + "' and lksj='" + lksj_temp.ToString() + "'");
                if ((ds_temp0.Tables[0].Rows.Count > 0))
                {
                    s = Ffjzt_add_edit_new.set_yd_ft(common_file.common_fjzt.zf, fjbh, DateTime.Parse(common_file.common_app.cssj), DateTime.Parse(common_file.common_app.cssj), czsj, zyzt + "自动修改房态成" + common_file.common_fjzt.zf, czy, xxzs);
                }
                ds_temp0.Dispose();
                B_Fwx_other.Delete(id);
                s = common_file.common_app.get_suc;
            }

            return(s);
        }
예제 #3
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Hotel_app.Model.Fwx_other GetModel(int id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 id,yydh,qymc,lsbh,fjrb,fjbh,ddsj,lksj,bz,zyzt,czsj,cznr,czy,is_top,is_select,shsc from Fwx_other ");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@id", SqlDbType.Int, 4)
            };
            parameters[0].Value = id;

            Hotel_app.Model.Fwx_other model = new Hotel_app.Model.Fwx_other();
            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]["lsbh"] != null && ds.Tables[0].Rows[0]["lsbh"].ToString() != "")
                {
                    model.lsbh = ds.Tables[0].Rows[0]["lsbh"].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]["ddsj"] != null && ds.Tables[0].Rows[0]["ddsj"].ToString() != "")
                {
                    model.ddsj = DateTime.Parse(ds.Tables[0].Rows[0]["ddsj"].ToString());
                }
                if (ds.Tables[0].Rows[0]["lksj"] != null && ds.Tables[0].Rows[0]["lksj"].ToString() != "")
                {
                    model.lksj = DateTime.Parse(ds.Tables[0].Rows[0]["lksj"].ToString());
                }
                if (ds.Tables[0].Rows[0]["bz"] != null && ds.Tables[0].Rows[0]["bz"].ToString() != "")
                {
                    model.bz = ds.Tables[0].Rows[0]["bz"].ToString();
                }
                if (ds.Tables[0].Rows[0]["zyzt"] != null && ds.Tables[0].Rows[0]["zyzt"].ToString() != "")
                {
                    model.zyzt = ds.Tables[0].Rows[0]["zyzt"].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]["cznr"] != null && ds.Tables[0].Rows[0]["cznr"].ToString() != "")
                {
                    model.cznr = ds.Tables[0].Rows[0]["cznr"].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]["is_top"] != null && ds.Tables[0].Rows[0]["is_top"].ToString() != "")
                {
                    if ((ds.Tables[0].Rows[0]["is_top"].ToString() == "1") || (ds.Tables[0].Rows[0]["is_top"].ToString().ToLower() == "true"))
                    {
                        model.is_top = true;
                    }
                    else
                    {
                        model.is_top = false;
                    }
                }
                if (ds.Tables[0].Rows[0]["is_select"] != null && ds.Tables[0].Rows[0]["is_select"].ToString() != "")
                {
                    if ((ds.Tables[0].Rows[0]["is_select"].ToString() == "1") || (ds.Tables[0].Rows[0]["is_select"].ToString().ToLower() == "true"))
                    {
                        model.is_select = true;
                    }
                    else
                    {
                        model.is_select = false;
                    }
                }
                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;
                    }
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }
예제 #4
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Hotel_app.Model.Fwx_other model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update Fwx_other set ");
            strSql.Append("yydh=@yydh,");
            strSql.Append("qymc=@qymc,");
            strSql.Append("lsbh=@lsbh,");
            strSql.Append("fjrb=@fjrb,");
            strSql.Append("fjbh=@fjbh,");
            strSql.Append("ddsj=@ddsj,");
            strSql.Append("lksj=@lksj,");
            strSql.Append("bz=@bz,");
            strSql.Append("zyzt=@zyzt,");
            strSql.Append("czsj=@czsj,");
            strSql.Append("cznr=@cznr,");
            strSql.Append("czy=@czy,");
            strSql.Append("is_top=@is_top,");
            strSql.Append("is_select=@is_select,");
            strSql.Append("shsc=@shsc");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@yydh",      SqlDbType.VarChar,   50),
                new SqlParameter("@qymc",      SqlDbType.VarChar,   50),
                new SqlParameter("@lsbh",      SqlDbType.VarChar,   50),
                new SqlParameter("@fjrb",      SqlDbType.VarChar,   50),
                new SqlParameter("@fjbh",      SqlDbType.VarChar,   50),
                new SqlParameter("@ddsj",      SqlDbType.DateTime),
                new SqlParameter("@lksj",      SqlDbType.DateTime),
                new SqlParameter("@bz",        SqlDbType.VarChar,   50),
                new SqlParameter("@zyzt",      SqlDbType.VarChar,   50),
                new SqlParameter("@czsj",      SqlDbType.DateTime),
                new SqlParameter("@cznr",      SqlDbType.VarChar,   50),
                new SqlParameter("@czy",       SqlDbType.VarChar,   50),
                new SqlParameter("@is_top",    SqlDbType.Bit,        1),
                new SqlParameter("@is_select", SqlDbType.Bit,        1),
                new SqlParameter("@shsc",      SqlDbType.Bit,        1),
                new SqlParameter("@id",        SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.yydh;
            parameters[1].Value  = model.qymc;
            parameters[2].Value  = model.lsbh;
            parameters[3].Value  = model.fjrb;
            parameters[4].Value  = model.fjbh;
            parameters[5].Value  = model.ddsj;
            parameters[6].Value  = model.lksj;
            parameters[7].Value  = model.bz;
            parameters[8].Value  = model.zyzt;
            parameters[9].Value  = model.czsj;
            parameters[10].Value = model.cznr;
            parameters[11].Value = model.czy;
            parameters[12].Value = model.is_top;
            parameters[13].Value = model.is_select;
            parameters[14].Value = model.shsc;
            parameters[15].Value = model.id;

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

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