private void BindWeiXinMoney(int moneyID) { Chain.BLL.WeiXinMoney bllWeiXinMoney = new Chain.BLL.WeiXinMoney(); Chain.Model.WeiXinMoney modelWeiXinMoney = bllWeiXinMoney.GetModel(moneyID); this.spEndTime.InnerHtml = modelWeiXinMoney.EndTime.ToString("yyyy.MM.dd HH:mm"); this.spStartTime.InnerHtml = modelWeiXinMoney.StartTime.ToString("yyyy.MM.dd HH:mm"); int count = new Chain.BLL.WeiXinMoneyMem().GetRecordCount("MoneyID=" + modelWeiXinMoney.MoneyID); this.MemtotalCount.Value = count.ToString(); DataTable dt; if (modelWeiXinMoney.QuerySql != null) { dt = new Chain.BLL.Mem().GetList(modelWeiXinMoney.QuerySql).Tables[0]; } else { dt = new Chain.BLL.Mem().GetList("").Tables[0]; } this.IsOwn.Value = "0"; for (int i = 0; i < dt.Rows.Count; i++) { if (this.txtMemID.Value == dt.Rows[i]["MemID"].ToString()) { this.IsOwn.Value = "1"; break; } } int maxcount = modelWeiXinMoney.MaxCount; int memcount = new Chain.BLL.WeiXinGiveMoney().GetRecordCount(string.Concat(new object[] { " MemID=", int.Parse(this.txtMemID.Value), " and MoneyID=", modelWeiXinMoney.MoneyID })); this.MemCount.Value = (maxcount - memcount).ToString(); this.spNoUseCount.InnerHtml = this.MemCount.Value; this.MaxCount.Value = modelWeiXinMoney.MaxCount.ToString(); this.MoneyRate.Value = modelWeiXinMoney.MoneyRate.ToString(); this.TotalMoney.Value = modelWeiXinMoney.TotalMoney.ToString(); this.StartMoney.Value = modelWeiXinMoney.StartMoney.ToString(); this.EndMoney.Value = modelWeiXinMoney.EndMoney.ToString(); this.MoneyType.Value = modelWeiXinMoney.MoneyType.ToString(); this.FixedMoney.Value = modelWeiXinMoney.FixedMoney.ToString(); this.txtImageUrl.Value = modelWeiXinMoney.ImageUrl.ToString(); this.spDesc.InnerHtml = modelWeiXinMoney.MoneyDesc.ToString(); decimal money = new Chain.BLL.WeiXinGiveMoney().GetMoneySum(" MoneyID=" + modelWeiXinMoney.MoneyID); this.GiveMoney.Value = money.ToString(); }
private void BindWeiXinMoney(int MoneyID) { Chain.Model.WeiXinMoney modelWeiXinMoney = new Chain.BLL.WeiXinMoney().GetModel(MoneyID); int maxcount = modelWeiXinMoney.MaxCount; int memcount = new Chain.BLL.WeiXinGiveMoney().GetRecordCount(string.Concat(new object[] { " MemID=", int.Parse(this.txtMemID.Value), " and MoneyID=", modelWeiXinMoney.MoneyID })); this.MemCount.Value = (maxcount - memcount).ToString(); this.txtMoneyID.Value = modelWeiXinMoney.MoneyID.ToString(); this.MaxCount.Value = modelWeiXinMoney.MaxCount.ToString(); this.MoneyRate.Value = modelWeiXinMoney.MoneyRate.ToString(); this.TotalMoney.Value = modelWeiXinMoney.TotalMoney.ToString(); this.StartMoney.Value = modelWeiXinMoney.StartMoney.ToString(); this.EndMoney.Value = modelWeiXinMoney.EndMoney.ToString(); this.MoneyType.Value = modelWeiXinMoney.MoneyType.ToString(); this.FixedMoney.Value = modelWeiXinMoney.FixedMoney.ToString(); int count = new Chain.BLL.WeiXinMoneyMem().GetRecordCount("MoneyID=" + modelWeiXinMoney.MoneyID); int giveCount = new Chain.BLL.WeiXinGiveMoney().GetRecordCount("MoneyID=" + modelWeiXinMoney.MoneyID); this.MemtotalCount.Value = count.ToString(); this.txtRemainMoney.Value = (modelWeiXinMoney.TotalMoney - modelWeiXinMoney.GiveMoney).ToString(); this.txtRemainCount.Value = Math.Floor(double.Parse(((count - giveCount) * modelWeiXinMoney.MoneyRate / 100m).ToString())).ToString(); double min = double.Parse(modelWeiXinMoney.StartMoney.ToString()); double max = double.Parse(modelWeiXinMoney.EndMoney.ToString()); double fixedmoney = double.Parse(modelWeiXinMoney.FixedMoney.ToString()); double getmoney; if (modelWeiXinMoney.MoneyType == 1) { getmoney = this.GetRandomMoney(max, min); } else { getmoney = this.GetFixedMoney(fixedmoney); } this.txtgetmoney.Value = getmoney.ToString(); }
protected void btnMoneySave_Click(object sender, EventArgs e) { Chain.Model.WeiXinMoney modelWeiXinMoney = new Chain.Model.WeiXinMoney(); Chain.BLL.WeiXinMoney bllWeiXinMoney = new Chain.BLL.WeiXinMoney(); int MoneyID = 0; DateTime StartTime; if (this.radStartTypeOne.Checked) { StartTime = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd HH:mm")); } else { StartTime = DateTime.Parse(DateTime.Parse(this.txtStartTime.Value).ToString("yyyy-MM-dd HH:mm")); } if (this.txtMoneyID.Value != "") { MoneyID = int.Parse(this.txtMoneyID.Value); StartTime = DateTime.Parse(DateTime.Parse(this.txtStartTime.Value).ToString("yyyy-MM-dd HH:mm")); } string ImageUrl = this.txtMoneyPhoto.Value; string MoneyDesc = this.txtMoneyDesc.Value; string MoneyTitle = this.txtMoneyTitle.Value; string MoneyWish = this.txtMoneyWish.Value; DateTime EndTime = DateTime.Parse(DateTime.Parse(this.txtEndTime.Value).ToString("yyyy-MM-dd HH:mm")); decimal TotalMoney = decimal.Parse(this.txtTotalMoney.Value); decimal StartMoney = 0m; decimal EndMoney = 0m; decimal FixedMoney = 0m; int MoneyType; if (this.radMoneyTypeOne.Checked) { StartMoney = decimal.Parse(this.txtStartMoney.Value); EndMoney = decimal.Parse(this.txtEndMoney.Value); MoneyType = 1; } else { FixedMoney = decimal.Parse(this.txtFixedMoney.Value); MoneyType = 2; } int MaxCount = int.Parse(this.txtMaxCount.Value); decimal MoneyRate = decimal.Parse(this.txtMoneyRate.Value); string MemIDList = this.txtMemIDList.Value.TrimEnd(new char[] { ',' }); string[] strMemIDList = MemIDList.Split(new char[] { ',' }); modelWeiXinMoney.MoneyTitle = MoneyTitle; modelWeiXinMoney.MoneyWish = MoneyWish; modelWeiXinMoney.MoneyDesc = MoneyDesc; modelWeiXinMoney.ImageUrl = ImageUrl; modelWeiXinMoney.StartTime = StartTime; modelWeiXinMoney.EndTime = EndTime; modelWeiXinMoney.TotalMoney = TotalMoney; modelWeiXinMoney.MoneyType = MoneyType; modelWeiXinMoney.StartMoney = StartMoney; modelWeiXinMoney.EndMoney = EndMoney; modelWeiXinMoney.FixedMoney = FixedMoney; modelWeiXinMoney.MaxCount = MaxCount; modelWeiXinMoney.MoneyRate = MoneyRate; modelWeiXinMoney.GiveMoney = 0m; modelWeiXinMoney.MoneyRegion = this.txtMoneyRegion.Value; modelWeiXinMoney.QuerySql = this.txtQuerySql.Value; if (MoneyID == 0) { modelWeiXinMoney.CreateTime = DateTime.Now; modelWeiXinMoney.CreateUserID = this._UserID; int intMoneyID = bllWeiXinMoney.Add(modelWeiXinMoney); Chain.BLL.WeiXinMoneyMem bllWeiXinMoneyMem = new Chain.BLL.WeiXinMoneyMem(); for (int i = 0; i < strMemIDList.Length; i++) { bllWeiXinMoneyMem.Add(new Chain.Model.WeiXinMoneyMem { MemID = int.Parse(strMemIDList[i]), MoneyID = intMoneyID }); } base.MessagePageShowError("保存成功!"); base.Response.Redirect("WeiXinMoneyList.aspx"); } else { modelWeiXinMoney.MoneyID = MoneyID; if (bllWeiXinMoney.Update(modelWeiXinMoney) > 0) { base.MessagePageShowError("修改成功!"); base.Response.Redirect("WeiXinMoneyList.aspx"); } else { base.MessagePageShowError("修改失败!"); } } }