Esempio n. 1
0
 public static bool UpdateLotteryTicket(LotteryTicketInfo info)
 {
     string str = JsonConvert.SerializeObject(info.PrizeSettingList);
     info.PrizeSetting = str;
     return new LotteryActivityDao().UpdateLotteryTicket(info);
 }
Esempio n. 2
0
 public int SaveLotteryTicket(LotteryTicketInfo info)
 {
     int num;
     StringBuilder builder = new StringBuilder();
     builder.Append("insert into Vshop_LotteryActivity(");
     builder.Append("ActivityName,ActivityType,StartTime,OpenTime,EndTime,ActivityDesc,ActivityPic,ActivityKey,PrizeSetting,GradeIds,MinValue,InvitationCode,IsOpened)");
     builder.Append(" values (");
     builder.Append("@ActivityName,@ActivityType,@StartTime,@OpenTime,@EndTime,@ActivityDesc,@ActivityPic,@ActivityKey,@PrizeSetting,@GradeIds,@MinValue,@InvitationCode,@IsOpened)");
     builder.Append(";select @@IDENTITY");
     DbCommand sqlStringCommand = this.database.GetSqlStringCommand(builder.ToString());
     this.database.AddInParameter(sqlStringCommand, "ActivityName", DbType.String, info.ActivityName);
     this.database.AddInParameter(sqlStringCommand, "ActivityType", DbType.Int32, info.ActivityType);
     this.database.AddInParameter(sqlStringCommand, "StartTime", DbType.DateTime, info.StartTime);
     this.database.AddInParameter(sqlStringCommand, "OpenTime", DbType.DateTime, info.OpenTime);
     this.database.AddInParameter(sqlStringCommand, "EndTime", DbType.DateTime, info.EndTime);
     this.database.AddInParameter(sqlStringCommand, "ActivityDesc", DbType.String, info.ActivityDesc);
     this.database.AddInParameter(sqlStringCommand, "ActivityPic", DbType.String, info.ActivityPic);
     this.database.AddInParameter(sqlStringCommand, "ActivityKey", DbType.String, info.ActivityKey);
     this.database.AddInParameter(sqlStringCommand, "PrizeSetting", DbType.String, info.PrizeSetting);
     this.database.AddInParameter(sqlStringCommand, "GradeIds", DbType.String, info.GradeIds);
     this.database.AddInParameter(sqlStringCommand, "MinValue", DbType.Int32, info.MinValue);
     this.database.AddInParameter(sqlStringCommand, "InvitationCode", DbType.String, info.InvitationCode);
     this.database.AddInParameter(sqlStringCommand, "IsOpened", DbType.Boolean, info.IsOpened);
     if (!int.TryParse(this.database.ExecuteScalar(sqlStringCommand).ToString(), out num))
     {
         return 0;
     }
     return num;
 }
Esempio n. 3
0
 public bool UpdateLotteryTicket(LotteryTicketInfo info)
 {
     StringBuilder builder = new StringBuilder();
     builder.Append("update Vshop_LotteryActivity set ");
     builder.Append("ActivityName=@ActivityName,");
     builder.Append("ActivityType=@ActivityType,");
     builder.Append("StartTime=@StartTime,");
     builder.Append("OpenTime=@OpenTime,");
     builder.Append("EndTime=@EndTime,");
     builder.Append("ActivityDesc=@ActivityDesc,");
     builder.Append("ActivityPic=@ActivityPic,");
     builder.Append("ActivityKey=@ActivityKey,");
     builder.Append("PrizeSetting=@PrizeSetting,");
     builder.Append("GradeIds=@GradeIds,");
     builder.Append("MinValue=@MinValue,");
     builder.Append("InvitationCode=@InvitationCode,");
     builder.Append("IsOpened=@IsOpened");
     builder.Append(" where ActivityId=@ActivityId ");
     builder.Append(";UPDATE vshop_Reply SET Keys = @ActivityKey WHERE ActivityId = @ActivityId  AND [ReplyType] = @ReplyType");
     string str = ((LotteryActivityType) info.ActivityType).ToString();
     object obj2 = Enum.Parse(typeof(ReplyType), str);
     DbCommand sqlStringCommand = this.database.GetSqlStringCommand(builder.ToString());
     this.database.AddInParameter(sqlStringCommand, "ActivityId", DbType.Int32, info.ActivityId);
     this.database.AddInParameter(sqlStringCommand, "ActivityName", DbType.String, info.ActivityName);
     this.database.AddInParameter(sqlStringCommand, "ActivityType", DbType.Int32, info.ActivityType);
     this.database.AddInParameter(sqlStringCommand, "StartTime", DbType.DateTime, info.StartTime);
     this.database.AddInParameter(sqlStringCommand, "OpenTime", DbType.DateTime, info.OpenTime);
     this.database.AddInParameter(sqlStringCommand, "EndTime", DbType.DateTime, info.EndTime);
     this.database.AddInParameter(sqlStringCommand, "ReplyType", DbType.Int32, (int) obj2);
     this.database.AddInParameter(sqlStringCommand, "ActivityDesc", DbType.String, info.ActivityDesc);
     this.database.AddInParameter(sqlStringCommand, "ActivityPic", DbType.String, info.ActivityPic);
     this.database.AddInParameter(sqlStringCommand, "ActivityKey", DbType.String, info.ActivityKey);
     this.database.AddInParameter(sqlStringCommand, "PrizeSetting", DbType.String, info.PrizeSetting);
     this.database.AddInParameter(sqlStringCommand, "GradeIds", DbType.String, info.GradeIds);
     this.database.AddInParameter(sqlStringCommand, "MinValue", DbType.Int32, info.MinValue);
     this.database.AddInParameter(sqlStringCommand, "InvitationCode", DbType.String, info.InvitationCode);
     this.database.AddInParameter(sqlStringCommand, "IsOpened", DbType.Boolean, info.IsOpened);
     return (this.database.ExecuteNonQuery(sqlStringCommand) > 0);
 }
