public static string GenerateFacturNo(string DeskNo) { DataMasterMgtServices DataMaster = new DataMasterMgtServices(); MSetting set = (MSetting)DataMaster.GetObjectByProperty(typeof(MSetting), MSetting.ColumnNames.SettingId, AssemblyProduct); //IList listTrans = DataMaster.GetAll(typeof(TTransaction)); string facturNoTemplate = set.FacturNoFormat; //int no = listTrans.Count + 1; int no = Convert.ToInt32(set.FacturNoNext) + 1; int len = set.FacturNoLength - no.ToString().Length; string factur = no.ToString(); for (int i = 0; i < len; i++) { factur = "0" + factur; } //update next faktur set.FacturNoNext = set.FacturNoNext + 1; DataMaster.UpdatePersistence(set); return(facturNoTemplate.Replace("[xxx]", factur).Replace("[meja]", DeskNo).Replace("[tanggal]", DateTime.Now.Day.ToString()).Replace("[bulan]", DateTime.Now.Month.ToString()).Replace("[tahun]", DateTime.Now.Year.ToString())); }
private void buttonOK_Click(object sender, EventArgs e) { MSetting set = (MSetting)DataMaster.GetObjectByProperty(typeof(MSetting), MSetting.ColumnNames.SettingId, AppCode.AssemblyProduct); set.AutoPrintSales = autoPrintSalesCheckBox.Checked; set.CompanyAddress = companyAddressTextBox.Text; set.CompanyCity = companyCityTextBox.Text; set.CompanyName = companyNameTextBox.Text; set.CompanyTelp = companyTelpTextBox.Text; set.AutoBackup = autoBackupCheckBox.Checked; set.BackupDir = backupDirTextBox.Text; set.FacturNoFormat = facturNoFormatTextBox.Text; DataMaster.UpdatePersistence(set); TBilliardSetting tbil = (TBilliardSetting)DataMaster.GetObjectByProperty(typeof(TBilliardSetting), TBilliardSetting.ColumnNames.SettingId, AppCode.AssemblyProduct); tbil.BiliardItemPrice = biliardItemPriceNumericUpDown.Value; tbil.BiliardItemPriceMini = biliardItemPriceMiniNumericUpDown.Value; tbil.BiliardItemPriceVip = biliardItemPriceVipNumericUpDown.Value; tbil.FullfillPrice = fullfillPriceNumericUpDown.Value; tbil.MinimumPlay = minimumPlayNumericUpDown.Value; tbil.QuitTimeout = quitTimeoutNumericUpDown.Value; DataMaster.UpdatePersistence(tbil); BindData(); }
public FormMain() { InitializeComponent(); this.Icon = Properties.Resources.billiard; this.Text = AppCode.AssemblyProduct; this.WindowState = FormWindowState.Maximized; toolStripStatusLabel_CompanyName.Text = ""; try { MSetting set = (MSetting)DataMaster.GetObjectByProperty(typeof(MSetting), MSetting.ColumnNames.SettingId, AppCode.AssemblyProduct); if (set != null) { toolStripStatusLabel_CompanyName.Text = "Registered to : " + set.CompanyName + " "; } //f_Bil.Show(dockPanel1); m_deserializeDockContent = new DeserializeDockContent(GetContentFromPersistString); Extender.SetSchema(dockPanel1, Extender.Schema.VS2005); } catch (Exception) { } }
public FormMain() { InitializeComponent(); this.MinimumSize = new Size(this.Size.Width, this.Size.Height); this.Icon = Properties.Resources.inventori_ico; try { set = (MSetting)DataMaster.GetObjectByProperty(typeof(MSetting), MSetting.ColumnNames.SettingId, AppCode.AssemblyProduct); if (set != null) { this.Text = AppCode.AssemblyTitle + "-" + set.CompanyName; } else { this.Text = AppCode.AssemblyTitle + "-" + "Demo Version "; set.CompanyName = "Demo Version"; } } catch (Exception) { this.Text = AppCode.AssemblyTitle + "-" + "Demo Version "; } SetEvent(); }
public FormLoginForApotek() { InitializeComponent(); DataMasterMgtServices DataMaster = new DataMasterMgtServices(); MSetting set = (MSetting)DataMaster.GetObjectByProperty(typeof(MSetting), MSetting.ColumnNames.SettingId, AppCode.AssemblyProduct); this.Text = AppCode.AssemblyProduct + " " + set.CompanyName; this.Icon = Properties.Resources.logo_apotek_ico; }
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(); }
private void buttonOK_Click(object sender, EventArgs e) { //set = (MSetting)DataMaster.GetObjectByProperty(typeof(MSetting), MSetting.ColumnNames.SettingId, AppCode.AssemblyProduct); bool isSave = (set == null); if (isSave) { set = new MSetting(); } set.AutoPrintSales = autoPrintSalesCheckBox.Checked; set.CompanyAddress = companyAddressTextBox.Text; 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.SettingId = AppCode.AssemblyProduct; set.ModifiedBy = lbl_UserName.Text; set.ModifiedDate = DateTime.Now; if (isSave) { DataMaster.SavePersistence(set); } else { DataMaster.UpdatePersistence(set); } isSave = (cafeSet == null); if (isSave) { cafeSet = new TCafeSetting(); } cafeSet.ExportedDir = exportedDirTextBox.Text; cafeSet.DiscountPassword = discountPasswordTextBox.Text; cafeSet.TelpNoSaranKritik = telpNoSaranKritikTextBox.Text; cafeSet.SettingId = AppCode.AssemblyProduct; cafeSet.ModifiedBy = lbl_UserName.Text; cafeSet.ModifiedDate = DateTime.Now; if (isSave) { DataMaster.SavePersistence(cafeSet); } else { DataMaster.UpdatePersistence(cafeSet); } ModuleControlSettings.SaveLog(ListOfAction.Update, string.Empty, ListOfTable.MSetting, lbl_UserName.Text); BindData(); }
private void BindData() { set = (MSetting)DataMaster.GetObjectByProperty(typeof(MSetting), MSetting.ColumnNames.SettingId, AppCode.AssemblyProduct); if (set != null) { mSettingDetail(); } cafeSet = (TCafeSetting)DataMaster.GetObjectByProperty(typeof(TCafeSetting), TCafeSetting.ColumnNames.SettingId, AppCode.AssemblyProduct); if (cafeSet != null) { cafeSettingDetail(); } }
public FormLogin() { InitializeComponent(); DataMasterMgtServices DataMaster = new DataMasterMgtServices(); MSetting set = (MSetting)DataMaster.GetObjectByProperty(typeof(MSetting), MSetting.ColumnNames.SettingId, AppCode.AssemblyProduct); if (set != null) { this.Text = AppCode.AssemblyProduct + " " + set.CompanyName; } this.Icon = Properties.Resources.inventori_ico; this.Load += new EventHandler(FormLogin_Load); this.Shown += new EventHandler(FormLogin_Shown); buttonOK.Click += new EventHandler(buttonOK_Click); }
private void BindData() { set = (MSetting)DataMaster.GetObjectByProperty(typeof(MSetting), MSetting.ColumnNames.SettingId, AppCode.AssemblyProduct); if (set != null) { mSettingDetail(); } else { companyPkpDateDateTimePicker.Value = DateTime.Today; } mot = (TMotorSetting)DataMaster.GetObjectByProperty(typeof(TMotorSetting), TMotorSetting.ColumnNames.SettingId, AppCode.AssemblyProduct); if (mot != null) { motSettingDetail(); } }
public FormLoginForGrosirMitra() { InitializeComponent(); DataMasterMgtServices DataMaster = new DataMasterMgtServices(); MSetting set = (MSetting)DataMaster.GetObjectByProperty(typeof(MSetting), MSetting.ColumnNames.SettingId, AppCode.AssemblyProduct); if (set != null) { this.Text = AppCode.AssemblyProduct + " " + set.CompanyName; } else { this.Text = AppCode.AssemblyProduct; } this.Icon = Properties.Resources.monitor_ico; pictureBox1.Image = Properties.Resources.monitor; }
public static string GenerateFacturNo(ListOfTransaction tr, string DeskNo) { DataMasterMgtServices DataMaster = new DataMasterMgtServices(); MSetting set = (MSetting)DataMaster.GetObjectById(typeof(MSetting), AssemblyProduct); TReference refer = (TReference)DataMaster.GetObjectByProperty(typeof(TReference), TReference.ColumnNames.ReferenceType, tr.ToString()); if (refer == null) { refer = new TReference(); refer.NextId = decimal.Zero.ToString(); } string facturNoTemplate = set.FacturNoFormat; decimal no = Convert.ToDecimal(refer.NextId) + 1; int len = set.FacturNoLength - no.ToString().Length; string factur = no.ToString(); for (int i = 0; i < len; i++) { factur = "0" + factur; } refer.NextId = no.ToString(); refer.ReferenceType = tr.ToString(); DataMaster.SaveOrUpdate(refer); string tipeTrans = string.Empty; char[] charTransArray = tr.ToString().ToCharArray(); char charTrans; for (int i = 0; i < tr.ToString().Length; i++) { charTrans = charTransArray[i]; if (char.IsUpper(tr.ToString(), i)) { tipeTrans += tr.ToString().Substring(i, 1); } } return(facturNoTemplate.Replace("[xxx]", factur).Replace("[meja]", DeskNo).Replace("[tanggal]", DateTime.Now.Day.ToString()).Replace("[bulan]", DateTime.Now.Month.ToString()).Replace("[tahun]", DateTime.Now.Year.ToString()).Replace("[Tipe]", tipeTrans)); }
private void AutoBackup() { MSetting set = (MSetting)DataMaster.GetObjectById(typeof(MSetting), AppCode.AssemblyProduct); if (set.AutoBackup) { if (f_BackupDB != null) { if (!f_BackupDB.IsDisposed) { //f_BackupDB.WindowState = FormWindowState.Normal; //f_BackupDB.BringToFront(); f_BackupDB.Close(); f_BackupDB = new FormBackupDatabase(); } else { f_BackupDB = new FormBackupDatabase(); } } else { f_BackupDB = new FormBackupDatabase(); } string BackupFileExtention = "backup"; f_BackupDB.txt_BackupFile.Text = set.BackupDir + "\\" + DateTime.Now.ToString("yyyyMMddHHmmss.") + BackupFileExtention; f_BackupDB.lbl_Auto.Text = set.AutoBackup.ToString(); f_BackupDB.ShowDialog(); } //e.Cancel = false; //Application.Exit(); //try //{ // System.Environment.Exit(1); //} //catch (Exception) //{ //} }
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 FormMainForCafe_Load(object sender, EventArgs e) { try { DataMasterMgtServices DataMaster = new DataMasterMgtServices(); MSetting set = (MSetting)DataMaster.GetObjectByProperty(typeof(MSetting), MSetting.ColumnNames.SettingId, AppCode.AssemblyProduct); if (set != null) { toolStripStatusLabel_CompanyName.Text = set.CompanyName; } else { toolStripStatusLabel_CompanyName.Text = "Demo "; } } catch (Exception) { toolStripStatusLabel_CompanyName.Text = "Demo"; } }
private void button3_Click(object sender, EventArgs e) { if (!ValidateFormHeader()) { return; } if (lbl_TempTransaction.Text.Equals(ListOfTransaction.Sales.ToString()) || lbl_TempTransaction.Text.Equals(ListOfTransaction.SalesVIP.ToString())) { set = (MSetting)DataMaster.GetObjectByProperty(typeof(MSetting), MSetting.ColumnNames.SettingId, AppCode.AssemblyProduct); if (set != null) { if (set.AutoPrintSales) { PrintFactur(); } else { DialogResult res = MessageBox.Show("Cetak faktur penjualan?", "Konfirmasi cetak faktur penjualan", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question); if (res == DialogResult.Yes) { PrintFactur(); } else if (res == DialogResult.No) { SaveTransactionInterface(); } } } else { SaveTransactionInterface(); } } else { SaveTransactionInterface(); } }
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); }
public static string GenerateFacturNo(ListOfTransaction tr, string DeskNo) { //return ""; DataMasterMgtServices DataMaster = new DataMasterMgtServices(); MSetting set = (MSetting)DataMaster.GetObjectByProperty(typeof(MSetting), MSetting.ColumnNames.SettingId, AssemblyProduct); if (set != null) { IList listTrans = DataMaster.GetListEq(typeof(TTransaction), TTransaction.ColumnNames.TransactionStatus, tr.ToString()); string facturNoTemplate = set.FacturNoFormat; int no = listTrans.Count + 1; int len = set.FacturNoLength - no.ToString().Length; string factur = no.ToString(); for (int i = 0; i < len; i++) { factur = "0" + factur; } string typeTrans = ""; switch (tr) { case ListOfTransaction.Correction: typeTrans = "Kor"; break; case ListOfTransaction.Purchase: typeTrans = "P"; break; case ListOfTransaction.PurchaseOrder: typeTrans = "PO"; break; case ListOfTransaction.ReturPurchase: typeTrans = "RP"; break; case ListOfTransaction.ReturSales: typeTrans = "RS"; break; case ListOfTransaction.ReturSalesVIP: typeTrans = "RSVIP"; break; case ListOfTransaction.Sales: typeTrans = "S"; break; case ListOfTransaction.SalesVIP: typeTrans = "SVIP"; break; case ListOfTransaction.Usage: typeTrans = "U"; break; default: break; } return(facturNoTemplate.Replace("[xxx]", factur).Replace("[meja]", DeskNo).Replace("[tanggal]", DateTime.Now.Day.ToString()).Replace("[bulan]", DateTime.Now.Month.ToString()).Replace("[tahun]", DateTime.Now.Year.ToString()).Replace("[TipeTransaksi]", typeTrans)); } else { return(""); } }
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); }
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); }
private void FormTransaction_Load(object sender, EventArgs e) { //set numeric updown ModuleControlSettings.SetNumericUpDown(num_Quantity); ModuleControlSettings.SetNumericUpDown(num_Jumlah, true); ModuleControlSettings.SetNumericUpDown(num_Disc); ModuleControlSettings.SetNumericUpDown(num_Total, true); ModuleControlSettings.SetNumericUpDown(num_Tax); ModuleControlSettings.SetNumericUpDown(num_TaxValue); ModuleControlSettings.SetNumericUpDown(num_GrandTotal, true); ModuleControlSettings.SetNumericUpDown(num_Pay); ModuleControlSettings.SetNumericUpDown(num_Back, true); num_Back.Minimum = decimal.MinValue; for (int i = 0; i < 7; i++) { grid_Trans.Columns.Add(i.ToString(), i.ToString()); } // Mengatur lebar kolom grid_Trans.Columns[0].Width = 192 - 1; grid_Trans.Columns[1].Width = 223; grid_Trans.Columns[2].Width = 65; grid_Trans.Columns[3].Width = 73 - 1; grid_Trans.Columns[4].Width = 101 - 1; grid_Trans.Columns[5].Width = 60 - 1; grid_Trans.Columns[6].Width = 89; grid_Trans.Columns[0].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft; grid_Trans.Columns[1].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft; ModuleControlSettings.SetDateTimePicker(dt_TransactionDate); dt_TransactionDate.Value = DateTime.Now; txt_TransactionId.Text = DateTime.Now.ToFileTimeUtc().ToString(); MSetting set = (MSetting)DataMaster.GetObjectByProperty(typeof(MSetting), MSetting.ColumnNames.SettingId, AppCode.AssemblyProduct); if (set != null) { lbl_ShopName.Text = set.CompanyName; lbl_ShopAddress.Text = set.CompanyAddress + " " + set.CompanyCity; lbl_ShopTelp.Text = "Telp : " + set.CompanyTelp; } //set location shop header float shopWidth = (lbl_ShopName.Text.Length * (lbl_ShopName.Font.Size - 2)); float xShop = (groupBox5.Width / 2) - (shopWidth / 2) + groupBox5.Location.X; lbl_ShopName.Location = new Point(Convert.ToInt32(xShop), lbl_ShopName.Location.Y); shopWidth = (lbl_ShopAddress.Text.Length * (lbl_ShopAddress.Font.Size - 2)); xShop = (groupBox5.Width / 2) - (shopWidth / 2) + groupBox5.Location.X; lbl_ShopAddress.Location = new Point(Convert.ToInt32(xShop), lbl_ShopAddress.Location.Y); shopWidth = (lbl_ShopTelp.Text.Length * (lbl_ShopTelp.Font.Size - 2)); xShop = (groupBox5.Width / 2) - (shopWidth / 2) + groupBox5.Location.X; lbl_ShopTelp.Location = new Point(Convert.ToInt32(xShop), lbl_ShopTelp.Location.Y); SetInitialSettings(); detailControl_KeyDown(null, null); //show tunai group box if (!(lbl_TempTransaction.Text.Equals(ListOfTransaction.Sales.ToString()) || lbl_TempTransaction.Text.Equals(ListOfTransaction.SalesVIP.ToString()))) { lbl_Pay.Visible = false; num_Pay.Visible = false; lbl_Back.Visible = false; num_Back.Visible = false; } if (lbl_TempTransaction.Text.Equals(ListOfTransaction.Sales.ToString()) || lbl_TempTransaction.Text.Equals(ListOfTransaction.ReturSales.ToString()) || lbl_TempTransaction.Text.Equals(ListOfTransaction.SalesVIP.ToString()) || lbl_TempTransaction.Text.Equals(ListOfTransaction.ReturSalesVIP.ToString())) { lbl_Customer.Text = "Pelanggan :"; if (lbl_TempTransaction.Text.Equals(ListOfTransaction.Sales.ToString()) || lbl_TempTransaction.Text.Equals(ListOfTransaction.SalesVIP.ToString())) { ModuleControlSettings.SetNumericUpDown(num_Price, true); } } else if (lbl_TempTransaction.Text.Equals(ListOfTransaction.Correction.ToString())) { SetFormToCorrection(); } else { lbl_Customer.Text = "Supplier :"; } PictureBox searchPic = new PictureBox(); ModuleControlSettings.SetSearchPictureBox(txt_CustId, ListOfSearchWindow.SearchCustomer.ToString(), searchPic); searchPic.Click += new EventHandler(searchPicCustomer_Click); txt_CustId.Controls.Add(searchPic); searchPic = new PictureBox(); ModuleControlSettings.SetSearchPictureBox(txt_ItemId, ListOfSearchWindow.SearchItem.ToString(), searchPic); searchPic.Click += new EventHandler(searchPicItem_Click); txt_ItemId.Controls.Add(searchPic); string j = "Penjualan"; if (lbl_TempTransaction.Text.Equals(ListOfTransaction.Sales.ToString()) || lbl_TempTransaction.Text.Equals(ListOfTransaction.SalesVIP.ToString())) { j = "Penjualan"; } else if (lbl_TempTransaction.Text.Equals(ListOfTransaction.ReturSales.ToString()) || lbl_TempTransaction.Text.Equals(ListOfTransaction.ReturSalesVIP.ToString())) { j = "Retur Penjualan"; } else if (lbl_TempTransaction.Text.Equals(ListOfTransaction.Purchase.ToString())) { j = "Pembelian"; } else if (lbl_TempTransaction.Text.Equals(ListOfTransaction.ReturPurchase.ToString())) { j = "Retur Pembelian"; } else if (lbl_TempTransaction.Text.Equals(ListOfTransaction.Correction.ToString())) { j = "Penyesuaian"; } this.TabText = j; this.Text = j; //fill suggest textbox ModuleControlSettings.FillItemSuggestSource(txt_ItemId); if (lbl_TempTransaction.Text.Equals(ListOfTransaction.Sales.ToString()) || lbl_TempTransaction.Text.Equals(ListOfTransaction.ReturSales.ToString()) || lbl_TempTransaction.Text.Equals(ListOfTransaction.SalesVIP.ToString()) || lbl_TempTransaction.Text.Equals(ListOfTransaction.ReturSalesVIP.ToString())) { ModuleControlSettings.SetCustomerTextBoxSuggest(txt_CustId); } else { ModuleControlSettings.SetSupplierTextBoxSuggest(txt_CustId); } }