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;
            }
        }
Esempio n. 2
0
        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");
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public static int Add(GuidNo  model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into ExamDB.dbo.tb_GUID_Number(");
            strSql.Append(@"guid_str,
                            activity_id,
                            create_time,
                            guid_status)");

            strSql.Append(" values (");

            strSql.Append(@"@guid_str,
                            @activity_id,
                            @create_time,
                            @guid_status)");

            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters = {
                    new SqlParameter("@guid_str", SqlDbType.NVarChar,255),
                    new SqlParameter("@activity_id", SqlDbType.Int,4),
                    new SqlParameter("@create_time",SqlDbType.DateTime),
                    new SqlParameter("@guid_status",SqlDbType.Int,4)
                                        };
            parameters[0].Value = model.GuidStr;
            parameters[1].Value = model.ActivityId;
            parameters[2].Value = model.CreateTime;
            parameters[3].Value = 0;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);
            if (obj == null)
            {
                return -1;
            }
            else
            {
                return Convert.ToInt32(obj);
            }
        }
Esempio n. 4
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public static void Update(GuidNo  model)
 {
     //todo add update
 }
Esempio n. 5
0
 //   public static DataSet GetGuid
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(GuidNo  model)
 {
     //TODO: ADD  return EnterpriseUserDAL.Add(model);
     return GuidNoDAL.Add(model);
 }