private void BindData() { set = (MSetting)DataMaster.GetObjectByProperty(typeof(MSetting), MSetting.ColumnNames.SettingId, AppCode.AssemblyProduct); if (set != null) { mSettingDetail(); } else { companyPkpDateDateTimePicker.Value = DateTime.Today; } mot = (TGrosirSetting)DataMaster.GetObjectByProperty(typeof(TGrosirSetting), TGrosirSetting.ColumnNames.SettingId, AppCode.AssemblyProduct); if (mot != null) { motSettingDetail(); } }
private void btn_OK_Click(object sender, EventArgs e) { TGrosirSetting motorSet = null; if (pin == Pin.Discount) { motorSet = (TGrosirSetting)DataMaster.GetObjectByProperty(typeof(TGrosirSetting), TGrosirSetting.ColumnNames.SettingId, AppCode.AssemblyProduct, TGrosirSetting.ColumnNames.DiscountPin, discountPinTextBox.Text); } if (motorSet != 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 = (mot == null); if (isSave) { mot = new TGrosirSetting(); } mot.DefaultPiutangCreditLong = int.Parse(defaultPiutangCreditLongNumericUpDown.Value.ToString()); mot.DiscountPin = discountPinTextBox.Text; mot.ModifiedBy = lbl_UserName.Text; mot.ModifiedDate = DateTime.Now; mot.SettingId = AppCode.AssemblyProduct; if (isSave) { DataMaster.SavePersistence(mot); } else { DataMaster.UpdatePersistence(mot); } ModuleControlSettings.SaveLog(ListOfAction.Update, string.Empty, ListOfTable.MSetting, lbl_UserName.Text); BindData(); MessageBox.Show(this.Text + " berhasil disimpan !!", AppCode.AssemblyProduct, MessageBoxButtons.OK, MessageBoxIcon.Information); }