private void ddlModelName_SelectedIndexChanged(object sender, EventArgs e) { if (ddlModelName.SelectedIndex != -1) { SparePartsInfoBL bl = new SparePartsInfoBL(); ComboboxItem item = (ComboboxItem)ddlModelName.SelectedItem; if (item != null) { var vehicleinfo = bl.GetSparePartsInfo(Convert.ToInt32(item.Value)); txtShowRoomPrice.Text = vehicleinfo.ShowRoomPrice.ToString(); txtMarginPrice.Text = vehicleinfo.MarginPrice.ToString(); } } }
private void PopulateSparePartstype(int SparePartsInfoID) { SparePartsInfoBL obj = new SparePartsInfoBL(); var SparePartsInfo = obj.GetSparePartsInfo(SparePartsInfoID); var SparePartsType = obj.GetSparePartsTypes().Where(vt => vt.SparePartsTypeID == SparePartsInfo.SparePartsTypeID).FirstOrDefault(); ComboboxItem selitem = new ComboboxItem(); selitem.Text = SparePartsType.Description; selitem.Value = SparePartsType.SparePartsTypeID; ddlSparePartsType.Text = selitem.Text; txtModelCode.Text = SparePartsInfo.ModelCode; txtModelName.Text = SparePartsInfo.ModelName; txtShowRoomPrice.Text = SparePartsInfo.ShowRoomPrice.ToString(); txtMarginPrice.Text = SparePartsInfo.MarginPrice.ToString(); }