public EXPLCOpeningController() { _vmMsg = new ValidationMsg(); objDalExpLCOpening = new DalEXPLCOpening(); objExpPI = new DalExportPI(); repository = new UnitOfWork(); }
public ValidationMsg Save(EXPLeatherPI 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 { _dalExportPI = new DalExportPI(); PIID = _dalExportPI.Save(model, userId, pageUrl); //GetpurchaseID(purchaseID); if (PIID > 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); }
public ValidationMsg Update(EXPLeatherPI 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 { _dalExportPI = new DalExportPI(); var UpdateStatus = _dalExportPI.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); }