// protected void Save_Click(object sender, EventArgs e) // { // EAVCPlan c = new EAVCPlan(); // 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, "AVCPlanCode")) // return; // WebUtils.StartFunction(Session, FUNCTION_CODE); // if (CurID < 0) // { //// Utils.MarkCreate(Session, c); // db.insert(dbConn, c); // CurID = c.AVCPlanID; //// url = Utils.BuildURL(-1, CurID); // } // else // { //// Utils.Mark(Session, c); // db.update(dbConn, c); // } // WebUtils.EndFunction(dbConn); // Response.Redirect(Request.Url.LocalPath+"?AVCPlanID="+CurID); // } protected void Delete_Click(object sender, EventArgs e) { //EAVCPlan c = new EAVCPlan(); //c.AVCPlanID = CurID; //db.delete(dbConn, c); //HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "AVCPlan_List.aspx"); ArrayList list = new ArrayList(); foreach (DataListItem item in Repeater.Items) { CheckBox c = (CheckBox)item.FindControl("DeleteItem"); HtmlInputHidden h = (HtmlInputHidden)item.FindControl("AVCPlanDetailID"); if (c.Checked) { EAVCPlanDetail obj = new EAVCPlanDetail(); obj.AVCPlanDetailID = Int32.Parse(h.Value); list.Add(obj); } } WebUtils.StartFunction(Session, FUNCTION_CODE); foreach (EAVCPlanDetail obj in list) { if (AVCPlanDetaildb.select(dbConn, obj)) { AVCPlanDetaildb.delete(dbConn, obj); } } WebUtils.EndFunction(dbConn); view = loadData(info, AVCPlanDetaildb, Repeater); }
protected void Repeater_ItemDataBound(object sender, DataListItemEventArgs e) { if (e.Item.ItemIndex == Repeater.EditItemIndex) { AVCPlanDetailebinding = new Binding(dbConn, AVCPlanDetaildb); AVCPlanDetailebinding.add((HtmlInputHidden)e.Item.FindControl("AVCPlanDetailID")); // AVCPlanDetailebinding.add((TextBox)e.Item.FindControl("AVCPlanID")); // not defined by ben AVCPlanDetailebinding.add((TextBox)e.Item.FindControl("AVCPlanDetailYearOfService")); AVCPlanDetailebinding.add((TextBox)e.Item.FindControl("AVCPlanDetailERBelowRI")); AVCPlanDetailebinding.add((TextBox)e.Item.FindControl("AVCPlanDetailERAboveRI")); AVCPlanDetailebinding.add((TextBox)e.Item.FindControl("AVCPlanDetailERFix")); AVCPlanDetailebinding.add((TextBox)e.Item.FindControl("AVCPlanDetailEEBelowRI")); AVCPlanDetailebinding.add((TextBox)e.Item.FindControl("AVCPlanDetailEEAboveRI")); AVCPlanDetailebinding.add((TextBox)e.Item.FindControl("AVCPlanDetailEEFix")); AVCPlanDetailebinding.init(Request, Session); EAVCPlanDetail obj = new EAVCPlanDetail(); AVCPlanDetaildb.toObject(((DataRowView)e.Item.DataItem).Row, obj); Hashtable values = new Hashtable(); AVCPlanDetaildb.populate(obj, values); AVCPlanDetailebinding.toControl(values); } else { e.Item.FindControl("Edit").Visible = toolBar.DeleteButton_Visible; e.Item.FindControl("DeleteItem").Visible = toolBar.DeleteButton_Visible; HtmlInputHidden h = (HtmlInputHidden)e.Item.FindControl("AVCPlanDetailID"); h.Value = ((DataRowView)e.Item.DataItem)["AVCPlanDetailID"].ToString(); } HROne.Common.WebUtility.WebControlsLocalization(Session, e.Item.Controls); }
protected void Add_Click(object sender, EventArgs e) { Repeater.EditItemIndex = -1; EAVCPlanDetail c = new EAVCPlanDetail(); Hashtable values = new Hashtable(); AVCPlanDetailbinding.toValues(values); PageErrors errors = PageErrors.getErrors(AVCPlanDetaildb, Page); errors.clear(); AVCPlanDetaildb.validate(errors, values); if (!errors.isEmpty()) { return; } AVCPlanDetaildb.parse(values, c); //if (!AppUtils.checkDuplicate(dbConn, AVCPlanDetaildb, c, errors, "AVCPlanDetailYearOfService")) // return; WebUtils.StartFunction(Session, FUNCTION_CODE); AVCPlanDetaildb.insert(dbConn, c); WebUtils.EndFunction(dbConn); AVCPlanDetailEEAboveRI.Text = string.Empty; AVCPlanDetailEEBelowRI.Text = string.Empty; AVCPlanDetailEEFix.Text = string.Empty; AVCPlanDetailERAboveRI.Text = string.Empty; AVCPlanDetailERBelowRI.Text = string.Empty; AVCPlanDetailERFix.Text = string.Empty; AVCPlanDetailYearOfService.Text = string.Empty; view = loadData(info, AVCPlanDetaildb, Repeater); //add by Ben }
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, AVCPlanDetaildb, Repeater); WebUtils.SetEnabledControlSection(AddPanel1, false); WebUtils.SetEnabledControlSection(AddPanel2, false); } else if (b.ID.Equals("Cancel")) { Repeater.EditItemIndex = -1; view = loadData(info, AVCPlanDetaildb, Repeater); WebUtils.SetEnabledControlSection(AddPanel1, true); WebUtils.SetEnabledControlSection(AddPanel2, true); } else if (b.ID.Equals("Save")) { AVCPlanDetailebinding = new Binding(dbConn, AVCPlanDetaildb); AVCPlanDetailebinding.add((HtmlInputHidden)e.Item.FindControl("AVCPlanDetailID")); // AVCPlanDetailebinding.add((TextBox)e.Item.FindControl("AVCPlanID")); // not defined by ben AVCPlanDetailebinding.add((TextBox)e.Item.FindControl("AVCPlanDetailYearOfService")); AVCPlanDetailebinding.add((TextBox)e.Item.FindControl("AVCPlanDetailERBelowRI")); AVCPlanDetailebinding.add((TextBox)e.Item.FindControl("AVCPlanDetailERAboveRI")); AVCPlanDetailebinding.add((TextBox)e.Item.FindControl("AVCPlanDetailERFix")); AVCPlanDetailebinding.add((TextBox)e.Item.FindControl("AVCPlanDetailEEBelowRI")); AVCPlanDetailebinding.add((TextBox)e.Item.FindControl("AVCPlanDetailEEAboveRI")); AVCPlanDetailebinding.add((TextBox)e.Item.FindControl("AVCPlanDetailEEFix")); AVCPlanDetailebinding.init(Request, Session); EAVCPlanDetail obj = new EAVCPlanDetail(); Hashtable values = new Hashtable(); PageErrors errors = PageErrors.getErrors(AVCPlanDetaildb, Page); errors.clear(); AVCPlanDetailebinding.toValues(values); AVCPlanDetaildb.validate(errors, values); if (!errors.isEmpty()) { return; } AVCPlanDetaildb.parse(values, obj); //if (!AppUtils.checkDuplicate(dbConn, AVCPlanDetaildb, obj, errors, "AVCPlanID")) //return; WebUtils.StartFunction(Session, FUNCTION_CODE); AVCPlanDetaildb.update(dbConn, obj); WebUtils.EndFunction(dbConn); Repeater.EditItemIndex = -1; view = loadData(info, AVCPlanDetaildb, Repeater); WebUtils.SetEnabledControlSection(AddPanel1, true); WebUtils.SetEnabledControlSection(AddPanel2, true); } }