Ejemplo n.º 1
0
        /// <summary>
        ///添加入住信息
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnAdds_Click(object sender, EventArgs e)
        {
            CdHotelManage.Model.occu_infor model  = new CdHotelManage.Model.occu_infor();
            CdHotelManage.Model.occu_infor models = new CdHotelManage.Model.occu_infor();

            model.occ_no         = System.DateTime.Now.ToString().Replace("-", "").Replace(":", "").Replace(" ", "");
            model.room_number    = this.txt_roomid.Value;
            model.real_type_id   = Convert.ToInt32(this.ddroomtype.SelectedValue);
            model.source_id      = Convert.ToInt32(this.DDlkrly.SelectedValue);
            model.real_scheme_id = Convert.ToInt32(this.DDLfjfa.SelectedValue);
            model.real_price     = Convert.ToDecimal(this.txt_fjPrice.Value);
            model.occ_with       = "否";
            model.real_mode_id   = Convert.ToInt32(this.DDlKffs.SelectedValue);
            model.occ_time       = Convert.ToDateTime(this.txt_rzdate.Value);
            model.pre_live_day   = Convert.ToInt32(this.txt_Day.Value);
            model.depar_time     = Convert.ToDateTime(this.txt_ylDate.Value);
            model.occ_name       = this.txt_name.Value;
            model.sex            = this.txt_Sex.Value;
            model.brithday       = this.txt_Date2.Value;
            model.family_name    = this.txt_mingzhu.Value;
            model.card_id        = Convert.ToInt32(this.DDlSFz.SelectedValue);;
            model.card_no        = (this.txt_CardId.Value);
            model.mem_cardno     = this.txt_hycardId.Value;                //会员卡号
            model.remark         = this.txt_Remaker.Value;
            model.meth_pay_id    = Convert.ToInt32(DDlZffs.SelectedValue); //支付方式
            model.deposit        = Convert.ToInt32(txt_yjmoney.Value);
            model.address        = txt_address.Value;                      //地址
            CdHotelManage.BLL.occu_infor    bll = new CdHotelManage.BLL.occu_infor();
            CdHotelManage.Model.room_number fh  = new CdHotelManage.Model.room_number();
            fh.Rn_state   = 2;
            fh.Rn_roomNum = txt_roomid.Value;
            string SQl = "update room_number set Rn_state=2 where Rn_roomNum='" + txt_roomid.Value + "'";

            //  fh.id = fhBll.GetModel(Convert.ToInt32(txt_roomid.Value), "Rn_roomNum");
            fhBll.Updates(SQl);

            for (int i = 0; i < hidSchool.Value.Split('|').Length - 1; i++)
            {
                models.occ_name = hidSchool.Value.Split('#')[0];
                models.sex      = hidSchool.Value.Split('#')[1];
                models.brithday = hidSchool.Value.Split('#')[2];
                models.card_id  = Convert.ToInt32(hidSchool.Value.Split('#')[3]);
                models.card_no  = hidSchool.Value.Split('#')[4];
                models.address  = hidSchool.Value.Split('#')[5];
                models.occ_time = Convert.ToDateTime(System.DateTime.Now.ToString());
                models.occ_with = "是";
                bll.Add(models);
            }
            if (bll.Add(model) > 0)
            {
                Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "");
            }
            else
            {
                Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存失败!", "");
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        ///添加入住信息
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnAdds_Click(object sender, EventArgs e)
        {
            try
            {
                Model.order_infor              ordermodel = new Model.order_infor();
                Model.goods_account            goodmodles = new Model.goods_account();
                Model.goods_account            goodmodlfz = new Model.goods_account();
                CdHotelManage.Model.occu_infor model      = new CdHotelManage.Model.occu_infor();
                CdHotelManage.Model.occu_infor models     = new CdHotelManage.Model.occu_infor();
                CdHotelManage.BLL.occu_infor   bll        = new CdHotelManage.BLL.occu_infor();
                model.order_id     = occno;
                model.occ_no       = "RZ" + System.DateTime.Now.ToString().Replace("-", "").Replace(":", "").Replace(" ", "").Replace("/", "");
                model.room_number  = this.txt_roomid.Value;
                model.real_type_id = Convert.ToInt32(this.ddroomtype.SelectedValue);

                model.real_price = Convert.ToDecimal(this.txt_money.Value);
                model.occ_with   = "否";

                model.occ_time    = Convert.ToDateTime(this.txt_rzdate.Value);
                model.stay_day    = Convert.ToInt32(this.txt_Day.Value);
                model.depar_time  = Convert.ToDateTime(this.txt_ylDate.Value);
                model.occ_name    = this.txt_name.Value;
                model.sex         = this.txt_Sex.Value;
                model.brithday    = this.txt_Date2.Value;
                model.family_name = this.txt_mingzhu.Value;
                model.card_id     = Convert.ToInt32(this.DDlSFz.SelectedValue);;
                model.card_no     = (this.txt_CardId.Value);

                model.remark = this.txt_Remaker.Value;//备注

                if (DDlZffs.SelectedValue == "信用预授权")
                {
                    // model.meth_pay_id = 0;
                }
                else
                {
                    model.meth_pay_id = Convert.ToInt32(DDlZffs.SelectedValue);//支付方式
                }
                model.deposit      = Convert.ToDecimal(txt_yjmoney.Value);
                model.address      = txt_address.Value;    //地址
                model.lordRoomid   = txt_zfzhanghao.Value; //主房账号
                model.phonenum     = txt_lxphone.Value;    //联系电话
                model.tuifaId      = "0";
                model.continuelive = 0;
                model.sort         = txtsort.Value;
                string[] hidAdd = contents.Split('|');
                if (Request.QueryString["type"].ToString() == "0" || Request.QueryString["type"].ToString() == "yding")
                {
                    if (hidAdd.Length > 2)
                    {
                        for (int i = 0; i < hidAdd.Length - 1; i++)
                        {
                            try
                            {
                                string NumNo = "000" + i;
                                string a     = hidAdd[i].Split('#')[0].Trim();

                                model.order_id       = occno.ToString();
                                model.occ_no         = "RZ" + System.DateTime.Now.ToString().Replace("-", "").Replace(":", "").Replace(" ", "").Replace("/", "") + NumNo;
                                model.room_number    = hidAdd[i].Split('#')[0];
                                model.real_type_id   = Convert.ToInt32(hidAdd[i].Split('#')[1]);
                                model.source_id      = Convert.ToInt32(hidAdd[i].Split('#')[2]);
                                model.real_scheme_id = Convert.ToInt32(hidAdd[i].Split('#')[3]);
                                model.real_price     = Convert.ToDecimal(hidAdd[i].Split('#')[4]);
                                model.occ_with       = hidAdd[i].Split('#')[5];
                                model.real_mode_id   = Convert.ToInt32(hidAdd[i].Split('#')[6]);
                                model.occ_time       = Convert.ToDateTime(hidAdd[i].Split('#')[7]);
                                model.pre_live_day   = Convert.ToInt32(hidAdd[i].Split('#')[8]);
                                model.depar_time     = Convert.ToDateTime(hidAdd[i].Split('#')[9]);
                                model.occ_name       = hidAdd[i].Split('#')[10];
                                model.sex            = hidAdd[i].Split('#')[11];
                                model.brithday       = hidAdd[i].Split('#')[12];
                                model.family_name    = hidAdd[i].Split('#')[13];
                                model.card_id        = Convert.ToInt32(hidAdd[i].Split('#')[14]);
                                model.card_no        = (hidAdd[i].Split('#')[15]);
                                model.mem_cardno     = hidAdd[i].Split('#')[16];//会员卡号
                                // model.remark = hidAdd[i].Split('#')[17];
                                // model.meth_pay_id = Convert.ToInt32(contents.Split('#')[18]);//支付方式
                                // model.deposit = Convert.ToInt32(contents.Split('#')[19]);
                                model.address = hidAdd[i].Split('#')[19];//地址
                                if (a != "")
                                {
                                    if (model.lordRoomid == model.room_number)
                                    {
                                        model.deposit = Convert.ToDecimal(txt_yjmoney.Value);
                                        model.remark  = txt_Remaker.Value;
                                    }
                                    else
                                    {
                                        model.deposit     = 0;
                                        txt_Remaker.Value = "";
                                    }
                                    bll.Add(model);
                                    if (Request.QueryString["type"].ToString() == "yding")
                                    {
                                        try
                                        {
                                            string sql = " update Book_Rdetail set Room_typeid=2 from Book_Rdetail where Book_no='" + Request.QueryString["ydbookno"].ToString() + "' and Room_typeid=1 and Room_number='" + model.room_number + "'";
                                            fmrdet.Updates(sql);
                                        }
                                        catch
                                        {
                                        }
                                    }
                                    goodmodlfz.ga_name      = "房费";
                                    goodmodlfz.ga_sum_price = Convert.ToDecimal(hidAdd[i].Split('#')[4]);
                                    goodmodlfz.ga_number    = "FZ" + System.DateTime.Now.ToString().Replace("-", "").Replace(":", "").Replace(" ", "").Replace("/", "");
                                    goodmodlfz.ga_price     = 0;
                                    goodmodlfz.ga_date      = Convert.ToDateTime(System.DateTime.Now);
                                    goodmodlfz.ga_people    = UserNow.UserID;
                                    goodmodlfz.ga_sfacount  = "否";
                                    goodmodlfz.ga_Type      = 8;
                                    goodmodlfz.ga_isjz      = 0;
                                    goodmodles.Ga_goodNo    = bll.GetModels(" where occ_with='否' and room_number='" + txt_roomid.Value + "' and state_id=0").occ_no;

                                    // goodmodlfz.ga_zffs_id = Convert.ToInt32(DDlZffs.SelectedValue);
                                    goodmodlfz.ga_remker     = txt_Remaker.Value;
                                    goodmodlfz.ga_roomNumber = model.room_number;
                                    goodmodlfz.ga_occuid     = occno;
                                    fmzj.Add(goodmodlfz);
                                    string str2 = "update room_number set Rn_state=2 where Rn_roomNum='" + model.room_number + "'";
                                    fhBll.Updates(str2);
                                }
                            }
                            catch
                            {
                            }
                        }
                    }
                    else
                    {
                        if (bll.Add(model) > 0)
                        {
                            goodmodlfz.ga_name      = "房费";
                            goodmodlfz.ga_sum_price = Convert.ToDecimal(txt_money.Value);
                            goodmodlfz.ga_number    = "FZ" + System.DateTime.Now.ToString().Replace("-", "").Replace(":", "").Replace(" ", "").Replace("/", "");
                            goodmodlfz.ga_price     = 0;
                            goodmodlfz.ga_date      = Convert.ToDateTime(System.DateTime.Now);
                            goodmodlfz.ga_people    = UserNow.UserID;
                            goodmodlfz.ga_sfacount  = "否";
                            goodmodlfz.ga_Type      = 8;
                            goodmodlfz.ga_isjz      = 0;
                            // goodmodlfz.ga_zffs_id = Convert.ToInt32(DDlZffs.SelectedValue);
                            goodmodlfz.ga_remker     = txt_Remaker.Value;
                            goodmodlfz.ga_roomNumber = txt_roomid.Value;
                            goodmodlfz.Ga_goodNo     = bll.GetModels(" where occ_with='否' and room_number='" + txt_roomid.Value + "' and state_id=0").occ_no;
                            //  goodmodlfz.ga_occuid = bll.GetModels(" where occ_with='否' and room_number=" + txt_roomid.Value + " and state_id=0").order_id;
                            goodmodlfz.ga_occuid = occno;
                            fmzj.Add(goodmodlfz);
                            string SQl = "update room_number set Rn_state=2 where Rn_roomNum='" + txt_roomid.Value + "'";
                            fhBll.Updates(SQl);
                        }
                    }
                }
                if (Request.QueryString["type"].ToString() == "1")
                {
                    model.order_id = fmmx.GetModels(" where occ_with='否' and state_id=0 and room_number='" + roomsid + "'").order_id;
                    model.occ_id   = Convert.ToInt32(ids);

                    if (bll.Update(model))
                    {
                        ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "click", "alert('修改成功');ShowTabs('房态图');", true);
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "click", "alert('修改失败')", true);
                    }
                }
                else
                {
                    ordermodel.order_no   = occno;
                    ordermodel.order_time = System.DateTime.Now;
                    ordermodel.room_id    = txt_zfzhanghao.Value;
                    if (fmorder.Add(ordermodel) > 0)
                    {
                        goodmodles.ga_name       = "入住收款";
                        goodmodles.ga_sum_price  = 0;
                        goodmodles.ga_number     = "YZYJ" + System.DateTime.Now.ToString().Replace("-", "").Replace(":", "").Replace(" ", "");;
                        goodmodles.ga_price      = Convert.ToDecimal(txt_yjmoney.Value);
                        goodmodles.ga_date       = Convert.ToDateTime(System.DateTime.Now);
                        goodmodles.ga_people     = UserNow.UserID;
                        goodmodles.ga_sfacount   = "是";
                        goodmodles.ga_Type       = 7;
                        goodmodlfz.ga_isjz       = 0;
                        goodmodles.Ga_goodNo     = bll.GetModels(" where occ_with='否' and room_number='" + txt_roomid.Value + "' and state_id=0").occ_no;
                        goodmodles.ga_remker     = txt_Remaker.Value;
                        goodmodles.ga_roomNumber = txt_roomid.Value;
                        if (DDlZffs.SelectedValue == "信用预授权")
                        {
                            // goodmodles.ga_zffs_id =0;
                            goodmodles.ga_occuid = bll.GetModels(" where occ_with='否' and room_number='" + txt_roomid.Value + "' and state_id=0").occ_no;
                        }
                        else
                        {
                            goodmodles.ga_occuid = occno;
                            // goodmodles.ga_zffs_id = Convert.ToInt32(DDlZffs.SelectedValue);
                        }
                        fmzj.Add(goodmodles);

                        ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "click", "if(confirm('开房成功,是否打印入住单')){PrintRZ(this," + model.order_id + ");}else{ShowTabs('房态图');}", true);
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "click", "alert('开房失败')", true);
                    }
                }
                string SQL = "delete from occu_infor where room_number='" + this.txt_roomid.Value + "' and state_id=0 and occ_with='是'";
                fmmx.Deletes(SQL);
                string[] content = txt_zhi.Value.Split('|');
                for (int i = 0; i < content.Length; i++)
                {
                    models.order_id    = fmmx.GetModels(" where occ_with='否' and state_id=0 and room_number='" + roomsid + "'").order_id;
                    models.room_number = content[i].Split(',')[0];
                    models.occ_name    = content[i].Split(',')[1];
                    models.sex         = content[i].Split(',')[2];
                    models.brithday    = content[i].Split(',')[3];
                    models.card_id     = fsfBll.GetModelList(" ct_name='" + content[i].Split(',')[4] + "'")[0].id;
                    models.card_no     = content[i].Split(',')[5];
                    models.address     = content[i].Split(',')[6];
                    models.occ_time    = Convert.ToDateTime(System.DateTime.Now.ToString());
                    models.occ_with    = "是";
                    //  models.room_number = this.txt_roomid.Value;
                    bll.Add(models);
                }
            }
            catch { }
        }