private void BindData() { set = (MSetting)DataMaster.GetObjectByProperty(typeof(MSetting), MSetting.ColumnNames.SettingId, AppCode.AssemblyProduct); if (set != null) { mSettingDetail(); } conSet = (TContractorSetting)DataMaster.GetObjectByProperty(typeof(TContractorSetting), TContractorSetting.ColumnNames.SettingId, AppCode.AssemblyProduct); if (conSet != null) { conSettingDetail(); } }
private void btn_OK_Click(object sender, EventArgs e) { TContractorSetting conSet = null; if (delPin == DeletePin.Giro) { conSet = (TContractorSetting)DataMaster.GetObjectByProperty(typeof(TContractorSetting), TContractorSetting.ColumnNames.SettingId, AppCode.AssemblyProduct, TContractorSetting.ColumnNames.GiroDeletePin, deletePinTextBox.Text); } else if (delPin == DeletePin.PO) { conSet = (TContractorSetting)DataMaster.GetObjectByProperty(typeof(TContractorSetting), TContractorSetting.ColumnNames.SettingId, AppCode.AssemblyProduct, TContractorSetting.ColumnNames.PoDeletePin, deletePinTextBox.Text); } if (conSet != null) { this.DialogResult = DialogResult.OK; this.Refresh(); this.Close(); } else { MessageBox.Show("Pin yang anda input salah.", "Pin Salah", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
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 = (conSet == null); if (isSave) { conSet = new TContractorSetting(); } conSet.GiroDeletePin = giroDeletePinTextBox.Text; conSet.PoDeletePin = poDeletePinTextBox.Text; conSet.CompanyNameFont = label_CompanyName.Font.Name; conSet.CompanyNameFontHeight = Convert.ToInt32(Math.Floor(Convert.ToDecimal(label_CompanyName.Font.Size))); conSet.CompanyNameColour = label_CompanyName.ForeColor.Name; conSet.SettingId = AppCode.AssemblyProduct; if (isSave) { DataMaster.SavePersistence(conSet); } else { DataMaster.UpdatePersistence(conSet); } ModuleControlSettings.SaveLog(ListOfAction.Update, string.Empty, ListOfTable.MSetting, lbl_UserName.Text); BindData(); MessageBox.Show("Konfigurasi Program berhasil disimpan.", AppCode.AssemblyProduct, MessageBoxButtons.OK, MessageBoxIcon.Information); }