Example #1
0
        public ValidationMsg Save(ExpBankVoucher model, int userId, string pageUrl)
        {
            var transactionOption = new TransactionOptions {
                Timeout = new TimeSpan(0, 0, 99999)
            };
            var vMsg = new ValidationMsg();


            using (var transactionScope = new TransactionScope(TransactionScopeOption.RequiresNew, transactionOption))
            {
                try
                {
                    _dalBankVoucher = new DalBankVoucher();

                    BVID = _dalBankVoucher.Save(model, userId, pageUrl);

                    //GetpurchaseID(purchaseID);

                    if (BVID > 0)
                    {
                        transactionScope.Complete();

                        vMsg.Type = Enums.MessageType.Success;
                        vMsg.Msg  = "Saved successfully.";
                        //vMsg.ReturnId = _dalChemicalForeignPurchaseOrder.GetOrderNo(OrderID);
                    }
                    else
                    {
                        vMsg.Type = Enums.MessageType.Error;
                        vMsg.Msg  = "Failed to save.";
                    }
                }

                catch (Exception e)
                {
                    vMsg.Type = Enums.MessageType.Error;
                    vMsg.Msg  = "Failed to save.";
                }
            }



            return(vMsg);
        }
Example #2
0
        public ValidationMsg Update(ExpBankVoucher model, int userId)
        {
            var transactionOption = new TransactionOptions {
                Timeout = new TimeSpan(0, 0, 9999)
            };
            var vMsg = new ValidationMsg();

            using (var transactionScope = new TransactionScope(TransactionScopeOption.RequiresNew, transactionOption))
            {
                try
                {
                    _dalBankVoucher = new DalBankVoucher();

                    var UpdateStatus = _dalBankVoucher.Update(model, userId);

                    if (UpdateStatus > 0)
                    {
                        transactionScope.Complete();

                        vMsg.Type = Enums.MessageType.Update;
                        vMsg.Msg  = "Updated successfully.";
                    }
                    else
                    {
                        vMsg.Type = Enums.MessageType.Error;
                        vMsg.Msg  = "Failed to Update.";
                    }
                }

                catch (Exception)
                {
                    vMsg.Type = Enums.MessageType.Error;
                    vMsg.Msg  = "Failed to Update.";
                }
            }
            return(vMsg);
        }