Exemplo n.º 1
0
        private void Save()
        {
            bool       result = false;
            ItemMaster item   = GetItem();


            ItemMaster handler = new ItemMaster();

            if (AddMode)
            {
                result = handler.AddNewItemMaster(item);
                if (result)
                {
                    result = GlobalFunction.UpdateUniqueCode("ItemMaster");
                }
            }
            else if (EditMode)
            {
                result = handler.UpdateItemMaster(item);
            }

            if (result == true)
            {
                if (AddMode)
                {
                    MessageBox.Show("New Record added successfully");
                }
                else
                {
                    MessageBox.Show("Record updated successfully");
                }

                ControlStatus(true);
            }
            else
            {
                MessageBox.Show("Errror Occurs!");
            }
        }
Exemplo n.º 2
0
        private void Save()
        {
            bool result = false;


            TransactionOutMaster objTransactionOutMaster = GetTransactionOutMasterInterface();

            TransactionOutMaster masterhandler = new TransactionOutMaster();

            List <TransactionOutDetails> objDetailsList    = GetTransactionOutDetailsInterface();
            TransactionOutDetails        objDetailsHandler = new TransactionOutDetails();

            //Inventory obj;
            if (AddMode)
            {
                result = masterhandler.AddNewTransactionOutMaster(objTransactionOutMaster);

                if (result)
                {
                    result = objDetailsHandler.AddNewTransactionOutDetails(objDetailsList);
                }
                if (result)
                {
                    result = GlobalFunction.UpdateUniqueCode("TransactionOutMaster");
                }

                // obj = new Inventory();
                //if (result)
                //{
                //    result = obj.AddInventory(objDetailsList);
                //}
            }
            else if (EditMode)
            {
                // obj = new Inventory();

                result = masterhandler.UpdateTransactionOutMaster(objTransactionOutMaster);

                //if (result)
                //{

                //    result = obj.UpdateInventory(objBooksTransactionOutMaster.TransactionID, objDetailsList);
                //}

                if (result)
                {
                    result = objDetailsHandler.DeleteTransactionOutMaster(objTransactionOutMaster.TransactionID);

                    if (result)
                    {
                        result = objDetailsHandler.AddNewTransactionOutDetails(objDetailsList);
                    }
                }
            }

            if (result == true)
            {
                if (AddMode)
                {
                    MessageBox.Show("New Record added successfully");
                }
                else
                {
                    MessageBox.Show("Record updated successfully");
                }

                ControlStatus(true);
            }
            else
            {
                MessageBox.Show("Errror Occurs!");
            }
        }