Ejemplo n.º 1
0
        protected void BtnInit_Click(object sender, EventArgs e)
        {
            try
            {
                blloc.Deletes("delete occu_infor");

                blloc.Deletes("delete goods_account");

                bllrn.Updates("update room_number set Rn_state=3,Rn_Tobe=0,Room_suod='否'");

                bllrns.DeletebyWhere("");


                bllbr.DeletebyWhere("");

                bllsx.DeleteAll();

                Response.Write("<script>alert('成功初始化!')</script>");
            }
            catch (Exception ex)
            {
            }
        }
Ejemplo n.º 2
0
 /// <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();
     }
 }