Ejemplo n.º 1
0
 private void bindingNavigatorDeleteItem_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(gudangIdLabel1.Text.Trim()))
     {
         if (MessageBox.Show("Anda yakin menghapus data?", "Konfirmasi Hapus Data", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
         {
             gud = (MGudang)DataMaster.GetObjectByProperty(typeof(MGudang), MGudang.ColumnNames.GudangId, Convert.ToInt32(gudangIdLabel1.Text));
             DataMaster.Delete(gud);
             ModuleControlSettings.SaveLog(ListOfAction.Delete, gudangNameTextBox.Text, ListOfTable.MGudang, lbl_UserName.Text);
             BindData();
         }
     }
 }
Ejemplo n.º 2
0
        internal static void FillGudangComboBox(ComboBox gudangIdComboBox)
        {
            DataMasterMgtServices DataMaster = new DataMasterMgtServices();

            gudangIdComboBox.DropDownStyle = ComboBoxStyle.DropDownList;

            DataTable dt = new DataTable();

            dt.Columns.Add(MGudang.ColumnNames.GudangId);
            dt.Columns.Add(MGudang.ColumnNames.GudangName);

            DataRow dr;

            IList listGudangType = DataMaster.GetAll(typeof(MGudang));

            MGudang gudang = new MGudang();

            //gudang.GudangId = 0;
            gudang.GudangName = "- Lokasi -";
            dr    = dt.NewRow();
            dr[0] = 0;
            dr[1] = gudang.GudangName;
            dt.Rows.Add(dr);

            for (int i = 0; i < listGudangType.Count; i++)
            {
                gudang = (MGudang)listGudangType[i];
                dr     = dt.NewRow();
                dr[0]  = gudang.GudangId;
                dr[1]  = gudang.GudangName;
                dt.Rows.Add(dr);
            }

            gudangIdComboBox.DataSource    = dt;
            gudangIdComboBox.DisplayMember = MGudang.ColumnNames.GudangName;
            gudangIdComboBox.ValueMember   = MGudang.ColumnNames.GudangId;
            gudangIdComboBox.Show();
        }
Ejemplo n.º 3
0
        private void bindingNavigatorSaveItem_Click(object sender, EventArgs e)
        {
            if (!ValidateForm())
            {
                return;
            }

            if (!(gudangIdLabel1.Text.Trim().Equals("0") || string.IsNullOrEmpty(gudangIdLabel1.Text.Trim())))
            {
                gud = (MGudang)DataMaster.GetObjectByProperty(typeof(MGudang), MGudang.ColumnNames.GudangId, Convert.ToInt32(gudangIdLabel1.Text));
            }
            else
            {
                gud = new MGudang();
            }

            gud.GudangName   = gudangNameTextBox.Text;
            gud.ModifiedBy   = lbl_UserName.Text;
            gud.ModifiedDate = DateTime.Now;

            DataMaster.SaveOrUpdate(gud);
            ModuleControlSettings.SaveLog(ListOfAction.Update, gudangNameTextBox.Text, ListOfTable.MGudang, lbl_UserName.Text);
            BindData();
        }