public void DeleteTemporaryAWD() { try { var e = Award.FetchObject(int.Parse(lblPK.Text)); e.Delete(); } catch { } }
protected void btnContinue3_Click(object sender, System.Web.UI.ImageClickEventArgs e) { var badge = LoadBadgeObject(); badge.Insert(); try { var badgePath = string.Format(Server.MapPath("~/images/Badges/")); System.IO.File.Copy(string.Format("{0}no_badge.png", badgePath), string.Format("{0}{1}.png", badgePath, badge.BID)); System.IO.File.Copy(string.Format("{0}no_badge_sm.png", badgePath), string.Format("{0}sm_{1}.png", badgePath, badge.BID)); } catch (Exception ex) { this.Log().Error("Couldn't copy no_badge images into new badge: {0}", ex.Message); } new SessionTools(Session).RemoveCache(Cache, CacheKey.BadgesActive); lblBID.Text = badge.BID.ToString(); var bl = Award.FetchObject(int.Parse(lblPK.Text)); bl.BadgeID = badge.BID; bl.Update(); FileUploadCtl.FileName = lblBID.Text; FileUploadCtl.ProcessRender(); OpenBadgesBadgeMaker.FileName = lblBID.Text; pnlLast.Visible = true; pnlBadgeMore.Visible = false; }
public void DeleteTemporaryAWDAndBadge() { try { var e = Award.FetchObject(int.Parse(lblPK.Text)); Badge.Delete(Badge.GetBadge(e.BadgeID)); e.Delete(); } catch { } }
protected void GvRowCommand(object sender, GridViewCommandEventArgs e) { string editpage = "~/ControlRoom/Modules/Setup/AwardAddEdit.aspx"; if (e.CommandName.ToLower() == "addrecord") { Response.Redirect(editpage); } if (e.CommandName.ToLower() == "editrecord") { int key = Convert.ToInt32(e.CommandArgument); Response.Redirect(String.Format("{0}?PK={1}", editpage, key)); } if (e.CommandName.ToLower() == "deleterecord") { var key = Convert.ToInt32(e.CommandArgument); try { var obj = Award.FetchObject(key); if (obj.IsValid(BusinessRulesValidationMode.DELETE)) { obj.Delete(); LoadData(); var masterPage = (IControlRoomMaster)Master; if (masterPage != null) { masterPage.PageMessage = SRPResources.DeleteOK; } } else { var masterPage = (IControlRoomMaster)Master; string message = String.Format(SRPResources.ApplicationError1, "<ul>"); foreach (BusinessRulesValidationMessage m in obj.ErrorCodes) { message = string.Format(String.Format("{0}<li>{{0}}</li>", message), m.ErrorMessage); } message = string.Format("{0}</ul>", message); if (masterPage != null) { masterPage.PageError = message; } } } catch (Exception ex) { var masterPage = (IControlRoomMaster)Master; if (masterPage != null) { masterPage.PageError = String.Format(SRPResources.ApplicationError1, ex.Message); } } } }
protected void btnContinue3_Click(object sender, System.Web.UI.ImageClickEventArgs e) { var obj = LoadBadgeObject(); obj.Insert(); Cache[CacheKey.BadgesActive] = true; lblBID.Text = obj.BID.ToString(); var bl = Award.FetchObject(int.Parse(lblPK.Text)); bl.BadgeID = obj.BID; bl.Update(); FileUploadCtl.FileName = lblBID.Text; FileUploadCtl.ProcessRender(); pnlLast.Visible = true; pnlBadgeMore.Visible = false; }
protected void GvRowCommand(object sender, GridViewCommandEventArgs e) { string editpage = "~/ControlRoom/Modules/Setup/AwardAddEdit.aspx"; string addtpage = "~/ControlRoom/Modules/Setup/AwardAddWizard.aspx"; if (e.CommandName.ToLower() == "addrecord") { Session["AWD"] = ""; Response.Redirect(addtpage); } if (e.CommandName.ToLower() == "editrecord") { int key = Convert.ToInt32(e.CommandArgument); Session["AWD"] = key; Response.Redirect(editpage); //Response.Redirect(String.Format("{0}?PK={1}", editpage, key)); } if (e.CommandName.ToLower() == "deleterecord") { var key = Convert.ToInt32(e.CommandArgument); try { var obj = Award.FetchObject(key); if (obj.IsValid(BusinessRulesValidationMode.DELETE)) { obj.Delete(); LoadData(); var masterPage = (IControlRoomMaster)Master; if (masterPage != null) { masterPage.PageMessage = SRPResources.DeleteOK; } } else { var masterPage = (IControlRoomMaster)Master; string message = String.Format(SRPResources.ApplicationError1, "<ul>"); foreach (BusinessRulesValidationMessage m in obj.ErrorCodes) { message = string.Format(String.Format("{0}<li>{{0}}</li>", message), m.ErrorMessage); } message = string.Format("{0}</ul>", message); if (masterPage != null) { masterPage.PageError = message; } } } catch (Exception ex) { var masterPage = (IControlRoomMaster)Master; if (masterPage != null) { masterPage.PageError = String.Format(SRPResources.ApplicationError1, ex.Message); } } } if (e.CommandName.ToLower() == "applyaward") { int key = Convert.ToInt32(e.CommandArgument); var awd = Award.FetchObject(key); var pl = GetMatchingData(awd); var pMax = pl.Tables[0].Rows.Count; var pCount = 0; Response.Buffer = false; Response.Write("<!-- "); foreach (DataRow row in pl.Tables[0].Rows) { var pid = Convert.ToInt32(row["PID"]); var list = new List <Badge>(); var p = Patron.FetchObject(pid); if (AwardPoints.AwardBadgeToPatron(awd.BadgeID, p, ref list)) { pCount++; // if they got a badge, then maybe they match the criteria to get another as well ... AwardPoints.AwardBadgeToPatronViaMatchingAwards(p, ref list); Response.Write(" :-> "); Response.Flush(); } } Response.Write("-->"); var masterPage = (IControlRoomMaster)Master; if (masterPage != null) { masterPage.PageMessage = String.Format("{0} patrons matched the award criteria. Award has been applied to {1} patrons who had not previously received the award.", pMax, pCount); } } }