Ejemplo 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);
     }
 }
 private void PrepareForm()
 {
     try
     {
         ServiceInventoryItems _service = new ServiceInventoryItems();
         if (this.CategoryID != 0)
         {
             TBL_MP_Master_Inventory_Category cat = _service.GetInventoryCategoriesDBItem(this.CategoryID);
             if (cat != null)
             {
                 this.Text = "Add New Specification for " + cat.Inv_Category;
                 int newSequence = _service.GetGetNextSequenceNumberOfInventoryLevelForCategory(CategoryID);
                 txtSequence.Text = newSequence.ToString();
             }
         }
         if (this.InventoryLevelID != 0)
         {
             TBL_MP_Master_Inventory_Level level = _service.GetInventoryLevelDBItem(this.InventoryLevelID);
             if (level != null)
             {
                 txtLevelName.Text = level.Inventory_Level;
                 txtSequence.Text  = level.Sequence.ToString();
             }
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
 private void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         ServiceInventoryItems _service = new ServiceInventoryItems();
         if (this.ValidateChildren())
         {
             if (this.InventoryLevelID == 0)
             {
                 TBL_MP_Master_Inventory_Level newLevel = new TBL_MP_Master_Inventory_Level();
                 newLevel.Fk_InvCategory_ID = this.CategoryID;
                 newLevel.Inventory_Level   = txtLevelName.Text.Trim();
                 newLevel.Sequence          = int.Parse(txtSequence.Text);
                 newLevel.IsActive          = true;
                 this.InventoryLevelID      = _service.AddNewInventoryLevel(newLevel);
             }
             else
             {
                 TBL_MP_Master_Inventory_Level level = _service.GetInventoryLevelDBItem(this.InventoryLevelID);
                 if (level != null)
                 {
                     level.Fk_InvCategory_ID = this.CategoryID;
                     level.Inventory_Level   = txtLevelName.Text.Trim();
                     level.Sequence          = int.Parse(txtSequence.Text);
                     _service.UpdateInventoryLevel(level);
                 }
             }
             this.DialogResult = DialogResult.OK;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "frmAddEditInventoryLevel::btnSave_Click", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Ejemplo n.º 4
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            TBL_MP_Master_Inventory_Category model = null;

            try
            {
                if (this.ValidateChildren())
                {
                    this.Cursor = Cursors.WaitCursor;
                    ServiceInventoryItems _service = new ServiceInventoryItems();

                    if (this.CategoryID == 0)
                    {
                        model              = new TBL_MP_Master_Inventory_Category();
                        model.FK_BranchID  = Program.CURR_USER.BranchID;
                        model.FK_CompanyID = Program.CURR_USER.CompanyID;
                    }
                    else
                    {
                        model = _service.GetInventoryCategoriesDBItem(this.CategoryID);
                    }

                    if (model != null)
                    {
                        model.Inv_Category         = txtCategoryName.Text;
                        model.Category_ShortCode   = txtShortCode.Text;
                        model.Category_Description = txtCategoryDescription.Text;
                        model.HSNCode = txtHSNCode.Text;
                        model.FK_Userlist_ItemType_ID = this.ItemTypeID;
                        model.IsActive = chkIsActive.Checked;
                    }

                    if (this.CategoryID == 0)
                    {
                        this.CategoryID = _service.AddNewInventoryCategory(model);
                    }
                    else
                    {
                        _service.UpdateInventoryCategory(model);
                    }

                    this.DialogResult = DialogResult.OK;
                    this.Cursor       = Cursors.Default;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "frmInventoryCategory::btnSave_Click", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.Cursor = Cursors.Default;
            }
        }
Ejemplo n.º 5
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            ServiceInventoryItems _InventoryItemService = new ServiceInventoryItems();

            errorProvider1.Clear();
            if (this.ValidateChildren())
            {
                try
                {
                    TBL_MP_Master_Item item = this.GatherData();
                    PrepareDuplicacyCheckProgressBar();
                    if (progressBar1.Value == progressBar1.Maximum)
                    {
                        string       strMEssage = "The same set of Specification is already assign to any other Item.\nDo you still wish to save this Item";
                        DialogResult choice     = MessageBox.Show(strMEssage, "CAUTION", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                        if (choice == DialogResult.No)
                        {
                            return;
                        }
                    }
                    if (item.Pk_ItemID == 0)
                    {
                        ItemID = _InventoryItemService.AddNewInventoryItemMasterInfo(item);
                    }
                    else
                    {
                        bool result = _InventoryItemService.UpdateInventoryItemMasterInfo(item);
                    }
                    _InventoryItemService.UpdateInventoryItemSpecifications(lstItemSpecifications, ItemID);

                    this.DialogResult = DialogResult.OK;
                }
                catch (Exception ex)
                {
                    string errMessage = ex.Message;
                    if (ex.InnerException != null)
                    {
                        errMessage += string.Format("\n{0}", ex.InnerException.Message);
                    }
                    MessageBox.Show(ex.Message, "frmAddEditInventoryItem::btnSave_Click", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Ejemplo n.º 6
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);
     }
 }