public void BookShow() { brModel = brBll.GetModel(Convert.ToInt32(id)); if (brModel != null) { List <Model.Book_Rdetail> list = bllbr.GetListModel("Book_no='" + brModel.book_no + "'"); if (list != null) { //预定人 this.lbname.Text = brModel.book_Name; //号码 this.lbtele.Text = brModel.tele_no; //客人来源 Model.guest_source gsModel = gsBll.GetModel(Convert.ToInt32(brModel.source_id)); this.lbsource.Text = gsModel.gs_name; //房型 Model.room_type rtModel = rtBll.GetModel(Convert.ToInt32(list[0].Real_type_Id)); this.lbroomtype.Text = rtModel.room_name; //房数 this.lbrealnum.Text = list.Count.ToString(); //可退订金 this.lbdeposit.Text = (Convert.ToDouble(brModel.deposit)).ToString(); } } }
public void BookShow() { brModel = brBll.GetModel(Convert.ToInt32(id)); //预定人 this.lbname.Text = brModel.book_Name; //号码 this.lbtele.Text = brModel.tele_no; //客人来源 Model.guest_source gsModel = gsBll.GetModel(Convert.ToInt32(brModel.source_id)); this.lbsource.Text = gsModel.gs_name; //房型 Model.room_type rtModel = rtBll.GetModel(Convert.ToInt32(brModel.real_type_id)); //可退订金 this.lbdeposit.Text = (Convert.ToDouble(brModel.deposit)).ToString(); //来店时间 this.lbtimeto.Text = brModel.time_to.ToString(); //离店时间 this.lbtimefrom.Text = brModel.time_from.ToString(); //绑定房型下拉 }
/* * /// <summary> * /// 分页获取数据列表 * /// </summary> * public DataSet GetList(int PageSize,int PageIndex,string strWhere) * { * SqlParameter[] parameters = { * new SqlParameter("@tblName", SqlDbType.VarChar, 255), * new SqlParameter("@fldName", SqlDbType.VarChar, 255), * new SqlParameter("@PageSize", SqlDbType.Int), * new SqlParameter("@PageIndex", SqlDbType.Int), * new SqlParameter("@IsReCount", SqlDbType.Bit), * new SqlParameter("@OrderType", SqlDbType.Bit), * new SqlParameter("@strWhere", SqlDbType.VarChar,1000), * }; * parameters[0].Value = "book_room"; * parameters[1].Value = "book_id"; * parameters[2].Value = PageSize; * parameters[3].Value = PageIndex; * parameters[4].Value = 0; * parameters[5].Value = 0; * parameters[6].Value = strWhere; * return DbHelperSQL.RunProcedure("UP_GetRecordByPage",parameters,"ds"); * }*/ #endregion BasicMethod #region ExtensionMethod #endregion ExtensionMethod //以标识列获得对象 public Model.book_room GetRealNum(int state_id) { string sql = "SELECT REAL_NUM FROM " + "book_room" + " WHERE state_id = @state_id"; try { SqlDataReader reader = DBHelper.GetReader(sql, new SqlParameter("@state_id", state_id)); if (reader.Read()) { Model.book_room model = new Model.book_room(); model.real_num = (int)reader["real_num"];//外键 reader.Close(); return(model); } else { reader.Close(); return(null); } } catch (Exception e) { Console.WriteLine(e.Message); throw e; } }
//取消按钮不做物理删除,改变状态 protected void Button1_Click(object sender, EventArgs e) { //改变状态,先写死,到时候再具体看。 brModel = brBll.GetModel(Convert.ToInt32(id)); brModel.state_id = 5; brModel.back_deposit = Convert.ToDecimal(this.txtdeposit.Value); //判断退订金不能大于可退订金 if (Convert.ToDecimal(txtdeposit.Value) > brModel.deposit) { MessageBox.Show(this, "退订金" + txtdeposit.Value + "不能大于" + brModel.deposit + "可退订金"); return; } brModel.meth_pay_id = Convert.ToInt16(meth_payDdl.SelectedValue); brModel.remark = this.txtremark.Value; if (brModel.Accounts != "")//如果是单位被取消 增加取消次数 { BLL.customer bllcuns = new BLL.customer(); Model.customer modelcus = bllcuns.GetAccounts(brModel.Accounts); if (modelcus != null) { modelcus.xqBook += 1; bllcuns.Update(modelcus); } } else { } //写入入账表 Model.goods_account gaModel = new Model.goods_account(); gaModel.ga_name = "退订金"; //gaModel.ga_roomNumber = Convert.ToInt32(brModel.room_number); gaModel.ga_zffs_id = Convert.ToInt16(meth_payDdl.SelectedValue); gaModel.ga_number = brModel.book_no; gaModel.ga_date = System.DateTime.Now; gaModel.ga_price = Convert.ToDecimal(txtdeposit.Value) * -1; gaModel.ga_people = UserNow.UserID; //gaModel.ga_people = Session["UserId"].ToString(); gabll.Add(gaModel); bool Result = brBll.Update(brModel); List <Model.Book_Rdetail> listbr = bllbr.GetListModel("book_no='" + brModel.book_no + "'"); foreach (Model.Book_Rdetail item in listbr) { item.RoomTypeID = 5; bllbr.Update(item); } if (Result == true) { Page.ClientScript.RegisterStartupScript(GetType(), "info", "<script language=\"javascript\">if(confirm('取消预定成功!是否打印退款单?')){ ShowDivs(this,'" + brModel.book_no + "') }else{ ShowTabs('预定管理');}</script>"); //Response.Redirect("BookList.aspx"); } else { Page.ClientScript.RegisterStartupScript(GetType(), "info", "<script>alert('取消失败!');parent.Window_Close();</script>"); //Response.Redirect("BookList.aspx"); } }
public override void SonLoad() { id = "Y2015411111326"; if (Request["id"] != null) { id = Request["id"].ToString(); List <Model.book_room> listbr = bllbr.GetModelList("Book_no='" + id + "'"); if (listbr != null) { nowModel = listbr[0]; if (Request["desp"] != null) { nowModel.deposit = Convert.ToDecimal(Request["desp"]); } } Bind(); } }
protected void Button1_Click(object sender, EventArgs e) { brModel = brBll.GetModel(Convert.ToInt32(id)); //判断退订金不能大于可退订金 if (Convert.ToDecimal(adddeposit.Value) < 0) { MessageBox.Show(this, "补交订金请输入大于0的数字"); return; } brModel.meth_pay_id = Convert.ToInt16(meth_payDdl.SelectedValue); brModel.remark = this.txtremark.Value; brModel.deposit = brModel.deposit + Convert.ToDecimal(this.adddeposit.Value); //写入入账表 Model.goods_account gaModel = new Model.goods_account(); gaModel.ga_name = "补交订金"; //gaModel.ga_roomNumber = Convert.ToInt32(brModel.room_number); gaModel.ga_zffs_id = Convert.ToInt16(meth_payDdl.SelectedValue); gaModel.ga_date = System.DateTime.Now; gaModel.ga_sum_price = brModel.deposit; //gaModel.ga_people = Session["UserId"].ToString(); gabll.Add(gaModel); bool Result = brBll.Update(brModel); if (Result == true) { //Page.ClientScript.RegisterStartupScript(GetType(), "info", "<script>(\"补订金成功\", \"info\",'../','');</script>"); // Response.Redirect("BookList.aspx"); //待修改 ClientScript.RegisterStartupScript(GetType(), "message", "<script language=\"javascript\">if(confirm('补交定金成功!是否打印收款单?')){ ShowDivs('" + brModel.book_no + "') }else{ ShowTabs('预定管理');}</script>"); } else { Page.ClientScript.RegisterStartupScript(GetType(), "info", "<script>(\"系统繁忙,请稍后再试!\", \"info\",'../','');</script>"); Response.Redirect("BookList.aspx"); } }
//把预定的信息绑定到入住信息里面 public void bindInfo() { //房型 Model.book_room bkmodel = bkBll.GetModel(ids); Model.room_type rtmodel = fxBll.GetModel(Convert.ToInt32(bkmodel.real_type_id)); this.ddroomtype.SelectedValue = rtmodel.room_name; //设为不可编辑 this.ddroomtype.Enabled = false; //房价 this.txt_money.Value = (Convert.ToDouble(bkmodel.real_price)).ToString(); //姓名 this.txt_name.Value = bkmodel.book_Name; //电话 this.txt_lxphone.Value = bkmodel.tele_no; //预住天数 this.txt_Day.Value = bkmodel.real_num.ToString(); //时间 txt_rzdate.Value = System.DateTime.Now.ToString(); }
public override void SonLoad() { Model.SysParamter modelsys = bllsys.GetModel(1); isok.Value = modelsys.IsCy.ToString(); RoomTypeDdl.Attributes.Add("onchange", "selectChange(this)"); if (!IsPostBack) { GuestSourceData(); MethPayData(); RoomTypeData(); //BindHouseNumber(); HouseShameData(); RealPrice(); BindOkNum(Convert.ToInt32(this.RoomTypeDdl.SelectedValue)); maxNum.InnerText = BindMaxNum(Convert.ToInt32(this.RoomTypeDdl.SelectedValue)); string type = Request.QueryString["type"].ToString(); if (type == "add") { lblmsg.Text = "新增"; } else if (type == "edit") { lblmsg.Text = "修改"; deposit.Disabled = true; BookAddButton.Text = "更新"; id = Convert.ToInt32(Request.QueryString["id"].ToString()); nowModel = bllbr.GetModel(id); book_no_hid.Value = nowModel.book_no; //通过ID获得实体,然后为控件赋值 book_name.Value = nowModel.book_Name; tele_no.Value = nowModel.tele_no; onli_no.Value = nowModel.onli_no; real_time.Value = nowModel.time_to.ToString(); time_from.Value = Convert.ToDateTime(nowModel.time_from).ToString(); time_to.Value = Convert.ToDateTime(nowModel.real_time).ToString("yyyy-MM-dd"); mem_cardNo.Value = nowModel.mem_cardno; GuarWayDll.SelectedValue = nowModel.guar_way; GuestSourceDdl.SelectedValue = nowModel.source_id.ToString(); MethPayDdl.SelectedValue = nowModel.meth_pay_id.ToString(); deposit.Value = nowModel.deposit.ToString(); textRemaker.Value = nowModel.remark; if (nowModel.Accounts != "" && nowModel.Accounts != null) { BLL.customer bllcus = new BLL.customer(); accounts.Value = nowModel.Accounts;//协议单位编号 CpId.Value = nowModel.CpID.ToString(); Model.customer modelcus = bllcus.GetAccounts(nowModel.Accounts); customer.Value = modelcus.cName; } Dictionary <int, string> dic = new Dictionary <int, string>(); List <Model.Book_Rdetail> listbr = bllrd.GetListModel("Book_no='" + nowModel.book_no + "'"); foreach (Model.Book_Rdetail item in listbr) { if (dic.ContainsKey(item.Real_type_Id)) { continue; } dic.Add(item.Real_type_Id, "true"); List <Model.Book_Rdetail> lists = listbr.Where(d => d.Real_type_Id == item.Real_type_Id).ToList(); if (lists.Count > 1) { //item = lists[0]; } sbDel.Append("<tr class=\"tr\"><td class=\"w30\"><span>房 型:</span></td>"); sbDel.Append("<td class=\"w70\"><select name=\"RoomTypeDdl\" id=\"RoomTypeDdl\" onchange=\"selectChange(this)\">"); GetAllType(item); sbDel.Append("</select></td>"); sbDel.Append("<td class=\"w30\">"); sbDel.Append("<span>方 案:</span>"); sbDel.Append("</td>"); sbDel.Append("<td class=\"w70\">"); sbDel.Append("<select name=\"HouseShameDdl\" id=\"HouseShameDdl\">"); GetAllYh(item); sbDel.Append("</select>"); sbDel.Append("</td>"); sbDel.Append("<td class=\"w30\">"); sbDel.Append("<span>房 价:</span>"); sbDel.Append("</td>"); sbDel.Append("<td class=\"w70\">"); sbDel.Append("<input name=\"real_price\" type=\"text\" id=\"real_price\" class=\"txtprice\" value=\"" + item.Real_Price + "\">"); sbDel.Append("</td>"); sbDel.Append("<td class=\"w70\">可预定数:<span id=\"txtOkNum\" runat=\"server\" class=\"txtprice\" >" + BindOkNum1(item.Real_type_Id) + "</span><span runat=\"server\" id=\"maxNum\" style=\" display:none;\">" + BindMaxNum(item.Real_type_Id) + "</span></td>"); sbDel.Append("<td class=\"w50\">"); sbDel.Append("<span>房间数量:</span>"); sbDel.Append("</td>"); sbDel.Append("<td class=\"w\" style=\"width:220px;\">"); sbDel.Append("<p onclick=\"SaleRealNum(this)\" class=\"jians\">"); sbDel.Append("-</p>"); sbDel.Append("<p style=\"float: left;\">"); if (lists.Count > 1) { sbDel.Append(" <input name=\"real_num\" type=\"text\" id=\"real_num\" value=\"" + lists.Count + "\" class=\"number fjslInp\"></p>"); } else { sbDel.Append(" <input name=\"real_num\" type=\"text\" id=\"real_num\" value=\"" + item.Real_num + "\" class=\"number fjslInp\"></p>"); } sbDel.Append("<p onclick=\"addRealNum(this)\" class=\"jia\">"); sbDel.Append(" +</p>"); sbDel.Append(" <p onclick=\"funAddTable()\" class=\"addBook\">"); sbDel.Append(" 添加</p>"); sbDel.Append(" <p class=\"delBook\" onclick=\"DelTr(this)\">"); sbDel.Append(" 删除</p>"); sbDel.Append("</td>"); sbDel.Append(" <td class=\"w30\">"); sbDel.Append(" <span>房 号:</span>"); sbDel.Append(" </td>"); sbDel.Append(" <td class=\"w30\" style=\"width:60px;\">"); if (lists.Count > 1) { sbDel.Append(" <span id=\"fh\">" + Geta(lists) + "</span><span class=\"yffh addBook\" onclick=\"ShowDiog(this)\" style=\" cursor:pointer;\">预 分</span>"); } else { sbDel.Append(" <span id=\"fh\"><a>" + item.Room_number + "</a></span><span class=\"yffh addBook\" onclick=\"ShowDiog(this)\" style=\" cursor:pointer;\">预 分</span>"); } sbDel.Append(" </td>"); sbDel.Append(" <td class=\"w70\">"); sbDel.Append(" <span id=\"HouseNumDdl\"></span>"); sbDel.Append(" </td>"); sbDel.Append(" </tr>"); } if (Request["isok"] != null) { bool b = Convert.ToBoolean(Request["isok"]); if (b) { BookAddButton.Style.Add("display", "none"); } } } } }
/// <summary> /// 新增与修改 /// </summary> private void AddBook() { try { bool isb = true; System.Text.StringBuilder sbText = new System.Text.StringBuilder(); string book_no = string.Empty; string isUpdate = context.Request.Form["isUpdate"].ToString(); if (isUpdate == "true") { book_no = context.Request.Form["book_no"].ToString(); List <Model.Book_Rdetail> listbr = bllrd.GetListModel("Book_no='" + book_no + "'"); if (listbr.Count > 0) { Model.room_number modelrt = new Model.room_number(); foreach (Model.Book_Rdetail item in listbr) { if (item.Room_number != null) { if (item.Room_number.Trim() != "") { modelrt = bllrn.GetModelList("Rn_roomNum='" + item.Room_number + "'")[0]; modelrt.Rn_Tobe = 0; Helper.AddRoom(item.Room_number); bllrn.Update(modelrt); } } } } bool rels = bllrd.DeletebyWhere("Book_no='" + book_no + "'"); if (rels) { bllbr.DeletebyWhere("Book_no='" + book_no + "'"); } } else { book_no = "Y" + System.DateTime.Now.ToString().Replace("-", "").Replace(":", "").Replace(" ", ""); } string txtname = context.Request.Form["txtname"].ToString(); string txtPhone = context.Request.Form["txtPhone"].ToString(); string txtDh = context.Request.Form["txtDh"].ToString(); string txtrz = context.Request.Form["txtrz"].ToString(); string txttf = context.Request.Form["txttf"].ToString(); string txtyd = context.Request.Form["txtyd"].ToString(); string txtmCard = context.Request.Form["txtmCard"].ToString(); string guarWayDll = context.Request.Form["guarWayDll"].ToString(); string guestSourceDdl = context.Request.Form["guestSourceDdl"].ToString(); string methPayDdl = context.Request.Form["methPayDdl"].ToString(); string txtdj = context.Request.Form["txtdj"].ToString(); string textRemaker = context.Request.Form["textRemaker"].ToString(); string accounts = context.Request.Form["accounts"].ToString(); string CpId = context.Request.Form["CpId"].ToString(); string strs = context.Request.Form["sjs"].ToString(); int? cid = null; if (CpId != "") { cid = Convert.ToInt32(CpId); } strs = strs.Remove(strs.Length - 1, 1); Model.book_room model = new Model.book_room() { book_no = book_no, book_Name = txtname, tele_no = txtPhone, onli_no = txtDh, guar_way = guarWayDll, mem_cardno = txtmCard, time_to = Convert.ToDateTime(txtrz), time_from = Convert.ToDateTime(txttf), real_time = Convert.ToDateTime(txtyd), source_id = Convert.ToInt32(guestSourceDdl), meth_pay_id = Convert.ToInt32(methPayDdl), deposit = Convert.ToDecimal(txtdj), remark = textRemaker, Userid = UserNow.UserID, Accounts = accounts, CpID = cid }; if (Math.Floor(Convert.ToDouble(txtdj)) == 0) { model.state_id = 6; } else { model.state_id = 1; } int rel = bllbr.Add(model); if (rel > 0) { string[] strlist = strs.Split(new char[1] { '*' }, StringSplitOptions.RemoveEmptyEntries); Dictionary <string, string> dic = new Dictionary <string, string>(); foreach (string str in strlist) { dic.Clear(); string[] strdelt = str.Split(new char[1] { ',' }); foreach (string s in strdelt) { string[] strval = s.Split(new char[1] { ':' }); dic.Add(strval[0], strval[1]); } Model.Book_Rdetail modelbr = new Model.Book_Rdetail() { Book_no = model.book_no, Real_type_Id = Convert.ToInt32(dic["typeid"]), Room_number = dic["roomnumber"], Real_num = Convert.ToInt32(dic["number"]), Ok_num = 0, Real_Price = Convert.ToDecimal(dic["price"]), Real_Scheme_Id = Convert.ToInt32(dic["fangan"]), RoomTypeID = Convert.ToInt32(model.state_id) }; if (!IsBook(modelbr.Room_number)) { isb = false; List <Model.room_number> list = bllrn.GetModelList("Rn_roomNum='" + modelbr.Room_number + "'"); if (list.Count > 0) { Model.room_number modelrn = list[0]; modelrn.Rn_Tobe = 1; bllrn.Update(modelrn); } if (modelbr.Room_number.Trim() != "") { Helper.AddRoom(modelbr.Room_number); } bllrd.Add(modelbr); } else { sbText.Append(modelbr.Room_number + ","); } } } if (isUpdate == "true") { context.Response.Write("更新成功!,' '"); } else { if (isb) { bllbr.Delete(rel); context.Response.Write("房间已被预定!," + book_no + ""); } else { string finalStr = "{book_no:" + book_no + "}"; Model.goods_account modelga = new Model.goods_account() { ga_name = "预定收款", ga_number = model.book_no, ga_price = Convert.ToDecimal(model.deposit), ga_zffs_id = Convert.ToInt32(methPayDdl), ga_date = DateTime.Now, ga_people = UserNow.UserID, ga_Type = 8, ga_occuid = "", ga_remker = "", ga_sum_price = Convert.ToDecimal("0.0000"), ga_sfacount = "是", ga_isjz = 0, ga_roomNumber = "0", ga_num = 0, ga_unit = "" }; bllga.Add(modelga); if (sbText.ToString() != "") { context.Response.Write("新增成功" + sbText.ToString() + "已被预定!," + book_no + ""); } else { context.Response.Write("新增成功!," + book_no + ""); } } } context.Response.End(); } catch (Exception ex) { context.Response.End(); } }