protected void uiDropDownListPackages_SelectedIndexChanged(object sender, EventArgs e)
        {
            uiCheckBoxListPackageOptions.ClearSelection();
            PackageOptionsLink options = new PackageOptionsLink();
            options.GetPackageOptionsLinksByPackageID(Convert.ToInt32(uiDropDownListPackages.SelectedValue));
            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();
            }
        }
        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;
                    }
                }
            }
        }
        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();
            }
        }
        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();
                }
            }
        }