Esempio n. 4
0
 protected void btnAddActivity_Click(object sender, EventArgs e)
 {
     if (ReplyHelper.HasReplyKey(this.txtKeyword.Text.Trim()))
     {
         this.ShowMsg("关键字重复!", false);
     }
     else if (!this.calendarStartDate.SelectedDate.HasValue)
     {
         this.ShowMsg("请选择活动开始时间", false);
     }
     else if (!this.calendarOpenDate.SelectedDate.HasValue)
     {
         this.ShowMsg("请选择抽奖开始时间", false);
     }
     else if (!this.calendarEndDate.SelectedDate.HasValue)
     {
         this.ShowMsg("请选择活动结束时间", false);
     }
     else
     {
         string str = string.Empty;
         if (this.fileUpload.HasFile)
         {
             try
             {
                 str = VShopHelper.UploadTopicImage(this.fileUpload.PostedFile);
             }
             catch
             {
                 this.ShowMsg("图片上传失败,您选择的不是图片类型的文件,或者网站的虚拟目录没有写入文件的权限", false);
                 return;
             }
         }
         string str2 = string.Empty;
         for (int i = 0; i < this.cbList.Items.Count; i++)
         {
             if (this.cbList.Items[i].Selected)
             {
                 str2 = str2 + "," + this.cbList.Items[i].Value;
             }
         }
         if (!string.IsNullOrEmpty(str2))
         {
             LotteryTicketInfo info = new LotteryTicketInfo {
                 GradeIds = str2,
                 MinValue = Convert.ToInt32(this.txtMinValue.Text),
                 InvitationCode = this.txtCode.Text.Trim(),
                 ActivityName = this.txtActiveName.Text,
                 ActivityKey = this.txtKeyword.Text,
                 ActivityDesc = this.txtdesc.Text,
                 ActivityPic = str,
                 ActivityType = 4,
                 StartTime = this.calendarStartDate.SelectedDate.Value,
                 OpenTime = this.calendarOpenDate.SelectedDate.Value.AddHours((double) this.ddlHours.SelectedIndex),
                 EndTime = this.calendarEndDate.SelectedDate.Value,
                 PrizeSettingList = new List<PrizeSetting>()
             };
             try
             {
                 PrizeSetting item = new PrizeSetting {
                     PrizeName = this.txtPrize1.Text,
                     PrizeNum = Convert.ToInt32(this.txtPrize1Num.Text),
                     PrizeLevel = "一等奖"
                 };
                 info.PrizeSettingList.Add(item);
                 PrizeSetting setting2 = new PrizeSetting {
                     PrizeName = this.txtPrize2.Text,
                     PrizeNum = Convert.ToInt32(this.txtPrize2Num.Text),
                     PrizeLevel = "二等奖"
                 };
                 info.PrizeSettingList.Add(setting2);
                 PrizeSetting setting3 = new PrizeSetting {
                     PrizeName = this.txtPrize3.Text,
                     PrizeNum = Convert.ToInt32(this.txtPrize3Num.Text),
                     PrizeLevel = "三等奖"
                 };
                 info.PrizeSettingList.Add(setting3);
             }
             catch (FormatException)
             {
                 this.ShowMsg("奖品数量格式错误", false);
                 return;
             }
             if (this.ChkOpen.Checked)
             {
                 try
                 {
                     PrizeSetting setting4 = new PrizeSetting {
                         PrizeName = this.txtPrize4.Text,
                         PrizeNum = Convert.ToInt32(this.txtPrize4Num.Text),
                         PrizeLevel = "四等奖"
                     };
                     info.PrizeSettingList.Add(setting4);
                     PrizeSetting setting5 = new PrizeSetting {
                         PrizeName = this.txtPrize5.Text,
                         PrizeNum = Convert.ToInt32(this.txtPrize5Num.Text),
                         PrizeLevel = "五等奖"
                     };
                     info.PrizeSettingList.Add(setting5);
                     PrizeSetting setting6 = new PrizeSetting {
                         PrizeName = this.txtPrize6.Text,
                         PrizeNum = Convert.ToInt32(this.txtPrize6Num.Text),
                         PrizeLevel = "六等奖"
                     };
                     info.PrizeSettingList.Add(setting6);
                 }
                 catch (FormatException)
                 {
                     this.ShowMsg("奖品数量格式错误", false);
                     return;
                 }
             }
             int num2 = VShopHelper.SaveLotteryTicket(info);
             if (num2 > 0)
             {
                 ReplyInfo reply = new TextReplyInfo {
                     Keys = info.ActivityKey,
                     MatchType = MatchType.Equal,
                     MessageType = MessageType.Text,
                     ReplyType = ReplyType.Ticket,
                     ActivityId = num2
                 };
                 ReplyHelper.SaveReply(reply);
                 base.Response.Redirect("ManageLotteryTicket.aspx");
             }
         }
         else
         {
             this.ShowMsg("请选择活动会员等级", false);
         }
     }
 }