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

            apoSet = (TApotekSetting)DataMaster.GetObjectByProperty(typeof(TApotekSetting), TApotekSetting.ColumnNames.SettingId, AppCode.AssemblyProduct);
            if (apoSet != null)
            {
                apoSettingDetail();
            }
        }
Exemplo n.º 2
0
        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);
            }

            //apotek setting
            isSave = (apoSet == null);
            if (isSave)
            {
                apoSet = new TApotekSetting();
            }

            apoSet.DefaultPiutangCreditLong = Convert.ToInt32(defaultPiutangCreditLongNumericUpDown.Value);
            apoSet.SettingId    = AppCode.AssemblyProduct;
            apoSet.ModifiedBy   = lbl_UserName.Text;
            apoSet.ModifiedDate = DateTime.Now;

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

            ModuleControlSettings.SaveLog(ListOfAction.Update, string.Empty, ListOfTable.MSetting, lbl_UserName.Text);
            BindData();

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