protected void uiButtonUpdate_Click(object sender, EventArgs e) { if (CurrentPackage != null) { UpdateRecord(); } else { AddNewRecord(); } uiPanelEdit.Visible = false; uiPanelViewPackages.Visible = true; BindData(); Clearfields(); CurrentPackage = null; }
protected void uiGridViewPackages_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "EditPackage") { Packages objData = new Packages(); objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString())); uiTextBoxEnName.Text = objData.EnName; uiTextBoxArName.Text = objData.ArName; uiTextBoxEnDesc.Text = objData.EnDescription; uiTextBoxArDesc.Text = objData.ArDescription; PackageOptionsLink options = new PackageOptionsLink (); options.GetPackageOptionsLinksByPackageID(objData.PackageID); for (int i = 0; i < options.RowCount; i++) { foreach (ListItem item in uiCheckBoxListPackageOptions.Items) { if (item.Value == options.PackageOptionID.ToString()) { item.Selected = true; break; } } options.MoveNext(); } uiPanelViewPackages.Visible = false; uiPanelEdit.Visible = true; CurrentPackage = objData; } else if (e.CommandName == "DeletePackage") { Packages objData = new Packages(); objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString())); objData.MarkAsDeleted(); objData.Save(); CurrentPackage = null; BindData(); } }