private void BindData()
        {
            set = (MSetting)DataMaster.GetObjectByProperty(typeof(MSetting), MSetting.ColumnNames.SettingId, AppCode.AssemblyProduct);
            if (set != null)
            {
                mSettingDetail();
            }

            bilSet = (TBilliardSetting)DataMaster.GetObjectByProperty(typeof(TBilliardSetting), TBilliardSetting.ColumnNames.SettingId, AppCode.AssemblyProduct);
            if (bilSet != null)
            {
                billiardSettingDetail();
            }

            bonus = (TBonus)DataMaster.GetObjectByProperty(typeof(TBonus), TBonus.ColumnNames.SettingId, AppCode.AssemblyProduct);
            if (bonus != null)
            {
                bonusSettingDetail();
            }
        }
        private void buttonOK_Click(object sender, EventArgs e)
        {
            bool isSave = (set == null);

            if (isSave)
            {
                set = new MSetting();
            }

            set.AutoPrintSales  = autoPrintSalesCheckBox.Checked;
            set.CompanyAddress  = companyAddressTextBox.Text;
            set.CompanyAddress2 = companyAddress2TextBox.Text;

            if (label_ImageLogoLocation.Text != label_ImageLogoLocation.Name)
            {
                if (label_ImageLogoLocation.Text != tempFileLoc)
                {
                    FileInfo   f    = new FileInfo(label_ImageLogoLocation.Text);
                    FileStream fs   = f.OpenRead();
                    byte[]     data = new byte[fs.Length];
                    fs.Read(data, 0, int.Parse(fs.Length.ToString()));
                    fs.Flush();
                    fs.Close();

                    set.CompanyLogo = data;

                    fs.Dispose();
                }
            }

            if (label_ImageLogoLocation.Text == tempFileLoc)
            {
                try
                {
                    FileInfo f = new FileInfo(label_ImageLogoLocation.Text);
                    f.Directory.Delete(true);
                }
                catch (Exception)
                {
                }
            }

            set.CompanyFax     = companyFaxTextBox.Text;
            set.CompanyNpwp    = companyNpwpTextBox.Text;
            set.CompanyPkpDate = companyPkpDateDateTimePicker.Value;

            set.CompanyCity    = companyCityTextBox.Text;
            set.CompanyName    = companyNameTextBox.Text;
            set.CompanyTelp    = companyTelpTextBox.Text;
            set.AutoBackup     = autoBackupCheckBox.Checked;
            set.BackupDir      = backupDirTextBox.Text;
            set.FacturNoFormat = facturNoFormatTextBox.Text;
            set.FacturNoLength = Convert.ToInt32(facturNoLengthNumericUpDown.Value);
            set.SettingId      = AppCode.AssemblyProduct;
            set.ModifiedBy     = lbl_UserName.Text;
            set.ModifiedDate   = DateTime.Now;
            if (isSave)
            {
                DataMaster.SavePersistence(set);
            }
            else
            {
                DataMaster.UpdatePersistence(set);
            }

            isSave = (bilSet == null);
            if (isSave)
            {
                bilSet = new TBilliardSetting();
            }

            //price periode I
            bilSet.BiliardItemPrice     = biliardItemPriceNumericUpDown.Value;
            bilSet.BiliardItemPriceMini = biliardItemPriceMiniNumericUpDown.Value;
            bilSet.BiliardItemPriceVip  = biliardItemPriceVipNumericUpDown.Value;
            //hour
            bilSet.BiliardItemHourFrom1 = Convert.ToInt32(biliardItemHourFrom1NumericUpDown.Value);
            bilSet.BiliardItemHourTo1   = Convert.ToInt32(biliardItemHourTo1NumericUpDown.Value);

            //price periode II
            bilSet.BiliardItemPrice2     = biliardItemPrice2NumericUpDown.Value;
            bilSet.BiliardItemPriceMini2 = biliardItemPriceMini2NumericUpDown.Value;
            bilSet.BiliardItemPriceVip2  = biliardItemPriceVip2NumericUpDown.Value;
            //hour
            bilSet.BiliardItemHourFrom2 = Convert.ToInt32(biliardItemHourFrom2NumericUpDown.Value);
            bilSet.BiliardItemHourTo2   = Convert.ToInt32(biliardItemHourTo2NumericUpDown.Value);

            //price periode III
            bilSet.BiliardItemPrice3     = biliardItemPrice3NumericUpDown.Value;
            bilSet.BiliardItemPriceMini3 = biliardItemPriceMini3NumericUpDown.Value;
            bilSet.BiliardItemPriceVip3  = biliardItemPriceVip3NumericUpDown.Value;
            //hour
            bilSet.BiliardItemHourFrom3 = Convert.ToInt32(biliardItemHourFrom3NumericUpDown.Value);
            bilSet.BiliardItemHourTo3   = Convert.ToInt32(biliardItemHourTo3NumericUpDown.Value);


            bilSet.FullfillPrice = fullfillPriceNumericUpDown.Value;
            bilSet.RefereeBonus  = refereeBonusNumericUpDown.Value;
            bilSet.MinimumPlay   = minimumPlayNumericUpDown.Value;
            bilSet.QuitTimeout   = quitTimeoutNumericUpDown.Value;

            //wasit
            bilSet.UseReferee = useRefereeCheckBox.Checked;

            //waktu
            bilSet.ToleranceTime = toleranceTimeNumericUpDown.Value;
            bilSet.CalculateTime = calculateTimeNumericUpDown.Value;

            //setting meja common
            bilSet.BackColor         = ColorTranslator.ToWin32(splitContainer1.Panel1.BackColor);
            bilSet.DeskBackColor     = ColorTranslator.ToWin32(btn_Bil.BackColor);
            bilSet.DeskFontBold      = btn_Bil.Font.Bold;
            bilSet.DeskFontColor     = ColorTranslator.ToWin32(btn_Bil.ForeColor);
            bilSet.DeskFontItalic    = btn_Bil.Font.Italic;
            bilSet.DeskFontName      = btn_Bil.Font.Name;
            bilSet.DeskFontSize      = decimal.Parse(btn_Bil.Font.Size.ToString());
            bilSet.DeskFontUnderline = btn_Bil.Font.Underline;
            bilSet.DeskHeight        = btn_Bil.Height;
            bilSet.DeskWidth         = btn_Bil.Width;

            //booking
            bilSet.DeskBackColor1     = ColorTranslator.ToWin32(btn_Bil1.BackColor);
            bilSet.DeskFontBold1      = btn_Bil1.Font.Bold;
            bilSet.DeskFontColor1     = ColorTranslator.ToWin32(btn_Bil1.ForeColor);
            bilSet.DeskFontItalic1    = btn_Bil1.Font.Italic;
            bilSet.DeskFontName1      = btn_Bil1.Font.Name;
            bilSet.DeskFontSize1      = decimal.Parse(btn_Bil1.Font.Size.ToString());
            bilSet.DeskFontUnderline1 = btn_Bil1.Font.Underline;

            //booking
            bilSet.DeskBackColor2     = ColorTranslator.ToWin32(btn_Bil2.BackColor);
            bilSet.DeskFontBold2      = btn_Bil2.Font.Bold;
            bilSet.DeskFontColor2     = ColorTranslator.ToWin32(btn_Bil2.ForeColor);
            bilSet.DeskFontItalic2    = btn_Bil2.Font.Italic;
            bilSet.DeskFontName2      = btn_Bil2.Font.Name;
            bilSet.DeskFontSize2      = decimal.Parse(btn_Bil2.Font.Size.ToString());
            bilSet.DeskFontUnderline2 = btn_Bil2.Font.Underline;
            bilSet.ModifiedBy         = lbl_UserName.Text;
            bilSet.ModifiedDate       = DateTime.Now;
            bilSet.SettingId          = AppCode.AssemblyProduct;

            if (isSave)
            {
                DataMaster.SavePersistence(bilSet);
            }
            else
            {
                DataMaster.UpdatePersistence(bilSet);
            }

            isSave = (bonus == null);
            if (isSave)
            {
                bonus = new TBonus();
            }

            bonus.ItemId       = itemIdTextBox.Text;
            bonus.Quantity     = quantityNumericUpDown.Value;
            bonus.ModifiedBy   = lbl_UserName.Text;
            bonus.ModifiedDate = DateTime.Now;
            bonus.SettingId    = AppCode.AssemblyProduct;
            if (isSave)
            {
                DataMaster.SavePersistence(bonus);
            }
            else
            {
                DataMaster.UpdatePersistence(bonus);
            }

            BindData();

            MessageBox.Show(this.Text + " berhasil disimpan !!", AppCode.AssemblyProduct, MessageBoxButtons.OK, MessageBoxIcon.Information);
        }