예제 #1
0
        public ActionResult Create(FileLogg filelogg)
        {
            if (ModelState.IsValid)
            {
                db.fileLoggs.Add(filelogg);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(filelogg);
        }
예제 #2
0
 public ActionResult Edit(FileLogg filelogg)
 {
     if (ModelState.IsValid)
     {
         db.Entry(filelogg).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(filelogg);
 }
예제 #3
0
 private void updateFileLog(FileLogg fileLog)
 {
     FileLogg fileObj = db.fileLoggs.Single(f => f.FileLogId == fileLog.FileLogId);
     fileObj = fileLog;
     db.SaveChanges();
 }
예제 #4
0
 private FileLogg setFileLogFields(string path, string fileName, int formId)
 {
     FileLogg fileLog = new FileLogg();
     fileLog.FileName = fileName;
     fileLog.FilePath = path;
     fileLog.FileStatusId = 0;
     fileLog.FormId = formId;
     return fileLog;
 }
예제 #5
0
        private bool isFileLogExists(FileLogg file)
        {
            bool returnType = false;

            try
            {
                string fName = db.fileLoggs.Single(p => p.FilePath == file.FilePath && p.FileName == file.FileName).FileName;
                returnType = true;
            }
            catch (Exception ex)
            {

            }
            return returnType;
        }
예제 #6
0
 //  private void fnUpdateFileLog(chqBook_FileLog chqbook_filelog)
 private void fnUpdateFileLog(FileLogg chqbook_filelog)
 {
     chqbook_filelog.sysDate = DateTime.Now.ToString();
     chqbook_filelog.osyDate = DateTime.Now.ToString();
     if (chqbook_filelog.FileLogId == 0)
     {
         //  db.SaveChanges();
         if (!isFileLogExists(chqbook_filelog))
         {
             db.fileLoggs.Add(chqbook_filelog);
             db.SaveChanges();
         }
     }
     else
     {
         //   db.fileLoggs.Add(chqbook_filelog);
         db.Entry(chqbook_filelog).State = EntityState.Modified;
         db.SaveChanges();
     }
 }
예제 #7
0
 private void fnUpdateFileLogs(FileLogg fileLog)
 {
     db.Entry(fileLog).State = EntityState.Modified;
     db.SaveChanges();
 }
예제 #8
0
        //  private void fnUpdateFileLog(chqBook_FileLog chqbook_filelog)
        private void fnUpdateFileLog(FileLogg chqbook_filelog)
        {
            try
            {
                if (chqbook_filelog.FileLogId == 0)
                {
                    //  db.SaveChanges();
                    if (!isFileLogExists(chqbook_filelog))
                    {
                        db.fileLoggs.Add(chqbook_filelog);
                        db.SaveChanges();
                    }
                }
                else
                {
                    //This means that the files already has been consumed.
                    if (chqbook_filelog.FormId == 10)
                    {

                        _getVals.LogAudit("", "Update", "", "Update  Contact file {" + chqbook_filelog.FilePath + " } on the database since there exists a file with a similar Name", "Update", "System");
                        chqbook_filelog.FileStatusId = 1;
                    }
                    db.Entry(chqbook_filelog).State = EntityState.Modified;
                    db.SaveChanges();
                }
            }
            catch (Exception ex)
            {

            }
        }