protected void Delete_Click(object sender, EventArgs e) { ArrayList list = new ArrayList(); foreach (DataListItem item in Repeater.Items) { CheckBox c = (CheckBox)item.FindControl("DeleteItem"); HtmlInputHidden h = (HtmlInputHidden)item.FindControl("MinimumWageID"); if (c.Checked) { EMinimumWage obj = new EMinimumWage(); obj.MinimumWageID = Int32.Parse(h.Value); list.Add(obj); } } foreach (EMinimumWage obj in list) { if (EMinimumWage.db.select(dbConn, obj)) { WebUtils.StartFunction(Session, FUNCTION_CODE); db.delete(dbConn, obj); WebUtils.EndFunction(dbConn); } } view = loadData(info, db, Repeater); //Response.Redirect(Request.Url.LocalPath); }
protected void Repeater_ItemDataBound(object sender, DataListItemEventArgs e) { HROne.Common.WebUtility.WebControlsLocalization(Session, e.Item.Controls); e.Item.FindControl("DeleteItem").Visible = IsAllowEdit; if (e.Item.ItemIndex == Repeater.EditItemIndex) { ebinding = new Binding(dbConn, db); ebinding.add((HtmlInputHidden)e.Item.FindControl("MinimumWageID")); ebinding.add(new TextBoxBinder(db, ((WebDatePicker)e.Item.FindControl("MinimumWageEffectiveDate")).TextBox, "MinimumWageEffectiveDate")); ebinding.add((TextBox)e.Item.FindControl("MinimumWageHourlyRate")); ebinding.init(Request, Session); EMinimumWage obj = new EMinimumWage(); db.toObject(((DataRowView)e.Item.DataItem).Row, obj); Hashtable values = new Hashtable(); db.populate(obj, values); ebinding.toControl(values); } else { e.Item.FindControl("Edit").Visible = IsAllowEdit; HtmlInputHidden h = (HtmlInputHidden)e.Item.FindControl("MinimumWageID"); h.Value = ((DataRowView)e.Item.DataItem)["MinimumWageID"].ToString(); } }
protected void Repeater_ItemCommand(object source, DataListCommandEventArgs e) { Button b = (Button)e.CommandSource; if (b.ID.Equals("Edit")) { Repeater.EditItemIndex = e.Item.ItemIndex; view = loadData(info, db, Repeater); WebUtils.SetEnabledControlSection(AddPanel, false); } else if (b.ID.Equals("Cancel")) { Repeater.EditItemIndex = -1; view = loadData(info, db, Repeater); WebUtils.SetEnabledControlSection(AddPanel, true); } else if (b.ID.Equals("Save")) { ebinding = new Binding(dbConn, db); ebinding.add((HtmlInputHidden)e.Item.FindControl("MinimumWageID")); ebinding.add(new TextBoxBinder(db, ((WebDatePicker)e.Item.FindControl("MinimumWageEffectiveDate")).TextBox, "MinimumWageEffectiveDate")); ebinding.add((TextBox)e.Item.FindControl("MinimumWageHourlyRate")); ebinding.init(Request, Session); EMinimumWage obj = new EMinimumWage(); Hashtable values = new Hashtable(); PageErrors errors = PageErrors.getErrors(db, Page.Master); errors.clear(); ebinding.toValues(values); db.validate(errors, values); if (!errors.isEmpty()) { return; } db.parse(values, obj); if (!AppUtils.checkDuplicate(dbConn, db, obj, errors, "MinimumWageEffectiveDate")) { return; } WebUtils.StartFunction(Session, FUNCTION_CODE); db.update(dbConn, obj); WebUtils.EndFunction(dbConn); Repeater.EditItemIndex = -1; view = loadData(info, db, Repeater); WebUtils.SetEnabledControlSection(AddPanel, true); } }
protected void Add_Click(object sender, EventArgs e) { Repeater.EditItemIndex = -1; EMinimumWage c = new EMinimumWage(); Hashtable values = new Hashtable(); binding.toValues(values); PageErrors errors = PageErrors.getErrors(db, Page.Master); errors.clear(); db.validate(errors, values); if (!errors.isEmpty()) { return; } db.parse(values, c); if (!AppUtils.checkDuplicate(dbConn, db, c, errors, "MinimumWageEffectiveDate")) { return; } WebUtils.StartFunction(Session, FUNCTION_CODE); db.insert(dbConn, c); WebUtils.EndFunction(dbConn); MinimumWageEffectiveDate.Value = string.Empty; MinimumWageHourlyRate.Text = string.Empty; view = loadData(info, db, Repeater); }