Beispiel #1
0
        public ActionResult UpdateFileType(UpdateFileType model)
        {
            if (ModelState.IsValid)
            {
                var oldFileType = (Document_Type)Session["updateFileType"];
                var types       = db.Document_Type.ToList();
                var typeExists  = types.Any(m => m.Document_Type_Name.ToLower() == model.Type_Name.ToLower() && m.Document_Type_ID != oldFileType.Document_Type_ID);
                if (typeExists)
                {
                    TempData["classStyle"] = "warning";
                    TempData["Message"]    = "File type already exists";
                    return(View(model));
                }
                else
                {
                    var type = db.Document_Type.Where(d => d.Document_Type_ID == oldFileType.Document_Type_ID).FirstOrDefault();
                    type.Document_Type_Name = model.Type_Name;
                    type.Description        = model.Description;
                    db.Entry(type).State    = EntityState.Modified;
                    db.SaveChanges();

                    //record action
                    global.addAudit("Repository", "Repository: Update File Type", "Update", User.Identity.Name);

                    TempData["classStyle"] = "success";
                    TempData["Message"]    = "File type successfuly updated";
                    return(RedirectToAction("ViewFileType"));
                }
            }
            else
            {
                return(View(model));
            }
        }
Beispiel #2
0
        public ActionResult UpdateFileType(int id)
        {
            var            fileType = db.Document_Type.Where(m => m.Document_Type_ID.Equals(id)).FirstOrDefault();
            UpdateFileType a        = new UpdateFileType
            {
                Type_Name   = fileType.Document_Type_Name,
                Description = fileType.Description,
            };

            Session["updateFileType"] = fileType;
            return(View(a));
        }
Beispiel #3
0
 private int GetFileSize(UpdateFileType eType)
 {
     int nSize = 0;
     for (int i = 0; i < m_lstLocalVersion.Count; i++)
     {
         if (m_lstLocalVersion[i].eType == eType)
         {
             nSize = m_lstLocalVersion[i].nFileSize;
             break;
         }
     }
     return nSize;
 }
Beispiel #4
0
 private string GetFileName(UpdateFileType eType)
 {
     string strName = "";
     for (int i = 0; i < m_lstLocalVersion.Count; i++)
     {
         if (m_lstLocalVersion[i].eType == eType)
         {
             strName = m_lstLocalVersion[i].strVersion;
             break;
         }
     }
     return strName;
 }
Beispiel #5
0
 private void FileSizeToList(UpdateFileType eType, int nSize)
 {
     for(int i=0; i< m_lstLocalVersion.Count; i++)
     {
         if(m_lstLocalVersion[i].eType == eType)
         {
             m_lstLocalVersion[i].nFileSize = nSize;
             string strFileName = Application.StartupPath + @"\" + m_lstLocalVersion[i].strVersion + ".bin";
             if (File.Exists(strFileName))
                 File.Delete(strFileName);
             break;
         }
     }
 }
Beispiel #6
0
 private void FileOffsetToList(UpdateFileType eType, int nOffset)
 {
     for (int i = 0; i < m_lstLocalVersion.Count; i++)
     {
         if (m_lstLocalVersion[i].eType == eType)
         {
             m_lstLocalVersion[i].nFileOffset = nOffset;
             break;
         }
     }
 }
Beispiel #7
0
 private void FileCompleted(UpdateFileType eType)
 {
     for (int i = 0; i < m_lstLocalVersion.Count; i++)
     {
         if (m_lstLocalVersion[i].eType == eType)
         {
             m_lstLocalVersion[i].bUpdated = true;
             break;
         }
     }
 }