コード例 #1
0
        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;
                    }
                }
            }
        }
コード例 #2
0
        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();
                }
            }
        }