protected void lstviewCannedRecords_ItemUpdating(object sender, ListViewUpdateEventArgs e) { //Get the controls HiddenField CannIdEdit = (HiddenField)lstviewCannedRecords.EditItem.FindControl("CannIdEdit"); TextBox txtHeaderTextEdit = (TextBox)lstviewCannedRecords.EditItem.FindControl("txtHeaderTextEdit"); PubEntAdmin.UserControl.cslistbox ucCancerTypeEdit = (PubEntAdmin.UserControl.cslistbox)lstviewCannedRecords.EditItem.FindControl("ucCancerTypeEdit"); PubEntAdmin.UserControl.cslistbox ucSubjectEdit = (PubEntAdmin.UserControl.cslistbox)lstviewCannedRecords.EditItem.FindControl("ucSubjectEdit"); PubEntAdmin.UserControl.cslistbox ucPubFormatEdit = (PubEntAdmin.UserControl.cslistbox)lstviewCannedRecords.EditItem.FindControl("ucPubFormatEdit"); PubEntAdmin.UserControl.cslistbox ucRaceEdit = (PubEntAdmin.UserControl.cslistbox)lstviewCannedRecords.EditItem.FindControl("ucRaceEdit"); PubEntAdmin.UserControl.cslistbox ucAudienceEdit = (PubEntAdmin.UserControl.cslistbox)lstviewCannedRecords.EditItem.FindControl("ucAudienceEdit"); PubEntAdmin.UserControl.cslistbox ucLanguageEdit = (PubEntAdmin.UserControl.cslistbox)lstviewCannedRecords.EditItem.FindControl("ucLanguageEdit"); PubEntAdmin.UserControl.cslistbox ucCollectionsEdit = (PubEntAdmin.UserControl.cslistbox)lstviewCannedRecords.EditItem.FindControl("ucCollectionsEdit"); DropDownList ddlActiveEdit = (DropDownList)lstviewCannedRecords.EditItem.FindControl("ddlActiveEdit"); if (ucCancerTypeEdit.SelValues.Length == 0 && ucSubjectEdit.SelValues.Length == 0 && ucPubFormatAdd.SelValues.Length == 0 && ucRaceEdit.SelValues.Length == 0 && ucAudienceEdit.SelValues.Length == 0 && ucLanguageEdit.SelValues.Length == 0 && ucCollectionsEdit.SelValues.Length == 0) { CustomValidator1.IsValid = false; } else { lstviewCannedRecords.EditIndex = -1; } if (Page.IsValid) { string recdidout = ""; DAL.cs_dal.Save( txtHeaderTextEdit.Text, ucCancerTypeEdit.SelValues, ucSubjectEdit.SelValues, ucPubFormatEdit.SelValues, ucRaceEdit.SelValues, ucAudienceEdit.SelValues, ucLanguageEdit.SelValues, ucCollectionsEdit.SelValues, Int32.Parse(CannIdEdit.Value), 1, Int32.Parse(ddlActiveEdit.SelectedValue), ref recdidout ); //Session["CANNED_SearchParam"] = recdidout; this.Bind(); } }
protected void lstviewCannedRecords_ItemDataBound(object sender, ListViewItemEventArgs e) { if (e.Item.ItemType == ListViewItemType.DataItem) { ListViewDataItem item = (ListViewDataItem)e.Item; cs_record currRecord = (cs_record)item.DataItem; //Get the Current Record Item in the collection #region ReadOnlyMode //Get the Controls HiddenField CannId = (HiddenField)e.Item.FindControl("CannId"); Label lblRecordId = (Label)e.Item.FindControl("lblRecordId"); Label lblHeaderText = (Label)e.Item.FindControl("lblHeaderText"); Label lblUrl = (Label)e.Item.FindControl("lblUrl"); Label lblCancerType = (Label)e.Item.FindControl("lblCancerType"); Label lblSubject = (Label)e.Item.FindControl("lblSubject"); Label lblPubFormat = (Label)e.Item.FindControl("lblPubFormat"); Label lblRace = (Label)e.Item.FindControl("lblRace"); Label lblAudience = (Label)e.Item.FindControl("lblAudience"); Label lblLanguage = (Label)e.Item.FindControl("lblLanguage"); Label lblCollections = (Label)e.Item.FindControl("lblCollections"); Label lblActive = (Label)e.Item.FindControl("lblActive"); //Assign Values if (CannId != null) { CannId.Value = currRecord.CannId.ToString(); } if (lblRecordId != null) { lblRecordId.Text = currRecord.RecId; } if (lblHeaderText != null) { lblHeaderText.Text = currRecord.HeaderText; } if (lblUrl != null) { lblUrl.Text = ConfigurationManager.AppSettings["NCIPLCannedSearchURL"] + currRecord.RecId; } if (lblCancerType != null) { lblCancerType.Text = currRecord.CancerType; } if (lblSubject != null) { lblSubject.Text = currRecord.Subject; } if (lblPubFormat != null) { lblPubFormat.Text = currRecord.PubFormat; } if (lblRace != null) { lblRace.Text = currRecord.Race; } if (lblAudience != null) { lblAudience.Text = currRecord.Audience; } if (lblLanguage != null) { lblLanguage.Text = currRecord.Language; } if (lblCollections != null) { lblCollections.Text = currRecord.Collections; } if (lblActive != null) { if (currRecord.Active == 1) { lblActive.Text = "Yes"; } else { lblActive.Text = "No"; } } #region SecurityCheck1 if (CannId != null) { this.SecurityCheck(1, CannId); } #endregion #endregion #region EditMode //Get the Controls HiddenField CannIdEdit = (HiddenField)e.Item.FindControl("CannIdEdit"); if (CannIdEdit != null) { CannIdEdit.Value = currRecord.CannId.ToString(); } Label lblRecordIdEdit = (Label)e.Item.FindControl("lblRecordIdEdit"); if (lblRecordIdEdit != null) { lblRecordIdEdit.Text = currRecord.RecId; } TextBox txtHeaderTextEdit = (TextBox)e.Item.FindControl("txtHeaderTextEdit"); if (txtHeaderTextEdit != null) { txtHeaderTextEdit.Text = currRecord.HeaderText; } //Type of Cancer PubEntAdmin.UserControl.cslistbox ucCancerTypeEdit = (PubEntAdmin.UserControl.cslistbox)e.Item.FindControl("ucCancerTypeEdit"); if (ucCancerTypeEdit != null) { kvpaircoll = DAL.cs_dal.GetKVPair("sp_CANNED_getCancerTypes", 0, currRecord.CannId); foreach (KVPair kvpair in kvpaircoll) { ListItem lstItem = new ListItem(); lstItem.Text = kvpair.Val; lstItem.Value = kvpair.Key; if (kvpair.IsSelected == "1") { lstItem.Selected = true; } else { lstItem.Selected = false; } ucCancerTypeEdit.listBoxCtrl.Items.Add(lstItem); lstItem = null; } kvpaircoll = null; } //Subject List PubEntAdmin.UserControl.cslistbox ucSubjectEdit = (PubEntAdmin.UserControl.cslistbox)e.Item.FindControl("ucSubjectEdit"); if (ucSubjectEdit != null) { kvpaircoll = DAL.cs_dal.GetKVPair("sp_CANNED_getSubjects", 0, currRecord.CannId); foreach (KVPair kvpair in kvpaircoll) { ListItem lstItem = new ListItem(); lstItem.Text = kvpair.Val; lstItem.Value = kvpair.Key; if (kvpair.IsSelected == "1") { lstItem.Selected = true; } else { lstItem.Selected = false; } ucSubjectEdit.listBoxCtrl.Items.Add(lstItem); lstItem = null; } kvpaircoll = null; } //Publication Format List PubEntAdmin.UserControl.cslistbox ucPubFormatEdit = (PubEntAdmin.UserControl.cslistbox)e.Item.FindControl("ucPubFormatEdit"); if (ucPubFormatEdit != null) { kvpaircoll = DAL.cs_dal.GetKVPair("sp_CANNED_getProductFormats", 0, currRecord.CannId); foreach (KVPair kvpair in kvpaircoll) { ListItem lstItem = new ListItem(); lstItem.Text = kvpair.Val; lstItem.Value = kvpair.Key; if (kvpair.IsSelected == "1") { lstItem.Selected = true; } else { lstItem.Selected = false; } ucPubFormatEdit.listBoxCtrl.Items.Add(lstItem); lstItem = null; } kvpaircoll = null; } //Race List PubEntAdmin.UserControl.cslistbox ucRaceEdit = (PubEntAdmin.UserControl.cslistbox)e.Item.FindControl("ucRaceEdit"); if (ucRaceEdit != null) { kvpaircoll = DAL.cs_dal.GetKVPair("sp_CANNED_getRace", 0, currRecord.CannId); foreach (KVPair kvpair in kvpaircoll) { ListItem lstItem = new ListItem(); lstItem.Text = kvpair.Val; lstItem.Value = kvpair.Key; if (kvpair.IsSelected == "1") { lstItem.Selected = true; } else { lstItem.Selected = false; } ucRaceEdit.listBoxCtrl.Items.Add(lstItem); lstItem = null; } kvpaircoll = null; } //Audience List PubEntAdmin.UserControl.cslistbox ucAudienceEdit = (PubEntAdmin.UserControl.cslistbox)e.Item.FindControl("ucAudienceEdit"); if (ucAudienceEdit != null) { kvpaircoll = DAL.cs_dal.GetKVPair("sp_CANNED_getAudience", 0, currRecord.CannId); foreach (KVPair kvpair in kvpaircoll) { ListItem lstItem = new ListItem(); lstItem.Text = kvpair.Val; lstItem.Value = kvpair.Key; if (kvpair.IsSelected == "1") { lstItem.Selected = true; } else { lstItem.Selected = false; } ucAudienceEdit.listBoxCtrl.Items.Add(lstItem); lstItem = null; } kvpaircoll = null; } //Language List PubEntAdmin.UserControl.cslistbox ucLanguageEdit = (PubEntAdmin.UserControl.cslistbox)e.Item.FindControl("ucLanguageEdit"); if (ucLanguageEdit != null) { kvpaircoll = DAL.cs_dal.GetKVPair("sp_CANNED_getLanguages", 0, currRecord.CannId); foreach (KVPair kvpair in kvpaircoll) { ListItem lstItem = new ListItem(); lstItem.Text = kvpair.Val; lstItem.Value = kvpair.Key; if (kvpair.IsSelected == "1") { lstItem.Selected = true; } else { lstItem.Selected = false; } ucLanguageEdit.listBoxCtrl.Items.Add(lstItem); lstItem = null; } kvpaircoll = null; } //Collections List PubEntAdmin.UserControl.cslistbox ucCollectionsEdit = (PubEntAdmin.UserControl.cslistbox)e.Item.FindControl("ucCollectionsEdit"); if (ucCollectionsEdit != null) { kvpaircoll = DAL.cs_dal.GetKVPair("sp_CANNED_getCollections", 0, currRecord.CannId); foreach (KVPair kvpair in kvpaircoll) { ListItem lstItem = new ListItem(); lstItem.Text = kvpair.Val; lstItem.Value = kvpair.Key; if (kvpair.IsSelected == "1") { lstItem.Selected = true; } else { lstItem.Selected = false; } ucCollectionsEdit.listBoxCtrl.Items.Add(lstItem); lstItem = null; } kvpaircoll = null; } DropDownList ddlActiveEdit = (DropDownList)e.Item.FindControl("ddlActiveEdit"); if (ddlActiveEdit != null) { if (currRecord.Active == 1) { ddlActiveEdit.SelectedIndex = 0; } else { ddlActiveEdit.SelectedIndex = 1; } } #region SecurityCheck2 if (CannIdEdit != null) { this.SecurityCheck(1, CannIdEdit); } if (txtHeaderTextEdit != null) { this.SecurityCheck(3, txtHeaderTextEdit); } if (ucCancerTypeEdit != null) { ucCancerTypeEdit.SecurityCheck(); } if (ucSubjectEdit != null) { ucSubjectEdit.SecurityCheck(); } if (ucPubFormatEdit != null) { ucPubFormatEdit.SecurityCheck(); } if (ucRaceEdit != null) { ucRaceEdit.SecurityCheck(); } if (ucAudienceEdit != null) { ucAudienceEdit.SecurityCheck(); } if (ucLanguageEdit != null) { ucLanguageEdit.SecurityCheck(); } if (ucCollectionsEdit != null) { ucCollectionsEdit.SecurityCheck(); } if (ddlActiveEdit != null) { this.SecurityCheck(2, ddlActiveEdit); } #endregion #endregion } }