public void BuildPage(long factorID, string factorTitle) { try { JQManager jqm = new JQManager(); this.literalFactorTitle.Text = factorTitle; cleanForm(); // clean form collections and set form controls JQFactorItemCollection listFactorItems = jqm.GetJQFactorItemCollectionByFactorID(factorID); // load factor items this.FactorItems = listFactorItems; bindData(listFactorItems); SetControls(); } catch (Exception ex) { base.HandleException(ex); } }
public JQFactorItemCollection GetJQFactorItemByJQFactorItemID() { JQFactorItemCollection childDataCollection = null; if (base.ValidateKeyField(this._ratingScaleID)) { try { DataTable dt = ExecuteDataTable("spr_GetJQFactorItemByRatingScaleID", this._ratingScaleID); // fill collection list childDataCollection = new JQFactorItemCollection(dt); } catch (Exception ex) { HandleException(ex); } } return(childDataCollection); }
void gridJQFactorItems_RowDrop(object sender, GridDragDropEventArgs e) { try { // make sure items are not null AND that the source table is equal to the destination table if ((e.DestDataItem != null && e.DraggedItems != null) && (string.Compare(e.DraggedItems[0].OwnerTableView.Name, e.DestDataItem.OwnerTableView.Name, true) == 0)) { switch (e.DestDataItem.OwnerTableView.Name) { case "FactorItems": long sourceFactorItemID = (long)e.DraggedItems[0].GetDataKeyValue("JQFactorItemID"); long destinationFactorItemID = (long)e.DestDataItem.GetDataKeyValue("JQFactorItemID"); long factorID = (long)e.DestDataItem.GetDataKeyValue("JQFactorID"); JQFactorItemCollection workFactorItems = this.FactorItems.FindByFactor(factorID); JQFactorItem sourceFactorItem = workFactorItems.Find(sourceFactorItemID); JQFactorItem destinationFactorItem = workFactorItems.Find(destinationFactorItemID); if (sourceFactorItem != null && destinationFactorItem != null) { int destinationIndex = workFactorItems.IndexOf(destinationFactorItem); destinationIndex = getNewIndex(ref destinationIndex, e); // remove and add in new position workFactorItems.Remove(sourceFactorItem); workFactorItems.Insert(destinationIndex, sourceFactorItem); // remove entire group this.FactorItems.RemoveByFactor(factorID); // now add back into batch with corrected order this.FactorItems.AddRange(workFactorItems); } bindData(this.FactorItems); //removing toggling of save order button because it was //enabled even when the ShowEditFields was returning false or when user was not an HR user //toggleButtons(true); break; case "RatingScaleResponses": long sourceJQResponseID = (long)e.DraggedItems[0].GetDataKeyValue("JQResponseID"); long destinationJQResponseID = (long)e.DestDataItem.GetDataKeyValue("JQResponseID"); long ratingScaleID = (long)e.DestDataItem.GetDataKeyValue("JQRatingScaleID"); RatingScaleResponseCollection workResponses = this.RatingScaleResponses.FindByScale(ratingScaleID); RatingScaleResponse sourceResponse = workResponses.Find(sourceJQResponseID); RatingScaleResponse destinationResponse = workResponses.Find(destinationJQResponseID); if (sourceResponse != null && destinationResponse != null) { int destinationIndex = workResponses.IndexOf(destinationResponse); destinationIndex = getNewIndex(ref destinationIndex, e); // remove and add in new position workResponses.Remove(sourceResponse); workResponses.Insert(destinationIndex, sourceResponse); // remove entire scale this.RatingScaleResponses.RemoveByScale(ratingScaleID); // now add back into batch with corrected order this.RatingScaleResponses.AddRange(workResponses); } e.DestDataItem.OwnerTableView.Rebind(); //removing toggling of save order button because it was //enabled even when the ShowEditFields was returning false or when user was not an HR user //toggleButtons(true); break; } } } catch (Exception ex) { base.HandleException(ex); } }
private void bindData(JQFactorItemCollection FactorLoadList) { this.gridJQFactorItems.DataSource = FactorLoadList; this.gridJQFactorItems.DataBind(); }