Can you cut out the cancerous parts of the pancreas and replace it with donated pancreas?

Yes. Yes, but not at the same time. Following removal of a cancerous pancreas, a pancreas transplant would need to be deferred until it is nearly certain that the cancer is cured. If some cancer remains, the medicine needed to prevent rejection could cause accelerated growth of the cancer left behind.
Transplant for ca. No. Pancreas transplantation is for type 1 dm, usually with a kidney transplant. If you have pancreas cancer and are a candidate for resection, then this can be accomplished and the pancreas does not need to be replaced. The last thing you would want while dealing with a pancreas cancer is the requirement for immunosuppression, which would encourage cancer growth.
No. There is no reason to transplant a pancreas if you had part of yours removed. You will still have pancreas function with part of a pancreas. Also since most types pancreas cancer is a difficult disease to treat with an unfortunately low cure rate, being on immunosuppression after surgery for it wouldn't be a good idea.