public ActionResult ReExecute(long id)
        {
            try
            {
                if (CurrentUser.UserRole == Enums.UserRole.Viewer || CurrentUser.UserRole == Enums.UserRole.Controller)
                {
                    return(RedirectToAction("Index"));
                }


                var input = new UpdateXmlFileInput();

                input.XmlId      = id;
                input.SourcePath = ConfigurationManager.AppSettings["XmlErrorPath"];   // @"C:\Deploy\InboundMsg\error\";
                input.DestPath   = ConfigurationManager.AppSettings["XmlInboundPath"]; //@"C:\Deploy\InboundMsg\";

                _xmlFileLogBll.UpdateXmlFile(input);

                AddMessageInfo("Success Move File", Enums.MessageInfoType.Success);
            }
            catch (Exception ex)
            {
                AddMessageInfo(ex.Message, Enums.MessageInfoType.Error);
            }
            return(RedirectToAction("Index"));
        }
Esempio n. 2
0
        public void UpdateXmlFile(UpdateXmlFileInput input)
        {
            var dbData = _repository.GetByID(input.XmlId);

            if (dbData == null)
            {
                throw new BLLException(ExceptionCodes.BLLExceptions.DataNotFound);
            }

            //update data
            dbData.STATUS        = Enums.XmlLogStatus.ReRun;
            dbData.MODIFIED_BY   = input.UserId;
            dbData.MODIFIED_DATE = DateTime.Now;

            //check if file is exist in source path
            if (!System.IO.File.Exists(input.SourcePath + dbData.XML_FILENAME))
            {
                throw new Exception("File Not Found : " + input.SourcePath + dbData.XML_FILENAME);
            }

            //if file exist ..in dest path .. remove ??
            if (System.IO.File.Exists(input.DestPath + dbData.XML_FILENAME))
            {
                System.IO.File.Delete(input.DestPath + dbData.XML_FILENAME);
            }

            System.IO.File.Move(input.SourcePath + dbData.XML_FILENAME, input.DestPath + dbData.XML_FILENAME);

            _uow.SaveChanges();
        }