Exemplo n.º 1
0
        private SubmitFile SaveFiles(
            String manCo, String docTypeCode, IEnumerable <String> files, String inputPath, Int32 jobId, ManCoDoc mancoDoc, IList <EnvironmentServerEntity> enviroments)
        {
            foreach (var file in files)
            {
                try
                {
                    this.inputFileRepository.InsertFile(file, inputPath, jobId, mancoDoc.ManCoDocID);
                }
                catch (Exception e)
                {
                    throw new DocProcessingException("Unable to insert input file", e);
                }
            }

            var submitFile = new SubmitFile
            {
                JobID         = jobId.ToString(),
                ManCoCode     = manCo,
                DocType       = docTypeCode,
                Environment   = enviroments.Single().EnvironmentType,
                EnvironmentID = enviroments.Single().EnvironmentTypeId.ToString()
            };

            return(submitFile);
        }
        public JsonResult SubmitFile([Bind(Include = "SubmitDate,FileDoc,SubmitBy,ApplicationNo,Sms,Email,Show,Uci,Appno,Gckey,Password,Question1,Answer1,Question2,Answer2,Question3,Answer3,Question4,Answer4")] SubmitFile sub, Helper help)
        {
            using (var transaction = db.Database.BeginTransaction())
            {
                try
                {
                    string _imgname  = string.Empty;
                    var    inquiryid = db.Applications.FirstOrDefault(x => x.ApplicationNo == sub.ApplicationNo).InquiryId;
                    online onlines   = db.onlines.FirstOrDefault(x => x.inquiryid == inquiryid);
                    if (System.Web.HttpContext.Current.Request.Files.AllKeys.Any())
                    {
                        var pic = System.Web.HttpContext.Current.Request.Files["FileDoc"];
                        if (pic.ContentLength > 0)
                        {
                            var fileName = Path.GetFileName(pic.FileName);
                            var _ext     = Path.GetExtension(pic.FileName);

                            _imgname = Guid.NewGuid().ToString();
                            var _comPath = Server.MapPath("~/Uploadfile/") + _imgname + _ext;
                            _imgname = _imgname + _ext;

                            ViewBag.Msg = _comPath;
                            var path = _comPath;

                            // Saving Image in Original Mode
                            pic.SaveAs(path);
                        }
                    }
                    sub.FileDoc = _imgname;

                    db.SubmitFiles.Add(sub);
                    db.SaveChanges();
                    Process pr = db.Process.FirstOrDefault(x => x.ApplicationNo == sub.ApplicationNo);
                    if (pr.SubmitFile == false)
                    {
                        var Process = db.Process.SingleOrDefault(x => x.ApplicationNo == sub.ApplicationNo);
                        if (Process != null)
                        {
                            Process.SubmitFile = true;

                            db.SaveChanges();
                        }
                    }
                    transaction.Commit();
                    if (sub.Sms == true)
                    {
                        help.sendsms(onlines.Mobile, "Dear," + onlines.Name + " your Your File is Ready For Submit ");
                    }
                    return(Json("", JsonRequestBehavior.AllowGet));
                }
                catch (Exception)
                {
                    transaction.Rollback();
                    throw;
                }
            }
        }
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            SubmitFile submitFile = await db.SubmitFiles.FindAsync(id);

            db.SubmitFiles.Remove(submitFile);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
        public async Task <ActionResult> Edit([Bind(Include = "Sid,SubmitDate,SubmitBy,FileDoc,ApplicationNo")] SubmitFile submitFile)
        {
            if (ModelState.IsValid)
            {
                db.Entry(submitFile).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(submitFile));
        }
        public async Task <ActionResult> Create([Bind(Include = "Sid,SubmitDate,SubmitBy,FileDoc,ApplicationNo")] SubmitFile submitFile)
        {
            if (ModelState.IsValid)
            {
                db.SubmitFiles.Add(submitFile);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(submitFile));
        }
Exemplo n.º 6
0
        public void SaveTriggerFile(Int32 jobId, SubmitFile submitFile, String path)
        {
            String fileName = String.Format(@"{0}\SubmitFile{1}.xml", path, jobId);

            // add to classes and serialize
            XmlSerializer SubmitFileSerializer = new XmlSerializer(typeof(SubmitFile));

            TextWriter XmlFile = new StreamWriter(fileName);

            SubmitFileSerializer.Serialize(XmlFile, submitFile);
            XmlFile.Close();
        }
        // GET: SubmitFiles/Delete/5
        public async Task <ActionResult> Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            SubmitFile submitFile = await db.SubmitFiles.FindAsync(id);

            if (submitFile == null)
            {
                return(HttpNotFound());
            }
            return(View(submitFile));
        }
Exemplo n.º 8
0
        private void CreateMonitorFile(List <String> files, IEnumerable <EnvironmentServerEntity> enviroments, SubmitFile submitFile, Int32 jobId, String inputPath)
        {
            var monitorPath = this.filePathBuilderEngine.BuildOneStepMonitorPath(enviroments.Single().ServerName);

            submitFile.AddFiles(files, inputPath);

            this.submitJobFileRepository.SaveTriggerFile(jobId, submitFile, monitorPath);
        }