private void button10_Click(object sender, EventArgs e) { UploadInfo ui = new UploadInfo(); ui.form1 = this; if (ui.CouponFavourite("0526", "123456")) { MessageBox.Show("操作成功!"); } else { MessageBox.Show("操作失败!"); } }
/// <summary> /// 收藏和打印半透明Label的时间处理 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void TranlateLabel_Click(object sender, EventArgs e) { MyMsgBox mb = new MyMsgBox(); if (!GlobalVariables.isUserLogin) { mb.ShowMsg("请您先刷卡!\n获取更多特权请致电:\n4001-868-968", 2); return; } Label lb = sender as Label; int type = 1; //0表示收藏,1表示打印 String id = null; CouponPicInfo pi = null; switch (lb.Name) { case "Home_Fav": type = 0; if (LP_ctype[0].Count > 0) { pi = LP_ctype[0][(curPage - 1) * 6 + theCouponNum]; id = pi.id; } break; case "Home_Print": type = 1; if (LP_ctype[0].Count > 0) { pi = LP_ctype[0][(curPage - 1) * 6 + theCouponNum]; id = pi.id; } break; case "ShopInfo_Fav": type = 0; if (LP_ctype[0].Count > 0) { pi = LP_ctype[0][curType]; id = pi.id; } break; case "ShopInfo_Print": type = 1; if (LP_ctype[0].Count > 0) { pi = LP_ctype[0][curType]; id = pi.id; } break; case "Coupon_Fav": type = 0; if (LP_ctype[0].Count > 0) { pi = LP_ctype[0][(curPage - 1) * 9 + theCouponNum]; id = pi.id; } break; case "Coupon_Print": type = 1; if (LP_ctype[0].Count > 0) { pi = LP_ctype[0][(curPage - 1) * 9 + theCouponNum]; id = pi.id; } break; case "MyInfo_Top_Print": type = 1; if (LP_ctype[0].Count > 0) { pi = LP_ctype[0][(curPage - 1) * 3 + theCouponNum]; id = pi.id; } break; case "MyInfo_Bottom_Fav": type = 0; if (LP_ctype[1].Count > 0) { pi = LP_ctype[1][(curPage - 1) * 3 + theCouponNum]; id = pi.id; } break; case "MyInfo_Bottom_Print": type = 1; if (LP_ctype[1].Count > 0) { pi = LP_ctype[1][(curPage - 1) * 3 + theCouponNum]; id = pi.id; } break; default: pi = null; id = null; break; } if (pi == null || id == null) { return; } try { if (id != null) { if (type == 1) { if (!GlobalVariables.isUserLogin) { mb.ShowMsg("请您先登录", 1); return; } else { if (GetUserPrintTimes() < GlobalVariables.PrintLimit) { CouponsPopForm cpf = new CouponsPopForm(pi, this); cpf.ShowDialog(); Thread.Sleep(200); } else { mb.ShowMsg("打印次数达到上限!", 1); return; } } } else { if (!GlobalVariables.isUserLogin) { mb.ShowMsg("请您先登录", 1); return; } else { mb.ShowMsg("确认收藏?", '1'); if (mb.DialogResult == DialogResult.Yes) { UploadInfo ui = new UploadInfo(); if (ui.CouponFavourite(GlobalVariables.LoginUserId, id)) { mb.ShowMsg("收藏成功!", 1); string[] str = new string[(GlobalVariables.M.AryFavourite.Length + 1)]; int i = 0; foreach (string favid in GlobalVariables.M.AryFavourite) { str[i++] = favid; } str[GlobalVariables.M.AryFavourite.Length] = id; GlobalVariables.M.AryFavourite = str; } else { mb.ShowMsg("收藏失败!请稍后重试", 1); } } } } } else return; mb.Dispose(); } catch (Exception) { this.CloseAllDialog(); mb.ShowMsg("操作错误!请稍后重试!", 2); mb.Dispose(); } }