Example #1
0
 public bool SaveActivitySignUp(ActivitySignUpInfo info)
 {
     StringBuilder builder = new StringBuilder();
     builder.Append("IF NOT EXISTS (select 1 from vshop_ActivitySignUp WHERE ActivityId=@ActivityId and UserId=@UserId) ").Append("INSERT INTO vshop_ActivitySignUp(").Append("ActivityId,UserId,UserName,RealName,SignUpDate").Append(",Item1,Item2,Item3,Item4,Item5)").Append(" VALUES (").Append("@ActivityId,@UserId,@UserName,@RealName,@SignUpDate").Append(",@Item1,@Item2,@Item3,@Item4,@Item5)");
     DbCommand sqlStringCommand = this.database.GetSqlStringCommand(builder.ToString());
     this.database.AddInParameter(sqlStringCommand, "ActivityId", DbType.Int32, info.ActivityId);
     this.database.AddInParameter(sqlStringCommand, "UserId", DbType.Int32, info.UserId);
     this.database.AddInParameter(sqlStringCommand, "UserName", DbType.String, info.UserName);
     this.database.AddInParameter(sqlStringCommand, "RealName", DbType.String, info.RealName);
     this.database.AddInParameter(sqlStringCommand, "SignUpDate", DbType.DateTime, info.SignUpDate);
     this.database.AddInParameter(sqlStringCommand, "Item1", DbType.String, info.Item1);
     this.database.AddInParameter(sqlStringCommand, "Item2", DbType.String, info.Item2);
     this.database.AddInParameter(sqlStringCommand, "Item3", DbType.String, info.Item3);
     this.database.AddInParameter(sqlStringCommand, "Item4", DbType.String, info.Item4);
     this.database.AddInParameter(sqlStringCommand, "Item5", DbType.String, info.Item5);
     return (this.database.ExecuteNonQuery(sqlStringCommand) > 0);
 }
Example #2
0
 private void SubmitActivity(HttpContext context)
 {
     context.Response.ContentType = "application/json";
     MemberInfo currentMember = MemberProcessor.GetCurrentMember();
     if (currentMember == null)
     {
         context.Response.Write("{\"success\":false}");
     }
     else
     {
         ActivityInfo activity = VshopBrowser.GetActivity(Convert.ToInt32(context.Request.Form.Get("id")));
         if ((DateTime.Now < activity.StartDate) || (DateTime.Now > activity.EndDate))
         {
             context.Response.Write("{\"success\":false, \"msg\":\"报名还未开始或已结束\"}");
         }
         else
         {
             ActivitySignUpInfo info = new ActivitySignUpInfo {
                 ActivityId = Convert.ToInt32(context.Request.Form.Get("id")),
                 Item1 = context.Request.Form.Get("item1"),
                 Item2 = context.Request.Form.Get("item2"),
                 Item3 = context.Request.Form.Get("item3"),
                 Item4 = context.Request.Form.Get("item4"),
                 Item5 = context.Request.Form.Get("item5"),
                 RealName = currentMember.RealName,
                 SignUpDate = DateTime.Now,
                 UserId = currentMember.UserId,
                 UserName = currentMember.UserName
             };
             string s = VshopBrowser.SaveActivitySignUp(info) ? "{\"success\":true}" : "{\"success\":false, \"msg\":\"你已经报过名了,请勿重复报名\"}";
             context.Response.Write(s);
         }
     }
 }
Example #3
0
 public static bool SaveActivitySignUp(ActivitySignUpInfo info)
 {
     return new ActivitySignUpDao().SaveActivitySignUp(info);
 }