コード例 #1
0
        public int Upgrade(int CAMTaskID)
        {
            CAMTask _dbEntry = _context.CAMTasks.Find(CAMTaskID);

            _dbEntry.State = 9;

            CAMTask _newTask = new CAMTask();

            _newTask.DrawingFile = _dbEntry.DrawingFile;
            _newTask.TaskName    = _dbEntry.TaskName;
            _newTask.Version     = _dbEntry.Version + 1;
            _newTask.UserID      = _dbEntry.UserID;
            _newTask.CreateDate  = DateTime.Now;
            _newTask.AcceptDate  = new DateTime();

            _newTask.ReleaseDate = new DateTime();
            _newTask.ProjectID   = _dbEntry.ProjectID;
            _newTask.MoldNumber  = _dbEntry.MoldNumber;
            _newTask.CADUserID   = _dbEntry.CADUserID;
            _newTask.State       = 1;

            _context.CAMTasks.Add(_newTask);

            _context.SaveChanges();
            return(_newTask.CAMTaskID);
        }
コード例 #2
0
 public int Save(CAMTask CAMTask)
 {
     if (CAMTask.CAMTaskID == 0)
     {
         CAMTask.Version = 1;
         _context.CAMTasks.Add(CAMTask);
     }
     else
     {
         CAMTask _dbEntry = _context.CAMTasks.Find(CAMTask.CAMTaskID);
         if (_dbEntry != null)
         {
             _dbEntry.DrawingFile   = CAMTask.DrawingFile;
             _dbEntry.TaskName      = CAMTask.TaskName;
             _dbEntry.Version       = CAMTask.Version;
             _dbEntry.UserID        = CAMTask.UserID;
             _dbEntry.CreateDate    = CAMTask.CreateDate;
             _dbEntry.ReleaseDate   = CAMTask.ReleaseDate;
             _dbEntry.ProjectID     = CAMTask.ProjectID;
             _dbEntry.MoldNumber    = CAMTask.MoldNumber;
             _dbEntry.CADUserID     = CAMTask.CADUserID;
             _dbEntry.State         = CAMTask.State;
             _dbEntry.ReleaseUserID = CAMTask.ReleaseUserID;
             _dbEntry.AcceptDate    = CAMTask.AcceptDate;
             _dbEntry.TaskType      = CAMTask.TaskType;
         }
     }
     _context.SaveChanges();
     return(CAMTask.CAMTaskID);
 }
コード例 #3
0
        public CAMTaskGridRowModel(CAMTask CAMTask, string UserName, string CADUserName, string ReleaseUserName, string TaskType)
        {
            string _dateVal = "";

            cell = new string[12];


            //TaskID
            cell[0] = CAMTask.CAMTaskID.ToString();

            //Drawing file link
            if (CAMTask.DrawingFile == "")
            {
                cell[1] = "<a href='' target='new'>打开</a>";
            }
            else
            {
                cell[1] = "<a href='file://" + CAMTask.DrawingFile + "' target='new'>打开</a>";
            }


            //Task Name
            cell[2] = CAMTask.TaskName;

            //Mold Number
            cell[3] = CAMTask.MoldNumber;

            //Task Type
            cell[4] = TaskType;

            //Task Version
            cell[5] = "V" + CAMTask.Version;

            //CAD User
            cell[6] = CADUserName;

            //Create Date
            _dateVal = CAMTask.CreateDate.ToString("yyyy-MM-dd");
            cell[7]  = _dateVal == "0001-01-01" ? "-" : _dateVal;

            //Accept User
            cell[8] = UserName;


            //Accept date
            _dateVal = CAMTask.AcceptDate.ToString("yyyy-MM-dd");
            cell[9]  = _dateVal == "0001-00-01" ? "-" : _dateVal;


            //Release User
            cell[10] = ReleaseUserName;
            //Release Date
            _dateVal = CAMTask.ReleaseDate.ToString("yyyy-MM-dd");
            cell[11] = _dateVal == "0001-01-01" ? "-" : _dateVal;
        }
コード例 #4
0
        public bool Pause(int CAMTaskID)
        {
            CAMTask _dbEntry = _context.CAMTasks.Find(CAMTaskID);

            _dbEntry.State = 3;
            try
            {
                _context.SaveChanges();
                return(true);
            }
            catch
            {
                return(false);
            }
        }
コード例 #5
0
        public bool Claim(int CAMTaskID, int UserID)
        {
            CAMTask _dbEntry = _context.CAMTasks.Find(CAMTaskID);

            _dbEntry.UserID     = UserID;
            _dbEntry.AcceptDate = DateTime.Now;
            _dbEntry.State      = 1;
            try
            {
                _context.SaveChanges();
                return(true);
            }
            catch
            {
                return(false);
            }
        }
コード例 #6
0
        public bool Release(int CAMTaskID, int UserID)
        {
            CAMTask _dbEntry = _context.CAMTasks.Find(CAMTaskID);

            _dbEntry.ReleaseUserID = UserID;
            _dbEntry.ReleaseDate   = DateTime.Now;
            _dbEntry.State         = 2;
            try
            {
                _context.SaveChanges();
                return(true);
            }
            catch
            {
                return(false);
            }
        }