//添加 protected void Button1_Click(object sender, EventArgs e) { string uid = this.txtId.Text; string uname = this.txtName.Text; string jf = this.txtJf.Text; QPS.NEW.Model.Integral Mgral = new QPS.NEW.Model.Integral(); //Mgral.UserID = uid; //Mgral.Content = Convert.ToInt32(jf); //Mgral.CreateTime = DateTime.Now; Mgral.UserID = Convert.ToInt32(uid); Mgral.TotalMoney = Convert.ToInt32(jf); QPS.NEW.BLL.Integral Bin = new QPS.NEW.BLL.Integral(); int i=Bin.Add(Mgral); if (i >= 0) { Response.Write("<script>alert('积分添加成功!!');window.location.href = 'UserInfo.aspx';</script>"); } else { Response.Write("<script>alert('积分添加失败!!');</script>"); } }
//添加 protected void Button1_Click(object sender, EventArgs e) { string uid = this.txtId.Text; string uname = this.txtName.Text; string jf = this.txtJf.Text; QPS.NEW.Model.Integral Mgral = new QPS.NEW.Model.Integral(); //Mgral.UserID = uid; //Mgral.Content = Convert.ToInt32(jf); //Mgral.CreateTime = DateTime.Now; Mgral.UserID = Convert.ToInt32(uid); Mgral.TotalMoney = Convert.ToInt32(jf); QPS.NEW.BLL.Integral Bin = new QPS.NEW.BLL.Integral(); int i = Bin.Add(Mgral); if (i >= 0) { Response.Write("<script>alert('积分添加成功!!');window.location.href = 'UserInfo.aspx';</script>"); } else { Response.Write("<script>alert('积分添加失败!!');</script>"); } }
protected void gdvOrder_RowCommand(object sender, GridViewCommandEventArgs e) { ////得到单位编号 //string rowUpdate = this.gdvOrder.DataKeys[].Values[0].ToString(); ////转换为整数 //int ID = Convert.ToInt32(rowUpdate); //QPS.BLL.Orderform Border = new QPS.BLL.Orderform(); //QPS.Model.Orderform Morder = new QPS.Model.Orderform(); //Morder.Id = ID; //Morder.Beveragecost = (decimal)this.gdvOrder.DataKeys[e.RowIndex].Values[3]; //Border.Update(Morder); //gdvOrder.DataSource = databind(); //gdvOrder.DataBind(); string strArgument = e.CommandArgument.ToString(); if (e.CommandName == "IsValidate") { string[] Argument = strArgument.Split('|'); string id = Argument[0].ToString(); string type = Argument[1].ToString(); int ok; if (type == "0") { ok = 1; } else { ok = 0; } QPS.NEW.BLL.Orderform Border = new QPS.NEW.BLL.Orderform(); QPS.NEW.Model.Orderform order = Border.GetModel(Convert.ToInt32(id)); Border.UpdateType(id,type); //订单有效 则加上积分 否则 如果存在积分 则删除 QPS.NEW.BLL.Integral Bint = new QPS.NEW.BLL.Integral(); QPS.NEW.Model.Integral Mint = new QPS.NEW.Model.Integral(); if (Bint.GetList("OrderId='" + id + "'").Tables[0].Rows.Count > 0)//删除已有积分 { Bint.Delete(Convert.ToInt32(Bint.GetList("OrderId='" + id + "'").Tables[0].Rows[0]["Id"])); } if (ok == 1)//有效 { QPS.NEW.BLL.Room Broom = new QPS.NEW.BLL.Room(); QPS.NEW.Model.Room r = Broom.GetModel(order.Roomid); //Mint.OrderId = Convert.ToInt32(id); //Mint.RoomId = order.Roomid; Mint.UserID = order.Userid; //Mint.CreateTime = order.StartTime; TimeSpan ts = (TimeSpan)(order.endTime - order.StartTime); Mint.BankMoney = Convert.ToInt32((ts.Hours * (double)r.RoomPrice)); if (order.Beveragecost != null) { Mint.BankMoney += (int)order.Beveragecost; } Bint.Add(Mint); } } gdvOrder.DataSource = databind(); gdvOrder.DataBind(); }
protected void gdvOrder_RowCommand(object sender, GridViewCommandEventArgs e) { ////得到单位编号 //string rowUpdate = this.gdvOrder.DataKeys[].Values[0].ToString(); ////转换为整数 //int ID = Convert.ToInt32(rowUpdate); //QPS.BLL.Orderform Border = new QPS.BLL.Orderform(); //QPS.Model.Orderform Morder = new QPS.Model.Orderform(); //Morder.Id = ID; //Morder.Beveragecost = (decimal)this.gdvOrder.DataKeys[e.RowIndex].Values[3]; //Border.Update(Morder); //gdvOrder.DataSource = databind(); //gdvOrder.DataBind(); string strArgument = e.CommandArgument.ToString(); if (e.CommandName == "IsValidate") { string[] Argument = strArgument.Split('|'); string id = Argument[0].ToString(); string type = Argument[1].ToString(); int ok; if (type == "0") { ok = 1; } else { ok = 0; } QPS.NEW.BLL.Orderform Border = new QPS.NEW.BLL.Orderform(); QPS.NEW.Model.Orderform order = Border.GetModel(Convert.ToInt32(id)); Border.UpdateType(id, type); //订单有效 则加上积分 否则 如果存在积分 则删除 QPS.NEW.BLL.Integral Bint = new QPS.NEW.BLL.Integral(); QPS.NEW.Model.Integral Mint = new QPS.NEW.Model.Integral(); if (Bint.GetList("OrderId='" + id + "'").Tables[0].Rows.Count > 0) //删除已有积分 { Bint.Delete(Convert.ToInt32(Bint.GetList("OrderId='" + id + "'").Tables[0].Rows[0]["Id"])); } if (ok == 1)//有效 { QPS.NEW.BLL.Room Broom = new QPS.NEW.BLL.Room(); QPS.NEW.Model.Room r = Broom.GetModel(order.Roomid); //Mint.OrderId = Convert.ToInt32(id); //Mint.RoomId = order.Roomid; Mint.UserID = order.Userid; //Mint.CreateTime = order.StartTime; TimeSpan ts = (TimeSpan)(order.endTime - order.StartTime); Mint.BankMoney = Convert.ToInt32((ts.Hours * (double)r.RoomPrice)); if (order.Beveragecost != null) { Mint.BankMoney += (int)order.Beveragecost; } Bint.Add(Mint); } } gdvOrder.DataSource = databind(); gdvOrder.DataBind(); }