Пример #1
0
        public bool Delete(int Id)
        {
            bool isDelete = true;

            try
            {
                ds = db.DocumentsStored.Find(Id);
                db.DocumentsStored.Remove(ds);
                db.SaveChanges();
            }
            catch (Exception)
            {
                isDelete = false;
            }
            return(isDelete);
        }
Пример #2
0
        public bool Update(int Id, string FileTitle, string FileDescription, string ServerPath, string IssueDate, string ExpireDate, string FileName, int EmployeeId, int DocumentsStoredTypeId, int DocumentsStoredDepartmentId)
        {
            bool isSave = true;

            try
            {
                ds = db.DocumentsStored.Find(Id);
                if (!String.IsNullOrEmpty(IssueDate))
                {
                    ds.IssueDate = Convert.ToDateTime(IssueDate);
                }
                else
                {
                    ds.IssueDate = null;
                }

                if (!String.IsNullOrEmpty(ExpireDate))
                {
                    ds.ExpireDate = Convert.ToDateTime(ExpireDate);
                }
                else
                {
                    ds.ExpireDate = null;
                }
                ds.DocumentsStoredId           = Id;
                ds.FileTitle                   = FileTitle;
                ds.FileDescription             = FileDescription;
                ds.ServerPath                  = ServerPath;
                ds.FileName                    = FileName;
                ds.EmployeeId                  = EmployeeId;
                ds.DocumentsStoredDepartmentId = DocumentsStoredDepartmentId;
                ds.DocumentsStoredTypeId       = DocumentsStoredTypeId;
                ds.FileName                    = FileName;
                db.DocumentsStored.AddOrUpdate(ds);
                db.SaveChanges();
            }
            catch (Exception)
            {
                isSave = false;
            }
            return(isSave);
        }