protected void GrVActivityManage_RowCommand(object sender, GridViewCommandEventArgs e) { int rowIndex = Int32.Parse(e.CommandArgument.ToString());//获取点击了第几行 if (e.CommandName == "GuidSetting") { string guidNew = GenerateGuid.NewGuidNo().Substring(0, 8); GuidNo guidObject = new GuidNo(); guidObject.GuidStr = guidNew; guidObject.ActivityId = int.Parse(grVActivityManage.DataKeys[rowIndex].Values[0].ToString()); guidObject.CreateTime = DateTime.Now; GuidBLL temp = new GuidBLL(); if (temp.Add(guidObject) != -1) { MessageBox.ShowAndRedirect(this, "已成功开启项目", "ManageActivity.aspx"); } } if (e.CommandName == "DisableActivity") { string strStatus = ((Button)grVActivityManage.Rows[rowIndex].Cells[8].Controls[0]).Text; string actid = grVActivityManage.DataKeys[rowIndex].Values[0].ToString(); string positonid = grVActivityManage.DataKeys[rowIndex].Values[1].ToString(); EnterpriseUserBLL enterprisebll = new EnterpriseUserBLL(); string enterpriseid = enterprisebll.GetEnterpriseIdByUser(Session["username"].ToString()); ActivityBLL temp = new ActivityBLL(); switch (strStatus) { case "开启项目": if (temp.UpdateActivityStatus(actid, positonid, enterpriseid, false) != -1) { MessageBox.ShowAndRedirect(this, "已成功开启项目", "ManageActivity.aspx"); } break; case "停止项目": if (temp.UpdateActivityStatus(actid, positonid, enterpriseid, true) != -1) { MessageBox.ShowAndRedirect(this, "已成功停止项目", "ManageActivity.aspx"); } break; default: break; } temp = null; } }
protected void btnSave_Click(object sender, EventArgs e) { try { int activityId = int.Parse(Request["actid"].ToString()); int count = int.Parse(txtAvailablecount.Text.Trim());//次数 float money = float.Parse(txtMoney.Text.Trim());//金额 if (payBll.AddPayment(activityId, money, count) != -1) { //正常 } else { } //产生GUID 分配企业。 for (int i = 0; i < count; i++) { string guidNew = GenerateGuid.NewGuidNo().Substring(0, 8); GuidNo guidObject = new GuidNo(); guidObject.GuidStr = guidNew; guidObject.ActivityId = activityId; guidObject.CreateTime = DateTime.Now; guidObject.Guid_status = 0; GuidBLL guidBLL = new GuidBLL(); guidBLL.Add(guidObject); } ActivityBLL aBll = new ActivityBLL(); DataSet dsEUsrInfo = aBll.GetEUsrInfoByActivityId(Int32.Parse(Request.QueryString["actid"])); MessageBox.ShowAndRedirect(this, "续费成功", "ActivityList.aspx?users_id=" + dsEUsrInfo.Tables[0].Rows[0][0].ToString()); } catch (Exception ex) { MessageBox.ShowAndRedirect(this, "续费失败!" + ex.Message, "EnterpriseUserList.aspx"); } }