Ejemplo n.º 1
0
        public ValidationMsg Save(INVStoreTrans 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
                {
                    _dalIssueToTransfer = new DalIssueToProduction();

                    TransactionID = _dalIssueToTransfer.Save(model, userId, pageUrl);

                    //GetpurchaseID(purchaseID);

                    if (TransactionID > 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);
        }
Ejemplo n.º 2
0
        public ValidationMsg Update(INVStoreTrans 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
                {
                    _dalIssueToTransfer = new DalIssueToProduction();

                    var UpdateStatus = _dalIssueToTransfer.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);
        }