protected void grpPriceLevel_OnCheckedChanged(Object sender, EventArgs e) { RadioButton rdoPrice = (RadioButton)sender; DataListItem item = (DataListItem)rdoPrice.NamingContainer; HtmlInputCheckBox chkList = (HtmlInputCheckBox)item.FindControl("chkList"); Int64 iContactID = Int64.Parse(chkList.Value); PriceLevel enumPriceLevel = PriceLevel.SRP; switch (rdoPrice.ID) { case "rdoPrice": enumPriceLevel = PriceLevel.SRP; break; case "rdoWSPrice": enumPriceLevel = PriceLevel.WSPrice; break; case "rdoLevel1": enumPriceLevel = PriceLevel.One; break; case "rdoLevel2": enumPriceLevel = PriceLevel.Two; break; case "rdoLevel3": enumPriceLevel = PriceLevel.Three; break; case "rdoLevel4": enumPriceLevel = PriceLevel.Four; break; case "rdoLevel5": enumPriceLevel = PriceLevel.Five; break; } Contacts clsContacts = new Contacts(); clsContacts.UpdatePriceLevel(iContactID, enumPriceLevel); clsContacts.CommitAndDispose(); }
protected void rdoPriceLevelAll_CheckedChanged(Object sender, EventArgs e) { HtmlInputCheckBox chkList = null; RadioButton rdoPriceLevelAll = (RadioButton)sender; RadioButton rdoPrice = null; Int64 iContactID = 0; Contacts clsContacts = new Contacts(); PriceLevel enumPriceLevel = PriceLevel.SRP; foreach (DataListItem item in lstItem.Items) { chkList = (HtmlInputCheckBox)item.FindControl("chkList"); iContactID = Int64.Parse(chkList.Value); switch (rdoPriceLevelAll.ID) { case "rdoPriceAll": enumPriceLevel = PriceLevel.SRP; rdoPrice = (RadioButton)item.FindControl("rdoPrice"); break; case "rdoWSPriceAll": enumPriceLevel = PriceLevel.WSPrice; rdoPrice = (RadioButton)item.FindControl("rdoWSPrice"); break; case "rdoLevel1All": enumPriceLevel = PriceLevel.One; rdoPrice = (RadioButton)item.FindControl("rdoLevel1"); break; case "rdoLevel2All": enumPriceLevel = PriceLevel.Two; rdoPrice = (RadioButton)item.FindControl("rdoLevel2"); break; case "rdoLevel3All": enumPriceLevel = PriceLevel.Three; rdoPrice = (RadioButton)item.FindControl("rdoLevel3"); break; case "rdoLevel4All": enumPriceLevel = PriceLevel.Four; rdoPrice = (RadioButton)item.FindControl("rdoLevel4"); break; case "rdoLevel5All": enumPriceLevel = PriceLevel.Five; rdoPrice = (RadioButton)item.FindControl("rdoLevel5"); break; } clsContacts.UpdatePriceLevel(iContactID, enumPriceLevel); rdoPrice.Checked = rdoPriceLevelAll.Checked; } clsContacts.CommitAndDispose(); }