protected void Delete_Click(object sender, EventArgs e) { PageErrors errors = PageErrors.getErrors(db, Page.Master); errors.clear(); EESSAnnouncement obj = new EESSAnnouncement(); obj.ESSAnnouncementID = CurID; db.select(dbConn, obj); DBFilter filter = new DBFilter(); filter.add(new Match("ESSAnnouncementID", obj.ESSAnnouncementID)); ArrayList essAnnouncementList = EESSAnnouncement.db.select(dbConn, filter); if (essAnnouncementList.Count > 0) { foreach (EESSAnnouncement essAnnouncement in essAnnouncementList) { EESSAnnouncement.db.delete(dbConn, essAnnouncement); } } else { db.delete(dbConn, obj); WebUtils.EndFunction(dbConn); } HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "ESS_Announcement_List.aspx"); }
protected bool loadObject() { obj = new EESSAnnouncement(); bool isNew = WebFormWorkers.loadKeys(db, obj, DecryptedRequest); if (!db.select(dbConn, obj)) { return(false); } Hashtable values = new Hashtable(); db.populate(obj, values); binding.toControl(values); if (!isNew) { ESSAnnouncementCode.Enabled = false; } else { ESSAnnouncementCode.Enabled = true; } string companies = obj.ESSAnnouncementTargetCompanies; string ranks = obj.ESSAnnouncementTargetRanks; string[] list; if (companies != null) { list = companies.Split(new Char[] { ';' }); foreach (string o in list) { if (o != "") { CurCompanies.Add(int.Parse(o), o); } } } if (ranks != null) { list = ranks.Split(new Char[] { ';' }); foreach (string o in list) { if (o != "") { CurRanks.Add(int.Parse(o), o); } } } return(true); }
protected void Save_Click(object sender, EventArgs e) { PageErrors errors = PageErrors.getErrors(db, Page.Master); errors.clear(); Hashtable values = new Hashtable(); binding.toValues(values); db.validate(errors, values); if (!errors.isEmpty()) { return; } EESSAnnouncement c = new EESSAnnouncement(); ArrayList newCompanyList = WebUtils.SelectedRepeaterItemToBaseObjectList(ECompany.db, ESSAnnouncementTargetCompanies, "ItemSelect"); ArrayList newRankList = WebUtils.SelectedRepeaterItemToBaseObjectList(ERank.db, ESSAnnouncementTargetRanks, "ItemSelect"); if (newCompanyList.Count > 0) { string companies = ""; foreach (ECompany company in newCompanyList) { companies += company.CompanyID + ";"; } c.ESSAnnouncementTargetCompanies = companies; } if (newRankList.Count > 0) { string ranks = ""; foreach (ERank rank in newRankList) { ranks += rank.RankID + ";"; } c.ESSAnnouncementTargetRanks = ranks; } db.parse(values, c); if (!AppUtils.checkDuplicate(dbConn, db, c, errors, "ESSAnnouncementCode")) { return; } if (c.ESSAnnouncementCode.Equals("")) { errors.addError(ESSAnnouncementCode.Text, HROne.Common.WebUtility.GetLocalizedString("validate.required.prompt")); } if (!errors.isEmpty()) { return; } if (CurID < 0) { db.insert(dbConn, c); CurID = c.ESSAnnouncementID; } else { db.update(dbConn, c); } WebUtils.EndFunction(dbConn); HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "ESS_Announcement_View.aspx?ESSAnnouncementID=" + CurID); }