private void bindingNavigatorDeleteItem_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(supplierIdTextBox.Text.Trim())) { if (MessageBox.Show("Anda yakin menghapus data?", "Konfirmasi Hapus Data", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) { supp = (MSupplier)DataMaster.GetObjectById(typeof(MSupplier), supplierIdTextBox.Text); DataMaster.Delete(supp); IList listAcc = DataMaster.GetListEq(typeof(MSupplierAccount), MSupplierAccount.ColumnNames.SupplierId, supplierIdTextBox.Text); MSupplierAccount suppAcc; for (int i = 0; i < listAcc.Count; i++) { suppAcc = (MSupplierAccount)listAcc[i]; if (suppAcc != null) { DataMaster.Delete(suppAcc); } } ModuleControlSettings.SaveLog(ListOfAction.Delete, supplierIdTextBox.Text, ListOfTable.MSupplier, lbl_UserName.Text); BindData(); } } }
private void bindingNavigatorDeleteItem_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(bilIdTextBox.Text.Trim())) { if (MessageBox.Show("Anda yakin menghapus data?", "Konfirmasi Hapus Data", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) { desk = (MDesk)DataMaster.GetObjectById(typeof(MDesk), bilIdTextBox.Text); DataMaster.Delete(desk); BindData(); } } }
private void bindingNavigatorDeleteItem_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(employeeIdTextBox.Text.Trim())) { if (MessageBox.Show("Anda yakin menghapus data?", "Konfirmasi Hapus Data", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) { emp = (MEmployee)DataMaster.GetObjectById(typeof(MEmployee), employeeIdTextBox.Text); DataMaster.Delete(emp); ModuleControlSettings.SaveLog(ListOfAction.Delete, employeeIdTextBox.Text, ListOfTable.MEmployee, lbl_UserName.Text); BindData(); } } }
private void bindingNavigatorDeleteItem_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(itemIdTextBox.Text.Trim())) { if (MessageBox.Show("Anda yakin menghapus data?", "Konfirmasi Hapus Data", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) { item = (MItem)DataMaster.GetObjectById(typeof(MItem), itemIdTextBox.Text); DataMaster.Delete(item); ItemGudangStok stok = (ItemGudangStok)DataMaster.GetObjectByProperty(typeof(ItemGudangStok), ItemGudangStok.ColumnNames.ItemId, itemIdTextBox.Text, ItemGudangStok.ColumnNames.GudangId, defaultGudangIdComboBox.SelectedValue); DataMaster.Delete(stok); } } }
private void bindingNavigatorSaveItem_Click(object sender, EventArgs e) { if (!ValidateForm()) { return; } if (!(groupIdLabel1.Text.Trim().Equals("0") || string.IsNullOrEmpty(groupIdLabel1.Text.Trim()))) { group = (MGroup)DataMaster.GetObjectById(typeof(MGroup), Convert.ToInt32(groupIdLabel1.Text)); } else { group = new MGroup(); } group.GroupName = groupNameTextBox.Text; group.ModifiedBy = lbl_UserName.Text; group.ModifiedDate = DateTime.Now; DataMaster.SaveOrUpdate(group); ModuleControlSettings.SaveLog(ListOfAction.Update, groupNameTextBox.Text, ListOfTable.MGroup, lbl_UserName.Text); BindData(); }
private void bindingNavigatorSaveItem_Click(object sender, EventArgs e) { if (!ValidateForm()) { return; } if (itemIdTextBox.Enabled == true) { item = new MItem(); } else { item = (MItem)DataMaster.GetObjectById(typeof(MItem), itemIdTextBox.Text); } item.DefaultGudangId = 0; item.GroupId = 0; item.ItemCommision = decimal.Zero; item.ItemDesc = itemDescTextBox.Text; item.ItemId = itemIdTextBox.Text; item.ItemName = itemNameTextBox.Text; item.ItemPriceMax = itemPriceMaxNumericUpDown.Value; item.ItemPriceMaxVip = decimal.Zero; item.ItemPriceMin = decimal.Zero; item.ItemPriceMinVip = decimal.Zero; item.ItemPricePurchase = decimal.Zero; //item.ItemPricePurchaseAvg item.ItemSatuan = string.Empty; item.ItemTypeId = 2; item.SupplierId = string.Empty; item.ModifiedBy = lbl_UserName.Text; item.ModifiedDate = DateTime.Now; if (itemIdTextBox.Enabled == true) { try { DataMaster.SavePersistence(item); } catch (NHibernate.NonUniqueObjectException) { RecreateBalloon(); balloonHelp.Caption = "Validasi data kurang"; balloonHelp.Content = "Service dengan kode " + itemIdTextBox.Text + " sudah pernah diinput, silahkan input dengan kode yang lain"; balloonHelp.ShowBalloon(itemIdTextBox); itemIdTextBox.Focus(); return; } ModuleControlSettings.SaveLog(ListOfAction.Insert, itemIdTextBox.Text, ListOfTable.MItem, lbl_UserName.Text); } else { DataMaster.UpdatePersistence(item); ModuleControlSettings.SaveLog(ListOfAction.Update, itemIdTextBox.Text, ListOfTable.MItem, lbl_UserName.Text); } BindData(); }
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) //{ //} }