private void UpdateRecord() { Packages objData = CurrentPackage; objData.EnName = uiTextBoxEnName.Text; objData.ArName = uiTextBoxArName.Text; objData.EnDescription = uiTextBoxEnDesc.Text; objData.ArDescription = uiTextBoxArDesc.Text; objData.Save(); foreach (ListItem item in uiCheckBoxListPackageOptions.Items) { if (item.Selected) { try { PackageOptionsLink Options = new PackageOptionsLink(); Options.AddNew(); Options.PackageID = objData.PackageID; Options.PackageOptionID = Convert.ToInt32(item.Value); Options.Save(); } catch (Exception ex) { continue; } } else { try { PackageOptionsLink Options = new PackageOptionsLink(); Options.LoadByPrimaryKey(objData.PackageID, Convert.ToInt32(item.Value)); Options.MarkAsDeleted(); Options.Save(); } catch (Exception ex) { continue; } } } }
private void AddNewRecord() { Packages objData = new Packages(); objData.AddNew(); objData.EnName = uiTextBoxEnName.Text; objData.ArName = uiTextBoxArName.Text; objData.EnDescription = uiTextBoxEnDesc.Text; objData.ArDescription = uiTextBoxArDesc.Text; objData.Save(); foreach (ListItem item in uiCheckBoxListPackageOptions.Items) { if (item.Selected) { PackageOptionsLink Options = new PackageOptionsLink(); Options.AddNew(); Options.PackageID = objData.PackageID; Options.PackageOptionID = Convert.ToInt32(item.Value); Options.Save(); } } }