/// <summary> /// 添加方案 /// </summary> private void Addmt() { BLL.mtPrice bllmt = new BLL.mtPrice(); int RowId = Convert.ToInt32(context.Request.QueryString["RowId"]); int MTID = Convert.ToInt32(context.Request.QueryString["MTID"]); int rtid = Convert.ToInt32(context.Request.QueryString["rtid"]); int Price = Convert.ToInt32(context.Request.QueryString["Price"]); float zdPrice = float.Parse(context.Request.QueryString["zdPrice"]); int Dayprice = Convert.ToInt32(context.Request.QueryString["Dayprice"]); int lcPrice = Convert.ToInt32(context.Request.QueryString["lcPrice"]); Model.mtPrice modelmt = new Model.mtPrice() { Price = Price, lcPrice = lcPrice, MTID = MTID, Dayprice = Dayprice, RoomType = rtid, zdPrice = zdPrice }; if (RowId == 0) { if (bllmt.GetModelList("RoomType=" + rtid + " and MTID=" + MTID).Count > 0) { context.Response.Write("不能添加重复的房型"); } else { if (bllmt.Add(modelmt) > 0) { context.Response.Write("ok"); } else { context.Response.Write("err"); } } } else { modelmt.ID = RowId; bllmt.Update(modelmt); context.Response.Write("ok"); } }
protected void BtnSave_Click(object sender, EventArgs e) { Model.memberType modelty = new Model.memberType(); modelty.TypeName = Name.Value; modelty.typePrice = Convert.ToInt32(CardFee.Value); modelty.Limit = Limitcke.Checked; if (Expire.Value == "") { modelty.LimitValue = null; } else { modelty.LimitValue = Convert.ToInt32(Expire.Value); } modelty.IntegraIs = ScoreChk.Checked; modelty.IsConsump = SEnable2.Checked; modelty.IsFz = Score_1.Checked; modelty.IsXf = Score_2.Checked; if (Rule_x.Value == "") { modelty.XfPrice = null; } else { modelty.XfPrice = Convert.ToInt32(Rule_x.Value); } if (Rule_y.Value == "") { modelty.XfConsump = null; } else { modelty.XfConsump = Convert.ToInt32(Rule_y.Value); } modelty.IsLive = SEnable1.Checked; if (ScoreType_x.Value == "") { modelty.LiveNum = null; } else { modelty.LiveNum = Convert.ToInt32(ScoreType_x.Value); } if (ScoreType_y.Value == "") { modelty.LiveConsump = null; } else { modelty.LiveConsump = Convert.ToInt32(ScoreType_y.Value); } if (machJf.Value == "") { modelty.MachJf = null; } else { modelty.MachJf = Convert.ToInt32(machJf.Value); } modelty.UpLive = Convert.ToInt32(MCategory.SelectedValue); modelty.IsTx = IsAddScore.Checked; modelty.IsDeaflut = defaultPrice.Checked; //差一个金额 modelty.IsUpgrade = UpEnable.Checked; if (UpScore.Value == "") { modelty.ConsumpSum = null; } else { modelty.ConsumpSum = Convert.ToInt32(UpScore.Value); } if (ThePrice.Value == "") { modelty.StaPrice = null; } else { modelty.StaPrice = Convert.ToInt32(ThePrice.Value); } modelty.IsDeduction = IsReduceScore.Checked; modelty.Isout = RoomMin.Checked; if (DayRoomHour.Value == "") { modelty.OutHour = null; } else { modelty.OutHour = Convert.ToInt32(DayRoomHour.Value); } if (HourRoomMin.Value == "") { modelty.OutZD = null; } else { modelty.OutZD = Convert.ToInt32(HourRoomMin.Value); } if (FirstPrice.Value == "") { modelty.FirstPrice = null; } else { modelty.FirstPrice = Convert.ToInt32(FirstPrice.Value); } modelty.XqTime = Convert.ToDateTime(XqTime.Value); if (Request.QueryString["type"] == "add") { int res = bllmt.Add(modelty); if (res > 0) { BLL.room_type bllrt = new BLL.room_type(); List <Model.room_type> listrt = bllrt.GetModelList(""); if (listrt.Count > 0) { foreach (Model.room_type item in listrt) { Model.mtPrice modelmt = new Model.mtPrice(); modelmt.RoomType = item.id; modelmt.zdPrice = 1; modelmt.Price = Convert.ToInt32(item.room_listedmoney); modelmt.Dayprice = Convert.ToInt32(item.room_listedmoney); modelmt.lcPrice = Convert.ToInt32(item.room_listedmoney); modelmt.MTID = res; BLL.mtPrice bllm = new BLL.mtPrice(); bllm.Add(modelmt); } } ClientScript.RegisterStartupScript(GetType(), "message", "<script language='javascript' defer>alert('保存成功');parent.window.location.reload();</script>"); } } else { modelty.MtID = Convert.ToInt32(Request.QueryString["id"]); if (bllmt.Update(modelty)) { ClientScript.RegisterStartupScript(GetType(), "message", "<script language='javascript' defer>alert('修改成功');parent.window.location.reload();</script>"); } } }