Exemplo n.º 1
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         ServiceInventoryItems _service = new ServiceInventoryItems();
         if (this.ValidateChildren())
         {
             if (this.InventoryLevelDetailID == 0)
             {
                 TBL_MP_Master_Inventory_Level_Details newDetail = new TBL_MP_Master_Inventory_Level_Details();
                 newDetail.Fk_Inv_Level_ID       = this.InventoryLevelID;
                 newDetail.Inv_Level_Description = newDetail.Inv_Level_Value = txtLevelDetailName.Text.Trim();
                 newDetail.IsActive          = true;
                 this.InventoryLevelDetailID = _service.AddNewInventoryLevelDetail(newDetail);
             }
             else
             {
                 TBL_MP_Master_Inventory_Level_Details detail = _service.GetInventoryLevelDetailDBItem(this.InventoryLevelDetailID);
                 if (detail != null)
                 {
                     detail.Fk_Inv_Level_ID       = this.InventoryLevelID;
                     detail.Inv_Level_Description = detail.Inv_Level_Value = txtLevelDetailName.Text.Trim();
                     _service.UpdateInventoryLevelDetail(detail);
                 }
             }
             this.DialogResult = DialogResult.OK;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "frmAddEditInventoryLevelDetail::btnSave_Click", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Exemplo n.º 2
0
 private void PrepareForm()
 {
     try
     {
         ServiceInventoryItems _service = new ServiceInventoryItems();
         if (this.InventoryLevelID != 0)
         {
             TBL_MP_Master_Inventory_Level_Details level = _service.GetInventoryLevelDetailDBItem(this.InventoryLevelDetailID);
             if (level != null)
             {
                 txtLevelDetailName.Text = level.Inv_Level_Description;
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "frmAddEditInventoryLevelDetail::PrepareForm", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }